Zen Cart Logo
Forums / Basic Configuration / How to set the products to sort by date added?

How to set the products to sort by date added?

Views: 6,068

Results 1 to 11 of 11
7 Dec 2010, 4:34 PM
#1
sharontan avatar

sharontan

New Zenner

Join Date:
Nov 2010
Posts:
57
Plugin Contributions:
0

How to set the products to sort by date added?

Hi, currently all my products listing are listing alphabetically.
How can I set it to date added? As in new items on top. Old items below.

I have set the config-> all listing Display Product Display - Default Sort Order-> 6

6= Date Added desc

However, nothing changes.

7 Dec 2010, 5:40 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to set the products to sort by date added?

Each of the Product Listings has its own settings ...

You will need to edit each one to customize them to be sorted by date ...

All Listings is the actually Listing for All of your Products when you click on the link for All Products ...

There are settings for:
Product Info
Product Listing
New Products
Featured Listing
All Listing

about the only one that would give a problem is the Product Listing as that does not have a sort order by date ...

For that, you would need to customize the code ...

7 Dec 2010, 5:56 PM
#3
sharontan avatar

sharontan

New Zenner

Join Date:
Nov 2010
Posts:
57
Plugin Contributions:
0

Re: How to set the products to sort by date added?

I've already listed all my products up. How do I customize the code? Or I have to individually go into every product to set it to be sorted by date?

7 Dec 2010, 7:35 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to set the products to sort by date added?

You could set the Product Listing to blank on the sort order, meaning nothing ... then customize the code:
/includes/index_filters/default_filter.php

and change the code from:

// sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
// for reverse, descending order use:
//       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
          $listing_sql .= " order by p.products_sort_order, pd.products_name";
          break;

to read:

// sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
// for reverse, descending order use:
//       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
// bof: customize to sort by date descending
          $listing_sql .= " order by p.products_date_added desc, p.products_sort_order, pd.products_name";
// eof: customize to sort by date descending
          break;

Now, when navigating the Categories the listing will be by date, sort order, name ...

8 Dec 2010, 5:33 PM
#5
sharontan avatar

sharontan

New Zenner

Join Date:
Nov 2010
Posts:
57
Plugin Contributions:
0

Re: How to set the products to sort by date added?

Awesome! Thanks!

29 Jan 2011, 1:16 PM
#6
hcd888 avatar

hcd888

Zen Follower

Join Date:
May 2008
Posts:
348
Plugin Contributions:
0

Re: How to set the products to sort by date added?

Hi, i have Product Listing Grid mod installed i tried the aboe and it dont seem to be working, does something different need to be done because of the installed mod?

Hope you can help.

Thanks

22 Sep 2011, 11:27 PM
#7
didee avatar

didee

Zen Follower

Join Date:
Jan 2009
Location:
Queensland, Australia
Posts:
115
Plugin Contributions:
0

Re: How to set the products to sort by date added?

This has also helped me. thanks so much :smile:

24 Sep 2011, 11:13 PM
#8
markmcknight avatar

markmcknight

New Zenner

Join Date:
Mar 2011
Posts:
13
Plugin Contributions:
0

Re: How to set the products to sort by date added?

we are using 1.3.9h version of zen. We have changed the code as per the instructions below, and still get nothing. All Alpha still. is it necessary to reset our other listings so that they should read something other than a 6. The product Listing is left blank on the sort order.

Ajeh:

You could set the Product Listing to blank on the sort order, meaning nothing ... then customize the code:
/includes/index_filters/default_filter.php

and change the code from:

// sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
// for reverse, descending order use:
// $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
$listing_sql .= " order by p.products_sort_order, pd.products_name";
break;

> 
> to read:
> ```
// sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
// for reverse, descending order use:
//       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
// bof: customize to sort by date descending
          $listing_sql .= " order by p.products_date_added desc, p.products_sort_order, pd.products_name";
// eof: customize to sort by date descending
          break;

Now, when navigating the Categories the listing will be by date, sort order, name ...

25 Sep 2011, 2:10 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to set the products to sort by date added?

If you click on the Product Name sorter for the listing, what comes up on URL for the
sort=

and does it sort right when you have it in ascending order?

5 Mar 2012, 12:51 AM
#10
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: How to set the products to sort by date added?

I tried this and it sorts my items correctly as by date added, however, the next and previous button need tinkering.

if i clicked on the first item (the newest added) the order of the product is the last item (ie 51/51) this makes the next button go to 1/51.

I tried a few things but to no avail.

I have the listing order using the modification from above. http://sales.michaelhulak.com/index.php?main_page=index&cPath=1

5 Mar 2012, 2:21 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to set the products to sort by date added?

The numbers have no real value ... they change depending on sort order ...