Results 1 to 4 of 4

Thread: Mini Cart

  1. #1
    User
    Join Date
    04-27-10.
    Posts
    134

    Default Mini Cart

    Hi,

    I want to have a mini cart on my page, but I only want to show the number of items in the cart.
    I've tried to use <?php echo count($this->products); ?> in a custom template but this only shows how many individual items are in the cart. ie, if I have 2 products but have a quantity of 5 for one of them - 6 items, the above code only shows 2.
    Is there a variable that will give me total quantity of all products in the cart? Or will I need to use some custom php to add everything up?

    Thanks

    James

  2. #2
    User winanscreative's Avatar
    Join Date
    06-21-09.
    Location
    Massachusetts, United States
    Posts
    261

    Default Re: Mini Cart

    Try this:

    Code:
    <?php $qty=0; ?>
    <?php foreach($this->products as $product): ?>
    	<?php $qty += $product['quantity']; ?>
    <?php endforeach; ?>
    <?php echo $qty; ?>
    You can get it with $this->Isotope->Cart->items within the module, but since it is not currently assigned to the template object within the module, not sure it can be grabbed like that. I will add a ticket and see if we can get this added so it can be referenced like $this->items...

  3. #3
    User
    Join Date
    04-27-10.
    Posts
    134

    Default Re: Mini Cart

    Thankyou

  4. #4
    User
    Join Date
    12-09-09.
    Location
    Russia, Moscow
    Posts
    48

    Default Re: Mini Cart

    Hi!
    Another question about miniCart: when i have no items in cart, i see message like this "There are no items in your cart" istead of cart modile.
    How can i add this message to card module and saw it regardless of the number of items in cart?

Bookmarks

Posting Permissions

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