Jump to content
  • 0

How To Echo Total Amount_Due In Template Rather Than Modify System Files.


ty0716

Question

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';
}
?>

20150815201312.jpg

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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
}
?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...