I have to add two button minus and plus in list product page like this site: https://www.goodeggs.com/sfbay/produce .
Each time an user click on minus button, the number of this product in cart will be change.
I can't find any solution to do this. Who can help me ?.
Here is my remove function :
public function removeAction() {
$this->getResponse()->setHeader('Content-type', 'application/json');
$_params = $this->getRequest()->getParams();
$_product = Mage::getModel('catalog/product')->load($_params['id']);
$_cart = Mage::getSingleton('checkout/cart');
$a = $_cart->getItemsQty();
$a = $a - 1;
$_cart->setQty($a);
$_cart->save();
return $this->getResponse()->setBody(json_encode($_response));
}
Best Answer
you need to check this product id is exiting on your cart current cart