Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    7
    Plugin Contributions
    0

    Default Setting up Product Sort Order Alpha and Numeric

    My product codes are a year followed by two or three letters followed by a number. For example 87LC10 tells me that this product is the 10th product recorded at a specific 1987 event. (87LC is the code for the event). However, when I put all these product codes in, ZC sorts them so that 87LC1 is followed by 87LC10 rather than 87LC2. I would like 87LC10 to follow 87LC9, not following 87LC1 as it does now.
    Is there some setting I can change so that ZC will sort these product codes the way I want?

    Colin

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,639
    Plugin Contributions
    6

    Default Re: Setting up Product Sort Order Alpha and Numeric

    Can you use:
    87LC001
    87LC009
    87LC010
    87LC110
    87LC987
    87LC999

    or do you need more than 3 digit on the number?

    Example, for 4 digit:
    87LC0001
    87LC0009
    87LC0010
    87LC0110
    87LC0987
    87LC0999
    87LC2999
    87LC8999
    87LC9999
    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: v1.5.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Feb 2012
    Posts
    7
    Plugin Contributions
    0

    Default Re: Setting up Product Sort Order Alpha and Numeric

    I could go back and renumber all my products, but I would rather not if there is some other way to do it. Windows Explorer on my computer manages to keep the files in correct order without having to use the renumbering trick or having to tell it to do so with some special setting so I was hoping that ZenCart would be able to do it also.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,019
    Plugin Contributions
    25

    Default Re: Setting up Product Sort Order Alpha and Numeric

    There is a PHP "natsort()" function that does this, and could probably be substituted for other sorting functions in certain places. From the PHP Manual:

    asort($array1);
    echo "Standard sorting\n";
    print_r($array1);

    natsort($array2);
    echo "\nNatural order sorting\n";
    print_r($array2);

    Standard sorting
    Array
    (
    [3] => img1.png
    [1] => img10.png
    [0] => img12.png
    [2] => img2.png
    )

    Natural order sorting
    Array
    (
    [3] => img1.png
    [2] => img2.png
    [1] => img10.png
    [0] => img12.png
    )

 

 

Similar Threads

  1. v139g Product Listings- How to change sort order to numeric
    By cahoca in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 13 Jan 2012, 03:00 AM
  2. Drop and Drag Product Sort Order
    By kwright in forum General Questions
    Replies: 0
    Last Post: 9 Dec 2010, 02:20 AM
  3. Product Listing numeric Sort Order
    By iivann in forum Basic Configuration
    Replies: 1
    Last Post: 10 Sep 2010, 03:29 PM
  4. alpha sorter sort by attributes
    By samone003 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 17 Jun 2008, 07:31 PM
  5. Alpha Sort - Help please
    By xveegerx in forum Setting Up Categories, Products, Attributes
    Replies: 26
    Last Post: 13 Jun 2008, 06:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •