Sort Product By Date (Admin Area)

Hello

How can I arrange products by upload date (not for name / code / price …)

I'd like to sort them the on admin panel like: newest first.

Thanks

Please use the URL in the following format to sort products in such a way:



http://domain.com/your_admin.php?dispatch=products.manage&sort_by=timestamp&sort_order=desc

thanks

U r welcome! :)

Thank you!

What should I change in fn_catalog.php to keep the sorting by timestamp DESC by default?

Settings->Appearance->Product list default sorting: Newest Items First

I need only in admin area.

Find the fn_get_default_products_sorting function (app/functions/fn.catalog.php) and replace:

return $sorting;

with

if (AREA == 'A') {
    $sorting = array (
        'sort_by' => 'timestamp',
        'sort_order' => 'desc',
    );
}

return $sorting;

To be able to set by default and also to use the rest of the sorting please add:

1.
#file

app/addons/my_changes/init.php
#content

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

fn_register_hooks(
‘get_products_pre’
);


2.

#file
app/addons/my_changes/func.php
#content

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

function fn_my_changes_get_products_pre(&$params, $items_per_page, $lang_code){
if(AREA==‘A’ && empty($params[‘sort_by’])){
$params[‘sort_by’] = ‘timestamp’;
$params[‘sort_order’] = ‘desc’;
}
}

* My Changes add-ons needs to be active
* Tested on CS-Cart 4.3.5 but will work for 4.2.x and 4.3.x


I hope that helps,


Valentin
part of hungryweb.net

I always designate my SKU's so they're sorted alphabetically, similar products are grouped together.

I know that there are options for setting the default sort of the product list by Name, (Settings->Appearance->Product list default sorting). Unfortunately, there's no option for SKU.

Is there some kind of workaround that will sort the product list by SKU by default?

I always designate my SKU's so they're sorted alphabetically, similar products are grouped together.

I know that there are options for setting the default sort of the product list by Name, (Settings->Appearance->Product list default sorting). Unfortunately, there's no option for SKU.

Is there some kind of workaround that will sort the product list by SKU by default?

You can extend the list of available sortings fn_get_products_sorting function (app/functions/fn.products.php or fn.catalog.php) with the following code

'code' => array('description' => __('product_code'), 'default_order' => 'asc')

Then clear cache

Thank for trying to help me! Unfortunately, I'm not sure if I did the right thing or not. Can you look at this and confirm I did the right thing?

deleted comment.

It should be 'code' instead of 'product_code'.

Add the line instead of editing an existing one.

Still not working for me. this is what my code looks like now...

$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'),
'code'=> array('description' => __('code'), 'default_order' => 'asc'),
'price' => array('description' => __('price'), 'default_order' => 'asc'),
'popularity' => array('description' => __('popularity'), 'default_order' => 'desc')

1. Did I put it in the right position?

2. I added a comma, what that the right thing to do?

The code is correct now. Did you clear cache? Do you see new option in the selectbox with available sortings in the admin panel?

I believe I did everything right, but no luck

Admin>Full Page Cache>Clear ALL Cache

the desired option doesn't show up under Settings>Appearance>Product list default view:

Please try

Administration -> Storage -> Clear cache

I really do appreciate you trying to help me, but unfortunately, I get the same result.