REDOUANE Posted April 21, 2021 Share Posted April 21, 2021 (edited) Hello Guys, pls i am facing issue with displaying the payment method, pls see screen, i don' know what is the problem, i am not facing the problem in domains, and payment method exist in order in backoffice Thanks guys Edited April 21, 2021 by REDOUANE 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 21, 2021 Share Posted April 21, 2021 On 4/21/2021 at 1:49 PM, REDOUANE said: pls i am facing issue with displaying the payment method, pls see screen, i don' know what is the problem, i am not facing the problem in domains, and payment method exist in order in backoffice Expand is it just affecting this one service, or every product ? i'm wondering if that service is linked to a paymentmethod that no longer exists in your payments gateway setup ? 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 21, 2021 Author Share Posted April 21, 2021 On 4/21/2021 at 1:55 PM, brian! said: is it just affecting this one service, or every product ? i'm wondering if that service is linked to a paymentmethod that no longer exists in your payments gateway setup ? Expand It's related to all products, and in the payment gateway is still there and active 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 21, 2021 Share Posted April 21, 2021 On 4/21/2021 at 1:57 PM, REDOUANE said: It's related to all products, and in the payment gateway is still there and active Expand then have you checked the relevant template to ensure the variable is still there... ? it's likely to be clientareaproductdetails and {$paymentmethod} - but if the products are linked to a module with custom templates, then it may be calling them instead. 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 21, 2021 Author Share Posted April 21, 2021 (edited) On 4/21/2021 at 2:08 PM, brian! said: then have you checked the relevant template to ensure the variable is still there... ? it's likely to be clientareaproductdetails and {$paymentmethod} - but if the products are linked to a module with custom templates, then it may be calling them instead. Expand the problem exist in every template even the six template, and the variable still there in template, i have checked the domaindetails template, and they are the same, in domaindetails its displayed, but in proudctdetails not Edited April 21, 2021 by REDOUANE 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 21, 2021 Share Posted April 21, 2021 On 4/21/2021 at 2:12 PM, REDOUANE said: the problem exist in every template even the six template, and the variable still there in template, i have checked the domaindetails template, and they are the same, in domaindetails its displayed, but in proudctdetails not Expand then add a {debug} to the end of the template file's code, refresh the page and that should open a popup window - in that window, see if $paymentmethod exists. remember to remove the {debug} when you're finished. 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 21, 2021 Author Share Posted April 21, 2021 On 4/21/2021 at 2:29 PM, brian! said: then add a {debug} to the end of the template file's code, refresh the page and that should open a popup window - in that window, see if $paymentmethod exists. remember to remove the {debug} when you're finished. Expand This is what i got, its null $paymentmethod Value Origin: "Smarty object" null 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 21, 2021 Share Posted April 21, 2021 is there any chance that there is an existing hook nulling the value ? 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 21, 2021 Author Share Posted April 21, 2021 On 4/21/2021 at 2:38 PM, brian! said: is there any chance that there is an existing hook nulling the value ? Expand no there any hook nulling the value 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 21, 2021 Share Posted April 21, 2021 On 4/21/2021 at 2:42 PM, REDOUANE said: no there any hook nulling the value Expand how unusual... out of interest, is the payment gateway a third-party one? i'm wondering if it's doing something non-standard and WHMCS isn't able to pull the gateway name from the database.... if there is a paymentmethod value in tblhosting, then using an action hook to get the value and return it to the template should be a quick fix... but i'd be tempted to open a ticket with Support and see if they have any ideas why the value is either not being pulled correctly by default, or if something could be interfering. 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 22, 2021 Author Share Posted April 22, 2021 On 4/21/2021 at 4:35 PM, brian! said: how unusual... out of interest, is the payment gateway a third-party one? i'm wondering if it's doing something non-standard and WHMCS isn't able to pull the gateway name from the database.... if there is a paymentmethod value in tblhosting, then using an action hook to get the value and return it to the template should be a quick fix... but i'd be tempted to open a ticket with Support and see if they have any ideas why the value is either not being pulled correctly by default, or if something could be interfering. Expand Can you pls just show me how to create this hook pls Thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 22, 2021 Share Posted April 22, 2021 On 4/22/2021 at 10:39 AM, REDOUANE said: Can you pls just show me how to create this hook pls Expand at its most basic, the hook below should return a value if it exists in the database.. <?php function product_details_payment_name_hook($vars) { $service = Menu::context('service'); $payment = $service->paymentGateway; return array ("paymentmethod" => $payment); } add_hook("ClientAreaPageProductDetails", 1, "product_details_payment_name_hook"); it will use the internal name of the gateway rather than the friendly name, but let's just see if it returns something and then polish it later if necessary. 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 22, 2021 Author Share Posted April 22, 2021 On 4/22/2021 at 10:45 AM, brian! said: at its most basic, the hook below should return a value if it exists in the database.. <?php function product_details_payment_name_hook($vars) { $service = Menu::context('service'); $payment = $service->paymentGateway; return array ("paymentmethod" => $payment); } add_hook("ClientAreaPageProductDetails", 1, "product_details_payment_name_hook"); it will use the internal name of the gateway rather than the friendly name, but let's just see if it returns something and then polish it later if necessary. Expand Yes its work fine man, thank you so much 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 22, 2021 Author Share Posted April 22, 2021 On 4/22/2021 at 10:45 AM, brian! said: at its most basic, the hook below should return a value if it exists in the database.. <?php function product_details_payment_name_hook($vars) { $service = Menu::context('service'); $payment = $service->paymentGateway; return array ("paymentmethod" => $payment); } add_hook("ClientAreaPageProductDetails", 1, "product_details_payment_name_hook"); it will use the internal name of the gateway rather than the friendly name, but let's just see if it returns something and then polish it later if necessary. Expand @Brian How can i change the polish pls ? thank you again 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 22, 2021 Share Posted April 22, 2021 to get the friendly name ? <?php # cPanel Service Payment Method Hook # Written by brian! use WHMCS\Database\Capsule; function product_details_cpanel_password_hook($vars) { $service = Menu::context('service'); $payment = $service->paymentGateway; $paymentname = Capsule::table('tblpaymentgateways')->where('gateway',$payment)->where('setting','name')->value('value'); return array ("paymentmethod" => $paymentname); } add_hook("ClientAreaPageProductDetails", 1, "product_details_cpanel_password_hook"); 0 Quote Link to comment Share on other sites More sharing options...
REDOUANE Posted April 22, 2021 Author Share Posted April 22, 2021 Thank you so much @brian! 0 Quote Link to comment Share on other sites More sharing options...
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.