Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2. $id = '100'; // Replace id with your product id
  3. $qty = '2'; // Replace qty with your qty
  4. $_product = Mage::getModel('catalog/product')->load($id);
  5. $cart = Mage::getModel('checkout/cart');
  6. $cart->init();
  7. $cart->addProduct($_product, array('qty' => $qty));
  8. $cart->save();
  9. Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
  10. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement