Skip to main content

Don't show out of stock products - search plugin

More
15 years 1 month ago #24120 by Karloz
Pls how to ?

Found the plugin @ plugins/search/hikashop_products.php

Thank you very much,
Karloz

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24143 by nicolas
There is no option for that.
Please update the plugin with this package and deactivate the new "out of stock products" option and it will work like you want.

This attachment is hidden for guests.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24162 by Karloz
Updated, configured but out of stock products are still in search results.
In database plugin config is correctly "out_of_stock_display=0"

found this, but i don't know php:
Code:
$out_of_stock = $this->params->get('out_of_stock_display','1'); if(!$out_of_stock){ $filters[]='a.product_quantity!=0'; }

? ?

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24164 by nicolas
Then let's try that:
$out_of_stock = (int)$this->params->get('out_of_stock_display','1');

instead of:
$out_of_stock = $this->params->get('out_of_stock_display','1');

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago - 15 years 1 month ago #24166 by Karloz
didnt work, so i tried to hardcoded in the original plugin like:
Code:
$filters = array('a.product_published=1','a.product_type=\'main\'','a.product_quantity!=0');

but didnt work as well, then tried to unpublish some products and search with the original plugin, the unpublished products shown up, so there must be something wrong with the filters in general
Last edit: 15 years 1 month ago by Karloz.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24167 by nicolas
Mmmm. It's working fine on our end. Maybe it comes from joomfish. Do you use joomfish ?

If so, could you try to replace the line:
$query = ' SELECT DISTINCT '.$select.' FROM '.hikashop_table('jf_content',false) . ' AS b LEFT JOIN '.hikashop_table('product').' AS a ON b.reference_id=a.product_id WHERE '.implode(' AND ',$filters2).' ORDER BY '.$order;

by:
$filters2[]=implode(' AND ',$filters);
$query = ' SELECT DISTINCT '.$select.' FROM '.hikashop_table('jf_content',false) . ' AS b LEFT JOIN '.hikashop_table('product').' AS a ON b.reference_id=a.product_id WHERE '.implode(' AND ',$filters2).' ORDER BY '.$order;

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24168 by Karloz
Yep joomfish is used ... still doesn't work o_O

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24169 by Karloz
On the site is used yootheme warp template framework (don't know what it exactly is)
i tried the remove all overrides, the search still didnt work properly then :[

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24170 by nicolas
There seems to be another problem when there are several fields selected for the search. Try to also replace the line:
$filters[] = '(' . implode( ') OR (', $wordFilters ) . ')';

to:
$filters[] = '((' . implode( ') OR (', $wordFilters ) . '))';

and the line:
$filters2[] = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wordFilters2 ) . ')';
to:
$filters2[] = '((' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wordFilters2 ) . '))';

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24171 by Karloz

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #24174 by Karloz
works ! B) thank you very much !

here are all the mods together

This attachment is hidden for guests.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.221 seconds
Powered by Kunena Forum