Post by clubbingaway » Fri Nov 07, 2014 1:14 am

Hi Opencart Board...

Does anyone know what code needs to be amended to show 2 decimal places on the dashboard for "Total Sales". At the moment mine shows on GBP as XX.XXXX.

Fresh install of Opencart V2.0

Many Thanks.

Matt.

Newbie

Posts

Joined
Fri Nov 07, 2014 1:12 am

Post by ihateclownz » Fri Nov 07, 2014 2:43 am

You are in luck because I just figured it out myself :)

/admin/view/template/dashboard/sale.tpl

Code: Select all

<div class="tile">
  <div class="tile-heading"><?php echo $heading_title; ?> <span class="pull-right">
    <?php if ($percentage > 0) { ?>
    <i class="fa fa-caret-up"></i>
    <?php } elseif ($percentage < 0) { ?>
    <i class="fa fa-caret-down"></i>
    <?php } ?>
    <?php echo $percentage; ?>% </span></div>
  <div class="tile-body"><i class="fa fa-credit-card"></i>
  <?
	function numberfix($total)
	{
	    $total = number_format($total,2,"."," ");
    return str_replace(" ", "&nbsp;", $total);
  }
  ?>
    <h2 class="pull-right"><?php echo "$".numberfix($total); ?></h2>
  </div>
  <div class="tile-footer"><a href="<?php echo $sale; ?>"><?php echo $text_view; ?></a></div>
</div>

Newbie

Posts

Joined
Tue Oct 07, 2014 4:05 am

Post by fido-x » Fri Nov 07, 2014 8:25 am

Another (better) option would be to do it in the controller.

In "admin/controller/dashboard/sale.php", replace line 37:

Code: Select all

$data['total'] = $sale_total;
with:

Code: Select all

$data['total'] = round($sale_total, 2);

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: No registered users and 4 guests