Created
October 1, 2015 20:25
-
-
Save jonatanrdsantos/69d1c59a0caa5950d915 to your computer and use it in GitHub Desktop.
Magento add products to cart via products IDS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function addToAction() | |
{ | |
$cart = Mage::getSingleton('checkout/cart'); | |
$cart->addProductsByIds( | |
array( | |
$this->getRequest()->getParam('currentproduct'), | |
$this->getRequest()->getParam('relatedproduct') | |
) | |
); | |
$cart->save(); | |
Mage::getSingleton('checkout/session')->setCartWasUpdated(true); | |
$this->_redirect('checkout/cart'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment