Forums / Templates, Stylesheets, Page Layout / disappearing cart quantity in header

disappearing cart quantity in header

Locked

Views: 682

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
15 Nov 2010, 5:58 PM
#1
tor86 avatar

tor86

New Zenner

Join Date:
Sep 2010
Location:
Leamington Spa, UK
Posts:
31
Plugin Contributions:
0

disappearing cart quantity in header

Hi everyone,

I've got a strange issue with the shopping cart summary in my header.

Whenever there is nothing in the cart and the cart counter is at "0", it sometimes disappears when navigating to a page for the first time. When the user refreshes the page, it then reappears. It creates a horizontal scrollbar which stretches the page about 400px to the right.

This is the code for the cart summary from tpl_shopping_cart_header.php which is called from the header:

<?php $content = ""; $product_amount = 0; if ($_SESSION['cart']->count_contents() > 0) { $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $product_amount = $products[$i]['quantity'] + $product_amount; } $content .= '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '"><img class="cart-icon full" src="'. $template->get_template_dir('', DIR_WS_TEMPLATE, $current_page_base,'images') . '/spacer.gif" />' . HEADER_PRODUCT_AMOUNT . '<div id="cartquantity">'. $product_amount . '</div></a> '; } else { $content .= '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '"><img class="cart-icon empty" src="'. $template->get_template_dir('', DIR_WS_TEMPLATE, $current_page_base,'images') . '/spacer.gif" />' . HEADER_PRODUCT_AMOUNT . '<div id="cartquantity">'. $product_amount . '</div></a> '; } if ($_SESSION['cart']->count_contents() > -1) { $content .= HEADER_CART_SUBTOTAL .'<div id="carttotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>'; } ?>

and the code from the header is..

<?php require($template->get_template_dir('tpl_shopping_cart_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_shopping_cart_header.php'); echo $content; /*require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');*/?>

If someone could help I'd really appreciate it, as this is doing my head in! :(

Site url is - http://notoriousdesign.co.uk/dr.um

Thank you!

24 Nov 2010, 11:10 PM
#2
tor86 avatar

tor86

New Zenner

Join Date:
Sep 2010
Location:
Leamington Spa, UK
Posts:
31
Plugin Contributions:
0

Re: disappearing cart quantity in header

hm I've realised this must be a problem with the CSS I'm using, as the quantity is still there after disabling the CSS. Here's the div class for it:

.cartquantity, .cartquantity a {
color:#FFFFFF;
display:block;
font-size:12pt;
height:5px;
position:absolute;
right:263px;
text-align:center;
top:42px;
width:20px;
z-index:12;
}

pleeeease someone help.

25 Nov 2010, 12:36 AM
#3
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: disappearing cart quantity in header

Tor,

I couldn't replicate the problem you are describing, although there is definitely a layout problem in IE for your site, and the larger image lightbox or whatever you're using shows nothing in Chrome.

25 Nov 2010, 7:36 PM
#4
tor86 avatar

tor86

New Zenner

Join Date:
Sep 2010
Location:
Leamington Spa, UK
Posts:
31
Plugin Contributions:
0

Re: disappearing cart quantity in header

Hi thanks for the reply. It seems to only happen when first browsing to the site, like the css isnt loading properly. Weird.

I couldn't replicate your chrome issue with the lightbox though, what version are you using? I dont understand why I'm having so many layout inconsistencies across browsers. It seems to be when I use relative divs that it messes things up. In this case my content wrapper is positioned relatively, but if i try absolute I then cant get my footer to stay put at the bottom of the page!

Gah! :frusty: