"Add to cart" button on external site or Facebook

Is it possible to add an “Add to cart” button on an external site. It’s ok if the info is fully static. Actually, I would like to do this in a facebook page using FBML but if you tell me how with regular html, I’ll manage in FB myself! Thanks!

Bump! Come on, there has to be a simple way to do this?

You are right this would be great to be able to do.

Here is one method



Install firebug, go to a product page inspect the add to cart button. Scroll up a bit in firebug till you see the beginning of the form tag copy the html and put it in your html editor.



Just a note, the number cs-cart adds to the fields that you see 21636 is not the product ID. I haven’t gone through my database to find out what it is…



Change the form action “/” to your domain and delete the unnecessary inputs and fields. My code is below, I tested it previewing it in firefox and it works. The product is added to your cart and the page you land on is the view cart page. FBML allows forms so it should work. Hope that helps



[HTML]









[/HTML]

Here’s a freebe for you…

Add the attached file to your addons/my_changes/controllers/customer directory (you may have to create the path).



Then you can use a link with an href like:

yoursite.com?index.php?dispatch=checkout.remote_add.

To do a remote add to cart. Or

yoursite.com?index.php?dispatch=checkout.remote_checkout.

To take them directly to checkout.



Note this works with the product_code, not product_id so it is not database dependent.

checkout.pre.zip

That’s works beautifully, Tony. Thanks!! :smiley:

Thanks so much!!! :smiley:

Let's say you would like to include a coupon code in the link and the cart reflects the applied code discount… any ideas?

Tony, thanks the mod. It works fine except if there are options. Any chance you have a fix for that?

You could add options, but it complicates immensely. I.e. how to pass an array of name/value pairs in a GET request… The other complexity this adds is if the option is really an option modifier that becomes a different product_code. It would be some work to figure out how to do it reliably… What I provided was a freebee since I already had it done and a client hadn't paid for the work.



So sorry guys, adding options takes it to a different level…

Thanks Tony, this is AWESOME!

Works a dream Tony thank you.



the urls are yoursite.com/index.php?dispatch=checkout.remote_add.

and

yoursite.com/index.php?dispatch=checkout.remote_checkout.



Regards

thanks Tony for sharing this!

Tony, first off thanks for sharing this!



One question, is there a way to use this to add multiple products to the cart? For example I'd like to add product code 2408 and 2480 to the cart from the same link, I tried this:



index.php?dispatch=checkout.remote_add.2408&dispatch=checkout.remote_add.2480




However, it just adds that last product to the cart…any suggestions or is this addon only able to handle one product at a time?



Thanks!

That is amazing. Like the previous post, is there anyway to add multiple item, and specific quantities?



Very nice indeed!

[quote name='tbirnseth' timestamp='1297041252' post='103191']

Here's a freebe for you…

Add the attached file to your addons/my_changes/controllers/customer directory (you may have to create the path).



Then you can use a link with an href like:

yoursite.com?index.php?dispatch=checkout.remote_add.

To do a remote add to cart. Or

yoursite.com?index.php?dispatch=checkout.remote_checkout.

To take them directly to checkout.



Note this works with the product_code, not product_id so it is not database dependent.

[/quote]



Hi. This code does not work with CS Cart 4.0. Do you know what I can do to make it work?

The error message I get in CS Cart 4.0 is:



Error[color=#9C3535][font=Arial, Helvetica, sans-serif][size=3] No such product 'ACTION'[/size][/font][/color]

I highly recommend tbirnseth and EZ Merchant Solutions for programming with CS-Cart and in general. Guy knows his stuff. Super nice and super knowledgable. Gets things working in a jiffy.



[color=#808080][font=arial, verdana, tahoma, sans-serif][size=2]EZ Merchant Solutions [/size][/font][/color]

[color=#808080][font=arial, verdana, tahoma, sans-serif][size=2]Custom B2B Development, Consulting and Special Projects ([/size][/font][/color]get a quote[color=#808080][font=arial, verdana, tahoma, sans-serif][size=2]).[/size][/font][/color]

[color=#808080][font=arial, verdana, tahoma, sans-serif][size=2]Commercial addons to meet your business and operations needs.[/size][/font][/color]

@alephins thanks for the kind words.

Here is a link to the current V4 version (remove the .txt suffix after download) of the script that will allow you to either add an item to the cart or to add and go directly to checkout.



There are two 'modes' (MODE) that it runs as:[list]

[]remote_checkout

[
]remote_add

[/list]

It utilizes the product_code (PRODUCT_CODE) and then looks that up and maps it to a product_id.

It optionally allows you to specify the quantity (QUANTITY) as the last parameter to the dispatch argument.

You can also specify a coupon code to be used by appending an "&ccode=COUPON_CODE



So an example might be:

?dispatch=checkout.MODE.PRODUCT_CODE.QUANTITY&ccode=COUPON_CODE



Have fun.

This is absolutely fantastic. You have no idea how much you've helped. G-d bless you.


[quote name='tbirnseth' timestamp='1377216646' post='167239']

@alephins thanks for the kind words.

Here is a link to the current V4 version (remove the .txt suffix after download) of the script that will allow you to either add an item to the cart or to add and go directly to checkout.



There are two 'modes' (MODE) that it runs as:[list]

[]remote_checkout

[
]remote_add

[/list]

It utilizes the product_code (PRODUCT_CODE) and then looks that up and maps it to a product_id.

It optionally allows you to specify the quantity (QUANTITY) as the last parameter to the dispatch argument.

You can also specify a coupon code to be used by appending an "&ccode=COUPON_CODE



So an example might be:

?dispatch=checkout.MODE.PRODUCT_CODE.QUANTITY&ccode=COUPON_CODE



Have fun.

[/quote]