Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. $params['product']=$productid;
  2. $params['super_group'] = array( $simpleid=> $qty );
  3. $cart = Mage::getModel('checkout/cart'); //Get cart object
  4. $cart->init();
  5. $cart->addProduct($productid, $params);
  6. $cart->save();
  7.  
  8. $cartHelper = Mage::helper('checkout/cart');
  9. $cartHelper->getCart()->removeItem($simpleproductcartid)->save();
  10.  
  11. $cartHelper->getCart()->updateItem($somecartrowid, $params)->save();
  12.  
  13. {"name":"Amigne 2012", "type":"grouped", "parent_id":"635", "entity_id":"567", "qty":3}
  14.  
  15. "567":{"cartid":"1000","qty":3},
  16.  
  17. $cart->updateItem('1000',1)
  18.  
  19. {"name":"Amigne 2012", "type":"simple", "parent_id":"", "entity_id":"567", "qty":1}
  20.  
  21. "567":{"cartid":"1002","qty":1}
  22.  
  23. public function updateItem($itemId, $buyRequest, $params = null)
  24. * @param int $itemId
  25. * @param Varien_Object $buyRequest
  26. * @param null|array|Varien_Object $params
  27. * @return Mage_Sales_Model_Quote_Item
  28.  
  29. public function addParamsToBuyRequest($buyRequest, $params)
  30. * $params holds parameters of what operation must be performed:
  31. * - 'current_config', Varien_Object or array - current buyRequest that configures product in this item,
  32. * used to restore currently attached files
  33. * - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file inputs,
  34. * so they won't intersect with other submitted options
  35. *
  36. * @param Varien_Object|array $buyRequest
  37. * @param Varien_Object|array $params
  38. * @return Varien_Object
  39.  
  40. $cartdata[988][qty]=100
  41. $cartdata[999][qty]=1
  42. $cartdata[1001][qty]=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement