Core Search Results Page, Add/make Default Sort By Product Code Desc

Joyous day, this one should be easy (from your end) to answer.



We are using WG Dynamic Search.



We have made it so that addon searches and displays results by Product Code, descending.



Unfortunately, when one selects to view ALL of the results; it passes to the core CS-Cart search results page… which does NOT allow setting search results sorting by Product Code… and further as DESC.



We simply need to have the core cart system’s search results page to list results by order of Product Code… descending (DESC). It already lists as ascending Product Codes… so simply, how can we change that to DESC?



Please advise A.S.A.P. as I have already tried for days to fix this for this client without any luck.



Thanks!! Jefferson

Dear Jefferson,



I am not sure how do you sort product by product code, but please try to open the app\functions\fn.catalog.php file and replace:


$params['sort_order'] = 'asc';



with



$params['sort_order'] = 'desc';




Hope this will help

Thanks, please see capture. The only similar code found in that file seems to allow the direct change from asc to desc…BUT… it seems that the default sorting param is still being pulled from db.



When looking at the code in the capture, what code can I add where to set the default sorting param TO desc… not just in the “else” condition?



And will it make search results listing order show as descending by Product Code?

Thanks… Jefferson

The default sorting parameters are received by the fn_get_products_sorting PHP function which has hooks. Looks like addon developed by WG uses these hooks. In this case, please contact them for more details.

Thanks… BUT… that addon does already sort/list ITS results by Product Code Descending.

It is the CS-Cart core search which does NOT list ITS search results by Product Code Descending.

So… let's ignore the addon, and please tell me how to make the core CS-Cart search/sort functions

list just the CS-Cart built-in search results by Descending Product Code numbers.

PLEASE?



Please let me know if you do not know what I mean by the CS-Cart's built-in search

functions.



Thanks! Jefferson

/app/functions/fn.catalog.php

function fn_get_products_sorting()
{
$sorting = array(
'null' => array('description' => __('none'), 'default_order' => 'asc', 'desc' => false),
'timestamp' => array('description' => __('date'), 'default_order' => 'desc'),
'position' => array('description' => __('default'), 'default_order' => 'asc'),
'product' => array('description' => __('name'), 'default_order' => 'asc'),
'price' => array('description' => __('price'), 'default_order' => 'asc'),
'popularity' => array('description' => __('popularity'), 'default_order' => 'desc'),
'code' => array('description' => __('code'), 'default_order' => 'desc')
);

Thank you… unfortunately, the code mod you have kindly provided does not seem to have any effect.

Please see embedded captures and advise… thanks! Jefferson





[quote name='Tribal' timestamp='1425576646' post='207213']

Thanks… BUT… that addon does already sort/list ITS results by Product Code Descending.

It is the CS-Cart core search which does NOT list ITS search results by Product Code Descending.

So… let's ignore the addon, and please tell me how to make the core CS-Cart search/sort functions

list just the CS-Cart built-in search results by Descending Product Code numbers.

PLEASE?



Please let me know if you do not know what I mean by the CS-Cart's built-in search

functions.

[/quote]



It is required to check how the WG search affects the default CS-Cart search to fix the issue

I agree with ecom because I have no idea how the WG addon works.