How can I add a product to the cart from pages not residing within the cart?
Posted by Michael G.K on 30 August 2008 05:26 AM

For this to work you will have to create a POST comand on the external pages.

First you will need to make sure that item that is posting to the cart is listed in the destination cart's database.

Then you would need to add the follow code to the external pages for every instance where a item is to be added.


<form action=
<input type="hidden" name="oa" value="AddItem"/>
<input type="hidden" name="oa_id" value="1"/>
<input type="hidden" name="backurl"
<input type="text" name="oa_quantity" value="1"/>
<input type="submit" style="width:100px;" value="Add To Cart" />


Key to above code:

path - web url to your carts index.php

oa_id - product id in database
    *note : you can use the id you have given to the product if you are using cart version 3.5.4 or higher
oa_quantity - product quantity,
backurl - url to page where user will be redirected after product is added.

(147 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).