The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Find:
Code: Select all
public function hasProducts() {
Code: Select all
public function hasProduct($product_id) {
$products = $this->getProducts();
foreach ($products as $product) {
if ((int)$product_id == (int)$product['product_id']) {
return true;
}
}
}
find:
Code: Select all
if (isset($this->request->post['quantity'])) {
$quantity = (int)$this->request->post['quantity'];
} else {
$quantity = 1;
}
Code: Select all
if ($this->cart->hasProduct($product_info['product_id'])) {
$json['error']['same_product'] = sprintf($this->language->get('text_same_product'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8'));
}
Code: Select all
foreach ($this->request->post['quantity'] as $key => $value) {
$this->cart->update($key, $value);
}
Code: Select all
$this->load->model('catalog/product');
foreach ($this->request->post['quantity'] as $key => $value) {
$product_info = $this->model_catalog_product->getProduct($key);
if ($product_info && $this->cart->hasProduct($product_info['product_id'])) {
$json['error']['same_product'] = $this->language->get('text_same_product');
}
}
add at the bottom:
Code: Select all
$_['text_same_product'] = 'The product name: %s has already been added to your cart.';
in the:
Code: Select all
var cart = {
Code: Select all
if (json['redirect']) {
Code: Select all
if (json['error']['same_product']) {
$('#content').parent().before('<div class="alert alert-danger alert-dismissible">' + json['error']['same_product'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
}
Code: Select all
'update': function(key, quantity) {
Code: Select all
if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
Code: Select all
if (json['error']['same_product']) {
$('#content').parent().before('<div class="alert alert-danger alert-dismissible">' + json['error']['same_product'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
}
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 7 guests