PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

How can I disable activation WOOF on several pages?

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello everybody!
I want to disable activation WOOF on Pages and to enable it on FrontPage (my shop), product category pages, single product pages and WOOF generated pages.

I chose"Yes" (on tab"Advanced") then wrote down link-masks (product! product-category! and other attributes) then pressed Save settings.

WOOF sometimes works correct (as my goal is) and sometimes doesn't work. Its behaviour is unpredictable. I can't catch its logic. What do I do wrong? Should I do something yet to climb my goal?

My site amulet-dzi.ru powered by Wordpress 5.6.1 with WooCommerce 4.9.2 and theme"Online Shop" 3.0.5
WOOF widget put into Header Area.

Здравствуйте  Денис

Попробуйте  поменять  функцию в файле -wp-content\plugins\woocommerce-products-filter-free\index.php  - новая  функция:

private function is_should_init() {

if (is_admin()) {
return true;
}

//stop loading the plugins filters and its another functionality on all pages of the site
if (isset($this->settings['init_only_on']) AND ! empty($this->settings['init_only_on'])) {
$links = explode(PHP_EOL, trim($this->settings['init_only_on']));
$server_link = '';
//print_r($_SERVER);
if (isset($_SERVER['SCRIPT_URI'])) {
$server_link = $_SERVER['SCRIPT_URI'];
} else {
if (isset($_SERVER['REQUEST_URI'])) {
$server_link = site_url() . $_SERVER['REQUEST_URI'];
}
}
//***
$removeChar = ["https://","http://","/"];
if (!empty($server_link)) {
$server_link_mask = str_replace($removeChar, '', trim(stripcslashes($server_link)," /"));

//echo stripcslashes($server_link_mask . '<br />');
foreach ($links as $key => $pattern_url) {
$pattern_url = str_replace($removeChar, '', trim(stripcslashes($pattern_url)," /"));
preg_match('/(.+)?' . trim($pattern_url) . '(.+)?/', $server_link_mask, $matches);
//print_r($matches);
//exit;
$init = !empty($matches);
if (isset($this->settings['init_only_on_reverse']) AND $this->settings['init_only_on_reverse']) {
$init = !$init;
}
// if($_SERVER['REQUEST_URI']=="/"){
// $this->is_activated = true;
// return true;
// }
if ($init) {
$this->is_activated = true;
return true;
}
}
}
} else {
return true;
}

return false;
}

И  делайте  тест

 

Заменил (в index.php это строки с 3115 по 3164). Попробовал установить сначала"белый" фильтр ("Yes"), потом"черный" ("No"). К сожалению, никаких отличий в поведении не заметил. Иногда срабатывает верно, иногда нет. Закономерности в поведении не могу уловить.

Я  не  понял  Вас:  сначала"белый" фильтр ("Yes"), потом"черный" ("No").  - что  это  такое  белый/черный  фильтр?  И Вам  следует  использовать  или Yes или NO

Извините за использование устаревшей терминологии (белый фильтр означает - есть список разрешенных, остальное по умолчанию запрещено; черный список означает - есть список запрещенных, все остальное по умолчанию разрешено).

Я имел в виду, что сначала я протестировал работу кода с опцией"Yes" (используя список страниц, на которых WOOFу разрешено работать) , а потом - с опцией"No" (используя список страниц, на которых WOOF запрещено работать).

Здравствуйте Денис

Не думаю что возможна такая нестабильная работа. Это  должно  или  работать  или не  работать  для  конкретных  страниц.

Вы используете  мульти-язычность  на  сайте? Если  да,  тогда  используйте ссылки  для  всех языков

Сделайте  скриншот  ваших  настроек и  опишите  подробнее  что я  должен сделать(на  какие страницы  перейти ) чтобы  получить  эту  ошибку