PDA

View Full Version : adding products straight to basket


Paul@Cite
27-May-2003, 03:47 PM
Im looking for a way to add a product to the shopping cart from anywhere on the site.

For example on a site homepage, rather than a component linking to an actual product page itself, can a link be coded to actually add that product straight to the shopping basket.

The perl script in question to do such a thing seems to be ca000001.pl ... im guessing i could link to this script and supply the product reference number as a variable within the url ... my knowledge of perl is flaky so im not sure of the right variables to supply if this is at all possible

thanks

pinbrook
27-May-2003, 03:51 PM
Can'y help you with the actual perl, but the file you want is shoppingcart.pl this file generates ca000001.pl.

Paul@Cite
27-May-2003, 03:56 PM
yeah im aware shoppingcart.pl generates ca000001.pl .... but ca000001.pl is the script on the server which would need to be supplied the variables via the url

thanks anyhow

zmagyar
27-May-2003, 05:55 PM
The URLhttp://localhost/cgi-bin/ca000241.pl?SID=3&PAGE=PRODUCT&Q_7=5works fine here.

The SID parameter should be the section ID of the section where the product can be found. You can figure out the exact SID by checking the HTML source of the product page (look for <INPUT TYPE=HIDDEN NAME="SID" VALUE="xxx"> where xxx will be the section ID). The Q_ parameter informs the script about the product reference and the quantity. The product reference is the (CGI encoded) string prefixed by Q_ while the quantity is the parameter value (prod ref is 7, qty is 5 in the above example).

Obviously this works only for products where components, attributes, date or other info prompts are not used. However these more complex products can also be added to the cart on similar way but more parameters are required (check the HTML source of your product page for hidden input parameters to see what else required in these cases).

The result of this script call may vary depending on the "Shopping mode" setting of the section where the product is located. E.g. if your product is located in a section where "Quantity on Product Page" shopping mode is used then using this link the product will be added to the cart and a bounce page will drop you back to the last used shop page, but if the shopping mode is "Quantity in Shopping Cart" then the cart will be displayed clicking on the link.

Note that this solution is not supported by Actinic Software therefore you should use this at your own risk.

I hope this helps.

Regards,

Paul@Cite
28-May-2003, 07:55 AM
thanks very much i shall give that a try :)

stuff-uk.net
09-Jul-2003, 04:13 PM
Is it possible to use

--------------------------------------------------------------------------------http://localhost/cgi-bin/ca000241.pl?SID=3&PAGE=PRODUCT&Q_7=5

with a catalog referrer url that tells catalog where to go after you have entered the goods into the cart?

also

From a static page in v5 we used to submit

<form method="post" action="http://www.stuff-uk.net/cgi/ca000001.pl">
<input type=hidden name="SID" value="35">
<input type=hidden name="PAGE" value="PRODUCT">
<input type="hidden" name="ACTINIC_REFERRER" VALUE="Stuff_UK_DeskJet_35.html">
<input type="image" height=18 width=29 src="http://www.stuff-uk.net/acatalog/pmenur1_c4.gif" border="0" name="ST-C2697A">


It doesnt seem to work in V6, I assume Referrer has been replaced by PAGEFILENAME and that you also need to pass the quantity using Q_PARTNUMBER=Quantity

Are there any more parameters to pass as I cant seem to get it working

Chuckie
23-Nov-2003, 03:32 PM
Hiya i follwed zmagyar instructions on how to add products directly to the shopping cart but i got an error

Error: Could not locate the product reference

But the product reference is passed along in the address bar though.

http://www.modelpower.co.uk/cgi-bin/ca000548.pl?SID=13&PAGE=PRODUCT&Q_132=1

thats what the link im passing is,

The nParentSectionID number in the database is 13 and the Product Reference is 132 in the database.

Can someone tell me where im going wrong please ?

James

NormanRouxel
23-Nov-2003, 07:07 PM
The ShoppingCart script doesn't get the Product Reference from the Quantity field. You have to add an extra parameter that simulates a Submit button or image.

Try appending "&_132=Add" (without the quotes) to the URL you tried.

Norman

zmagyar
24-Nov-2003, 03:51 PM
Originally posted by stuff-uk.net
Is it possible to use

--------------------------------------------------------------------------------http://localhost/cgi-bin/ca000241.pl?SID=3&PAGE=PRODUCT&Q_7=5

with a catalog referrer url that tells catalog where to go after you have entered the goods into the cart?

Most likely ACTINIC_REFERRER will do the trick here.

From a static page in v5 we used to submit

<form method="post" action="http://www.stuff-uk.net/cgi/ca000001.pl">
<input type=hidden name="SID" value="35">
<input type=hidden name="PAGE" value="PRODUCT">
<input type="hidden" name="ACTINIC_REFERRER" VALUE="Stuff_UK_DeskJet_35.html">
<input type="image" height=18 width=29 src="http://www.stuff-uk.net/acatalog/pmenur1_c4.gif" border="0" name="ST-C2697A">


It doesnt seem to work in V6, I assume Referrer has been replaced by PAGEFILENAME and that you also need to pass the quantity using Q_PARTNUMBER=Quantity

Are there any more parameters to pass as I cant seem to get it working Lot of things have been changed on this field due to the new shopping modes. So there can be several reasons why this is not working anymore.

Regards,

Chuckie
24-Nov-2003, 04:02 PM
the reply from NormanRouxel with his mod to my code makes it work a treat and is really handy cheers guys