Forum
Inconsistent checkout failure problem
Hi,
I'm getting a few reports of customers being unable to checkout, but I'm unsure what could be causing it. Hope someone can shed light on what I may have done.
Here's the checkout code:
<?php
if (!perch_shop_addresses_set()) {
perch_shop_edit_address_form(false, [
'template' => 'checkout/customer_create_passwordless.html',
]);
} else {
// your 'success' return URL
$return_url = 'https://XXX/paypal-complete.php';
$cancel_url = 'https://XXX/paypal-failed.php';
perch_shop_checkout('paypal-express', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
//}
}
?>
This is from the php_error.log:
[06-Feb-2018 16:30:33 UTC] PHP Fatal error: Uncaught Error: Call to a member function id() on null in /homepages/21/d688763965/htdocs/utt/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php:910
Stack trace:
#0 /homepages/21/d688763965/htdocs/utt/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php(600): PerchShop_Runtime->get_address(NULL, 'default')
#1 /homepages/21/d688763965/htdocs/utt/perch/addons/apps/perch_shop/runtime/cart.php(186): PerchShop_Runtime->checkout('paypal-express', Array, 'default')
#2 /homepages/21/d688763965/htdocs/utt/checkout.php(59): perch_shop_checkout('paypal-express', Array)
#3 {main}
thrown in /homepages/21/d688763965/htdocs/utt/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php on line 910
Diagnostics
Perch: 3.0.13, PHP: 7.1.13, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.10), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2)
App runtimes: <?php $apps_list = [ 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_members', 'perch_shop', ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /homepages/21/d688763965/htdocs/utt/perch
PERCH_CORE: /homepages/21/d688763965/htdocs/utt/perch/core
PERCH_RESFILEPATH: /homepages/21/d688763965/htdocs/utt/perch/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 256M, Total max file upload: 64M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: XXX
DOCUMENT_ROOT: /kunden/homepages/21/d688763965/htdocs/utt
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
It looks like you have no customer when it's trying to get the customer's address. Are you checking that a member is logged in at this point?
Aha, I'm not. I'll look into this further. Thanks Drew.