Featured Products

Sort Featured Products - Featured Products

Sort Featured Products

by Moxamint » Tue May 09, 2023 1:41 pm

Hi Rainer,

What is the logic of this add-on to sort the featured products? And which part of the code should I change to sort featured products by featured_id?

Many thanks, Eddy
Moxamint
VIP Member
VIP Member
Posts: 85
Joined: Fri Nov 06, 2020 10:36 am
Contact:

Re: Sort Featured Products

by raiwa » Wed May 10, 2023 7:26 am

Hi Eddy,

Sort order is random. If you wish to change it to featured_id edit the query for example in the index module:
includes\modules\content\index\cm_i_featured_products.php line 68:

Code: Select all

  ORDER BY rand() DESC
change to:

Code: Select all

  ORDER BY featured_id DESC
or

Code: Select all

  ORDER BY featured_id ASC
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Sort Featured Products

by Moxamint » Wed May 10, 2023 11:30 am

Thank you very much! What about the file featured_products.php in the root? It shows all featured products on an independent page, but I could not figure out how products are sorted there, either.

Cheers, Eddy
Moxamint
VIP Member
VIP Member
Posts: 85
Joined: Fri Nov 06, 2020 10:36 am
Contact:

Re: Sort Featured Products

by raiwa » Wed May 10, 2023 12:24 pm

In the sql of the page there is no order by statement. It should show then by products_id order.
If you wish to change something, add the order by statement at the end of the sql in:
featured.php around line 41:

Code: Select all

  AND pd.language_id = %s
  ORDER BY featured_id DESC
EOSQL
    , (int)$_SESSION['languages_id']);
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Sort Featured Products

by Moxamint » Wed May 10, 2023 12:30 pm

Thanks again Rainer!
Moxamint
VIP Member
VIP Member
Posts: 85
Joined: Fri Nov 06, 2020 10:36 am
Contact: