Forum

Thread tagged as: Problem, Error, Shop

Fatal error on shop checkout

Hi there,

My shop has been working fine today until today. When I click pay with paypal or pay via cheque I get this fatal error

( ! ) Fatal error: Uncaught Error: Call to a member function memberID() on boolean in /Users/Barry/Sites/bigblueswim/admin/addons/apps/perch_shop/lib/PerchShop_Order.class.php on line 299
( ! ) Error: Call to a member function memberID() on boolean in /Users/Barry/Sites/bigblueswim/admin/addons/apps/perch_shop/lib/PerchShop_Order.class.php on line 299
Call Stack
#   Time    Memory  Function    Location
1   0.0012  373272  {main}( )   .../start.php:0
2   0.2559  4721192 include( '/Users/Barry/Sites/bigblueswim/admin/templates/pages/shop/checkout.php' ) .../start.php:32
3   0.2560  4721728 perch_shop_checkout( )  .../checkout.php:37
4   0.2560  4721728 PerchShop_Runtime->checkout( )  .../cart.php:182
5   0.3431  4875368 PerchShop_Orders->create_from_cart( )   .../PerchShop_Runtime.class.php:552
6   1.2711  5648016 Perch->event( ) .../PerchShop_Orders.class.php:84
7   1.2714  5653320 PerchShop_Events::order_status( )   .../Perch.class.php:228
8   1.3138  5689784 PerchShop_Order->send_order_email( )    .../PerchShop_Events.class.php:25

Here is my DEBUG

Debug Message
[32] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /shop/checkout, so not using routes.
Using master page: /templates/pages/shop/checkout.php
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='31c1c10de4685ca4a376c02b6931a13f3fe69b5d' AND sessionHttpFootprint='a38673fec9a8955dc9f50097d7cddf9b141fa821' AND sessionExpires>'2016-11-03 17:48:53' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/shop/checkout' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=220
[1] SELECT * FROM perch2_shop_cart WHERE cartID=220
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
[19] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/checkout' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-008-001', '000-008', '000') ORDER BY pageTreePosition DESC
[8] Using template: /templates/navigation/item.html
Using cart from cache.
[1] SELECT * FROM perch2_shop_products WHERE productID=64 AND productDeleted IS NULL LIMIT 1
[5] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=64 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch2_shop_options o, perch2_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=64 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[5] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch2_shop_product_option_values pov, perch2_shop_options o, perch2_shop_option_values ov WHERE pov.productID='64' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[48] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] Using template: /templates/shop/cart/cart_static.html
[1] SELECT cartProperties FROM perch2_shop_cart WHERE cartID=220
[3] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/checkout' OR regionPage='*' ORDER BY regionPage DESC
Using template: /addons/apps/perch_shop/templates/shop/gateways/stripe_payment_form.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer' LIMIT 1
[7] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=1 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=1 AND p.pagePath='/shop/checkout' LIMIT 1
[7] Using template: /templates/navigation/footer.html
Request time: 0.6662
Process time: 0.662
Memory: 5.0959

This is my checkout out page

<?php

    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/shop/register');
    }

    //PerchUtil::hold_redirects();
    $url = "https://$_SERVER[HTTP_HOST]";

    // your 'success' and 'failure' URLs
    $return_url = $url.'/shop/result';
    $cancel_url = $url.'/bookings';

    if (perch_member_logged_in() && perch_post('stripeToken')) {

        perch_shop_checkout('stripe', [
            'return_url' => $return_url,
            'cancel_url' => $cancel_url,
            'token'      => perch_post('stripeToken')
        ]);

    }

    if (perch_member_logged_in() && isset($_POST["paypal"])) {

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

    }

    if (perch_member_logged_in() && isset($_POST["cheque"])) {

        perch_shop_checkout('manual', [
            'return_url' => $return_url,
            'cancel_url' => $cancel_url,
        ]);

    }

    // Include the header. You can find this in tempates/layouts/global
    perch_layout('global/header');
?>

    <div class="canvas">

        <?php
            // Show the cart with a non-interactive template
            perch_shop_cart([
                'template'=>'cart/cart_static.html'
            ]);

        ?>

            <div class="content  clear  row  top--sm">

                <?php
                    // Have T&Cs been agreed to?
                    if (!perch_shop_cart_has_property('terms_agreed')) {

                        perch_content('T&Cs confirm');

                        // Display the form with the T&Cs checkbox
                        perch_shop_form('checkout/confirm.html');

                    } else {

                        perch_content('T&Cs pre payment');
                ?>

                <div class="clear block  bottom--sm">

                    <div class="left right-p--md">
                        <?php
                            // Display the form with the T&Cs checkbox
                            perch_shop_payment_form('stripe');
                        ?>
                    </div>

                    <div class="left right-p--md">
                        <p class="block  b300-it primary epsilon">
                            or
                        </p>
                    </div>

                    <form action="" method="post" class="left">
                        <button name="paypal" value="true" class="button"><img src="/assets/img/PayPal-Express-btn.png" alt="Check out with PayPal" /></button>
                    </form>

                </div>

                <form action="" method="post" class="block">
                    <button name="cheque" value="true" class="button epsilon b300 primary  hover--secondary"><i class="v-align-middle  icon-arrow-right-c"></i> Click here if you want to pay via cheque</button>
                </form>

                <?php } ?>

            </div>

        <?php
            // Include the footer. You can find this in tempates/layouts/global
            perch_layout('global/footer');
        ?>

    </div> <!-- Closes Canvas Div -->

    <script src="/assets/build/js/main.min.js"></script>

</body>
</html>

And this is my Diagnostic report

HEALTH CHECK

Perch Runway is up to date
PHP 7.0.12 is up to date
MySQL 5.5.5-10.0.28-MariaDB is up to date
Image processing available

SUMMARY INFORMATION

Perch Runway: 2.8.32, PHP: 7.0.12, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0), 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)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_members', 'perch_shop', );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/Barry/Sites/bigblueswim/admin
PERCH_CORE: /Users/Barry/Sites/bigblueswim/admin/core
PERCH_RESFILEPATH: /Users/Barry/Sites/bigblueswim/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: bigblue.swim
DOCUMENT_ROOT: /Users/Barry/Sites/bigblueswim
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Thanks

Fishtank Creative

Fishtank Creative 2 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you still logged in?

I logged out and in again. I still get that error.

There is nothing in the logs except for this which I think is unrelated

[03-Nov-2016 17:44:59 UTC] PHP Notice:  Use of undefined constant PERCH_SHOP_VERSION - assumed 'PERCH_SHOP_VERSION' in /home/thebigbl/public_html/newsite/admin/addons/apps/perch_shop_orders/admin.php on line 3

I got this sorted by clearing out all members from the admin system and basically started again.