Page 1 of 1

sortable_product_columns

Posted: Fri Oct 21, 2022 4:43 pm
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?

Re: sortable_product_columns

Posted: Fri Oct 21, 2022 4:50 pm
by Kofod95

Re: sortable_product_columns

Posted: Fri Oct 21, 2022 5:22 pm
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.

Re: sortable_product_columns

Posted: Fri Oct 21, 2022 7:07 pm
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.

Re: sortable_product_columns

Posted: Mon Oct 24, 2022 10:43 am
by Denzel
or you may try this...
defaultSortOrderHook.zip
Just copy to includes/hooks/shop/siteWide/