i.e. i wanna display show amount of items of the shopping cart in my front-page.tpl.php
any ideas?
Sun, 03/01/2009 - 03:07
Re: getting shopping cart variables outside of the shopping cart
This will get the number of items, then you just need to output them with php in your front page.
<?php
$items
= uc_cart_get_contents();
$item_count= count($items);
?>This might also help:
Re: getting shopping cart variables outside of the shopping cart
If you only want to show the number of items in the cart, just do this in your template file... this is similar to how I do it on my site:
<?php
$items = uc_cart_get_contents();
print t('Cart: !items', array('!items' => format_plural(count($items), '@count item', '@count items')));
?>
Re: Re: getting shopping cart variables outside of the shopping
thanks guys, that was really fast.
Re: Re: getting shopping cart variables outside of the shopping
This seems to only put the item type count. For instance, if I add two different items into the cart, it counts it as "2". However, if I have two different items, but 14 of type 1, it still displays "2" and not 15.
Is there any ways to fix this?


