Jump to content

My product listing layouts


Recommended Posts

Hi

 

I have been doing some work on my site over the past few days and have noticed the the products are not displaying in the correct order and need some advice.

 

I have them set up to show in ascending order by product name.

 

However for example

 

I have a listing for a d14 appering above a listing for a d3 part

It looks to me like the system is not recognising that its 14 not 1 4 therfore putting the d14 above the d3.

 

Is there anyway to sort this out?

 

 

Thanks

Wil 

Link to post
Share on other sites

34 minutes ago, WSD said:

I have a listing for a d14 appering above a listing for a d3 part

That is the "correct" sort order as it is done character by character left to right

 

34 minutes ago, WSD said:

Is there anyway to sort this out?

Yes - take a look at our enhanced sorting plugin which you can find along with all our other plugins in the extension marketplace here https://www.cubecart.com/extensions/developer/havenswift-hosting  this allow you to specify a custom sort order for products on each category page (as well as adding lots of other possible sorting options)

Ian

Link to post
Share on other sites

Not really. Regardless of the length of a string of characters, d1... comes before d3...

PHP has the function natsort() which should give you what you want, but that would be PHP's job to work on the recordset fetched from the database. MySQL has no ability to sort in a natural way.

Link to post
Share on other sites

There is a work-around, and requires the data in the column to be formatted in a common pattern. See:
https://www.mysqltutorial.org/mysql-natural-sorting/

There would be two parts of the ORDER BY clause: shorter length values (such as 'd7', 'd3') followed by longer length value (such as 'd19', 'd14') would be ordered, then a regular sort. That would produce 'd3', 'd7', 'd14', 'd17', etc. This fails when a value such as 'dd2' is in the list and you want it ahead of 'd3'.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...