Forums / General Questions / Shopping Cart and Items in Cart in the Header

Shopping Cart and Items in Cart in the Header

Views: 3,687

Results 1 to 11 of 11
30 Sep 2011, 8:52 PM
#1
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Shopping Cart and Items in Cart in the Header

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.

30 Sep 2011, 9:02 PM
#2
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Re: Shopping Cart and Items in Cart in the Header

Here is the image so you can see what i mean in the header.

1 Oct 2011, 11:15 AM
#3
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Shopping Cart and Items in Cart in the Header

Since the 'Items In Cart' don't appear in a stock Zencart installation, we'll need to see the site.

12 Oct 2011, 2:46 AM
#4
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Re: Shopping Cart and Items in Cart in the Header

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?

12 Oct 2011, 5:41 AM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping Cart and Items in Cart in the Header

Where can we see the site? The answer will be very different for different possible sources of the cart-header.

12 Oct 2011, 10:56 AM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Shopping Cart and Items in Cart in the 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.

12 Oct 2011, 12:39 PM
#7
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Re: Shopping Cart and Items in Cart in the Header

Duh, two times I forgot to post the link. My excitement got ahead of my fingers. Kaleidoscope Galaxy

12 Oct 2011, 3:26 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping Cart and Items in Cart in the Header

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 has```php

<?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 }?>

which you could change likephp

<?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.
24 Oct 2011, 8:31 PM
#9
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Re: Shopping Cart and Items in Cart in the Header

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>
24 Oct 2011, 9:37 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping Cart and Items in Cart in the Header

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.

25 Oct 2011, 1:09 AM
#11
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

Re: Shopping Cart and Items in Cart in the Header

Thanks yet once again Glenn. You rock with this stuff!