Jump to content

Assign custom value to template variable


dotnetrix

Recommended Posts

Hi,

 

I am trying to update a value for a template variable.

 

The {debug} on the domainrenewals.tpl states:

 

$renewals
Origin: "Smarty object" 	
Value
Array (3)
0 => Array (12)
 id => "21"
 domain => "mydomain.com"
 tld => ".com"
 status => "Expired"
 expirydate => "06/09/2016"
 daysuntilexpiry => -151
 beforerenewlimit => false
 beforerenewlimitdays => 0
 ingraceperiod => false
 pastgraceperiod => true
 graceperioddays => "30"
 renewaloptions => Array (1)
   0 => Array (2)
     period => 1
     price => WHMCS\View\Formatter\Price Object (0)

 

So, via a hook on ClientAreaPageCart I am trying to update the price value, but cannot get this right:

 

I've tried:

 

$template->assign('price', '285.00');

 

and also:

 

$return['renewals']['renewaloptions']['price'] = "285.00";

 

The last one above actually overrides the entire array, but I just want to update the price.

 

Now, the .tpl file itself shows the variable as {$renewaloption.price}

 

Any help appreciated.

Link to comment
Share on other sites

Thank you for that!

 

I am however looking to only temporarily change the price, if the domain expired more than 30 days ago. Sort of a Redemption Fee hook. The Price Formatter class appears to allow for permanent updating of the price field of the domain/s.

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
Reply to this topic...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated