L
L
lagudal2021-01-11 12:58:28
Magento
lagudal, 2021-01-11 12:58:28

How to make it easier and correct to add to cart in the background (ajax) of cross-sell, up-sell and related products?

There is such a question for some kind of cross-sell, up-sell, related product.
In the template for such products, the "add to cart" button is disabled by default, but it's easy to add it (set $showCart = true in templates/product/list/items.phtml).
Everything works, but there is a small fly in the ointment: adding to the cart comes with a full reload of the page, but I would like it to be in the background, with Ajax, as in the default product template, as in the product view or category view.
What is the best and easiest way to achieve this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lagudal, 2021-01-11
@lagudal

If anyone is interested, here is the answer to magento exchange
The code is working, the only thing to enable the "add to cart" buttons at the top in the switch is to set $showCart = true; for the required cases. Well, I wrote about it there in the last comment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question