I’m working on an easy way to do edit the status of an Paypal payment system so i can switch it over in test mode when needed without going into the code. “MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER” is defined to “Live”, but for some reason it keep throwing the sandbox url.
echo MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER ;
if (MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER == "Live") {
$form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
} else {
$form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
}
echo ' '.$form_action_url;
die();
The above outputs:
If I replace MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER with ‘live’ it returns the value correctly, I also tried to move the DEFINE to a Variable before it goes to the IF statement, but it still doesn’t work.
I’m using OsCommerce to define this via the admin system.
var_dump also shows:
string(20) “Live”
instead of what it should:
string(4) “Live”
Options for MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER
is “Live” and “Sandbox”.
3
Answers
After removing and adding MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER a few times without any changes I completely removed the paypal script from the site and installet it again. now it works!
The following code works as expected:
How exactly are you definine your constant?
When the following is changed:
the output is
Edit: Based on your comment, the code is working exactly as it should then. You are defining your constant as
LIVE
but then checking it in your if statement againstLive
. When you compare them, they are not equal, therefore theif
statement evaluates to false and your second condition is executed.Shows live ;-))
Works as expected – can NOT reproduce your described result.