Forums / Setting Up Categories, Products, Attributes / Products "sort by model" problem

Products "sort by model" problem

Locked

Views: 2,034

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
25 Feb 2007, 5:52 PM
#1
alexexela avatar

alexexela

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Products "sort by model" problem

Ok, I spent hours searching through the posts about sorting but I can't seem to find a solution to my problem.

I believe I setup everything correctly for products to be sorted by model.

This is what I get:
ABC10
ABC12
ABC2
ABC3
ABC4

But this is what I want:
ABC2
ABC3
ABC4
ABC10
ABC12

I believe this could be a problem caused by SQL. Or am I missing? Has someone already fix this problem? Model name cannot be changed (there are too many) and I tried to explicitly give a sort order to the products in the category but it seems Zen Cart just ignores it.

Any help is appreicated, Thanks!

25 Feb 2007, 6:00 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Products "sort by model" problem

Alpha sorts are based on numbers and characters logic ...

To get this display:
ABC2
ABC3
ABC4
ABC10
ABC12

You would need to use:
ABC02
ABC03
ABC04
ABC10
ABC12

So that the numbers do not sort as:
ABC1
ABC10
ABC12
ABC2
ABC20
ABC21
ABC3
ABC4
ABC40

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

26 Feb 2007, 2:59 AM
#3
alexexela avatar

alexexela

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: Products "sort by model" problem

Thank you for the reply.

I can't change the model number since there are way too many (10,000+). Is there anyway I can overide the default sorting method I defined in PRODUCT LISTING by the sorting order I explicitly defined for each product in the category? (The listings on the admin side works perfectly)
Thanks.

26 Feb 2007, 3:26 AM
#4
alexexela avatar

alexexela

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: Products "sort by model" problem

Ok, I think I figured out this....

in the file includes/index_filters/default_filter.php
Change:

        case 'PRODUCT_LIST_MODEL':
          $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
          break;

To:

        case 'PRODUCT_LIST_MODEL':
          $listing_sql .= "p.products_sort_order, p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
          break;

(For sorting by MODEL only, for others, modify the related "sort-by" right below the code I mentioned above)
The code above allows you to have the products sort order overrides the default sort setting in both ALL LISTING and PRODUCT LISTING. It makes sense to me that if you explicitly give an order to the product itself, it should be made the utmost importatance.