jsv
March 21, 2018, 12:00am
1
Hello,
i have a little problem. I extended fn_get_products_sorting function in app/functions/fn.catalog.php to sort goods by product code, but after every CS-CART update i must edit fn.catalog.php again.
Is there any way to avoid this ? eg. add-on MyChanges ? How ?
Thanks
J.Svoboda | CZ
Sure, there is the products_sorting hook, which can be used by My changes module.
1. app/addons/my_changes/init.php
if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }
fn_register_hooks(
‘products_sorting’
);
2. app/addons/my_changes/func.php
if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }
function fn_my_changes_products_sorting(&$sorting, $simple_mode)
{
$sorting[‘code’] = array(‘description’ => __(‘product_code’), ‘default_order’ => ‘asc’);
}
jsv
March 21, 2018, 12:00am
3
thank you for your advice, unfortunately this solution does not work...
JS
Did you clear cache? Try to delete var/cache directory manually
jsv
March 21, 2018, 12:00am
5
cache cleaned manualy, still not function...
Where do you check result?
jsv
March 21, 2018, 12:00am
7
in admin -> Settings: Appearance -> Available product list sortings - Here is not visible checkbox to select this options.
Created language variables sort_by_code_asc + sort_by_code_desc
and nothing....
We have corrected code for init.php file. Please check
http://prntscr.com/iumsfy
Hi eComLabs,
is this possible sort by vendor plan? for example paid members above than a free members. like GOLD / SILVER / BRONZE / FREE
Unfortunately more complex changes are required in this case