Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. http://localhost/magento/index.php/checkout/cart/add?product=2&qty=2
  2.  
  3. public function newAction() {
  4. $cart = $this->_getCart();
  5. try {
  6. //getting list of products
  7. $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
  8. for ($i = 1; $i <= 4; $i++) {
  9. echo '<br>';
  10. $param = $_GET['product' . $i];
  11. if (isset($param)) {
  12. $param = explode("/", $param);
  13. print_r($param);
  14. $productId = $param[0];
  15. $product = $this->addNewProduct($productId);
  16. $quantity = $filter->filter($param[1]);
  17. $params['product'] = $product;
  18. $params['qty'] = $quantity;
  19.  
  20. $cart->addProduct($product);
  21. }// if over
  22. }//for over
  23. $cart->save();
  24. $message = $this->__('Added to Your Cart Successfully', Mage::helper('core')->escapeHtml());
  25. $this->_getSession()->addSuccess($message);
  26. Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
  27. $this->_redirect("checkout/cart/");
  28. } catch (Mage_Core_Exception $e) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement