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?
sortable_product_columns
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
- 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
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
Searched but didn't find that topic
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.
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
It's hooked: https://github.com/CE-PhoenixCart/Phoen ... ns.php#L75heatherbell 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?
Code: Select all
public function listen_filterStart($parameters) {
if ('PRODUCT_LIST_NAME' === $parameters['default_column']) {
$parameters['default_column'] = 'PRODUCT_LIST_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.