Forum

Thread tagged as: Problem, PayPal, Shop

Customer address not being stored or passed to PayPal

Hi,

I'm just running through a load of tests to ensure my checkout procedure is ok, but I've noticed that my customer address is no longer being saved.

I've removed any edits I had made to customer_create_passwordless.html but the issue persists.

I'm unsure what exactly I've done to break this and would appreciate a pointer in the correct direction.

Regards, Chris

Summary information

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_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), pipit_catalog (1.1.0)
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: www.***.org.uk
DOCUMENT_ROOT: /kunden/homepages/21/d688763965/htdocs/utt
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Chris McMahon

Chris McMahon 0 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

We're going to need to know more about your checkout, such as seeing the code.

Sure.

From the cart I go to a page with this little bit of code, which then redirects to PayPal:

    <?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://www.***.org.uk/paypal-complete.php';
        $cancel_url = 'https://www.***.org.uk/paypal-failed.php';

        perch_shop_checkout('paypal-express', [
          'return_url' => $return_url,
          'cancel_url' => $cancel_url,
        ]);
       }
    ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's changed since it was working?

I wish I knew, Drew. Perhaps a lesson in using source control.

I've looked through everything that I've changed since Friday, when I believe it was working, but I'm just not seeing what it could be.

Is there anywhere in particular I should be/could be looking?

Apologies for the vague rubbishness.

This is part of the debug output from the PayPal payment complete page, does it shed any light on the issue:

UPDATE perch3_shop_orders_meta SET metaValue=last_insert_id(metaValue+1) WHERE id='last_invoice_number'
[1] SELECT last_insert_id()
UPDATE perch3_shop_orders SET orderInvoiceNumber='Invoice17', orderUpdated='2018-01-30 15:37:49' WHERE orderID='28'
No ids to log.
Setting order status to paid
UPDATE perch3_shop_orders SET orderDynamicFields='{\"status\":\"paid\"}', orderStatus='paid', orderUpdated='2018-01-30 15:37:49' WHERE orderID='28'
No ids to log.
Array
(
    [country] => GB
)
[1] SELECT * FROM perch3_shop_countries WHERE iso2='GB' LIMIT 1
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=236 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
INSERT INTO perch3_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(28,'CARD_ADDRESS','GB','PayPal_Express','1','236','2018-01-30 15:37:51')
[1] SELECT * FROM perch3_shop_tax_exhibits WHERE exhibitID='77' LIMIT 1
No ids to log.
UPDATE perch3_shop_tax_exhibits SET orderID=28, exhibitType='CARD_ADDRESS', exhibitDetail='GB', exhibitSource='PayPal_Express', locationID='1', countryID='236', exhibitDate='2018-01-30 15:37:51' WHERE exhibitID='77'
No ids to log.
[1] SELECT * FROM perch3_shop_addresses WHERE addressID='102' AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=0 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
Looking up missing property address_1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property address_2
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property city
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property county
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property postcode
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
INSERT INTO perch3_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(28,'BILL_ADDRESS',', ','Customer','1','0','2018-01-30 15:37:51')
[1] SELECT * FROM perch3_shop_tax_exhibits WHERE exhibitID='78' LIMIT 1
No ids to log.
UPDATE perch3_shop_tax_exhibits SET orderID=28, exhibitType='BILL_ADDRESS', exhibitDetail=', ', exhibitSource='Customer', locationID='1', countryID='0', exhibitDate='2018-01-30 15:37:51' WHERE exhibitID='78'
No ids to log.
[1] SELECT * FROM perch3_shop_addresses WHERE addressID='103' AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=0 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
Looking up missing property address_1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property address_2
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property city
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property county
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
Looking up missing property postcode
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
INSERT INTO perch3_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(28,'SHIP_ADDRESS',', ','Customer','1','0','2018-01-30 15:37:51')
[1] SELECT * FROM perch3_shop_tax_exhibits WHERE exhibitID='79' LIMIT 1
No ids to log.
UPDATE perch3_shop_tax_exhibits SET orderID=28, exhibitType='SHIP_ADDRESS', exhibitDetail=', ', exhibitSource='Customer', locationID='1', countryID='0', exhibitDate='2018-01-30 15:37:51' WHERE exhibitID='79'
No ids to log.
[1] SELECT * FROM perch3_shop_order_statuses WHERE statusKey='paid' AND statusActive=1 AND statusDeleted IS NULL
[1] SELECT * FROM perch3_shop_emails WHERE emailStatus=3 AND emailActive=1
Sending customer email
[1] SELECT * FROM perch3_shop_customers WHERE customerID='12' AND customerDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_members WHERE memberID='12' LIMIT 1
Using email template: /homepages/21/d688763965/htdocs/utt/perch/templates/shop/emails/order_paid.html (html)
[1] SELECT * FROM perch3_shop_order_statuses WHERE statusKey='paid' AND statusDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_addresses WHERE addressID=103 AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
[1] SELECT * FROM perch3_shop_addresses WHERE addressID=102 AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='0' LIMIT 1
No country set for address (name)
[1] SELECT * FROM perch3_shop_order_items WHERE orderID='28' ORDER BY itemID ASC
[1] SELECT * FROM perch3_shop_order_statuses WHERE statusKey='paid' AND statusDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch3_shop_shippings WHERE shippingID=0 AND shippingDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_products WHERE productID=24 AND productDeleted IS NULL LIMIT 1
[0] SELECT promoID FROM perch3_shop_order_promotions WHERE orderID=28
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you create a member successfully?

Yes, an order will create a member and I can manually create a member via Perch Admin. There are no fields for Address details, though.

The form uses this template: /addons/apps/perch_members/templates/members/member.html

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right, the address is stored as part of the customer record in the shop. You want to use the shop/checkout/customer_create.html template.

Which form function are you using? Have you tried following the examples in the docs?

I followed the passwordless example in the docs, I'm using:

perch_shop_edit_address_form(false, [ 'template' => 'checkout/customer_create_passwordless.html', ]);
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so where are you using templates/members/member.html ?

Oh, apologies for the confusion, I'm not using it, it's the form used on the Perch Admin Members page.

I was just wondering if the address should show on that template, as it doesn't on mine.

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, it shouldn't. The Members app is used for authentication accounts. Any information about the customer is stored against a Customer object in the Shop app.

I actually believe I fixed this by deleting and re-adding the perch folder and running setup again. Then adding my templates back in.