[Skip to main content](#vessel-content)

#   Price sorting - taking the lowest price of the variants

##

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

6 years 3 months ago -  6 years 3 months ago [\#322522](#322522) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  *[Price sorting - taking the lowest price of the variants](/forum/50-feature-request/900504-price-sorting-taking-the-lowest-price-of-the-variants#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...")* was created by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")*

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 3 months ago by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUwLWZlYXR1cmUtcmVxdWVzdC85MDA1MDQtcHJpY2Utc29ydGluZy10YWtpbmctdGhlLWxvd2VzdC1wcmljZS1vZi10aGUtdmFyaWFudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

6 years 3 months ago [\#322538](#322538) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Price sorting - taking the lowest price of the variants](/forum/50-feature-request/900504-price-sorting-taking-the-lowest-price-of-the-variants#322538 "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...")*

Hi,

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

$element-&gt;product_sort_price = hikashop_toFloat($selectedPrice-&gt;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](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUwLWZlYXR1cmUtcmVxdWVzdC85MDA1MDQtcHJpY2Utc29ydGluZy10YWtpbmctdGhlLWxvd2VzdC1wcmljZS1vZi10aGUtdmFyaWFudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.039 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
