Price sorting - taking the lowest price of the variants

  • Posts: 386
  • Thank you received: 14
1 year 9 months ago #322522

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: 1 year 9 months ago by neo191987.

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

  • Posts: 75529
  • Thank you received: 11765
  • MODERATOR
1 year 9 months ago #322538

Hi,

To do that, you would need to add custom code before the line:

$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:
$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.053 seconds
Powered by Kunena Forum