VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Piszi on September 02, 2014, 16:56:43 PM

Title: Browse view order products correctly by name if it contains numbers
Post by: Piszi on September 02, 2014, 16:56:43 PM
Hello,

I have a problem with my browse view if I set the default ordering to product name and the product name contains numbers than the ordering is wrong. And have over 500 products so the custom order is not an option for me.
For example in my case I have product names like this:
Product (A), Product (B), Product (1), Product (2), Product (3) Product (10), Product (20)
Than it orders like this:
Product (A)
Product (B)
Product (1)
Product (10)
Product (2)
Product (20)
Product (3)

Which is wrong because it should be like this:
Product (A)
Product (B)
Product (1)
Product (2)
Product (3)
Product (10)
Product (20)

Is there a way to modify this?
Title: Re: Browse view order products correctly by name if it contains numbers
Post by: GJC Web Design on September 02, 2014, 23:25:54 PM
can u not just 01, 02, 03 etc
Title: Re: Browse view order products correctly by name if it contains numbers
Post by: Piszi on September 02, 2014, 23:57:22 PM
Sadly not, the manufacturer calls its products like this. for example: Complex System (A) or Complex System CS1 L/P
Title: Re: Browse view order products correctly by name if it contains numbers
Post by: Piszi on September 04, 2014, 06:03:24 AM
Ok I came up up with a temporary solution but it works only if all the products are shown on one page. I did a usort() with strnatcmp() in the category default.php right before the foreach. But for permanent solution I think I have to edit the mysql query or at least the result of the query. Maybe I'm tired or I don't see the forest because of the tree :) but I can't seem to finde the query.
Does anyone know in which file should I look for it?

by the way it would be a nice feature if the dev team could implement a natural sort at least on the product name and maybe on the product sku
Title: Re: Browse view order products correctly by name if it contains numbers
Post by: GJC Web Design on September 04, 2014, 09:52:15 AM
sortSearchListQuery() in admin-> models->product.php