Jump to content

Alphabetitizing categories & products?


Guest
 Share

Recommended Posts

Guest estelle

If you know a bit about PHP, you can track down the relevant SQL queries (I think in the files in includes/content) and at the end of the SQL queries add " ORDER BY name" for products and " ORDER BY cat_name" for categories.

Link to comment
Share on other sites

Guest estelle

This really is just a hack. I expect eventually brooky will add an option in the settings to allow you to specify how you want things ordered. But for now....

For the categories box, you would need to modify the file: includes/boxes/categories.inc.php

Change this:

$results = $db->select("SELECT cat_name, cat_id FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = 0");

To this:

$results = $db->select("SELECT cat_name, cat_id FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = 0 ORDER BY cat_name ASC");

The subcategory listing is already ordered alphabetically (includes/content/viewCat.inc.php).

For the product listing, you would need to modify the file: includes/content/viewCat.inc.php

Change this:

$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']);

To this:

$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 ".$glob['dbprefix']."CubeCart_inventory.name ASC";

Link to comment
Share on other sites

Guest estelle

I also put a post elsewhere with a hack/mod to allow you to order your products with newly listed items shown first. For anyone interested, its here.

Link to comment
Share on other sites

Guest Immortalis

Will there be an admin function for this in the near future? I wish that there was a function so you also could place the categories in whatever order you want.

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