Jump to content
  • 0

smarty->assign on ClientAreaPage Hook


servetas

Question

Hello All,

I am trying to following part of code within the viewinvoice page but the paymentbutton is not updated. Is the smarty->assign option still supported?

<?php 
function custom($vars)
{
    global $smarty;
	if ($vars['filename'] == 'viewinvoice' && $vars['status'] == 'Unpaid') {
		$smarty->assign('paymentbutton', "BG");
	}
}
add_hook('ClientAreaPage', 1, 'custom');
?>

The hook seems to run but the paymentbutton is not updated. Does anyone have the same issue? How can we update the paymentbutton?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

So, I come back with the same issue run on 7.4.1. I am using the code below but the paymentbutton of the invoice is not updated:

function custom_bank_gateway_text($vars) {
    global $details;
    global $_LANG;
    if ($vars['filename'] == 'viewinvoice' && $vars['status'] == 'Unpaid' && $vars['paymentmethod'] == 'Bank Transfer') {
        return array("paymentbutton" => "Hello User!");
    }
}
add_hook('ClientAreaPage', 5, 'custom_bank_gateway_text');

The payment button keeps showing the bank details section that has been set on WHMCS admin center.

Link to comment
Share on other sites

  • 0

as @brian! code shows, you may use "ClientAreaPageViewInvoice" instead of "ClientAreaPage" (the last one doesn't work as it did in the past), also no need to check for current file name as your your function will only run in view invoice page:

function custom_bank_gateway_text($vars) {
    global $details;
    global $_LANG;
    if ($vars['status'] == 'Unpaid' && $vars['paymentmethod'] == 'Bank Transfer') {
        return array("paymentbutton" => "Hello User!");
    }
}
add_hook('ClientAreaPageViewInvoice', 5, 'custom_bank_gateway_text');

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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