VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: restodo on April 07, 2014, 05:15:10 AM

Title: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 07, 2014, 05:15:10 AM
Hi,

I've used natural sorting in my Old VM 1.1.9 configuration and everything goes well.

Now I'm updating to VM 2.0.26d and I couldn't use the same procedure.

The steps to install are very easy.

1. Log into PhpMyAdmin and select your database

2. Ejecute the following mysql script: natsort.install.mysql

3. In VM 1.1.9 I've modified shop_browse_queries.php in line 287 with the following code:
$q .= "\n ORDER BY natsort_canon($orderbyField,'natural') $DescOrderBy";


Someone could tell me where I can do the same in VM 2.0.26d ?


This is the link of natsort:
https://drupal.org/project/natsort

Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 07, 2014, 13:09:31 PM
Check sorting option in VM config.
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 08, 2014, 03:24:29 AM
Quote from: Maxim Pishnyak on April 07, 2014, 13:09:31 PM
Check sorting option in VM config.

Thanks for your answer.

Do you mean in Configuration -> Product Order Settings ?
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 08, 2014, 13:15:24 PM
Yes.
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 08, 2014, 19:06:33 PM
Quote from: Maxim Pishnyak on April 08, 2014, 13:15:24 PM
Yes.

There isn't any option to have Natural Sort. Only sort by Product Name and Ascending or Descending.

Could you explain where do you know it is the option?


Regards!

PS: by the way, now I'm on VM 2.6.0
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 08, 2014, 22:58:03 PM
Natural=Order.
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 09, 2014, 01:07:58 AM
Quote from: Maxim Pishnyak on April 08, 2014, 22:58:03 PM
Natural=Order.

Thanks for your answer. I'm attaching a screenshot of VM Configuration.

If I choose Ordering, the products are ordered in the same way that Product Name.



[attachment cleanup by admin]
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 09, 2014, 13:19:59 PM
Product id?
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 09, 2014, 16:08:15 PM
Quote from: Maxim Pishnyak on April 09, 2014, 13:19:59 PM
Product id?

Product ID is wrong because it's only a number.

Do you understand what do I meant to do?

Example:

Standard Order:

HDJ-1500
HDJ-500
HDJ-2000


Natural Order:

HDJ-500
HDJ-1500
HDJ-2000

Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 10, 2014, 21:39:48 PM
Nobody knows how can I use Natural Sort in VM2 ?
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 10, 2014, 22:28:20 PM
Why your natural order doesn't equal to sorted order? Screenshot maybe for backend area with products?
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 11, 2014, 03:29:41 AM
Quote from: Maxim Pishnyak on April 10, 2014, 22:28:20 PM
Why your natural order doesn't equal to sorted order? Screenshot maybe for backend area with products?

Thanks for your answer. I'm attaching a screenshot of my product backend.

There you could see that ordering by Product Name isn't Natural because you have:

HDJ-1500
HDJ-2000
HDJ-500

And the right order should be:

HDJ-500
HDJ-1500
HDJ-2000


That's why I'm asking here how can I do it.
In my old VM 1.1.9 I've done it inserting a script in my mysql database and also modified a file at virtuemart.

If you see my first post, you understand How can made it.
Maybe you could tell me where I've to modify de ORDER BY command in VM2.


Regards.


[attachment cleanup by admin]
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 11, 2014, 14:18:41 PM
Why you don't change for HDJ-500 value 9 to 1?
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: restodo on April 12, 2014, 02:04:23 AM
Quote from: Maxim Pishnyak on April 11, 2014, 14:18:41 PM
Why you don't change for HDJ-500 value 9 to 1?

Thanks for your answer.

I've tried your manual solution and it works using Ordering.

But this is not Natural Sort, just order products as I left them.

I think VM developers should think to add real Natural Order because If I have a large catalog I have to make a manual order.


Regards.
Title: Re: How can I manage to have Natural Sort in my VM2
Post by: Maxim Pishnyak on April 12, 2014, 19:07:18 PM
I can't see ids on your picture.

Also check CSVI and OpenOffice capabilities.