Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
  1. #11
    Join Date
    Feb 2007
    Posts
    212
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Hi guys...a totally newbie here...

    And getting a little confused with all the different methods..

    What files do i need to edit and with what and also where to find them please


    any help will be good.


    if possible the art should be in the header and shop - number of Items and Total in cart and link to checkout

    thanxs

  2. #12
    Join Date
    Aug 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Quote Originally Posted by businesstoweb View Post
    Hi,

    I changed a few bits and use this code.

    tpl_header ->

    <?php if ($_SESSION['cart']->count_contents() > 0) {
    $products = $_SESSION['cart']->get_products();
    echo '<p><a href="/index.php?main_page=shopping_cart">' . $_SESSION['cart']->count_contents().' Item(s) - Total: £';
    echo $currencies->format($_SESSION['cart']->show_total());
    }

    if ($_SESSION['cart']->count_contents() == 0) {
    $products = $_SESSION['cart']->get_products();
    echo '<p><a href="/index.php?main_page=shopping_cart"> Item(s) £0.00';
    }

    ?></a></p>

    Hope this helps.
    Works perfect, mate! I added a bit of code to make it a little more precise. ;)

    <?php if ($_SESSION['cart']->count_contents() > 1) {
    $products = $_SESSION['cart']->get_products();
    echo '' . $_SESSION['cart']->count_contents().' Items - ';
    echo $currencies->format($_SESSION['cart']->show_total());
    }

    if ($_SESSION['cart']->count_contents() == 1) {
    $products = $_SESSION['cart']->get_products();
    echo '' . $_SESSION['cart']->count_contents().' Item - ';
    echo $currencies->format($_SESSION['cart']->show_total());
    }

    if ($_SESSION['cart']->count_contents() == 0) {
    $products = $_SESSION['cart']->get_products();
    echo 'Your Cart is Empty!';
    }

    ?>

    Basically if there is one item, it now just says "1 item" and if there's more than one it says "2 (or however many) items"

    Useless change, really, but I'm a stickler!

    By the way, I put mine in the main template, since I'm not using the header at all.

  3. #13
    Join Date
    Aug 2008
    Posts
    14
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Quote Originally Posted by pensive612 View Post
    Hey everyone,

    I am only getting the total number of different products in the cart. Although, many of my products are quantity based. Is there a way to edit the total number to be of quantity products, and not just products??

    thanks in advance.
    Code:
    <li>My Cart: <span class="style1">
    	<?php echo sizeof($_SESSION['cart']->get_products()); ?> &nbsp;items&nbsp;&nbsp;
     	<?php $header_cart = $currencies->format($_SESSION['cart']->show_total());  
    	echo $header_cart;
    	?>
    </span>
    <br class="clearBoth" />
    </li>
    I used the code above to add the shopping cart to my header(http://dropyourdrawers.net/shop), how do I get it to move all the way to the right of the header? I've been playing around with it for an hour and can't figure it out. Thank you!

  4. #14
    Join Date
    Aug 2008
    Posts
    165
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Can someone please advise where in the code I put this new code? Do I replace code or do I add it and where?

    Much much appreciated ,
    Lynn

    http://www.PetHerbalRemedies.com

  5. #15
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Hi Lynn,

    put following code or some of the earlier examples to your template_header.php. If you want your cart to be for example inside navCatTabsWrapper, then put this code inside those divs and just under the navCatTabs closing div. Or you can put it anywhere you like.

    HTML Code:
    <div id="headerCart">
    
        <ul class="hCart">
    
          <li><?php echo $_SESSION['cart']->count_contents() . HEADER_TITLE_CART_ITEMS ;?></li>
    
          <li><?php echo HEADER_TITLE_CART_AMOUNT . $currencies->format($_SESSION['cart']->show_total());?></li>
    
          <li class="cartLink"><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    
        </ul>
    
        </div>
    If you are using code above, you have to define those TEXTs in languages/english/your_template/header.php.

    Depending of where you put your code, you need to use css to float new #headerCart div to its place. And if above code is used, css also needs this

    #headerCart ul li{

    display: inline;

    }
    to show list inline.

  6. #16
    Join Date
    Jul 2008
    Posts
    151
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Is this right? I have this code in my header:

    <?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; ?>
    <?php if (!empty($totalsDisplay)) { ?>
    <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
    <br class="clearBoth" />
    <?php } ?>

    </a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
    <?php }?>
    </ul>
    </div>

    It seems to be working. Only I want to remove the "Weight" and "Check Out" options from the header. I just want the Shopping Cart, Total Items, and Price. What and how should I blankout the other two?

  7. #17
    Join Date
    Jul 2008
    Posts
    151
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Actually its still not quite working right. When I add products to the cart, it show in the header the quantity, price etc, but when I click on "continue shopping" all of that info dissappears except for the "Shopping Cart" link.

  8. #18

    Default Re: Shopping cart in header

    Quote Originally Posted by pensive612 View Post
    Hey everyone,

    I am only getting the total number of different products in the cart. Although, many of my products are quantity based. Is there a way to edit the total number to be of quantity products, and not just products??

    thanks in advance.
    Code:
    <li>My Cart: <span class="style1">
        <?php echo sizeof($_SESSION['cart']->get_products()); ?> &nbsp;items&nbsp;&nbsp;
         <?php $header_cart = $currencies->format($_SESSION['cart']->show_total());  
        echo $header_cart;
        ?>
    </span>
    <br class="clearBoth" />
    </li>

    Hi there, sorry to drag this old thread up but I have the "shopping cart total in header" mod - which is just the bit of code in the above post - installed and I'm having the same problem that if you add 2 of one kind of a product it gives the total as 1 rather than 2. In otherwords it counts the number of different types of product inthe cart rather than the number of items.

    Does anyone know how to fix this?

    cheers

    heres the cart - www.babyclothingcentral.co.uk

  9. #19
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Shopping cart in header

    The code by scubyfan, post #12 gives you number of Items, not number of Products.

    Hats Off to scubyfan for sharing.

  10. #20
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Shopping cart in header

    Good stuff scubyfan. Thank you.

    Did anybody manage to add a little shopping cart image to this code? I would like the cart to be clickable, just like the text link. Any input would be appreciated.
    Live and learn... the Zen way.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v150 Add a View Cart link to my shopping cart header, in 12leaves template?
    By Serg in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 22 Aug 2012, 02:49 AM
  2. Shopping Cart and Items in Cart in the Header
    By sendmenews in forum General Questions
    Replies: 10
    Last Post: 25 Oct 2011, 02:09 AM
  3. Show number of products in cart by shopping cart in header
    By robertwhitis in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 27 Mar 2011, 07:15 PM
  4. Shopping Cart in Header
    By autoace in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Nov 2009, 07:18 PM
  5. Shopping cart in header
    By rascald in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Jun 2009, 12:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg