1. В файле \system\library\cart.php
код (стр. 261-268)
if ((int)$qty && ((int)$qty > 0)) {
if (!isset($this->session->data['cart'][$key])) {
$this->session->data['cart'][$key] = (int)$qty;
} else {
$this->session->data['cart'][$key] += (int)$qty;
}
}
заменить на
if ((int)$qty && ((int)$qty > 0)) {
if (!isset($this->session->data['cart'][$key])) {
$this->session->data['cart'][$key] = (int)$qty;
return('ok');
} else {
//$this->session->data['cart'][$key] += (int)$qty;
return('no');
}
}
2. В файле \catalog\controller\checkout\cart.php
код (стр. 543-545)
$this->cart->add($this->request->post['product_id'], $quantity, $option);
$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
заменить на
if ($this->cart->add($this->request->post['product_id'], $quantity, $option) == "ok") {
$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
}
else if ($this->cart->add($this->request->post['product_id'], $quantity, $option) == "no") {
$json['attention'] = sprintf($this->language->get('text_attention'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
}
3. В файле \catalog\view\theme\default\template\product\product.tpl
после кода (стр. 362-370)
if (json['success']) {
$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.success').fadeIn('slow');
$('#cart-total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
добавить
if (json['attention']) {
$('#notification').html('<div class="attention" style="display: none;">' + json['attention'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.attention').fadeIn('slow');
$('#cart-total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
и тоже самое в файле \catalog\view\javascript\common.js
после кода (стр. 128-136)
if (json['success']) {
$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.success').fadeIn('slow');
$('#cart-total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
добавить код
if (json['attention']) {
$('#notification').html('<div class="attention" style="display: none;">' + json['attention'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.attention').fadeIn('slow');
$('#cart-total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
4. "Из шаблона товара и корзины выпилить - убрать поле кол-ва, сделать его hidden с кол-вом 1 шт." как писал templater
Говорю сразу - я не программист и опен картом занимаюсь впервые. Делал под себя. Не пинать!