S
S
SteepNET2020-04-06 22:33:03
Laravel
SteepNET, 2020-04-06 22:33:03

Bitrix smart filter multicurrency?

Good afternoon!
I ask for help in implementing multi-currency in a smart filter, namely in the output in the fields for entering "Price FROM - TO" prices in another currency!
I successfully implemented the output in another currency in the product card using CCurrencyRates::ConvertCurrency() using the selector, I change the display of prices there.

But the smart filter in the input fields became a problem for me...

In the input in the template, I replaced the value with

$price_min = round(CCurrencyRates::ConvertCurrency($arItem["VALUES"]["MIN"]["VALUE"], 'RUB', 'USD'), 2);
$price_min_html = round(CCurrencyRates::ConvertCurrency($arItem["VALUES"]["MIN"]["HTML_VALUE"], 'RUB', 'USD'), 2);

value="<?=($price_min_html) ? $price_min_html : ($price_min)?>"
data-price="<?=$price_min;?>"

Also for the MAX

values, the values ​​are successfully substituted in the input fields for the required ones, but the sliders still display rubles when moving.
In $arJsParams =
Just the parameters are passed to script.js, but if I change it to converted values ​​there, it naturally does not work correctly since there are no such prices.

It is necessary to transfer values ​​in rubles and display in the input in converted values.
And then came to a standstill! I know that right off the bat it’s hardly possible to suggest without trial, maybe someone will come up with some kind of thought or solve a similar problem ...

The product has one price in rubles.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NubasLol, 2019-10-04
@NubasLol

Because whereHas works for querying Result. with works after this request. Therefore, you must also write this condition in with

T
topuserman, 2020-04-07
@SteepNET

The smart filter filters only the fields specified by the values.
Those. if the filter is by the price property with the ruble currency, then the filtering will be only by the ruble, and customizing the component, and even more so the template, is very labor-intensive.
It will be much easier to add additional price types - USD Price , EUR Price , etc.
Hang a handler for changing/adding a product, in which these types of prices will be automatically filled in from the conversion from the ruble at the internal exchange rate.
Next, in the smart filter, display all the necessary price types using standard tools, and slightly customize the template so that only the Ruble is displayed by default, then the necessary price types are shown by select.
UPD
If you have the Small Business edition, then there will be no multi-price.
In this case, you will have to customize the filter component:
1. Move the component to a separate space
2. Enter the exchange rate somewhere
3. In the component template, where the block for filtering by price is displayed, add a select, with the choice of the desired currency, when changing the currency, through ajax, recalculate prices at the rate, and display in the same place.
+ add input:hidden with the selected currency
4. In the component, check the incoming rate, and convert to rubles.
As a result, everything will work on top of the standard functionality.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question