Forum

Thread tagged as: Error, Shop

Error at checkout

Working on a local server and developing Shop, I get the following when I click "Checkout."

I did delete all members soon before the result below.

PHP Fatal error: Call to a member function to_array() on boolean in /Applications/MAMP/htdocs/lgoose/perch/addons/apps/perch_shop/lib/PerchShop_Order.class.php on line 323

Line 323 is:

$Email->set_bulk($Member->to_array());

Diagnostics Report:

      Summary information

    Perch Runway: 3.1.2, PHP: 5.6.28, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
    Server OS: Darwin, apache2handler
    Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.12), perch_gallery (2.8.9), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4)
    App runtimes: <?php $apps_list = [ 'content', 'categories', 'perch_members', 'perch_shop', 'perch_blog', 'perch_forms', 'perch_gallery', 'perch_events', ];
    PERCH_LOGINPATH: /perch
    PERCH_PATH: /Applications/MAMP/htdocs/lgoose/perch
    PERCH_CORE: /Applications/MAMP/htdocs/lgoose/perch/core
    PERCH_RESFILEPATH: /Applications/MAMP/htdocs/lgoose/perch/resources
    Image manipulation: GD
    PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
    F1: 3b606135b33e6a102526838f4152a807
    Resource folder writeable: Yes
    HTTP_HOST: lgoose.loc
    DOCUMENT_ROOT: /Applications/MAMP/htdocs/lgoose
    REQUEST_URI: /perch/core/settings/diagnostics/
    SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

The checkout page:

<?php
//Section below is the perch-supplied set-up for manual processing
    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/shop/checkout');
    }

//The following was the default entry   
/*
    if (perch_shop_cart_has_property('terms_agreed')) {
        perch_shop_checkout('manual', [
        'return_url' => '/shop/result',
        'cancel_url' => '/shop',
        ]);
}
*/
//End default entry 

//Following  are from Perch Documentation for Paypal Express
if (perch_member_logged_in()) {

  //your 'success' return URL
  $return_url = 'https://staging.lonegoosepress.com/payment';
  $cancel_url = 'https://staging.lonegoosepress.com/index.php/';

  perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);
}
//End part 1 of PayPal Express from documentation
//The following is part 2 from documentation
 perch_shop_complete_payment('paypal-express');

  if (perch_shop_order_successful()) {
      echo '<h1>Thank you for your order!</h1>';
    }else{
      echo '<h1>Sorry!</h1>';
    }
//End part 2 of documentation

    perch_layout('global.above', array(
            'title'           => perch_page_title(true),
            'section_heading' => 'shop',
        ));


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

    // Show the order addresses
    perch_shop_order_addresses();

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

    perch_layout('shop.sidebar', array(
            'promo' => false,
            'shipping' => false,
            'currency' => false,
            'minicart' => false,
            'social' => false,
        ));

    perch_layout('global.below');
?>
John Rose

John Rose 6 points

  • 2 years ago

Hi John

I don't know a specific fix here but the first things I would check are:

  • Are you logged in as a member and does that member still exist?
  • Does the product you have in the cart still exist?

These can cause shop errors.

Jon

Drew McLellan

Drew McLellan 2638 points
Perch Support

It certainly sounds like your user isn't logged in.