Forum

Thread tagged as: Problem, Error, Shop

Shipping Zone - Cart Error

We have two Perch Shop sites that had been working with shipping prior to Perch Shop 1.0, but since updating we are experiencing some problems with Zones. In the Perch documentation it says to setup a default zone, which we have done, to enable shipping calculations and as soon as we do, the shipping calculations fail. We can't get shipping without zones, but with the zone, an exception is thrown. Creating a zone works fine.

Error

Notice: Undefined index: zones in /var/www/vhosts/www.lyndenhouse.net/public/admin/addons/apps/perch_shop/lib/PerchShop_Shippings.class.php on line 32

...

$shipping =
array (size=37)
  'title' => string 'Purolator' (length=9)
  'slug' => string 'purolator' (length=7)
  'company' => string 'Purolator' (length=9)
  'description' => 
    array (size=3)
      '_flang' => string 'markdown' (length=8)
      'raw' => string '' (length=0)
      'processed' => string '' (length=0)
  'price' => 
    array (size=1)
      26 => string '15.25' (length=5)
  'price_min' => 
    array (size=1)
      26 => string '1' (length=1)
  'price_max' => 
    array (size=1)
      26 => string '' (length=0)
  'tax_group' => string '1' (length=1)
  'weight_min' => string '1' (length=1)
  'weight_max' => string '500' (length=3)
  'width_max' => string '20' (length=2)
  'height_max' => string '20' (length=2)
  'depth_max' => string '20' (length=2)
  'status' => string '1' (length=1)
  'shippingID' => string '2' (length=1)
  'shippingTitle' => string 'Purolator' (length=9)
  'shippingSlug' => string 'purolator' (length=7)
  'shippingDynamicFields' => string '{"title":"Purolator","slug":"hahahah","company":"Purolator","description":{"_flang":"markdown","raw":"","processed":""},"price":{"26":"15.25"},"price_min":{"26":"1"},"price_max":{"26":""},"tax_group":"1","weight_min":"1","weight_max":"500","width_max":"20","height_max":"20","depth_max":"20","status":"1"}' (length=305)
  'shippingCreated' => string '2015-12-16 16:02:15' (length=19)
  'shippingUpdated' => string '2016-04-15 16:14:09' (length=19)
  'shippingDeleted' => null
  'perch_title' => string 'Purolator' (length=9)
  'perch_slug' => string 'purolator' (length=7)
  'perch_company' => string 'Purolator' (length=9)
  'perch_description' => 
    array (size=3)
      '_flang' => string 'markdown' (length=8)
      'raw' => string '' (length=0)
      'processed' => string '' (length=0)
  'perch_price' => 
    array (size=1)
      26 => string '15.25' (length=5)
  'perch_price_min' => 
    array (size=1)
      26 => string '1' (length=1)
  'perch_price_max' => 
    array (size=1)
      26 => string '' (length=0)
  'perch_tax_group' => string '1' (length=1)
  'perch_weight_min' => string '1' (length=1)
  'perch_weight_max' => string '500' (length=3)
  'perch_width_max' => string '20' (length=2)
  'perch_height_max' => string '20' (length=2)
  'perch_depth_max' => string '20' (length=2)
  'perch_status' => string '1' (length=1)
  'zones' => 
    array (size=0)
      empty
  'sort_price' => string '15.25' (length=5)

Diagnostic Report

Perch: 2.8.29, PHP: 5.6.7-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_forms (1.8.3), perch_shop_orders (1.0), perch_shop_products (1.0), perch_shop (1.0), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_forms', 'perch_shop', );
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/vhosts/www.lyndenhouse.net/public/admin
PERCH_CORE: /var/www/vhosts/www.lyndenhouse.net/public/admin/core
PERCH_RESFILEPATH: /var/www/vhosts/www.lyndenhouse.net/public/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 256M, Max POST 256M, Memory: 512M, Total max file upload: 256M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: lyndenhouse.dev
DOCUMENT_ROOT: /var/www/vhosts/www.lyndenhouse.net/public
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
James Harrison

James Harrison 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which version of the gamma did you update from?

For the one website (Lyndenhouse) we upgraded from Gamma 25, for the other (Ridgetec) we updated from Gamma 33. Hope that helps!

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to update from Gamma 33.

We upgraded from Gamma 33 to version 1 on Ridgetec and that didn't work.

I just tried overwriting Gamma 33 on Lyndenhouse, running the Update-gamma.php (which succeeded), and overwriting with version 1, and we are still getting the same errors.

Any other ideas on what we are missing?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What shipping zones do you have configured?

Just one default shipping zone (in our case, Canada is checked), and it is marked as active. We have two methods of shipping defined as well.

I don't know if this will help, but this is the full error output:

 Notice: Undefined index: zones in /var/www/vhosts/www.lyndenhouse.net/public/admin/addons/apps/perch_shop/lib/PerchShop_Shippings.class.php on line 32
Call Stack
#   Time    Memory  Function    Location
1   0.0002  239944  {main}( )   ../index.php:0
2   0.0006  285736  require( '/var/www/vhosts/www.lyndenhouse.net/app/app.php' )    ../index.php:2
3   0.0026  366720  require_once( '/var/www/vhosts/www.lyndenhouse.net/public/admin/runtime.php' )  ../app.php:4
4   0.0029  373920  include( '/var/www/vhosts/www.lyndenhouse.net/public/admin/core/runtime/runtime.php' )  ../runtime.php:2
5   0.0433  5247616 include( '/var/www/vhosts/www.lyndenhouse.net/public/admin/core/inc/forms.php' )    ../runtime.php:16
6   0.0433  5247696 perch_find_posted_forms( )  ../forms.php:26
7   0.0433  5248232 Perch->dispatch_form( ) ../forms.php:9
8   0.0463  5488544 call_user_func:{/var/www/vhosts/www.lyndenhouse.net/public/admin/core/lib/Perch.class.php:127} ( )  ../Perch.class.php:127
9   0.0463  5489000 perch_shop_form_handler( )  ../Perch.class.php:127
10  0.0481  5668600 PerchShop_Runtime->update_cart_from_form( ) ../forms.php:11
11  0.0481  5646752 PerchShop_Cart->update_from_form( ) ../PerchShop_Runtime.class.php:437
12  0.0507  5862312 PerchShop_Cart->recalculate_summary_data( ) ../PerchShop_Cart.class.php:451
13  0.0507  5863680 PerchShop_Cart->calculate_cart( )   ../PerchShop_Cart.class.php:242
14  0.0641  6430272 PerchShop_Shippings->find_options_for_cart( )   ../PerchShop_Cart.class.php:739
15  0.0652  6493976 array_filter ( )    ../PerchShop_Shippings.class.php:98
16  0.0652  6494592 PerchShop_Shippings->{closure:/var/www/vhosts/www.lyndenhouse.net/public/admin/addons/apps/perch_shop/lib/PerchShop_Shippings.class.php:27-98}( )   ../PerchShop_Shippings.class.php:98
Variables in local scope (#16)
$Currency =
object(PerchShop_Currency)[33]
  protected 'factory_classname' => string 'PerchShop_Currencies' (length=20)
  protected 'table' => string 'perch2_shop_currencies' (length=22)
  protected 'pk' => string 'currencyID' (length=10)
  protected 'pk_is_int' => boolean true
  protected 'date_fields' => 
    array (size=0)
      empty
  public 'deleted_date_column' => null
  protected 'api' => 
    object(PerchAPI)[12]
      public 'app_id' => string 'perch_shop' (length=10)
      public 'version' => float 1
      private 'Lang' => boolean false
  protected 'db' => 
    object(PerchDB_MySQL)[7]
      private 'link' => 
        object(PDO)[8]
      public 'errored' => boolean false
      public 'error_msg' => boolean false
      public 'dsn' => string 'mysql:host=localhost;dbname=lynden_dev;' (length=39)
  protected 'details' => 
    array (size=11)
      'currencyID' => string '26' (length=2)
      'currencyCode' => string 'CAD' (length=3)
      'currencyNumber' => string '124' (length=3)
      'currencyTitle' => string 'Canadian dollar' (length=15)
      'currencySymbol' => string '$' (length=1)
      'currencySymbolPosition' => string 'before' (length=6)
      'currencyDecimals' => string '2' (length=1)
      'currencyRate' => string '1.0000' (length=6)
      'currencyActive' => string '1' (length=1)
      'currencyIsCommon' => string '1' (length=1)
      'currencyDynamicFields' => string '[]' (length=2)
  protected 'index_table' => boolean false
  protected 'event_prefix' => boolean false
  public 'suppress_events' => boolean true
  protected 'can_log_resources' => boolean true
  protected 'modified_date_column' => boolean false
$Totaliser =
object(PerchShop_CartTotaliser)[35]
  public 'items' => float 18.08
  public 'shipping' => int 0
  public 'tax' => float 0.904
  public 'shipping_tax' => int 0
  public 'discounts' => int 0
  public 'discounts_tax' => int 0
  public 'shipping_discounts' => int 0
  public 'shipping_discounts_tax' => int 0
  public 'weight' => int 4
  public 'width' => string '3' (length=1)
  public 'height' => string '3' (length=1)
  public 'depth' => string '3' (length=1)
  public 'shippable_items' => int 1
  public 'tax_rate_totals' => 
    array (size=1)
      '5.00' => 
        array (size=2)
          'items' => float 18.08
          'tax' => float 0.904
  public 'grand_total' => float 18.984
$Zone =
object(PerchShop_ShippingZone)[37]
  protected 'table' => string 'perch2_shop_shipping_zones' (length=26)
  protected 'pk' => string 'zoneID' (length=6)
  protected 'event_prefix' => string 'shop.shipping_zone' (length=18)
  protected 'duplicate_fields' => 
    array (size=4)
      'zoneTitle' => string 'title' (length=5)
      'zoneSlug' => string 'slug' (length=4)
      'zoneActive' => string 'status' (length=6)
      'zoneIsDefault' => string 'zoneIsDefault' (length=13)
  protected 'pk_is_int' => boolean true
  protected 'date_fields' => 
    array (size=0)
      empty
  public 'deleted_date_column' => null
  protected 'api' => 
    object(PerchAPI)[12]
      public 'app_id' => string 'perch_shop' (length=10)
      public 'version' => float 1
      private 'Lang' => boolean false
  protected 'db' => 
    object(PerchDB_MySQL)[7]
      private 'link' => 
        object(PDO)[8]
      public 'errored' => boolean false
      public 'error_msg' => boolean false
      public 'dsn' => string 'mysql:host=localhost;dbname=lynden_dev;' (length=39)
  protected 'details' => 
    array (size=9)
      'zoneID' => string '2' (length=1)
      'zoneTitle' => string 'Canada' (length=6)
      'zoneSlug' => string 'canada' (length=6)
      'zoneIsDefault' => string '1' (length=1)
      'zoneActive' => string '1' (length=1)
      'zoneDynamicFields' => string '{"title":"Canada","slug":"canada","description":{"_flang":"markdown","raw":"","processed":""},"status":"1","countries":["39"]}' (length=126)
      'zoneCreated' => string '2016-04-18 19:36:18' (length=19)
      'zoneUpdated' => string '2016-04-18 19:36:18' (length=19)
      'zoneDeleted' => null
  protected 'index_table' => boolean false
  public 'suppress_events' => boolean true
  protected 'can_log_resources' => boolean true
  protected 'modified_date_column' => boolean false
$shipping =
array (size=37)
  'title' => string 'Canada Post' (length=11)
  'slug' => string 'canada-post' (length=11)
  'company' => string 'Canada Post' (length=11)
  'description' => 
    array (size=3)
      '_flang' => string 'markdown' (length=8)
      'raw' => string '' (length=0)
      'processed' => string '' (length=0)
  'price' => 
    array (size=1)
      26 => string '12.00' (length=5)
  'price_min' => 
    array (size=1)
      26 => string '0.00' (length=4)
  'price_max' => 
    array (size=1)
      26 => string '' (length=0)
  'tax_group' => string '1' (length=1)
  'weight_min' => string '0' (length=1)
  'weight_max' => null
  'width_max' => null
  'height_max' => null
  'depth_max' => null
  'status' => string '1' (length=1)
  'shippingID' => string '4' (length=1)
  'shippingTitle' => string 'Canada Post' (length=11)
  'shippingSlug' => string 'canada-post' (length=11)
  'shippingDynamicFields' => string '{"title":"Canada Post","slug":"canada-post","company":"Canada Post","description":{"_flang":"markdown","raw":"","processed":""},"price":{"26":"12.00"},"price_min":{"26":"0.00"},"price_max":{"26":""},"tax_group":"1","weight_min":"0","weight_max":null,"width_max":null,"height_max":null,"depth_max":null,"status":"1"}' (length=315)
  'shippingCreated' => string '2016-04-18 19:35:07' (length=19)
  'shippingUpdated' => string '2016-04-18 13:35:32' (length=19)
  'shippingDeleted' => null
  'perch_title' => string 'Canada Post' (length=11)
  'perch_slug' => string 'canada-post' (length=11)
  'perch_company' => string 'Canada Post' (length=11)
  'perch_description' => 
    array (size=3)
      '_flang' => string 'markdown' (length=8)
      'raw' => string '' (length=0)
      'processed' => string '' (length=0)
  'perch_price' => 
    array (size=1)
      26 => string '12.00' (length=5)
  'perch_price_min' => 
    array (size=1)
      26 => string '0.00' (length=4)
  'perch_price_max' => 
    array (size=1)
      26 => string '' (length=0)
  'perch_tax_group' => string '1' (length=1)
  'perch_weight_min' => string '0' (length=1)
  'perch_weight_max' => null
  'perch_width_max' => null
  'perch_height_max' => null
  'perch_depth_max' => null
  'perch_status' => string '1' (length=1)
  'zones' => 
    array (size=0)
      empty
  'sort_price' => string '12.00' (length=5)

We finally figured it out Drew - the shipping template price id had changed somewhere along the way and we hadn't updated it's name in the templates!

type="shop_currency_value"

became

type="shop_shipping_price"

Sorry for the trouble!