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

#   order by cheapest price!

##

- **[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")**
- [![papaleksi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7905-papaleksi "View papaleksi's Profile") Topic Author
- [ Offline](/forum/user/7905-papaleksi)

Less More

- Posts: 25
- Thank you received: 0
-
-

14 years 3 months ago [\#57655](#57655) by [papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")  *[order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#57655 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")* was created by *[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")*

Hi again i use the starter edition and i need to show my products order by cheapest (lower price)
i do not want to be a choice - filter i just want to show my products from cheapest to more expensive.
Thank you again!

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

14 years 3 months ago [\#57679](#57679) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#57679 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Hi papaleksi,

To change the ordering, you have to edit the file: YourSite/components/com_hikashop/views/product/view.html.php
And in the "listing()" function edit the ordering in the SQL Request.

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

- **[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")**
- [![papaleksi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7905-papaleksi "View papaleksi's Profile") Topic Author
- [ Offline](/forum/user/7905-papaleksi)

Less More

- Posts: 25
- Thank you received: 0
-
-

14 years 3 months ago [\#57706](#57706) by [papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")  Replied by *[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#57706 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Thank you for your answer do you mean to change ....
if($this-&gt;params-&gt;get('product_order')=='ordering'){....

and change "ordering" with "product_price"?

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

14 years 3 months ago -  14 years 3 months ago [\#57757](#57757) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#57757 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Hi papaleski,

You can add this line: Code:

$order = ' ORDER BY c.price_value ASC';

Just after: Code:

if(!empty($pageInfo-&gt;filter-&gt;order-&gt;value)){ $order = ' ORDER BY '.$pageInfo-&gt;filter-&gt;order-&gt;value.' '.$pageInfo-&gt;filter-&gt;order-&gt;dir; }

And replace the line: Code:

$query = $select2.' FROM '.$b.$a.$on.' WHERE '.implode(' AND ',$filters).$order;

By: Code:

$query = $select2.' FROM '.$b.$a.$on.' LEFT JOIN '.hikashop_table('price').' AS c ON c.price_product_id=b.product_id WHERE '.implode(' AND ',$filters).$order;

Last edit: 14 years 3 months ago by [Xavier](/forum/user/4105-xavier "View Xavier's Profile").

The following user(s) said Thank You: [FranksBank](/forum/user/6002-franksbank "View FranksBank's Profile"), [papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")

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

- **[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")**
- [![papaleksi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7905-papaleksi "View papaleksi's Profile") Topic Author
- [ Offline](/forum/user/7905-papaleksi)

Less More

- Posts: 25
- Thank you received: 0
-
-

14 years 3 months ago [\#57906](#57906) by [papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")  Replied by *[papaleksi](/forum/user/7905-papaleksi "View papaleksi's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#57906 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Hi xavier i will try your solution thank you for you precious time and help

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

- **[beeldstudio](/forum/user/1943-beeldstudio "View beeldstudio's Profile")**
- [![beeldstudio's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1943-beeldstudio "View beeldstudio's Profile")
- [ Offline](/forum/user/1943-beeldstudio)

Less More

- Posts: 6
- Thank you received: 0
-
-

14 years 1 month ago [\#62764](#62764) by [beeldstudio](/forum/user/1943-beeldstudio "View beeldstudio's Profile")  Replied by *[beeldstudio](/forum/user/1943-beeldstudio "View beeldstudio's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#62764 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Hello guys!
I think that not good solution overwrite files of core

I have suggestion.

we have event 'onBeforeProductListingLoad'. And just need add more parameters that we can send in plugin.
Now we have only this:
$dispatcher-&gt;trigger( 'onBeforeProductListingLoad', array( &amp; $filters, &amp; $order, &amp;$this) );

and if we add also '$select,$select2, $a, $b, $on,' then we could make this changes in plugins without changes core files

Best regards,
Alex

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzU3NjU1LW9yZGVyLWJ5LWNoZWFwZXN0LXByaWNlP3RtcGw9bWFya2Rvd24=) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14271
-
-

14 years 1 month ago [\#62860](#62860) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#62860 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Unfortunately, onBeforeProductListingLoad is triggered from other files where $select,$select2, $a, $b, $on are not available.
So that would break other things in HikaShop.

Another solution is to create a system plugin and paste the whole ProductViewProduct class of the view.html.php file in it.
The system will automatically use your class instead of the HikaShop core class.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzU3NjU1LW9yZGVyLWJ5LWNoZWFwZXN0LXByaWNlP3RtcGw9bWFya2Rvd24=) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14271
-
-

12 years 9 months ago [\#139240](#139240) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: order by cheapest price!](/forum/4-how-to/57655-order-by-cheapest-price#139240 "Hi again i use the starter edition and i need to show my products order by cheapest (lower price) i do not want to be a choice - filter i just want to show my products from cheapest to more expensive. Thank you again!")*

Instead of that code, you should use that one in order to avoid some conflict with potential filters :

You can add this line: Code:

$order = ' ORDER BY price_join.price_value ASC';

Just after: Code:

if(!empty($pageInfo-&gt;filter-&gt;order-&gt;value)){ $order = ' ORDER BY '.$pageInfo-&gt;filter-&gt;order-&gt;value.' '.$pageInfo-&gt;filter-&gt;order-&gt;dir; }

And replace the line: Code:

$query = $select2.' FROM '.$b.$a.$on.' WHERE '.implode(' AND ',$filters).$order;

By: Code:

$query = $select2.' FROM '.$b.$a.$on.' LEFT JOIN '.hikashop_table('price').' AS price_join ON price_join.price_product_id=b.product_id WHERE '.implode(' AND ',$filters).$order;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzU3NjU1LW9yZGVyLWJ5LWNoZWFwZXN0LXByaWNlP3RtcGw9bWFya2Rvd24=) 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.191 seconds

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

[](#top)
