Jump to content

Setting A Default And/or Sort Order On Options


SibeSpace

Recommended Posts

I've added a bunch of options to many of my products. Is there any way to set the default option and/or the sort order of the options?

For example.

Clothing comes in a range of size - S/M/L/XL/XXL/XXXL.

In the option box it's listed Alphabetically - L/M/S/XL/XXL/XXXL

I want the sort order to be from S -> XXXL.

If I wanted XL to be the one that is default, is there any way to do this?

thanks

Link to comment
Share on other sites

If you added them from small to large, then you could change the sort order to be by the ID, rather than alpha. I'm guessing you probably DID enter them in that order, so it would work fine for you.

The other trick I've seen that works would be to add blank spaces. The more spaces, the more towards the beginning of the alphabet it would be.

Example: (where x equals a space)

xxxxS

xxxM

xxL

xXL

It looks odd, but the page doesn't render the spaces, only the way the database sees it.

To change the sort as stated in my first solution, you would do it in this file: includes/content/ViewProd.inc.php

Look for the line that begins:

$query = "SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id

Then make the last part of that line look like this:

ORDER BY option_id, value_name ASC";

Link to comment
Share on other sites

I did enter them in the right order S/M/L/XL/XXL etc, but they are alphabetically sorted automatically into L/M/S/XL/XXL.

I added "ORDER BY option_ID, value_name ASC";" at the end of the string but it's made no difference?

Tried the spaces too, but that didn't work. I must be doing something wrong but can't see what.

Link to comment
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...