Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to add a custom cart icon to nav?

How to add a custom cart icon to nav?

Locked

Views: 3,484

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
21 Mar 2009, 2:45 AM
#1
ldonohue avatar

ldonohue

New Zenner

Join Date:
Oct 2008
Location:
Seattle
Posts:
9
Plugin Contributions:
0

How to add a custom cart icon to nav?

Hi there,

I'm working on tweaking a store design and would like to know how I can add my own little cart icon to the main/top nav like in this example:

Cart Icon Mockup

Any tips on how I can do this easily? -I don't need it clickable, just the icon.

Thanks heaps!

21 Mar 2009, 3:02 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to add a custom cart icon to nav?

ldonohue,

Any tips on how I can do this easily? -I don't need it clickable, just the icon.
Just add the image to your header background image - you have one right?? No Link to what you have so am guessing....

Don't know why you only want the image with no function???
Have a look at several of the free templates that have a cart icon HERE, you can download any of them and see how they have implemented this with functionality

21 Mar 2009, 4:17 AM
#3
mickyelta avatar

mickyelta

New Zenner

Join Date:
Nov 2006
Posts:
67
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

This is easily done in

/includes/templates/template_default/common/header.php

find

<?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>
```insert the red bit

<?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; ?><img src="/path to image/cart.gif" height="10" width = "10" /></a></li>
It even makes it clickable remember to copy it to /includes/templates/yourtemplate/common/header.php
21 Mar 2009, 5:26 AM
#4
ldonohue avatar

ldonohue

New Zenner

Join Date:
Oct 2008
Location:
Seattle
Posts:
9
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

Thanks so much Mickyelta,

That worked perfectly! --I really appreciate your help!

awesome community here..

Lisa

11 Apr 2009, 9:34 PM
#5
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

Mickyelta:

This is easily done in

/includes/templates/template_default/common/header.php

find

<?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>
> 
> ```
<?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; ?><img src="/path to image/cart.gif" height="10" width = "10" /></a></li>

It even makes it clickable remember to copy it to /includes/templates/yourtemplate/common/header.php

I put this in my tpl_header.php but the header_cart.gif is not showing.

11 Apr 2009, 9:49 PM
#6
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?><img src="/images/header_cart.gif" height="10" width="10"/></a></li>
<?php }?>

Not sure what I do wrong. Would the image have to be put somewhere else than my root/image folder? I have tried with png, jpg and now gif. Still not showing.

11 Apr 2009, 9:57 PM
#7
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

Found my mistake,

<img src="/images/header_cart.gif" height="20" width="20"/>

/ in front of my path had to be removed. :blush:

Thank you for the solution posted here.

5 Jun 2009, 11:24 PM
#8
anap avatar

anap

New Zenner

Join Date:
May 2009
Location:
The West Coast
Posts:
25
Plugin Contributions:
0

Re: How to add a custom cart icon to nav?

Instead of hard coding the images directory, make use of Zen Cart directory constants. This way if you change your template, the directory changes for you!

I put the cart image before the "View Shopping Cart" text, but within the link.
The Red text has been added to '/includes/templates/yourtemplate/common/tpl_header.php':

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'cart.png', 'alt text here'); ?><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
6 Jun 2009, 2:21 AM
#9
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: How to add a custom cart icon to nav?

anap:

Instead of hard coding the images directory, make use of Zen Cart directory constants. This way if you change your template, the directory changes for you!

I put the cart image before the "View Shopping Cart" text, but within the link.
The Red text has been added to '/includes/templates/yourtemplate/common/tpl_header.php':

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'cart.png', 'alt text here'); ?><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>

This is correct .. :D