Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / shopping cart in header nav!!!

shopping cart in header nav!!!

Views: 10,138

Results 1 to 20 of 20
5 Jun 2007, 10:29 AM
#1
alexan avatar

alexan

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

shopping cart in header nav!!!

Hi there,

Well I looked all over the place but I can't seem to find it.

What I want is that the shopping cart is in the header navigation bar instead of the sideboxes.

Is there anyone who knows how to do this?

Thanks

5 Jun 2007, 11:19 AM
#2
touranman avatar

touranman

New Zenner

Join Date:
Dec 2006
Posts:
48
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Like this...?

www.craftycarrot.com

5 Jun 2007, 11:43 AM
#3
alexan avatar

alexan

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Yes! How do you do that?

6 Jun 2007, 7:58 PM
#4
touranman avatar

touranman

New Zenner

Join Date:
Dec 2006
Posts:
48
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Hi alexan,

To display the cart info, use:

 
<?php echo $displayCartInfo; ?>

or to have the info as a link to your cart, use:

<a href="/yourshopdir/index.php?main_page=shopping_cart"><?php echo $displayCartInfo; ?></a>

Also, in the tpl_header.php file, I added code to display 'item(s)' depending on how many items in your cart:

$displayCartInfo = '';
switch (true) {
  case ($_SESSION['cart']->count_contents() == '0'):
  $displayCartInfo = '<b>' . $_SESSION['cart']->count_contents() . ' items' . '</b><br>' . 'Total: ' . $currencies->format($_SESSION['cart']->show_total());
  break;
  case ($_SESSION['cart']->count_contents() == '1'):
  $displayCartInfo = '<b>' . $_SESSION['cart']->count_contents() . ' item' . '</b><br>' . 'Total: ' . $currencies->format($_SESSION['cart']->show_total());
  break;
  case ($_SESSION['cart']->count_contents() >= '2'):
  $displayCartInfo = '<b>' . $_SESSION['cart']->count_contents() . ' items' . '</b><br>' . 'Total: ' . $currencies->format($_SESSION['cart']->show_total());
  break;
}

so this displays '0 items', '1 item', '2 items', etc.

Hope this helps

7 Jun 2007, 11:00 AM
#5
alexan avatar

alexan

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Hi,

First let me thank you for replying.

Could you help me a little more.
Now I've ot the code could you show me how and where to implement the code.

For instance where should I put the $displayCartInfo ?

I tried somethings but I don't have the experience to know exactly what I'm doing.

thanks,

alexan

7 Jun 2007, 4:32 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: shopping cart in header nav!!!

The Cart Summary Sidebox contribution is designed to work in a sidebox or the header. The readme includes basic instructions on how to implement in the header.

8 Jun 2007, 12:44 PM
#7
alexan avatar

alexan

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Thanks Dr.Byte,

I allways forget to look there.
This was really helpful.

And thanks for Tourman too.

:smile:

13 Jul 2007, 9:45 AM
#8
nocas avatar

nocas

New Zenner

Join Date:
Jul 2007
Posts:
6
Plugin Contributions:
0

Re: shopping cart in header nav!!!

TouranMan: thank you for the explanation - i was browsing the forum looking for exactly that :)

27 Jul 2007, 3:32 PM
#9
limejuice avatar

limejuice

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: shopping cart in header nav!!!

I'm still struggling a bit with this this is the code snippet I'm using in header php:

<td width="200"> <table align="right" cellpadding="0" cellspacing="0" width="175"> <tbody><tr><td class="ch">Shopping Cart:</td></tr> <tr><td height="6"></td></tr> <tr><td class="tx">Your shopping cart has <a href="http://www.xxxxxxxxxxx.com/shopping_cart.php"><?php echo $displayCartInfo; ?></a><td> <tr> <td class="tx"></td> </tr> </tbody></table></td></tr>I'm using SEO urls hence shopping_cart link.

Any help appreciated!

30 Jul 2007, 8:34 PM
#10
limejuice avatar

limejuice

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Fixed!

<td width="200"> <table align="right" cellpadding="0" cellspacing="0" width="175"> <tbody><tr><td class="ch">Shopping Cart:</td></tr> <tr><td height="6"></td></tr> <tr><td class="tx"><div class="smalltext"> Your shopping cart has <a href="http://www.xxxxxxxxxxx.com/shopping_cart.php"> <?php if ($_SESSION['cart']->count_contents() == '0') { echo $_SESSION['cart']->count_contents() . " items"; } if ($_SESSION['cart']->count_contents() == '1') { echo $_SESSION['cart']->count_contents() . " item"; } if ($_SESSION['cart']->count_contents() >= '2') { echo $_SESSION['cart']->count_contents() . " items"; } ?></a></div></td></tr>

:D

13 Oct 2007, 4:39 AM
#11
wolflupo avatar

wolflupo

New Zenner

Join Date:
Feb 2007
Posts:
27
Plugin Contributions:
0

Re: shopping cart in header nav!!!

DrByte:

The Cart Summary Sidebox contribution is designed to work in a sidebox or the header. The readme includes basic instructions on how to implement in the header.

I've managed to use Cart summary Sidebox and seems to work fine using this code in my tpl_header.php file:

<!--bof-cart item number display-->
    <div id="headerlogocartAdd">
    <table id="Table_01" width="297" height="80" border="0" cellpadding="0" cellspacing="0">
    <tr height="80">
    <td width="13" height="80">
        <img src="../images/cart2_01.gif" width="13" height="80" alt=""></td>
    <td align="left" valign="middle" width="63" height="80" background="../images/cart2_02.gif">
    <a href="http://www.salon-depot.com/index.php?main_page=shopping_cart"><img src="../images/cart.gif" width="52" height="45" alt=""></a>
    </td>
    <td align="left" valign="middle" width="206" height="80" background="../images/cart2_03.gif">
    <div id="navMainCartSummary"><?php require(DIR_WS_MODULES . 'sideboxes/cart_summary.php'); ?></div> 
    </td>
    <td width="15" height="80">
        <img src="../images/cart2_04.gif" width="15" height="80" alt=""></td>
</tr>
</table> </div> <!--eof-cart item number display-->

Now I'm trying to move the Cart to the far right (right aligned ) but don't know how to do this. can anyone help.
site is Salon-depot.com

JL

25 Oct 2007, 7:12 AM
#12
field4000 avatar

field4000

New Zenner

Join Date:
Sep 2007
Posts:
9
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Thank you very much!

I also found your help very useful.

:clap:

29 May 2008, 6:16 AM
#13
blackhalo avatar

blackhalo

Zen Follower

Join Date:
Feb 2008
Posts:
118
Plugin Contributions:
0

Re: shopping cart in header nav!!!

I have one of these variations in my header...
the problem is that it doesn't disappear when I run through the checkout pages,
this is annoying as the list gets quite long when a customer buys many items.

NOTE: The header summary WILL disappear on the "shopping cart" page...
but it then re-appears during the rest of the checkout process!?!?

How do I keep it invisible during the entire checkout process?

30 May 2008, 10:40 PM
#14
blackhalo avatar

blackhalo

Zen Follower

Join Date:
Feb 2008
Posts:
118
Plugin Contributions:
0

Re: shopping cart in header nav!!!

This Problem Has Been Solved - Thank You!

2 Jun 2008, 7:06 PM
#15
dmoore avatar

dmoore

New Zenner

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

Re: shopping cart in header nav!!!

I've got my shopping cart displaying in the side nav. It works fine for logged in users, but for guest users it only displays the total, not the contents.

A strange thing is that on the shopping_cart page it works for guests.

$_SESSION['cart']->get_products(); // Returns empty for guests except on shopping_cart page

$_SESSION['cart']->get_products(); // Works for logged in

19 Jun 2009, 9:44 PM
#16
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Downloaded and installed the cart summary sidebox addon. Love it!
Thanks Dr.Byte.

The only thing I don't particularly like is how it moved my logo down. My site now appears to have a very long header area.

Is there a way to move the shopping cart picture down into the logo area so it is to the right of my logo? I tried modifying the location by editing the files provided in the addon, but to no avail. It either ends up above and overlapping the logo, or I get two logos and the cart:oops:

A slight nudge in the right direction would help tremendously:smile:

To see what I am talking about, please visit http://mistkits.com .

28 Mar 2010, 3:15 PM
#17
gjh42 avatar

gjh42

Black Belt

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

Re: shopping cart in header nav!!!

You might try absolute positioning.```
#navMainCartSummary {position: absolute; top: 8em; right: 0;}

8 May 2010, 10:47 AM
#18
rapro avatar

rapro

New Zenner

Join Date:
Nov 2009
Posts:
44
Plugin Contributions:
0

Re: shopping cart in header nav!!!

Hi i am trying to get this working too and it almost working but still has a few weird thinks.

When i add product to shopping cart and stay there it shows everythink correct. If i navigate to home or any other page after this it like it dont read my changed text.

Link: https://www.witgoedextra.nl/wxt

Also how can i move this text from right side to under the cart image.

Tnx in avance:D

edit: link

12 Mar 2011, 9:27 PM
#19
edux10 avatar

edux10

New Zenner

Join Date:
Feb 2011
Posts:
26
Plugin Contributions:
0

Re: shopping cart in header nav!!!

what if you want your cart to display as a picture? like one if it is empty and one if it has items in it? I have seen it done before, but am unsure of the exact code.

14 Mar 2011, 11:43 PM
#20
gjh42 avatar

gjh42

Black Belt

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

Re: shopping cart in header nav!!!

Something like this perhaps?

if ($_SESSION['cart']->count_contents() == '0') {
echo zen_image(../images/empty_cart.gif);
} else {
echo zen_image(../images/full_cart.gif);
}
```Check on the correct terminolgy for the zen_image() function.