Forum

Thread tagged as: Problem, Shop

Tax Location not Setting

Hello,

We've been in the process of bringing our first Perch Shop website live. Currently, most of the checkout process is complete, with exception for proper tax calculations.

In the backend, we have a couple Tax locations setup, but the front-end form for selecting a Tax location doesn't seem to work.

Here's the IF statement for the checkout page:

                if(!perch_member_logged_in())
                {
                    perch_shop_registration_form(array('template'=> 'checkout/customer_create_passwordless.html'));
                }
                else if (!perch_shop_addresses_set())
                {
                    perch_shop_customer_addresses();
                    perch_shop_order_address_form();
                }
                else if (!perch_shop_location_selected()) {
                    perch_shop_location_form();
                }
                else
                {
                    perch_shop_customer_addresses();
                    perch_shop_cart([
                        'template' => 'cart/cart_overview.html'
                        ]);
                    //...
                }

When the location form submits, it returns to the same page, with the correct value selected; but it still shows the location selection form; which means the perch_shop_location_selected returned false - so there's no location selected.

Is the call order correct here? Or would we have to do the registration form before the location selection?

Here's the basic diagnostic:


Perch: 2.8.29, PHP: 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, 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.6), perch_shop_products (1.0.6), perch_shop (1.0.6), perch_members (1.5) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_members', 'perch_shop' ); PERCH_LOGINPATH: /admin PERCH_PATH: /var/www/vhosts/www.thesite.com/httpdocs/admin PERCH_CORE: /var/www/vhosts/www.thesite.com/httpdocs/admin/core PERCH_RESFILEPATH: /var/www/vhosts/www.thesite.com/httpdocs/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: site.dev DOCUMENT_ROOT: /var/www/vhosts/www.thesite.com/httpdocs REQUEST_URI: /admin/core/settings/diagnostics/ SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Thanks in advance for any assistance!

James Harrison

James Harrison 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the tax location not already being set from the address?

It doesn't seem to be, I'm not sure how it would set properly anyway because our Tax Locations are named based on the Provinces here in Canada. So unless there's some sort of comparison made in the Perch code that checks the address Province field against the tax location names, I don't think there would be an automatic association. Is this not correct?

On second thought, which form would be used to set the tax location (besides perch_shop_location_form); the perch_shop_registration_form?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, ok, that would make sense then.

What does debug output when you submit the form?

Debug Message
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='4259c410b7dd7b1c7587bcb931588dbe19ee6825' AND sessionHttpFootprint='93fc1bc5b2fbe08684cd964072d59192c83a252c' AND sessionExpires>'2016-08-10 09:59:58' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/index.php' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[27] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
UPDATE perch2_shop_cart SET locationID='2' WHERE cartID='226'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=2 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch2_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=26 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=226
Tax mode: exc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=226 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=77 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=226
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='7' AND orderID IS NULL AND addressSlug='default'
[1] SELECT z.* FROM perch2_shop_shipping_zones z LEFT JOIN perch2_shop_shipping_zone_countries c ON z.zoneID=c.zoneID WHERE z.zoneActive=1 AND z.zoneDeleted IS NULL AND (c.countryID=39 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[1] SELECT * FROM perch2_shop_shippings WHERE shippingDeleted IS NULL ORDER BY shippingOrder ASC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[2] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
Qualifying shipping method ‘A guy running’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='1' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Default
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[nil] SELECT * FROM perch2_shop_promotions WHERE promoFrom<='2016-08-10 15:59:00' AND promoTo>'2016-08-10 15:59:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
UPDATE perch2_shop_cart SET cartTotalItems='1', cartTotalProducts='1', cartTotalWithTax='283.45', cartTotalWithoutTax='249.95' WHERE cartID='226'
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 AND currencyCode='CAD' LIMIT 1
UPDATE perch2_shop_cart SET currencyID='26' WHERE cartID='226'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[1] SELECT * FROM perch2_shop_cart WHERE cartID=226
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=2 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch2_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=26 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=226
Tax mode: exc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=226 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=77 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=3 AND productDeleted IS NULL LIMIT 1
[2] SELECT productID, productVariantDesc, stock_level FROM perch2_shop_products WHERE parentID=3 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=3 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch2_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] 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='3' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=226
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='7' AND orderID IS NULL AND addressSlug='default'
[1] SELECT z.* FROM perch2_shop_shipping_zones z LEFT JOIN perch2_shop_shipping_zone_countries c ON z.zoneID=c.zoneID WHERE z.zoneActive=1 AND z.zoneDeleted IS NULL AND (c.countryID=39 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[1] SELECT * FROM perch2_shop_shippings WHERE shippingDeleted IS NULL ORDER BY shippingOrder ASC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Qualifying shipping method ‘A guy running’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='1' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Default
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[nil] SELECT * FROM perch2_shop_promotions WHERE promoFrom<='2016-08-10 15:59:00' AND promoTo>'2016-08-10 15:59:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
UPDATE perch2_shop_cart SET cartTotalItems='1', cartTotalProducts='1', cartTotalWithTax='283.45', cartTotalWithoutTax='249.95' WHERE cartID='226'
[5] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/checkout' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Header' AND (regionPage='/checkout' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=67 AND idx.itemRev=1)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[1] Using template: /templates/content/generic_header.html
[1] SELECT billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=226
[2] SELECT locationID, locationTitle FROM perch2_shop_tax_locations ORDER BY locationIsHome DESC, locationIsDefault ASC, locationTitle ASC
Using template: /templates/shop/tax/location_form.html
[1] SELECT * FROM perch2_pages WHERE pagePath='/checkout' LIMIT 1
Using template: /templates/pages/attributes/seo.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Support Grid' AND (regionPage='/support' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=14 AND idx.itemRev=27)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[6] Using template: /templates/content/support_grid.html
[4] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/checkout' LIMIT 1
[1] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-015', '000') ORDER BY pageTreePosition DESC
[6] Using template: /templates/navigation/item.html
[4] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/checkout' LIMIT 1
[1] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-015', '000') ORDER BY pageTreePosition DESC
[4] Using template: /templates/navigation/item_foot.html

Here's the perch2_shop_cart row:

'226', '7', NULL, '26', '2', '1', 'standard', '1', '1', '283.45', '249.95', 'default', 'default', '[]', NULL
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like it's using location 2 - does that seem right?

Yes, the id does change in the database as I submit the form.

ID 2 is for BC, which is correct. Currently we only have 2 Locations setup for testing; here's the values from perch_shop_location_form <perch:showall/>:

perch_page_path : /checkout
locations_list : Alberta|1,BC|2
perch_namespace : perch:shop

On a second note; I just searched through the code for 'location_set_by_user', it's defined and set to false in PerchShop_Runtime.class.php, but doesn't seem to be assigned to another value anywhere else in the code. Could this be the problem?

Drew McLellan

Drew McLellan 2638 points
Perch Support

From what you're saying it sounds like setting the location is working. Is that right?

Setting the location seems to work; but Perch doesn't seem to realize that it's set. perch_shop_location_selected() returns false every time it's called, as the value returned within it (location_set_by_user) is never updated (unless it's being set somewhere in the code where location_set_by_user cannot be found by a plaintext search).

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that's far less worrying. I'll take a look at it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think this should be fixed in 1.0.7 when it's available.