I
I
Ivan Sergeevich2017-06-05 15:33:57
1C-Bitrix
Ivan Sergeevich, 2017-06-05 15:33:57

How to make a shopping cart in the bitrix modal window?

Tell me how, after clicking on the "buy" button, display a popup with a basket, instead ofd56e795828d942feb4640c5cff1b8ef6.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Emelyanov, 2017-06-05
@babarun

After adding the product to the cart, make a request to the script that returns the cart.

V
Vyacheslav Shevchenko, 2017-06-05
@WebDev2030

The buy button is processed in the JS of the components, and the cart on the page is updated on the event. For modals, I use magnific popup, and so I would do this: hide the basket in a div that would open via magnific popup on the OnBasketChange event.

BX.addCustomEvent("OnBasketChange", function(){
//и тут уже пишете скрипт для открытия попап окна
});

Try this. Perhaps it will be necessary to use another event. "OnBasketChange" is called when the basket changes, but it is necessary to add it, otherwise it may turn out that simply by changing the amount of goods in the basket, the window will open the window again and again.
In general, there are different events in standard components.
In principle, you can even create your own event: add BX.onCustomEvent('AddToBasketEvent') for the button after successful sending to the basket; and this will need to be added to all components where there is an output of goods. And in any other place write:
BX.addCustomEvent("OnBasketChange", function(){
//и тут уже пишете скрипт для открытия попап окна
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question