Adding new Sort Option

Open to all! Ask other shopowners for help.
Post Reply
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Adding new Sort Option

Post by levelup »

Hi! I'm looking for a way to add another sort option for the dropdown for the product listing pages. I've added an image here for further context, but for the life of me, I cannot find a way to make any changes within the admin folders/files.

Is this possible? If so, do you have any recommendations on files/folders I could review?

Thanks in advance here for any details sent my way.
You do not have the required permissions to view the files attached to this post.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Adding new Sort Option

Post by burt »

What is the `Sort Option` you want to add ?

I *think* it's possible with a Hook, but getting some more details from you, might help to illuminate a way forward.

--

Side Note; always state Phoenix Version when asking for help.
I am not here to build for you.
I am here to build with you. Let's help each other.
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Re: Adding new Sort Option

Post by levelup »

burt wrote: Tue Sep 02, 2025 7:20 pm What is the `Sort Option` you want to add ?

I *think* it's possible with a Hook, but getting some more details from you, might help to illuminate a way forward.

--

Side Note; always state Phoenix Version when asking for help.
I figured it out, sorta, I just added what I'm looking to do (add a product list column to sort by) in the configuration database table, and it showed up as an option under Product Listing.

Ultimately, what I'm trying to do is add a 'PRODUCT_LIST_MSRP' option to sort by and include in the sortable_product_columns. This was part of a rabbit hole I went down to see how I could override sortable_product_columns, but I couldn't figure out a way to create a hook...it was a whole thing.

Sidenote, Burt, thank you for your help here and there over the years. You've been so insightful, even in the old osCommerce days. You, @ecartz and @raiwa have definitely inspired me to become a better developer, even with my inadequate hook creation capabilities.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Adding new Sort Option

Post by burt »

TY for the kind words @levelup - appreciated.

Back to this;
I am not sure that just adding to the DB would make anything work in the Shop Side.
If you set your new option to show, does it actually show in the Shop Side on the dropdown menu in the listings?
If it does show, does it do what you want (ie order by MSRP asc/desc).
I am not here to build for you.
I am here to build with you. Let's help each other.
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Re: Adding new Sort Option

Post by levelup »

burt wrote: Wed Sep 03, 2025 1:50 pm TY for the kind words @levelup - appreciated.

Back to this;
I am not sure that just adding to the DB would make anything work in the Shop Side.
If you set your new option to show, does it actually show in the Shop Side on the dropdown menu in the listings?
If it does show, does it do what you want (ie order by MSRP asc/desc).
Of course! And, sure, so I've included a couple of more screenshots. The screenshots show segments of the Product Listing configuration page with details I added to the database. After that, I edited the sortalbe_product_columns.php page and added the new column specification details I wanted to include for the MSRP.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Adding new Sort Option

Post by burt »

levelup wrote: Wed Sep 03, 2025 2:39 pm I edited the sortalbe_product_columns.php page and added the new column specification details I wanted to include for the MSRP.
Depending on Phoenix Version, I think this is a template component - so you could override it in your template.

And, again depending on Phoenix Version, I think this has a hook listener so you could add your new column_specification with a Hook.

You would probably not do both of those things, but certainly one or the other.
Either way, it leaves the Core File untouched, good for the future.
I am not here to build for you.
I am here to build with you. Let's help each other.


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