EN:
Hello!
It turned out that your plugin completely removes all search results in the “filter (slider) by price from and to” WooCommerce
https://elektro.vveb.ws/shopcat/televizori/?min_price=11840&max_price=24340
slider widget
Filter by price
installed:
WordPress 5.6.1 and WooCommerce 4.8.0
SSL, PHP = CGI 7.4.33 (alt)
in newer versions of WordPress and WooCommerce the problem persists!
first I posted in the Plugin forum: YITH WooCommerce Ajax Product Filter
Plugin disables standard slider “Filter by Price” Woocommerce?
then – to Forum Plugin: WooCommerce
After updating WP=6.0.1 and Woo=6.8.2, price filter from and to not work
but it turns out that the problem is in the exchange-rates-today plugin!
* * *
RU:
Здравствуйте!
Оказалось что Ваш плагин полностью удаляет все результаты поиска в “фильтре (ползунок) по цене от и до” WooCommerce
https://elektro.vveb.ws/shopcat/televizori/?min_price=11840&max_price=24340
виджет ползунок
Фильтр по цене
установлены:
WordPress 5.6.1 и WooCommerce 4.8.0
SSL, PHP = CGI 7.4.33 (alt)
в более новых версиях WordPress и WooCommerce проблема сохраняется!
сначала я написал в форум Plugin: YITH WooCommerce Ajax Product Filter
Plugin disables standard slider “Filter by Price” Woocommerce?
затем – в форум Plugin: WooCommerce
After updating WP=6.0.1 and Woo=6.8.2, price filter from and to not work
а оказывается проблема именно в плагине exchange-rates-today!
]]>Не работает фильтр по цене!
add_filter( ‘woocommerce_product_query_meta_query’, ‘filter_function_name_3276’, 10, 2 );
function filter_function_name_3276( $meta_query ){
global $wpdb;
if ( isset( $_GET[‘max_price’] ) || isset( $_GET[‘min_price’] ) ) { // WPCS: input var ok, CSRF ok.
$kurs=get_option(‘kurs’);
if (isset($_GET[‘min_price’]) && $_GET[‘min_price’]>0){
$meta_query[‘price_filter’][‘value’][0] = $meta_query[‘price_filter’][‘value’][0]/$kurs;
};
if (isset($_GET[‘max_price’])){
$meta_query[‘price_filter’][‘value’][1] = $meta_query[‘price_filter’][‘value’][1]/$kurs;
};
return $meta_query;
}
return $meta_query;
}
Есть ли возможность сделать автоматическое обновление курса по ЦБ?
]]>Код самого плагина переносим в function php
далее срочку
add_filter( 'woocommerce_get_price', 'change_price', PHP_INT_MAX - 100, 2 );
меняем на
add_filter( 'woocommerce_product_variation_get_price', 'change_price', PHP_INT_MAX - 100, 2 );
далее в коде
function change_price ($this) {
$int = $this;
$kurs=get_option('kurs');
if ($kurs!='') {
return $int*$kurs;
} else return $int;
}
Меняем переменную $this на $price
должно выглядеть вот так:
function change_price ($price) {
$int = $price;
$kurs=get_option('kurs');
if ($kurs!='') {
return $int*$kurs;
} else return $int;
}
_____________________________________
весь код который должен быть в Function.php
add_action ('admin_menu', 'dynamic_price_button');
//Simple product
add_filter( 'woocommerce_product_variation_get_price', 'change_price', PHP_INT_MAX - 100, 2 );
// add_filter( 'woocommerce_get_price', 'change_price', PHP_INT_MAX - 100, 2 );
// add_filter( 'woocommerce_get_sale_price', 'change_price', PHP_INT_MAX - 100, 2 );
add_filter( 'woocommerce_get_regular_price', 'change_price', PHP_INT_MAX - 100, 2 );
// Variations
add_filter( 'woocommerce_variation_prices_price', 'change_price', PHP_INT_MAX - 100, 2 );
add_filter( 'woocommerce_variation_prices_regular_price', 'change_price', PHP_INT_MAX - 100, 2 );
// add_filter( 'woocommerce_variation_prices_sale_price', 'change_price', PHP_INT_MAX - 100, 2 );
add_filter( 'woocommerce_price_filter_widget_min_amount', 'change_price', PHP_INT_MAX - 100, 2);
add_filter( 'woocommerce_price_filter_widget_max_amount', 'change_price', PHP_INT_MAX - 100, 2);
add_action( 'admin_init', 'register_mysettings' );
function register_mysettings () {
register_setting( 'baw-settings-group', 'kurs' );
register_setting( 'baw-settings-group', 'valuta' );
}
/*
function change_price ($price) {
$int = $price;
$kurs=get_option('kurs');
if ($kurs!='') {
return $int*$kurs;
} else return $int;
}
*/
function dynamic_price_button () {
add_submenu_page ('woocommerce', 'Курс сегодня', 'Курс сегодня', 'manage_options', 'dynamic_price', 'setting_page');
}
function setting_page () {
?>
<div class="wrap">
<h2>Курс на сегодня</h2>
<form method="post" action="options.php">
<?php settings_fields( 'baw-settings-group' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">Курс</th>
<td><input type="text" name="kurs" value="<?php echo get_option('kurs'); ?>" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
<?php }
]]>
Не работает в вариативных товарах, общую цену показывает верно “от-до”, сами вариации не конвертирует.
]]>Выдает цену 0
]]>Hello!
Any idea how to make it work with the widget “filter by price”?
]]>Добрый день. Встретился с проблемой некорректного вывода цены в каталоге. В карточке товара нормально работает, а в сетке магазина выводит цену указанную как начальную. тоесть *начальная цена * курс*. Так вот выводится только начальная цена без умножения на курс. Как нормализовать нормальный вывод в каталоге?
]]>