Add A Product To The Cart Using A Link

Hello,

I'm developing a "decision tree" using d3.js to give the users the opportunity to choose the right product based on his/her needs.

What I want to do is to add a link to the last leaf of the tree to permit to add the proper product to the cart.

Please have a look at the attached image to better understand.

Thanks

Luca

tree.jpg

If the link will be used in CS-Cart, you can use the following code:

{__('add_to_cart')}

where 244 is the ID of the required product

Hello,

thank you for your help.

The link is used inside an html block.

I have tried all these options but none of them works

PRODUCT LINK



{__('add_to_cart')}


{__('add_to_cart')}


{__('add_to_cart')}

I get these errors depending on which link I click

ErrorOops, something went wrong (Forbidden). Please try again.

or

POST http://localhost/projects/rf_shop2/%7Bnet::ERR_CONNECTION_RESET

Hello,

thank you for your help.

The link is used inside an html block.

I have tried all these options but none of them works

PRODUCT LINK



{__('add_to_cart')}


{__('add_to_cart')}


{__('add_to_cart')}

I get these errors depending on which link I click

ErrorOops, something went wrong (Forbidden). Please try again.

or

POST http://localhost/projects/rf_shop2/%7Bnet::ERR_CONNECTION_RESET

Sorry the 244 is replaced with 1 that is the actual product code

You should use HTML block with SMARTY support. Please try

Hello,

using a html block with Smarty support, the add to cart modal window appear, but the cart doesn't update (the number of itmes in the cart doesn't change) until I manually refresh the page.

Seems that the product is added correctly to the cart, but the cart content is not refreshed.

I noticed that there are some other relevant fields, but I don't know how to add them to the href link.

The most interesting are:

I have tried something like this but doesn't work. Keeps on adding the prodcut to the cart but it doesn't refresh the number of contained items.

NEW LINK

Here the complete form










Add to cart

OK. I got it. Use the following code:

{__('add_to_cart')}

Hi thank you for the effort you put to solve the issue, but it doesn't work for me.

I have used a block with smarty support and just changed the product code, and basically I have the same behaviour as before.

The number of products in the cart is not updated, even if the product has been added.

Does it works for you ?

Just tested. Additional class is required. Please try

{__('add_to_cart')}

No luck. I have also tried on an older cs-cart version, but it doesn't work for me.

No luck. I have also tried on an older cs-cart version, but it doesn't work for me.

Works for me. Just tested. Make sure that the cm-ajax-full-render class is added and clear the cache. It should work

Just tested. Additional class is required. Please try

{__('add_to_cart')}
Is there anyway to have this work with out having the popup that says continue shopping/view cart?

No luck. I have also tried on an older cs-cart version, but it doesn't work for me.


You are using the product code witch is why it isn't working, you have to use the product_id for it to work.

Is there anyway to have this work with out having the popup that says continue shopping/view cart?

Unfortunately, no. Additional code changes are required

Is there a way to use this code to add multiple products. For example


{__(‘add_to_cart’)}

Is there a way to use this code to add multiple products. For example

{__('add_to_cart')}

Unfortunately, no

+question

i have ajax request like this in categories page.

extra info

if i use regisrty display in php rendering that block. but i want render every target id without display assign

what can i do ?

+question

i have ajax request like this in categories page.

extra info

if i use regisrty display in php rendering that block. but i want render every target id without display assign

what can i do ?

In this case replace display function with

return array(CONTROLLER_STATUS_OK, 'categories.view?category_id=123');

where 123 - is the ID of required category page