Perch Shop Checkout Localhost vs. Hosting
I've got an issue where my checkout experience works as it should on localhost but not when I upload files to my hosting provider.
I have implemented a no password, no payment flow with customer_create_passwordless.html
and the manual
payment gateway.
I use customer_create_passwordless.html
form to register the user and have added next="/shop-checkout"
to the form to take the user to my checkout page on submission.
The checkout page only contains the perch_shop_checkout()
function:
<?php
if (perch_member_logged_in()) {
// your 'success' return URL
$return_url = '/order-complete';
$cancel_url = '/basket';
perch_shop_checkout('manual', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
} else {
echo '<h1>Not logged in</h1>';
}
?>
On localhost it works as it should, completes the order and redirects to the return url. However after I ftp files to hosted server, when I checkout I always get 'Not logged in' on shop-checkout.php
as it does not appear to login the user after submitting the customer_create_passwordless.html
form.
Is there anything obvious I need to do between testing locally and on external server?
What's different between the servers?
I'd have to ask my hosts. Is there some info that I can provide them which might help diagnose the problem. i.e. how is the user logged in, is it php sessions? Obviously they will be unfamiliar with Perch therefore it would be helpful to explain in the most basic terms what I am trying to achieve and how it might be supported on their server
Yes you will need sessions enabled.
Has this server passed the compatibility test?
Yes compatibility test passed on this sever, so maybe not to do with sessions?
Are the dev and live servers on the same platform?
I would assume so but I can contact support to make sure. I'm developing locally on MAMP and the host is basic shared hosting with www.lcn.com.
I contacted them yesterday and they confirmed that sessions are enabled by default and since then when I checkout a Customer is created but the Order is not created?
Can test by checking out from here (after adding a Fabric swatch to basket): https://test-chase-erwin-com.php5.hostingweb.co.uk/basket
My
shop-checkout.php
page is this:But for some reason
perch_shop_checkout()
is not being called? This still works as it should when testing locally, but not on the hosted server.So you're saying that a basic test of
perch_member_logged_in()
is failing on this server?perch_member_logged_in()
is now working and the Customer is created, but no Order is created so it appearsperch_shop_checkout()
is failing on this server.After adding debug to the checkout page I can see there is an error with the Address and Shipping missing? Since I am using
customer_create_passwordless.html
to create the Customer and then initiate the Checkout by usingnext="/shop-checkout"
on that create customer form, is there something I need to do to associate the address added to that form, with the Order address? Again, this all works locally, but is maybe causing the issue on the server?Which version of Shop are you running?
Perch Shop 1.0.8
I think we may have addressed the issue you're seeing in Shop 1.0.9, but it'll apply to new setups of the shop.
How do you mean new setups? As in new installs going forward, or I can update and it may fix?
It's to do with how the database tables are created.
Do you have the shop loaded up with a lot of data?
30 pages of products...
How many per page?
Admin page - 24 x 30 around 720 products
Ok, so you'll need to edit the existing tables. I'll see if we can put together some sort of update script.
Ok thanks Drew. So I hold fire on updating?
This is the last remaining item before go-live, do you have any indication of how long it might take so I can manage my clients expectations?
You can update - if I'm able to create an update script for it, it will be as part of the next release.