Jump to content

Sorting product options


Guest

Recommended Posts

Does anybody know how to make the product options dropdown box list the options from lowest to highest cost?

I think I have to change the file: includes/content/viewprod.inc.php

But i am not sure.

Link to comment
Share on other sites

Try the search button with "product options" and change the search posts from 90 or 120 days.

I tryed it and i came up with to many results for me to post and help you.

Hope this helps :)

Link to comment
Share on other sites

Guest megagente

I was looking for an even simpler way. Just making the product to show automatically sorted even if I have to change something on the code. I dont need the customers to press anything.

Link to comment
Share on other sites

Guest tbladecki

Yes i know how to do it....

you have to modify the DB request for the product options... look at the following site and lt me know if this what you are looking for:

Link

THis happens to be highest to lowest but you can change it around..

Link to comment
Share on other sites

Product options are set to display alphabetically no matter what order they are in the database but here's a fix. Go to your database and order them the way you like, then do this:

You need to edit /includes/content/viewProd.inc.php

On or around line 154, you'll find the following:

CODE

// build sql query for product options luuuuuurvely

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

$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".

$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".

$glob['dbprefix']."CubeCart_options_mid` ON ".

$glob['dbprefix']."CubeCart_options_mid.value_id = ".

$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".

$glob['dbprefix']."CubeCart_options_top` ON ".

$glob['dbprefix']."CubeCart_options_bot.option_id = ".

$glob['dbprefix']."CubeCart_options_top.option_id WHERE product =".

$db->mySQLSafe($_GET['productId'])." ORDER BY option_name, value_name ASC";

(here it's multi-line to make it easier to read in the file it's one long line)

At the end after the "ORDER BY", simply remove the ", value_name" (remove the comma with it). That will pull them in by the order in the database then.

That's the way I did it.

Link to comment
Share on other sites

It will arrange in whatever order you've set your options in your database. The value_name is what makes it arrange in alphabetical order. If you delete this, it will arrange by your database values. If you look at my teeshirt site I have product options from small to xxxlarge. Before I changed this file it went from large as the first option. You want to go to yourdb_options_mid and arrange the values the way you want them.

Link to comment
Share on other sites

Guest tbladecki

Here is what I changed it to to sort that way:

// build sql query for product options luuuuuurvely

$query = "SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE product =".$db->mySQLSafe($_GET['productId'])." ORDER BY option_id, option_symbol, value_id DESC";

You can change it if you want to but this displays it just as on my site.

Link to comment
Share on other sites

Guest megagente

On phpmyadmin I cannot browse the options_mid table maybe because its nothing there. I used Roban method and evem went to many of the database tables and sort them but still dont see any result in the page.

Link to comment
Share on other sites

On phpmyadmin I cannot browse the options_mid table maybe because its nothing there. I used Roban method and evem went to many of the database tables and sort them but still dont see any result in the page.

You're saying you can't check all and Browse? I can.

Link to comment
Share on other sites

Guest megagente

On phpmyadmin I cannot browse the options_mid table maybe because its nothing there. I used Roban method and evem went to many of the database tables and sort them but still dont see any result in the page.

You're saying you can't check all and Browse? I can.

i did not use the option settings on administration thats maybe the reason I get empty table.

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