I'm using Ubercart ajax cart, and I want to create a static block with AJAX that only shows the total items in the cart.
How can I go about doing this? Is there a module that has this functionality?
I'm using Ubercart ajax cart, and I want to create a static block with AJAX that only shows the total items in the cart.
How can I go about doing this? Is there a module that has this functionality?
You can test this one -
Put below code in your page (create new page content) and select input format "php" and hit preview button you will get what you want (if cart is not empty).
<?php
$items = uc_cart_get_contents();
foreach($items as $item){
while(list($key,$value) = each($item)){
if($key == 'qty')$qty = $value;
if($key == 'price')$price = $value;
}
$total_qty += $qty;
$total_price += $qty*$price;
}
echo 'Total Quantity : '.$total_qty.' Total Price : '.uc_currency_format($total_price);
?>