I have copied the commerce-cart-block.tpl.php and created a custom content view. I only have a bit knowledge in PHP.
I used the devel module to get the data I need.
Here is the code I put on the tpl.php but I have this error.

Notice: Undefined variable: currency_code in commerce_currency_format()

I don't know if it's a module issue or just my code.

  
  $orderprice = commerce_currency_format($order->commerce_order_total[LANGUAGE_NONE][0]['amount']);

  $qty = $order->commerce_line_items[LANGUAGE_NONE];
  $i = 0;
  foreach($qty as $key => $value) {
    $line_item = $order->commerce_line_items[LANGUAGE_NONE][$key]['line_item_id'];
    $itemqty = commerce_line_item_load($line_item);
    $i += $itemqty->quantity;
  }
    
    print t('<a href="/cart">Cart</a>: ' . $i . ' item(s) - ' . $orderprice);
    
  

Please help me to fix this issue. Thanks!!

___________________

Fixed issue:

  $amount = $order->commerce_order_total[LANGUAGE_NONE][0]['amount'];
  $currency_code = $order->commerce_order_total[LANGUAGE_NONE][0]['currency_code'];
  
  $orderprice = commerce_currency_format($amount, $currency_code);

  $qty = $order->commerce_line_items[LANGUAGE_NONE];
  $i = 0;
  foreach($qty as $key => $value) {
    $line_item = $order->commerce_line_items[LANGUAGE_NONE][$key]['line_item_id'];
    $itemqty = commerce_line_item_load($line_item);
    $i += $itemqty->quantity;
  }
    
    print t('<a href="/cart">Cart</a>: @qty item(s) - @price', array('@qty' => $i, '@price' => $orderprice));
    

Comments

madelyncruz’s picture

I have been so careless and I missed to put the currency code at the commerce_currency_format.

Please mark this one as fixed. Thank you.

madelyncruz’s picture

Issue summary: View changes
madelyncruz’s picture

Issue summary: View changes
madelyncruz’s picture

Status: Active » Closed (fixed)