Skip to main content

next/previous feature and product ordering,

More
10 years 11 months ago - 10 years 11 months ago #218998 by saturnales
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3

I tried to hide the out of stock products via the content-menu options, and it works quite fine on the products listing page.
But it seems that on the product page , when i use the "next product" or the "previous product" link, it still browse out of stock products...

In the same way, i have some trouble with he procucts order on the next/previous feature : On the content menu options i put the product orering to "product_created". Again it works fine on the products listing view but it is not supported by the next/previous ordering which still take the product_ID ordering

Any solution ?

Thanks
(please tranfer this message to the "product display" forum, i made a mistake)
Last edit: 10 years 11 months ago by saturnales.

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

More
10 years 11 months ago #219042 by nicolas
Hi,

1. You need to turn off the "show out of stock products" setting of the Hikashop configuration too as the product page next/previous buttons base themselves on it.

2. There is no option to change that.
You would have to change the line:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY a.ordering ASC';
to:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY b.product_created ASC';

in the file components/com_hikashop/views/product/view.html.php
The following user(s) said Thank You: saturnales

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

More
10 years 11 months ago #219418 by saturnales
Thanks

Changing the SQL request sems to be a good solution if its not possible on the BO

Concerning your first answer, its not possible on my website : I have 2 pages, accessible from differents urls ( and with differents templates). The first one has to show out of stocks products while the second has to hide it. (on the product listing page AND on the dedicated products pages) If i turn off the "show out of stock products" setting, I suppose it will hide out of stock products on the 2 websites even if the menu parameter says to show it

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

More
10 years 10 months ago #219427 by nicolas
Hi,

No, the menu item parameter actually overrides the configuration setting on the listing.
For the next/previous buttons, however, it's indeed based on the setting of the configuration all the time.
You'll have to change the code:
Code:
if($this->params->get('show_out_of_stock') != '1'){ $filters[]='b.product_quantity!=0'; }
to:
Code:
if(in_array($Itemid,array(XX,YY))){ $filters[]='b.product_quantity!=0'; }
where XX and YY are the ids of the menu items where you don't want to display out of stock products for the next/previous buttons.
The following user(s) said Thank You: saturnales

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

More
10 years 10 months ago #219538 by saturnales
Thanks a lot.

Again, i can see that the staff is fast and effective.

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

Time to create page: 0.177 seconds
Powered by Kunena Forum