P
P
po4emu4ka20202020-11-10 06:42:56
1C-Bitrix
po4emu4ka2020, 2020-11-10 06:42:56

How can I change the price type for all products directly in the cart?

I'm trying to implement the following algorithm in the cart:
If the user switches the radio button in the cart, then the whole cart should appear to him with one type of price, if he switches back - with another.

Can you please tell me the best way to implement this?

There is an idea to catch the GET parameter from this button and, before loading the cart, refill it with goods with a new price type. But I'm not sure if this is rational, since the user can click on this radio and have to refill this trash every time.

Thanks in advance to everyone who will respond.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
1BX.host Hosted by, 2020-11-10
@1BX_host

A logical question - why refill products when you only need to change the price type for the same list of products? =) less load on the database will be

A
Alexander, 2020-11-11
@AlexanderKs3

1. The standard implementation of the BUS displays the most favorable price depending on the user's rights; as a rule, the task of switching prices does not arise;
2. If you want to show the client only one price assigned to him, it is enough to specify in the settings of the bitrix:catalog complex component the parameter PRICE_CODE - the name of the price type;
3. If you really want a switch in the cart, you will have to get the user's cart object for the current site, then bypass the products (BasketItems), making it setFields for the CURRENCY and (possibly) PRICE parameters, then save the cart and get its cost. Maybe this blog will help you .
In fact, the idea of ​​changing the price type in the cart is crazy. But I did point 2 so that the visitor sees only his own, affiliate price.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question