Forum

Thread tagged as: Shop

Blank page on checkout

OK, so now on the the next problem! The checkout page was all working fine until I rejigged how I dealt with the addresses for the shop, now though I get a 500 error. There is nothing in my error log.

It is all down to the checkout function (basically if I remove this the page renders just fine):

$return_url = 'https://sgs.localhost/shop/result.php?s=order-success';
$cancel_url = 'https://sgs.localhost/shop/result.php?s=order-cancelled';
    perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);

The only thing I changed with regards to that since messing with my address collection was to change the urls to result.php instead of re-using checkout.php. What could be causing the error? I have read on the forums that some people got this error when the shipping was not set up, but I have this set up and it shows correctly in the cart. Maybe once entering the address it screws the shipping up? The address is within the shipping zone of the carrier. CountryID for the address is 236 which is United Kingdom (a selected country within the zone).

Could something about my address collection be screwing with the checkout? Or is it somethign completely different?

Lisa Morena

Lisa Morena 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I get a 500 error. There is nothing in my error log.

Sounds like you don't have error logging enabled, or you're looking at the wrong log somehow.

You are totally right. Did think it was odd. The site is a virtual site on my WAMP and the error log accessed through the control panel was not the one for the site!

Anyway, so this is what it says:

[Tue Oct 18 11:14:03.692383 2016] [:error] [pid 11540:tid 1588] [client 127.0.0.1:54323] PHP Fatal error: Call to a member function memberID() on boolean in C:\UniServerZ\www\sgs.localhost\perch\addons\apps\perch_shop\lib\PerchShop_Order.class.php on line 299, referer: https://sgs.localhost/shop/address.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you checking that the member is logged in before sending them to checkout?

Yes, at the top of the checkout.php I have

if (!perch_member_logged_in()) {
        PerchSystem::redirect('/members/');
    }
$return_url = 'https://sgs.localhost/shop/result.php?s=order-success';
$cancel_url = 'https://sgs.localhost/shop/result.php?s=order-cancelled';
if (perch_shop_addresses_set()) {
if (perch_shop_cart_has_property('terms_agreed')) {
    perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);
}
}

Perch doesn't redirect, so it does seem to think the user is logged in but just shows a blank page

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are sessions otherwise persisting ok?

What's the URL when you get the error?

https://sgs.localhost/checkout.php

Yes, if I click the back button, I am still logged in and the cart is till full, etc. Not had any problems with that.

If I change the if statement on checkout.php to redirect if I AM logged in it does redirect as it should, so it seems to know I am logged in even though it apparently says it doesn't know the member ID.

Drew McLellan

Drew McLellan 2638 points
Perch Support

So you never get to either of your result pages?

Does the call to checkout come before any HTML is output?

No I never get to result.php.

Yes, the code above just comes after the perch runtime include - no HTML before it.

It was working before I faffed with the addresses and checkout flow but now I get nothing!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is it the same error generated each time?

Yup :(

I just put

echo perch_member_get('memberID');

before perch_shop_checkout() and I get 1 which is the correct member ID.

What does Fatal error: Call to a member function memberID() on boolean mean exactly? Obviously not that it can't retrieve the member ID.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's trying to get the member ID from the customer, but the customer object is false.

If you output anything before the perch_shop_checkout() function call, it will not work.

There is nothing being output before it. I just did it as a test to make sure member ID was being passed to the page.

I just don't get why it is returning false. I am going to try and bypass my address pages to see if it works going straight from cart to checkout

Hmm, well that made no difference! This is very frustrating as it was working at one point before I added all the address stuff and the conditionals before perch_shop_checkout! If it won't work bypassing the new address stuff and without the conditionals, I am running out of ideas...

Is there someway we can get more information about what is going wrong and where beyond the error log?

Diagnostics

    Perch: 2.8.32
    Production mode: Production (100)
    Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_forms (1.8.3), perch_shop_orders (1.0.9), perch_shop_products (1.0.9), perch_shop (1.0.9), perch_members (1.5)
    DB driver: PDO
    DB tables: perch2_categories (3), perch2_category_counts (0), perch2_category_sets (1), perch2_content_index (0), perch2_content_items (11), perch2_content_regions (1), perch2_forms (4), perch2_forms_responses (1), perch2_members (2), perch2_members_forms (0), perch2_members_member_tags (0), perch2_members_sessions (4), perch2_members_tags (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (0), perch2_pages (1), perch2_resource_log (45), perch2_resource_tags (0), perch2_resources (11), perch2_resources_to_tags (0), perch2_settings (25), perch2_shop_addresses (0), perch2_shop_admin_index (30), perch2_shop_brands (1), perch2_shop_cart (12), perch2_shop_cart_data (84), perch2_shop_cart_items (12), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (2), perch2_shop_emails (3), perch2_shop_index (606), perch2_shop_option_values (0), perch2_shop_options (0), perch2_shop_order_items (158), perch2_shop_order_promotions (0), perch2_shop_order_statuses (9), perch2_shop_orders (75), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (0), perch2_shop_product_options (0), perch2_shop_product_tags (0), perch2_shop_products (8), perch2_shop_promotions (0), perch2_shop_search (8), perch2_shop_shipping_zone_countries (4), perch2_shop_shipping_zones (1), perch2_shop_shippings (1), perch2_shop_tax_exhibits (87), perch2_shop_tax_group_rates (1), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (0), perch2_shop_variants (0), perch2_user_passwords (0), perch2_user_privileges (69), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
    Users: 1
    App runtimes:

    <?php
        $apps_list = array(
            'content', 
            'categories',
            'perch_forms',
    'perch_members',
    'perch_shop',
        );

    Editor plug-ins: ckeditor, markitup, redactor
    H1: 5238654cba3af19af8b40d479727ac50
    L1: 631c421152c1f13dd7654cb910052040
    F1: 2edba60ed1f613d6dd804feb202456a2
    headerColour: #ffffff
    content_singlePageEdit: 1
    helpURL:
    siteURL: /
    hideBranding: 0
    content_collapseList: 1
    lang: en-gb
    update_2.8.31: done
    latest_version: 2.8.15
    on_sale_version: 2.8.32
    perch_members_update: 1.4
    update_2.8.32: done
    perch_shop_update: 1.0.9
    headerScheme: light
    perch_members_login_page: /members/login.php?r={returnURL}
    perch_shop_price_tax_mode: inc
    perch_shop_site_url:
    perch_shop_product_url: /shop/{slug}
    perch_shop_default_currency: 47
    perch_shop_reporting_currency: 47
    perch_shop_invoice_number_format: Invoice%d
    dashboard: 0
    hide_pwd_reset: 0
    content_hideNonEditableRegions: 0
    content_frontend_edit: 0
    PERCH_DEVELOPMENT: 10
    PERCH_STAGING: 50
    PERCH_PRODUCTION: 100
    PERCH_DB_USERNAME: root
    PERCH_DB_SERVER: localhost
    PERCH_DB_DATABASE: my_cms
    PERCH_DB_PREFIX: perch2_
    PERCH_TZ: Europe/London
    PERCH_EMAIL_FROM: email@test.co.uk
    PERCH_EMAIL_FROM_NAME: Lisa Morena
    PERCH_LOGINPATH: /my_cms
    PERCH_PATH: C:\UniServerZ\www\sgs.localhost\my_cms
    PERCH_CORE: C:\UniServerZ\www\sgs.localhost\my_cms\core
    PERCH_RESFILEPATH: C:\UniServerZ\www\sgs.localhost\my_cms\resources
    PERCH_RESPATH: /my_cms/resources
    PERCH_HTML5: 1
    PERCH_RUNWAY:
    PERCH_ERROR_MODE: DIE
    PERCH_DATE_LONG: %d %B %Y
    PERCH_DATE_SHORT: %d %b %Y
    PERCH_TIME_SHORT: %H:%M
    PERCH_TIME_LONG: %H:%M:%S
    PERCH_RUNWAY_ROUTED:
    PERCH_STRONG_PASSWORDS:
    PERCH_DEBUG:
    PERCH_PREVIEW_ARG: preview
    PERCH_TEMPLATE_PATH: C:\UniServerZ\www\sgs.localhost\my_cms\templates
    PERCH_DEFAULT_DOC: index.php
    PERCH_DEFAULT_EXT: .php
    PERCH_PRODUCTION_MODE: 100
    PERCH_RWD:
    PERCH_HTML_ENTITIES:
    PERCH_SSL:
    PERCH_STRIPSLASHES:
    PERCH_PROGRESSIVE_FLUSH: 1
    PERCH_PARANOID:
    PERCH_FORCE_SECURE_COOKIES:
    PERCH_PASSWORD_MIN_LENGTH: 6
    PERCH_MAX_FAILED_LOGINS: 10
    PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
    PERCH_VERIFY_UPLOADS:
    PERCH_AUTH_PLUGIN:
    PERCH_DB_CHARSET: utf8
    PERCH_DB_PORT:
    PERCH_DB_SOCKET:
    PERCH_SESSION_TIMEOUT_MINS: 20
    PERCH_SHOP_VERSION: 1.0.9
    PERCH_APPS_EDITOR_PLUGIN: markitup
    PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile

Hosting settings

    PHP: 5.6.19
    Zend: 2.6.0
    OS: WINNT
    SAPI: apache2handler
    Safe mode: not detected
    MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
    MySQL server: 5.6.28
    Free disk space: 455.86 GB
    Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, openssl, SimpleXML, wddx, xml, xmlreader, xmlwriter, apache2handler, curl, fileinfo, gd, intl, mbstring, exif, mysql, mysqli, Phar, pdo_mysql, sockets, xmlrpc, com_dotnet, mhash
    GD: Yes
    ImageMagick: No
    PHP max upload size: 20M
    PHP max form post size: 25M
    PHP memory limit: 128M
    Total max uploadable file size: 20M
    Resource folder writeable: Yes
    Session timeout: 24 minutes
    Native JSON: Yes
    Filter functions: Yes
    Transliteration functions: Yes
    HTTP_HOST: sgs.localhost
    HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
    HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.5
    HTTP_ACCEPT_ENCODING: gzip, deflate
    HTTP_REFERER: https://sgs.localhost/my_cms/core/settings/diagnostics/
    HTTP_COOKIE: cookieconsent_dismissed=yes; p_m=a78018689cf229354f5b47682209705d725fcd16; cmsa=1; PHPSESSID=9gf7gq6nhqlno8o51rml07fld0
    HTTP_CONNECTION: keep-alive
    HTTP_UPGRADE_INSECURE_REQUESTS: 1
    PATH: C:\UniServerZ\core\apache2\bin;C:\UniServerZ\core\mysql\bin;C:\UniServerZ\core\php56;C:\UniServerZ\core\openssl;C:\UniServerZ\core\msmtp;C:\UniServerZ\utils;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\ZipGenius 6\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Windows Live\Shared
    SystemRoot: C:\Windows
    COMSPEC: C:\Windows\system32\cmd.exe
    PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    WINDIR: C:\Windows
    SERVER_SOFTWARE: Apache
    SERVER_NAME: sgs.localhost
    SERVER_ADDR: 127.0.0.1
    SERVER_PORT: 80
    REMOTE_ADDR: 127.0.0.1
    DOCUMENT_ROOT: C:/UniServerZ/www/sgs.localhost
    REQUEST_SCHEME: http
    CONTEXT_DOCUMENT_ROOT: C:/UniServerZ/www/sgs.localhost
    SERVER_ADMIN: email@test.co.uk
    SCRIPT_FILENAME: C:/UniServerZ/www/sgs.localhost/my_cms/core/settings/diagnostics/index.php
    REMOTE_PORT: 50059
    GATEWAY_INTERFACE: CGI/1.1
    SERVER_PROTOCOL: HTTP/1.1
    REQUEST_METHOD: GET
    QUERY_STRING: extended
    REQUEST_URI: /my_cms/core/settings/diagnostics/?extended
    SCRIPT_NAME: /my_cms/core/settings/diagnostics/index.php
    PHP_SELF: /my_cms/core/settings/diagnostics/index.php
    REQUEST_TIME_FLOAT: 1476874100.33
    REQUEST_TIME: 1476874100


Oh well, this is interesting: I created a new member and tried it all out and it works fine! Maybe my deleting the customer addresses from the database while faffing with the whole address set up screwed up the member / customer relationship??

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's very possible.