I would like to remove the "shopping cart" and have the "items in cart" take you to the shopping cart page (like the present shopping cart does) that are in the header. Cannot figure out how to do it.
I would like to remove the "shopping cart" and have the "items in cart" take you to the shopping cart page (like the present shopping cart does) that are in the header. Cannot figure out how to do it.
Last edited by sendmenews; 30 Sep 2011 at 09:59 PM. Reason: forgot attatchement
Here is the image so you can see what i mean in the header.
Since the 'Items In Cart' don't appear in a stock Zencart installation, we'll need to see the site.
Okay Stevesh....round two. Site is up in beginning mode, not near complete. When an item is put into the cart, it says shopping cart, checkout and show the cart icon with the number of items in cart. Is there a way to have the number of items in the cart linked to take you to the actual shopping cart content page, therefore allowing me to remove the shopping cart words?
Where can we see the site? The answer will be very different for different possible sources of the cart-header.
You should be able to fiind the code for that area (using the Developers Tool Kit to search for items in cart) and add an <a href= ...> to it so it links to the shopping cart page.
Duh, two times I forgot to post the link. My excitement got ahead of my fingers. Kaleidoscope Galaxy
The Shopping Cart and Checkout links appear to be the stock header nav links, while the items in cart is a custom template addon (so we don't know exactly what its code looks like).
One approach would be to put the item count output into the stock header nav, in place of the shopping cart link text. Then you would need a new alternate in there to output the item count as a non-link when the cart is empty. The stock tpl_header.php haswhich you could change likePHP Code:<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
<li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>The item count is processed before the header nav so it appears in the right location when they are both floated right; thus, you can tweak the code in that to store the output as a variable instead of printing it immediately. This part is fuzzy since we don't have the actual code available, but it could go something like swappingPHP Code:<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo $cart_count_output; ?></a></li>
<li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php } else { //if the cart is empty ?>
<li><?php echo $cart_count_output; ?></li>
<?php }?>
echo 'whatever';
for
$cart_count_output .= 'whatever';
Then $cart_count_output is used in the header nav as shown above. If you can't figure out how to modify the item count code, post that section of tpl_header.php here.
When I move the following line in red below from the tpl_header.php it removes the items in cart in full and allows the remaining links to stay put. Do you see any reason that this might interfere with any other pages it is connected with?
<?php
/**
* Common Template - tpl_header.php
*
* this file can be copied to /templates/your_template_dir/pagename<br />
* example: to override the privacy page<br />
* make a directory /templates/my_template/privacy<br />
* copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_header.php<br />
* to override the global settings and turn off the footer un-comment the following line:<br />
* <br />
* $flag_disable_header = true;<br />
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_header.php 4813 2006-10-23 02:13:53Z drbyte $
*/
?>
<?php
// Display all header alerts via messageStack:
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
echo htmlspecialchars(urldecode($_GET['error_message']));
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message']);
} else {
}
?>
<!-- bof mainmenu -->
<div id="menu_wrap">
<div id="menu_body">
<!--bof-header ezpage links-->
<?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<?php require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?>
<?php } ?>
<!--eof-header ezpage links-->
</div>
</div>
<!-- eof mainmenu -->
<div id="headerWrapper">
<!--bof-navigation and shopping cart display-->
<div id="navMainWrapper">
<div id="cart"><? echo $_SESSION['cart']->count_contents();?> items in cart</div>
<div id="navMain">
<ul class="back">
<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a> <span>|</span></li>
<?php if ($_SESSION['customer_id']) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a> <span>|</span></li>
<li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> <span>|</span></li>
<?php
} else {
if (STORE_STATUS == '0') {
?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>
<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
<li>|</li> <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li> |
<li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>
</ul>
</div>
<div class="clearboth"></div>
</div><br class="clearBoth" />
<!--eof-navigation and shopping cart display-->
<!--bof logo -->
<div id="logoWrapper">
<div id="logo">
<?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' ?><?php echo zen_image(DIR_WS_TEMPLATE.'images/logo.gif'); ?></a>
</div>
<?php
if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
}
}
?>
</div><br class="clearBoth" />
<!--eof logo -->
<!--bof-optional categories tabs navigation display-->
<?php require($template->get_template_dir('tpl_modules_categories_tabs.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_categories_tabs.php'); ?>
<!--eof-optional categories tabs navigation display-->
</div>
The red code is a complete and self-contained snippet, so removing it will have no effect on other parts of the code or validation.