Jump to content

Product Sort Order


Guest tuscanblue
 Share

Recommended Posts

By default they are in alphabetical order. You can do it this way:

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

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

------------ CODE SAMPLE ----------

// 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";

-----------------------------------

(Note, In the file it is one long string but I made it multi-line to make it easier to read)

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.

Go into your db and change the order to anything you like then upload the modified viewProd.inc.php.

Link to comment
Share on other sites

  • 1 year later...
Guest LitBitas

I know that here was lots of quoestions like mine, but now i cant find answer :)

Half year ago i found in this forum how to change "ORDER BY" in viewCat.inc (i think) to sort products by item code - 6 digits in our shop (productCode i think) (020456 goes after 010678 etc) but after upgradeing to SEO it gone, and now i cant find right topics in this forum, all links are wrong and i cant make it again ;)

Maybe somebody can help pls. Cheers.

Link to comment
Share on other sites

Open /includes/contents/viewCat.inc.php

Find somewhere @ line 158

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId']);

Replace it with

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY name ASC";

Link to comment
Share on other sites

  • 3 weeks later...

By default they are in alphabetical order. You can do it this way:

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

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

------------ CODE SAMPLE ----------

// 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";

-----------------------------------

(Note, In the file it is one long string but I made it multi-line to make it easier to read)

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.

Go into your db and change the order to anything you like then upload the modified viewProd.inc.php.

Where is the db located?

Link to comment
Share on other sites

  • 1 month later...
Guest SafariWoman

Open /includes/contents/viewCat.inc.php

Find somewhere @ line 158

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId']);

Replace it with

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY name ASC";

Hello, If I add a field in my inventory data base titled -- order -- and give each product a numerical value in this field depending on what order I want an item to appear on the products list in the category page that has nothing to do with name, idcode, description etc.. would the last words on the replace it with instructions be "ORDER BY order ASC"; ???

Thanks for any help! I need to place things in an order that is up to my frequently changing needs.

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.

 Share

×
×
  • Create New...