PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Zencart 1.5.8a - PHP 8.2 - No Plugins - Fresh install w/upgraded DB
Hello, I am getting this error with a fresh install and upgraded database.
Code:
PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY"
/home/dev/public_html/includes/modules/payment/paypaldp.php:264
Because of the error the payment modules page only loads halfway, stops right after Paypal Payments Standard. It also affects the orders-edit page with just a white screen.
Any seen this before?
Thanks
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Quote:
Originally Posted by
djdavedawson
Zencart 1.5.8a - PHP 8.2 - No Plugins - Fresh install w/upgraded DB
Hello, I am getting this error with a fresh install and upgraded database.
Code:
PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY"
/home/dev/public_html/includes/modules/payment/paypaldp.php:264
Because of the error the payment modules page only loads halfway, stops right after Paypal Payments Standard. It also affects the orders-edit page with just a white screen.
Any seen this before?
Thanks
Have you set your country in
Configuration >> My Store > Country
~Melanie
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Go to Admin > Modules > Payment and click on the PayPal you have installed. This will fix your installation.
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Quote:
Originally Posted by
swguy
Go to Admin > Modules > Payment and click on the PayPal you have installed. This will fix your installation.
Unfortunately, it won't. Apparently the previous database has paypaldp enabled, but that version didn't have the MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY setting defined.
That setting's added in the module's check method, but the processing doesn't get that far due to the PHP Fatal error due to the constant not being defined.
Noting that another issue is that the setting is either USA, UK or Canada, but various comparisons in the module check for US instead of USA.
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Quote:
Originally Posted by
swguy
So uninstall/reinstall?
And lose all the configuration setting from the previous install (that you can't view due to that fatal error)?
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Quote:
Originally Posted by
lat9
Unfortunately, it won't. Apparently the previous database has paypaldp enabled, but that version didn't have the MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY setting defined.
That setting's added in the module's check method, but the processing doesn't get that far due to the PHP Fatal error due to the constant not being defined.
Noting that another issue is that the setting is either USA, UK or Canada, but various comparisons in the module check for US instead of USA.
Should line 264
Code:
if ( ((MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'US' || MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'Canada') && (MODULE_PAYMENT_PAYPALWPP_APISIGNATURE == '' || MODULE_PAYMENT_PAYPALWPP_APIUSERNAME == '' || MODULE_PAYMENT_PAYPALWPP_APIPASSWORD == ''))
be
Code:
if ( ((MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'UK' || MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'Canada') && (MODULE_PAYMENT_PAYPALWPP_APISIGNATURE == '' || MODULE_PAYMENT_PAYPALWPP_APIUSERNAME == '' || MODULE_PAYMENT_PAYPALWPP_APIPASSWORD == ''))
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Ok so I tried updating line 264 like this.
Code:
if ( ((MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'USA' || MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'Canada') && (MODULE_PAYMENT_PAYPALWPP_APISIGNATURE == '' || MODULE_PAYMENT_PAYPALWPP_APIUSERNAME == '' || MODULE_PAYMENT_PAYPALWPP_APIPASSWORD == ''))
Unfortunately, this did not work for my case.
However, I added this right above line 264
HTML Code:
define('MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY','US');
This allowed the payment module page to load completely. Once loaded I
*Took screen-shots of all the settings.
*Clicked Remove Module
*Clicked Install Module
*Entered my settings
*Then removed my define
HTML Code:
define('MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY','US');
This process added the correct entries to the db.
So far everything seems to be loading correctly.
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
Smart! That was an excellent way to work-around the issue! Don't forget to remove that define statement now that the configuration setting is (er) set.
Note to self, read the whole post before you reply!
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
The patch which is going into v2.0.0, and can safely be applied to v1.5.8 is: https://github.com/zencart/zencart/pull/6144/files
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
I had to add this define statement at the top of the page to make it work.
Re: PHP Fatal error: Undefined constant MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY
This is still an issue in 2.0.
Code:
[21-Apr-2024 21:24:22 America/New_York] Request URI: /admin/index.php?cmd=modules&set=payment, IP address: 111.111.111.111
--> PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY" in public_html/includes/modules/payment/paypaldp.php:292
Stack trace:
#0 public_html/admin/modules.php(173): paypaldp->__construct()
#1 public_html/admin/index.php(11): require('...')
#2 {main}
thrown in public_html/includes/modules/payment/paypaldp.php on line 292.
[21-Apr-2024 21:24:22 America/New_York] Request URI: /admin/index.php?cmd=modules&set=payment, IP address: 111.111.111.111
--> PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY" in public_html/includes/modules/payment/paypaldp.php:292
Stack trace:
#0 public_html/admin/modules.php(173): paypaldp->__construct()
#1 public_html/admin/index.php(11): require('...')
#2 {main}
thrown in public_html/includes/modules/payment/paypaldp.php on line 292.