Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / How to make new products show first on categories and sub categories...HELP!

How to make new products show first on categories and sub categories...HELP!

Views: 3,302

Results 1 to 16 of 16
1 Nov 2012, 7:03 PM
#1
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

How to make new products show first on categories and sub categories...HELP!

On my site: http://www.allclipart.info, I want all of my products in the categories and sub categories to show new products first. So for example, if
you look at my EXCLUSIVE category (http://allclipart.info/shop/index.php?main_page=index&cPath=195) it shows everything in alphabetical order. I want it to show the most recently added products first.

My "New Products, All Products, Featured Products" show in the proper order, but I can't seem to get the other categories & sub categories to show new
products first. Can someone point me in the right direction?

Thanks...

2 Nov 2012, 6:05 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: How to make new products show first on categories and sub categories...HELP!

You can customize the file:
/includes/index_filters/default_filter.php

and add the code in RED:

// 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";
[B]//[/B]          $listing_sql .= " order by p.products_sort_order, pd.products_name";
[B]          $listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
[/B]          break;

Then set the Sort Order in the Configuration ... Product Listing ... to blank for:

Display Product Listing Default Sort Order
Product Listing Default sort order?
NOTE: Leave Blank for Product Sort Order. Sort the Product Listing in the order you wish for the default display to start in to get the sort order setting. Example: 2a

And now your Categories Product Listings will default to be based on the Date Added, Sort Order, Product Name ...

2 Nov 2012, 6:44 PM
#3
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

BEAUTIFUL!!! Worked like a dream. Thanks so much! :)

3 Nov 2012, 2:13 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: How to make new products show first on categories and sub categories...HELP!

Thanks for the update that this was able to work for you ... :smile:

28 Jul 2013, 9:10 PM
#5
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

Hi Linda...I recently installed some modules to my site and it messed up my sort order. Anyway, I went back and did what you say in the post above and I get this message:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by p.products_date_added DESC, p.products_sort_order, pd.products_name' at line 7
in:

When I visit the front end of my store. Any idea why i might be getting that? Thanks.

BTW: When I remove the code in red it goes away.

28 Jul 2013, 10:45 PM
#6
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: How to make new products show first on categories and sub categories...HELP!

amandavz:

Hi Linda...I recently installed some modules to my site and it messed up my sort order. Anyway, I went back and did what you say in the post above and I get this message:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by p.products_date_added DESC, p.products_sort_order, pd.products_name' at line 7
in:

When I visit the front end of my store. Any idea why i might be getting that? Thanks.

BTW: When I remove the code in red it goes away.

Please post the block of code as modified by you (file includes/index_filters/default_filter.php)

28 Jul 2013, 11:18 PM
#7
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

and add the code in RED:

// 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";
$listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
break;

28 Jul 2013, 11:54 PM
#8
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: How to make new products show first on categories and sub categories...HELP!

What else does the error message say after this

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by p.products_date_added DESC, p.products_sort_order, pd.products_name' at line 7
in:

in: what???

29 Jul 2013, 12:24 AM
#9
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

Sorry...here is the whole error message:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by p.products_date_added DESC, p.products_sort_order, pd.products_name' at line 7
in:
[select m.manufacturers_name, p.products_image, pd.products_name, p.products_quantity, p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status from zen_products_description pd, zen_products p left join zen_manufacturers m on p.manufacturers_id = m.manufacturers_id, zen_products_to_categories p2c left join zen_specials s on p2c.products_id = s.products_id where p.products_status = 1 and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '5' and p2c.categories_id = '195' order by p.products_sort_order, pd.products_name order by p.products_date_added DESC, p.products_sort_order, pd.products_name]

Does it help to know that i just installed CEON Uri? It may have something to do with the products now being named link instead of code.

29 Jul 2013, 12:33 AM
#10
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

amandavz:

order by p.products_sort_order, pd.products_name order by p.products_date_added DESC, p.products_sort_order, pd.products_name]It appears you didn't comment out the original "order by" details as you have it in twice.

So your post 7 code probably looks like this```
// 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";
$listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
break;

29 Jul 2013, 12:41 AM
#11
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: How to make new products show first on categories and sub categories...HELP!

gilby:

It appears you didn't comment out the original "order by" details as you have it in twice.

So your post 7 code probably looks like this```
// 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";
$listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
break;


Post #2: 

> Then set the Sort Order in the Configuration ... Product Listing ... to blank for:
29 Jul 2013, 12:42 AM
#12
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

I'm not sure I understand...

here is what I added: $listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
according to Linda's instructions in the above post and when I go to my store front end I get the error I posted in the last post.

29 Jul 2013, 12:43 AM
#13
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

I got it...let me try that. i didn't see this post of your before I responded. Let me try that.

29 Jul 2013, 12:44 AM
#14
amandavz avatar

amandavz

Zen Follower

Join Date:
Mar 2009
Location:
Crockett, Texas
Posts:
139
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

Hey...what do you know...that worked. Thanks for your time. :)

29 Jul 2013, 12:47 AM
#15
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: How to make new products show first on categories and sub categories...HELP!

frank18:

Post #2: Then set the Sort Order in the Configuration ... Product Listing ... to blank for:Ooops I missed that frank.

amandavz:

I'm not sure I understand...

here is what I added: $listing_sql .= " order by p.products_date_added DESC, p.products_sort_order, pd.products_name";
according to Linda's instructions in the above post and when I go to my store front end I get the error I posted in the last post.As Frank posts have you done the second part of Post #2 as well.

29 Jul 2013, 12:52 AM
#16
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: How to make new products show first on categories and sub categories...HELP!

amandavz:

Hey...what do you know...that worked. Thanks for your time. :)

Pleasure