close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Side menu

Thread began 8/30/2010 8:27 am by warrenphillips25336771 | Last modified 9/30/2010 11:59 am by Jason Byrnes | 2762 views | 9 replies |

warrenphillips25336771Beta Tester

Side menu

is there a way to get the menu to display in alphabetical order for the categories, and most recently added for the products? or even alphabetical order for the products to? my client wants to be able to customise the menu himself, this would not be possible would it? IE: move menu items up and down as he sees fit?

Sign in to reply to this post

Jason ByrnesWebAssist

the side menu is created in the CSSMenuWriter/intermediate.php file.


you could edit the recordsets herre to add an order by clause


the reocrdsets are at lines 42:

php:
$query_ProductCategories = sprintf("SELECT * FROM categories WHERE CategoryParent = %s", GetSQLValueString($colname_ProductCategories, "int"));




and 69:

php:
$query_ProductMenu = sprintf("SELECT * FROM categories WHERE CategoryParent = %s", GetSQLValueString($catParam_ProductMenu, "int"));





you could edit those to:

php:
$query_ProductCategories = sprintf("SELECT * FROM categories WHERE CategoryParent = %s ORDER BY CategoryName DESC", GetSQLValueString($colname_ProductCategories, "int"));




and 69:

php:
$query_ProductMenu = sprintf("SELECT * FROM categories WHERE CategoryParent = %s  ORDER BY CategoryName DESC", GetSQLValueString($catParam_ProductMenu, "int"));




reordering the categories manually is not supported.

Sign in to reply to this post

warrenphillips25336771Beta Tester

thanks Jayson

Thanks Jayson

Sign in to reply to this post

Jason ByrnesWebAssist

no worries

Sign in to reply to this post

warrenphillips25336771Beta Tester

No Joy

Jayson

Sorry I know this ticket is a little old, just getting round to doing it, does this apply to ps2? as my intermediate file is different to yours then?

this is what i got

<div id="sideMenu">
<?php /* ?>
<?php require_once('../Connections/localhost.php'); ?>
<?php */ ?>
<?php
mysql_select_db($database_localhost, $localhost);
$query_ProductCategories = "SELECT * FROM productcategories WHERE CategoryID = (SELECT ProductCategoryID FROM products WHERE ProductCategoryID = CategoryID AND ProductLive <> 0 LIMIT 1)";
$ProductCategories = mysql_query($query_ProductCategories, $localhost) or die(mysql_error());
$row_ProductCategories = mysql_fetch_assoc($ProductCategories);
$totalRows_ProductCategories = mysql_num_rows($ProductCategories);
?>
<?php do { ?>
<?php
$catParam = $row_ProductCategories['CategoryID'];
?>
<?php
$catParam_ProductMenu = "0";
if (isset($catParam)) {
$catParam_ProductMenu = (get_magic_quotes_gpc()) ? $catParam : addslashes($catParam);
}
mysql_select_db($database_localhost, $localhost);
$query_ProductMenu = sprintf("SELECT * FROM products WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID AND ProductCategoryID = %s", GetSQLValueString($catParam_ProductMenu, "int"));
$ProductMenu = mysql_query($query_ProductMenu, $localhost) or die(mysql_error());
$row_ProductMenu = mysql_fetch_assoc($ProductMenu);
$totalRows_ProductMenu = mysql_num_rows($ProductMenu);

$WA_localRoot = "".$WAGLOBAL_localRoot. "";
$WA_remoteRoot = "".$WAGLOBAL_remoteRoot. "";
$WA_curURL = strtolower((isset($_SERVER["PHP_SELF"]))?$_SERVER["PHP_SELF"]:"");
$assumedRoot = $WA_remoteRoot;
if ((strpos($WA_curURL,strtolower($WA_localRoot)) !== false && strpos($WA_curURL,strtolower($WA_localRoot)) == 0) && (strlen($WA_localRoot) >= strlen($WA_remoteRoot) || strpos($WA_curURL,strtolower($WA_localRoot)) === 0)) {
$assumedRoot = $WA_localRoot;
}

?>
<a href="<?php echo($assumedRoot); ?>Products_Results.php?Search=true&CategoryID=<?php print $row_ProductCategories['CategoryID']; ?>"><h2><?php print $row_ProductCategories['CategoryName']; ?></h2></a>
<ul >
<?php do { ?>
<?php if ($totalRows_ProductMenu > 0) { // Show if recordset not empty ?>
<li><span><a href="<?php echo($assumedRoot); ?>Products_Detail.php?ProductID=<?php echo $row_ProductMenu['ProductID']; ?>"><?php print $row_ProductMenu['ProductName']; ?></a></span></li>
<?php } // Show if recordset not empty ?>
<?php } while ($row_ProductMenu = mysql_fetch_assoc($ProductMenu)); ?></ul>
<?php
mysql_free_result($ProductMenu);
?>
<?php } while ($row_ProductCategories = mysql_fetch_assoc($ProductCategories)); ?>
<?php
mysql_free_result($ProductCategories);
?>
</div>

Sign in to reply to this post

Jason ByrnesWebAssist

same idea, you just need to modify the recordset code to add an order by clause:

php:
$query_ProductCategories = "SELECT * FROM productcategories WHERE CategoryID = (SELECT ProductCategoryID FROM products WHERE ProductCategoryID = CategoryID AND ProductLive <> 0 LIMIT 1) ORDER BY CategoryName";




and

php:
$query_ProductMenu = sprintf("SELECT * FROM products WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID AND ProductCategoryID = %s ORDER BY CategoryName", GetSQLValueString($catParam_ProductMenu, "int"));
Sign in to reply to this post

warrenphillips25336771Beta Tester

Errror

Jayson

Keeps throwing an error at me Unknown column 'CategoryName' in 'order clause'

and another one but had to restore as quick as i could!

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, the second query:

php:
$query_ProductMenu = sprintf("SELECT * FROM products WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID AND ProductCategoryID = %s ORDER BY CategoryName", GetSQLValueString($catParam_ProductMenu, "int"));




should be:

php:
$query_ProductMenu = sprintf("SELECT * FROM products WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID AND ProductCategoryID = %s ORDER BY ProductName", GetSQLValueString($catParam_ProductMenu, "int"));
Sign in to reply to this post

warrenphillips25336771Beta Tester

Perfect

Perfect works a treat

Sign in to reply to this post

Jason ByrnesWebAssist

great, glad to hear it is working.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...