ty0716 Posted August 15, 2015 Report Share Posted August 15, 2015 as the picture shows,i want to echo total amount_due in client_main.pdt file,but not modify system files.Because it is not conducive to update. I used a very primitive way: <?php if(isset($message)){ $pa = '%<p>(.*?)</p>%sim'; preg_match($pa, trim($message), $arr); preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr); $total_due=$arr[0]; }else{ $total_due='0.00'; } ?> Quote Link to comment Share on other sites More sharing options...
0 Tyson Posted August 15, 2015 Report Share Posted August 15, 2015 If you don't want to update core files, you can write a plugin that adds a widget to the client dashboard similar to the Invoices, Transactions, and Services widgets. Otherwise, you'll need to update core files to make the data you want available to that template. To do so, open the ClientMain controller in /app/controllers/client_main.php. Find: $this->set("client", $this->client); Above that line add: $this->set("max_due_currency", (isset($max_due_currency) ? $max_due_currency : null)); $this->set("max_due_amount", (isset($max_due_amount) ? $max_due_amount : null)); Open up the client_main.pdt template you mentioned, and use the CurrencyFormat helper to format the amount due, e.g.: <?php if ($this->Html->ifSet($max_due_currency) && $this->Html->ifSet($max_due_amount)) { ?> <p><?php echo $this->CurrencyFormat->format($this->Html->ifSet($max_due_amount), $this->Html->ifSet($max_due_currency));?></p> <?php } ?> Michael 1 Quote Link to comment Share on other sites More sharing options...
Question
ty0716
as the picture shows,i want to echo total amount_due in client_main.pdt file,but not modify system files.Because it is not conducive to update.
I used a very primitive way:
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.