Skip to content

Instantly share code, notes, and snippets.

$product = Mage::getModel('catalog/product')->load(87); // Random product ID
// get cart and add product
$cart = Mage::getSingleton('checkout/cart');
$cart->init();
$cart->addProduct($product, 2);
// update session
$session->setCartWasUpdated(true);
/* Details of products and stores: */
<?php
/**
* @author MagePsycho <info@magepsycho.com>
* @website http://www.magepsycho.com
* @category using Header / Footer outside of Magento
*/
$mageFilename = '/var/www/html/magento1.9/app/Mage.php';
require_once $mageFilename;