Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So I've come across a solution to my problem... I'm using a Simple Modal (That TheBlackBenzKid hinted me to) that I'm either going to call from a custom button or with the add to cart button. This in turn will redirect to a php page that will redirect to the cart. For the php page I'll just include the code to put a item into the cart from there anyone could figure out how to customize it to there own needs.</p> <pre><code>&lt;?php // Include Magento application (URL to Mage.php) require_once ( "app/Mage.php" ); umask(0); //specified quantity my own variable I'm using for quantities $spqty = 9; // Initialize Magento Mage::app("default"); // You have two options here, // "frontend" for frontend session or "adminhtml" for admin session Mage::getSingleton("core/session", array("name" =&gt; "frontend")); $session = Mage::getSingleton("customer/session"); // get the current Magento cart $cart = Mage::getSingleton('checkout/cart'); if ($spqty &lt;= 2) { // insert item to cart where "98" is the product ID (NOT SKU!) Where "2" is the quantity $cart-&gt;addProduct(98, array('qty' =&gt; 2)); } elseif ($spqty &gt;= 4 ){ // you can add multiple products at the same time by adding this line multiple times $cart-&gt;addProduct(96, array('qty' =&gt; 3)); } // save the cart $cart-&gt;save(); // very straightforward, set the cart as updated Mage::getSingleton('checkout/session')-&gt;setCartWasUpdated(true); // redirect to index.php header("Location: index.php/checkout/cart"); </code></pre> <p>I also found some of this information from this guys blog I'll link to the article</p> <p><a href="http://mysillypointofview.richardferaro.com/2009/04/27/how-to-add-a-product-into-magento-from-an-external-site/" rel="nofollow" title="How to Add a Product into Magento From an External Site">How to add a product from an external site into Magento</a></p> <p>I'm happy to answer any questions on this...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload