Skip to main content

Price sorting - taking the lowest price of the variants

More
6 years 2 months ago - 6 years 2 months ago #322522 by neo191987
Hi, I would very much like to add price sorting and for variants. Because I use HikaMarket and do not need a main product price but only variants, price filters become useless. I think it is best to do so when the main product has no price is to take the lowest price of the variants.
Last edit: 6 years 2 months ago by neo191987.

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

More
6 years 2 months ago #322538 by nicolas
Hi,

To do that, you would need to add custom code before the line:
Code:
$element->product_sort_price = hikashop_toFloat($selectedPrice->price_value);
in the file administrator/components/com_hikashop/classes/product.php
There, you have the price objects of the variants in $publicPrices and you need to set the one you want in the $publicPrices variable.
By default, it just uses the first one it finds thanks to the code:
Code:
$selectedPrice = reset($publicPrices);
The following user(s) said Thank You: neo191987

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

Time to create page: 0.163 seconds
Powered by Kunena Forum