For future users <?php echo '$' . number_format(( $total['amount'] /100),2); ?>
is how.
Following this guide http://kahthong.com/2012/08/programmatically-show-number-items-drupal-commerce-shopping-cart I got the cart item total using
<?php
global $user;
$quantity = 0;
$order = commerce_cart_order_load($user->uid);
if ($order) {
$wrapper = entity_metadata_wrapper('commerce_order', $order);
$line_items = $wrapper->commerce_line_items;
$quantity = commerce_line_items_quantity($line_items, commerce_product_line_item_types());
$total = commerce_line_items_total($line_items);
$currency = commerce_currency_load($total['currency_code']);
}
print format_plural($quantity, '1 item', '@count items');
?>
however when I try to get the dollar total using <?php print $total; ?>
, it just returns 'Array'.
I used Devel on the page, but the cart is just a bunch of markup in ['content']['system_main']['main']['#markup']
. What I want is <span class="line-item-total-raw">$106.00</span>
, is there a way I can grab that class specifically with php somehow? Or maybe there's another way to go about this.