Page 1 of 1

How to "Add to cart" from a href Link -

Posted: Thu Jan 05, 2012 2:17 am
by aboutwd
index.php?route=checkout/cart&product_id=603

I simply need an <a href="" style link that will automatically add products to the cart on our site.

The format above was working perfectly in version 1.4. Now I've upgraded to 1.5 and this no longer adds products to the cart at all.

We have affiliates that are linking to us. How can I get this working again?

Please help.

Thanks
Rob

Re: How to "Add to cart" from a href Link -

Posted: Thu Jan 05, 2012 2:55 am
by aboutwd
One option is this... (although I don't like it at all)

Add this to the top of the cart's INDEX.PHP page.

Code: Select all

if($_GET['route']=="checkout/cart" && $_GET['product_id'] > 0){
		?>
		<form action="index.php?route=checkout/cart" id="frm" method="post">
<input type="hidden" name="product_id" value="<?php echo $_REQUEST['product_id']; ?>">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="tracking" value="<?php echo $_GET['tracking']; ?>">
</form>
<body onload="document.getElementById('frm').submit()"></body>
<?php
}

Re: How to "Add to cart" from a href Link -

Posted: Wed Apr 24, 2013 7:54 am
by tmas73
Where can I find this index.php file?

Thanks