
Originally Posted by
kuroi
The code has been written so that the generation of link is done on its own line. You should remove the whole line to remove the link cleanly.
Thanks, Kuroi, I am familiar enough with coding to know this, I was just trying to shorthand what I was planning to do. I think it was wise for you to document it more clearly for future coders trying to do the same thing! Sorry about that!
In reading your response about trying to make your sidebox mods available as a learning tool, it occurred to me that it could be made more robust and provide a stronger learning experience by building in the same changes I need to make for myself. There are probably other people who will ask "how do I ..." for some of this same customization I'm doing, so feel free to actually pickup these changes into the mod itself if you want. I'm not on my development computer right now to actually test these changes, so please feel free to correct any oopses I make here - I'm really just coding on the fly!!
1) In navmain_sidebox_defines.php add three additional constants:
Code:
/* Configuration constants for navmain_sidebox
Each of the three display options can be independently enabled or
disabled by setting them to 'True' or 'False' appropriately. If you find
yourself setting them ALL to 'False', then you should turn the
sidebox off via the admin Layout Boxes Controller instead of using
these constants or alternatively uninstall the mod altogether!
DISPLAY_NAVMAIN_SIDEBOX_HOMELINK
controls whether or not to display the 'Home' link in this sidebox
DISPLAY_NAVMAIN_SIDEBOX_LOGINLINKS
controls whether or not to display the 'Login', 'Logoff', and
'Account' links at the appropriate time in this sidebox
DISPLAY_NAVMAIN_SIDEBOX_CARTLINKS
controls whether or not to display the 'Shopping Cart'
and 'Checkout' links at the appropriate time in this sidebox
*/
define('DISPLAY_NAVMAIN_SIDEBOX_HOMELINK','True');
define('DISPLAY_NAVMAIN_SIDEBOX_LOGINLINKS','True');
define('DISPLAY_NAVMAIN_SIDEBOX_CARTLINKS','True');
2) In tpl_navmain_sidebox.php make the changes in red:
Code:
// home page link
if (DISPLAY_NAVMAIN_SIDEBOX_HOMELINK == 'True') {
$content .= '<li><a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . HEADER_TITLE_CATALOG . '</a></li>' . "\n";
}
// IF customer is logged in display Log Off and My Account links
if (DISPLAY_NAVMAIN_SIDEBOX_LOGINLINKS == 'True' {
if ($_SESSION['customer_id']) {
$content .= '<li><a href="' . zen_href_link(FILENAME_LOGOFF, '', 'SSL') .'">' . HEADER_TITLE_LOGOFF . '</a></li>' . "\n";
$content .= '<li><a href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a></li>' . "\n";
} else {
// OR provided the store is not a showcase, display the Log In link
if (STORE_STATUS == '0') {
$content .= '<li><a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . HEADER_TITLE_LOGIN . '</a></li>' . "\n";
}
}
}
// IF customer has items in their stopping cart display the Shopping Cart and Checkout links
if (DISPLAY_NAVMAIN_SIDEBOX_CARTLINKS == 'True') {
if ($_SESSION['cart']->count_contents() != 0) {
$content .= '<li><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . HEADER_TITLE_CART_CONTENTS . '</a></li>' . "\n";
$content .= '<li><a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . HEADER_TITLE_CHECKOUT . '</a></li>' . "\n";
}
}
Thanks for your quick response to my questions. I and thousands of other ZenCart newbies really appreciate your help!!
Karen