Sorting Products Ascending

Open to all! Ask other shopowners for help.
Post Reply
bestmate
Member
Posts: 27
Joined: Wed Mar 08, 2023 1:23 am
Phoenix Version:
Has thanked: 22 times
Been thanked: 4 times

Sorting Products Ascending

Post by bestmate »

Hi All, please can someone tell me is there is a way in admin to set products to be listed in and ascending manner instead of descending? Any time I add a product, it shows up first when products are listed. I want to reverse this so products are listed by oldest first instead on the last.

I have the product listing addon but I believe this does not have anything to do with the default sorting in phoenix which shows the latest product first.

Thanks in advance for any assistance.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Sorting Products Ascending

Post by tessthepup »

bestmate wrote: Mon May 08, 2023 1:34 pm Hi All, please can someone tell me is there is a way in admin to set products to be listed in and ascending manner instead of descending? Any time I add a product, it shows up first when products are listed. I want to reverse this so products are listed by oldest first instead on the last.

I have the product listing addon but I believe this does not have anything to do with the default sorting in phoenix which shows the latest product first.

Thanks in advance for any assistance.
@bestmate
Have you changed this in the product listing settings

Sort Option: Latest Added (0=disable; 1=enable)

edit, sorry ignore that it is not what you asked
bestmate
Member
Posts: 27
Joined: Wed Mar 08, 2023 1:23 am
Phoenix Version:
Has thanked: 22 times
Been thanked: 4 times

Re: Sorting Products Ascending

Post by bestmate »

@tessthepup No worries, thanks.

@burt Please can you help with this? If you could kindly point me to where I can amend the way the results for new products are ordered, I could try change the ordering format for the database query from DESC to ASC which I believe will sort out my issue.

Many thanks.
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Sorting Products Ascending

Post by tessthepup »

@bestmate

I think you need to look in

includes/modules/content/index_products/cm_ip_product_listing.php

at '// We show them all'

I would copy the file and location into your override template first so you do not mess with the core.
bestmate
Member
Posts: 27
Joined: Wed Mar 08, 2023 1:23 am
Phoenix Version:
Has thanked: 22 times
Been thanked: 4 times

Re: Sorting Products Ascending

Post by bestmate »

tessthepup wrote: Mon May 08, 2023 5:22 pm
includes/modules/content/index_products/cm_ip_product_listing.php

at '// We show them all'

I would copy the file and location into your override template first so you do not mess with the core.

@tessthepup

Thanks for your suggestion. I'm not quite sure what I expected to do as I don't see anything relating to sorting products in that file. Also, not sure what I should be copying to the ovveride template and where to copy to.

The file you mentioned above seems to relate to categories and manufacturers and I see only two instances of "ORDER BY" and they do not relate to new products. I'd thought I could just make a change somewhere from DESC to ASC but it seems that's not the case?
bestmate
Member
Posts: 27
Joined: Wed Mar 08, 2023 1:23 am
Phoenix Version:
Has thanked: 22 times
Been thanked: 4 times

Re: Sorting Products Ascending

Post by bestmate »

I got this resolves after tinkering around in three files. Everything sorts ascending now with the ?sort=1a appended to the three links in the three files. May not be pretty but I got my solution.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply