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 4 minutes ago, 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 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 2 minutes ago, 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 ? 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 10 minutes ago, REDOUANE said: It's related to all products, and in the payment gateway is still there and active 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) 4 minutes ago, 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. 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 16 minutes ago, 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 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 5 minutes ago, 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. 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 3 minutes ago, brian! said: is there any chance that there is an existing hook nulling the value ? 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 1 hour ago, REDOUANE said: no there any hook nulling the value 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 18 hours ago, 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. 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 4 minutes ago, REDOUANE said: Can you pls just show me how to create this hook pls 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 5 minutes ago, 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. 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 2 hours ago, 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. @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.