Добавьте «плюс» «минус» вместо «добавить в корзину» в opencart
Я хочу заменить добавить в корзину двумя кнопками, плюс и минус в OpenCart 2.0.1.1, теперь я не могу правильно кодировать кнопку минус. Я добавил плюс и миус кнопку вcatalog/view/theme/*/template/module/featured.tpl
и позвонить вcatalog/controller/api/cart.php
И вcommon.js
Я поставил URL какurl: 'index.php?route=checkout/cart/minus
и остальной код ниже
system/library/cart.php
public function minus($product_id, $qty)
{
$this->data = array();
$qnt1 = 1;
$product['product_id'] = (int)$product_id;
$key = base64_encode(serialize($product));
if ((int)$qty && ((int)$qty > 0)) {
if (!isset($this->session->data['cart'][$key])) {
$this->session->data['cart'][$key]-= (int)$qty;
}
else {
$this->remove($key);
}
}
}
[Image for plus minus button in place of "Add to cart" Button] [1]