Change Category Order
I need to change the order of the category items as they appear in the drop down menu - I'm adding categories and don't want them to appear at the bottom of the list.
Thanks!
I need to change the order of the category items as they appear in the drop down menu - I'm adding categories and don't want them to appear at the bottom of the list.
Thanks!
You can order the items by descending order, so the categories will be sorted by newest at the top and oldest at the bottom. To do this, go to your menu.php page in the CSSMenuWriter/cssmw_home/ directory within your powerstore and find the MySql query that looks like this:
"SELECT CategoryName, CategoryID FROM productcategories"
Change it to look like this:
"SELECT CategoryName, CategoryID FROM productcategories ORDER BY CategoryID DESC"
That's not what I need .... I need to insert a couple of categories within an existing list. Please don't tell me I need to redo and loose what I've already entered into the db....
If you modify the query that way, any new categories added will be at the top. You will not lose any of the category data, this just causes the results to be ordered when they are being retrieved from the database. If you want to put the categories into a specific order, this will take considerably more work than modifying the categories to show up.
Yes - I want to put them in a SPECIFIC ORDER without having to redo it all. I h=guess if I have to I will, but its a considerable amount of work. I'd rather know how to deal with this for future maintenance.
I'm not a php or mySQL expert - wondering if I can make change through phpmy admin - or does the query go by the time stamp??
I guess in the future I should add some empty categories between things - in case I need to more/different categories in the future....
Okay - I changed the CategoryID's in mySQL, so if I can get them to display in ascending order, it would be great.
I'm assuming that this bit from menu.php is what needs to be changed?
<li class="parent"><span><a href="<?php echo($assumedRoot); ?>Products_Results.php">Products</a></span>
<?php
mysql_select_db($database_localhost, $localhost);
$query_menuwriter_productcategories = "SELECT CategoryName, CategoryID FROM productcategories";
$menuwriter_productcategories = mysql_query($query_menuwriter_productcategories, $localhost) or die(mysql_error());
$row_menuwriter_productcategories = mysql_fetch_assoc($menuwriter_productcategories);
$totalRows_menuwriter_productcategories = mysql_num_rows($menuwriter_productcategories);
?>
Thank you for our help.
Yes, that is where you would change the categories to show in ascending order. Change this:
SELECT CategoryName, CategoryID FROM productcategories
to:
SELECT CategoryName, CategoryID FROM productcategories ORDER BY CategoryID ASC
Thank you!! I so appreciate your help - learning PHP is on my "To do" list...
Sorry - now I'm trying to change intermediate.php so the the CategoryID list in ascending order and not having any luck. Again assuming its this snippet that needs to be changed:
SELECT * FROM productcategories WHERE CategoryID = (SELECT ProductCategoryID FROM products WHERE ProductCategoryID = CategoryID AND ProductLive <> 0 LIMIT 1)
I tried adding ASC in various places - no luck.
Thank you - very appreciative.....
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.