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
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
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.
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
)