sortable_product_columns

Open to all! Ask other shopowners for help.
Post Reply
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

sortable_product_columns

Post by heatherbell »

https://github.com/CE-PhoenixCart/Phoen ... olumns.php
Where should an edited version of this be saved to override the core file?
In fact, only wanted to change $default_column = 'PRODUCT_LIST_NAME'; to change the default sort of product listing so maybe there's another/better way of doing that than overriding sortable_product_columns?


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: sortable_product_columns

Post by Kofod95 »

I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: sortable_product_columns

Post by heatherbell »

Searched but didn't find that topic :roll:
Followed the advice in the first answer, this post viewtopic.php?p=6424#p6424
So copied/renamed/edited sortable_product_columns.php
Then copied/renamed the Product Listing module including the tpl_ and language files.
Edited the new includes/modules/content/index_products/cm_ip_product_listing_renamed.php on Line 73 to call the renamed/edited sortable_product_columns_renamed.php
Yay! Works with no core edits.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: sortable_product_columns

Post by ecartz »

heatherbell wrote: Fri Oct 21, 2022 4:43 pm In fact, only wanted to change $default_column = 'PRODUCT_LIST_NAME'; to change the default sort of product listing so maybe there's another/better way of doing that than overriding sortable_product_columns?
It's hooked: https://github.com/CE-PhoenixCart/Phoen ... ns.php#L75

Code: Select all

public function listen_filterStart($parameters) {
  if ('PRODUCT_LIST_NAME' === $parameters['default_column']) {
    $parameters['default_column'] = 'PRODUCT_LIST_SOMETHING_ELSE';
  }
}
If you use that hook, you might want to check if it equals 'PRODUCT_LIST_NAME' before changing it. Because some pages (e.g. products_new.php) set it to something else.

You also might want to check if you need to modify column_specifications, although that seems less important. The two times when you might are when PRODUCT_LIST_NAME has a sort value of 0 or when your new column does. If neither of those things is true, then it shouldn't matter.
Denzel
Member
Posts: 87
Joined: Sat Oct 31, 2020 7:22 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 15 times

Re: sortable_product_columns

Post by Denzel »

or you may try this...
defaultSortOrderHook.zip
Just copy to includes/hooks/shop/siteWide/
You do not have the required permissions to view the files attached to this post.


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