Jump to content

Payment method doesn't show in product details page


REDOUANE

Recommended Posts

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

Capture d’écran 2021-04-21 à 13.43.09.png

Edited by REDOUANE
Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by REDOUANE
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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");
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