3

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?

1
  • do you make your urbercart threw views or using any module? Dec 28, 2011 at 13:20

1 Answer 1

3

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);
    ?>
1
  • How can I add taxes on $total_price price? Nov 23, 2017 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.