Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

direct link to add a product Rate Topic   - - - - -

 
  • taydu
  • Senior Member
  • Members
  • Join Date: 24-Jul 06
  • 350 posts

Posted 14 October 2008 - 06:49 AM #1

hi all,

what is the directlink to add a product, so when someone click on the link it automatically add that product to buyer cart.

thanks

 
  • raizscanlon
  • Junior Member
  • Members
  • Join Date: 16-Nov 08
  • 8 posts

Posted 25 January 2009 - 12:49 AM #2

Yes I'd like to know this too!

 
  • raizscanlon
  • Junior Member
  • Members
  • Join Date: 16-Nov 08
  • 8 posts

Posted 27 January 2009 - 12:33 PM #3

OK I've had an excellent answer from the helpdesk - thought I'd post it here in case anyone else needs something similar:

Use a form like this (V1.3.5):

<form name="product_details_form_5" method="post" action="http://www.yoursite.com/store/index.php">
<input value="checkout" name="target" type="hidden">
<input value="add" name="mode" type="hidden">
<input value="5" name="product_data[5][product_id]" type="hidden">
<input name="product_data[5][amount]" value="1" type="hidden">

<a href="javascript:document.product_details_form_5_final.submit();"><img src="your-images-folder/add-to-cart.gif" alt="Your Store" width="250" border="0" height="70"></a><br>

<a href="javascript:document.product_details_form_5.submit();">Add To Cart</a>
</form>

Where

<input value="5" name="product_data[5][product_id]" type="hidden">

uses the ID number of the product you want to add (just hover your mouse over the links in "Manage Products" in your admin panel and you'll see the product_id in the url)

and

<input name="product_data[5][amount]" value="1" type="hidden">

determines the quantity to be added to the cart (value="n").

I used both a text link AND a button image, but you could use just one or the other. You can see my example live here:

http://www.hotyogama...ass.com/#launch

Note if you need more than one on the same page, then you'll need to have unique names for each form and also the javascript:document.submit such as:

form name="product_details_form_5_one"
...
javascript:document.product_details_form_5_one.submit

and

form name="product_details_form_5_two"
...
javascript:document.product_details_form_5_two.submit

etc

I was also given the code for V2.0Beta, but I haven't tested it yet.
<form action="http://beta.cs-cart.com/index.php" method="post" name="product_form_899">
<input name="result_ids" value="cart_status,wish_list" type="hidden">
<input name="redirect_url" value="http://beta.cs-cart.com/index.php?dispatch=checkout.cart" type="hidden">
<input name="product_data[899][product_id]" value="899" type="hidden">

<input name="dispatch[checkout.add..899]" value="Add to cart" type="submit">

</form>

Hope that helps someone - it helped me!

Cheers,

Robert