Forum

Thread tagged as: Problem, Error, Shop

Alternate payment method for wholesale error

I'm trying to setup so wholesale orders are processed via the manual method (normal orders will be stripe although this isn't setup yet). Orders are going through successfully for normal orders but wholesale orders get an error and I can't work out why...

This is the code at the top of the checkout page:

<?php
if (!perch_member_logged_in()) {
    PerchSystem::redirect('/shop/register');
}
$wholesale_member = false;
if (perch_member_logged_in() && perch_member_has_tag('wholesale')) {
    $wholesale_member = true;
}
if (perch_shop_cart_has_property('terms_agreed')) {
    if ($wholesale_member) {
        perch_shop_checkout('manual', [
            'return_url' => '/shop/result',
            'cancel_url' => '/shop',
            'status' => 'wholesale_order',
        ]);
    } else {
        perch_shop_checkout('manual', [
            'return_url' => '/shop/result',
            'cancel_url' => '/shop',
        ]);
    }
}
?>

This is the code at the top of the result page:

<?php
$page_result = "";
if (perch_shop_order_successful()) {
    $page_result = "Thank you";
} else {
    $page_result = "Order error";
}
?>

Wholesale orders are returning "Order error" for some reason even though the correct status is applied and the order details are in the backend. The only difference I can see in the backend is in the Tax Evidence tab. The wholesale orders don't have BILL_ADDRESS or SHIP_ADDRESS for some reason?

Debug:

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/result, so not using routes.
Using master page: /templates/pages/shop/result.php
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='3efa2197350006b75416a15ebc30b871e1479b7b' AND sessionHttpFootprint='93fc1bc5b2fbe08684cd964072d59192c83a252c' AND sessionExpires>'2016-12-15 16:28:06' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_orders WHERE orderID=12 AND orderDeleted IS NULL LIMIT 1
Is paid?
[3] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/result' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Website Config' AND (regionPage='/shop/result' 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=4 AND idx.itemRev=2)) 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/website_config.html
UPDATE perch2_shop_cart SET cartPricing='trade' WHERE cartID='52'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 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=11
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=8 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=52
[38] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Tax mode: inc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=52 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=22 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 billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=52
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='11' AND orderID IS NULL AND addressSlug='shipping'
[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=13 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[12] 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)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Standard Shipping (Australia)’
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Express Shipping (Australia)’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='5' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Australia
[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_promotions WHERE promoFrom<='2016-12-15 05:28:00' AND promoTo>'2016-12-15 05:28:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Free Shipping in Australia for orders over $50) qualifies!
This is a free shipping promo
UPDATE perch2_shop_cart SET cartTotalItems='50', cartTotalProducts='1', cartTotalWithTax='137.50', cartTotalWithoutTax='125.00' WHERE cartID='52'
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='account' LIMIT 1
[3] 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=2 AND p.pageNew=0 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=2 AND p.pagePath='/shop/result' LIMIT 1
[3] Using template: /templates/navigation/item.html
Using template: /templates/shop/cart/cart_mini.html
Using template: /templates/search/search-form.html
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-002-009', '000-002', '000') ORDER BY pageTreePosition DESC
Using template: /templates/navigation/level1.html
[4] Using template: /templates/navigation/level2.html
[1] SELECT * FROM perch2_shop_orders WHERE orderID=12 AND orderDeleted IS NULL LIMIT 1
Is paid?
[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=4 AND idx.itemRev=2)) 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/website_config.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer' LIMIT 1
[4] 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 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/result' LIMIT 1
[4] Using template: /templates/navigation/footer-menu.html
Using template: /templates/mailchimp/forms/subscribe.html
Using template: /templates/mailchimp/forms/subscribe.html
Debug Message
[30] 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/result, so not using routes.
Using master page: /templates/pages/shop/result.php
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='3efa2197350006b75416a15ebc30b871e1479b7b' AND sessionHttpFootprint='93fc1bc5b2fbe08684cd964072d59192c83a252c' AND sessionExpires>'2016-12-15 16:28:06' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_orders WHERE orderID=12 AND orderDeleted IS NULL LIMIT 1
Is paid?
[3] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/result' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Website Config' AND (regionPage='/shop/result' 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=4 AND idx.itemRev=2)) 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/website_config.html
UPDATE perch2_shop_cart SET cartPricing='trade' WHERE cartID='52'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_cart WHERE cartID=52
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 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=11
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=8 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=52
[38] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Tax mode: inc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=52 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=22 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 billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=52
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='11' AND orderID IS NULL AND addressSlug='shipping'
[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=13 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[12] 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)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Standard Shipping (Australia)’
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Express Shipping (Australia)’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='5' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Australia
[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_promotions WHERE promoFrom<='2016-12-15 05:28:00' AND promoTo>'2016-12-15 05:28:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Free Shipping in Australia for orders over $50) qualifies!
This is a free shipping promo
UPDATE perch2_shop_cart SET cartTotalItems='50', cartTotalProducts='1', cartTotalWithTax='137.50', cartTotalWithoutTax='125.00' WHERE cartID='52'
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='account' LIMIT 1
[3] 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=2 AND p.pageNew=0 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=2 AND p.pagePath='/shop/result' LIMIT 1
[3] Using template: /templates/navigation/item.html
Using template: /templates/shop/cart/cart_mini.html
Using template: /templates/search/search-form.html
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-002-009', '000-002', '000') ORDER BY pageTreePosition DESC
Using template: /templates/navigation/level1.html
[4] Using template: /templates/navigation/level2.html
[1] SELECT * FROM perch2_shop_orders WHERE orderID=12 AND orderDeleted IS NULL LIMIT 1
Is paid?
[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=4 AND idx.itemRev=2)) 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/website_config.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer' LIMIT 1
[4] 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 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/result' LIMIT 1
[4] Using template: /templates/navigation/footer-menu.html
Using template: /templates/mailchimp/forms/subscribe.html
Using template: /templates/mailchimp/forms/subscribe.html
Request time: 0.1972
Process time: 0.1957
Memory: 6.969

Diagnostics:

Perch Runway: 2.8.32, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, 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), perch_mailchimp (3.0.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_members', 'perch_shop', 'perch_blog', 'perch_mailchimp', );
PERCH_LOGINPATH: /tt_admin
PERCH_PATH: /Users/bradhardinge/Documents/thethinktree/thethinktree/site/production/tt_admin
PERCH_CORE: /Users/bradhardinge/Documents/thethinktree/thethinktree/site/production/tt_admin/core
PERCH_RESFILEPATH: /Users/bradhardinge/Documents/thethinktree/thethinktree/site/production/tt_admin/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: thethinktree.dev
DOCUMENT_ROOT: /Users/bradhardinge/Documents/thethinktree/thethinktree/site/production
REQUEST_URI: /tt_admin/core/settings/diagnostics/
SCRIPT_NAME: /tt_admin/core/settings/diagnostics/index.php
Brad Hardinge

Brad Hardinge 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is wholesale_order a valid status slug? Normally slugs have dashes rather than underscores, so worth checking.

Are you sure? The default 'Payment failed' and 'Partial refund' use underscores.

Ok, so I've worked out where the error is. If I remove the 'status' => 'wholesale', from the following the order goes through successfully.

perch_shop_checkout('manual', [
'status' => 'wholesale',
'return_url' => '/shop/result',
'cancel_url' => '/shop',
]);

I read the posts in this thread (https://forum.grabaperch.com/forum/08-11-2016-account-only-customers-order-status) and realise the newly created status must be above 100, it is. The wholesale status is 500 and it's enabled. I can't work out why perch_shop_order_successful is returning false on the results page?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What does the debug output at this stage now?

This is the debug output on the result page where perch_shop_order_successful is false.

Debug Message
[30] 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/result, so not using routes.
Using master page: /templates/pages/shop/result.php
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='2a13ac5f11e99e32042b199c4d7194903b9fc020' AND sessionHttpFootprint='93fc1bc5b2fbe08684cd964072d59192c83a252c' AND sessionExpires>'2016-12-19 11:18:48' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_orders WHERE orderID=19 AND orderDeleted IS NULL LIMIT 1
Is paid?
[4] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/result' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Website Config' AND (regionPage='/shop/result' 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=4 AND idx.itemRev=2)) 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/website_config.html
UPDATE perch2_shop_cart SET cartPricing='trade' WHERE cartID='82'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 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=22
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=8 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=82
[38] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Tax mode: inc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=82 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=40 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 billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=82
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='22' AND orderID IS NULL AND addressSlug='shipping'
[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=13 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[12] 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)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Standard Shipping (Australia)’
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Express Shipping (Australia)’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='5' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Australia
[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_promotions WHERE promoFrom<='2016-12-19 00:18:00' AND promoTo>'2016-12-19 00:18:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Free Shipping in Australia for orders over $50) qualifies!
This is a free shipping promo
UPDATE perch2_shop_cart SET cartTotalItems='50', cartTotalProducts='1', cartTotalWithTax='137.50', cartTotalWithoutTax='125.00' WHERE cartID='82'
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='account' LIMIT 1
[3] 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=2 AND p.pageNew=0 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=2 AND p.pagePath='/shop/result' LIMIT 1
[3] Using template: /templates/navigation/item.html
Using template: /templates/shop/cart/cart_mini.html
Using template: /templates/search/search-form.html
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-002-009', '000-002', '000') ORDER BY pageTreePosition DESC
Using template: /templates/navigation/level1.html
[4] Using template: /templates/navigation/level2.html
[1] SELECT * FROM perch2_shop_orders WHERE orderID=19 AND orderDeleted IS NULL LIMIT 1
Is paid?
[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=4 AND idx.itemRev=2)) 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/website_config.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer' LIMIT 1
[4] 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 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/result' LIMIT 1
[4] Using template: /templates/navigation/footer-menu.html
Using template: /templates/mailchimp/forms/subscribe.html
Using template: /templates/mailchimp/forms/subscribe.html
Debug Message
[30] 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/result, so not using routes.
Using master page: /templates/pages/shop/result.php
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='2a13ac5f11e99e32042b199c4d7194903b9fc020' AND sessionHttpFootprint='93fc1bc5b2fbe08684cd964072d59192c83a252c' AND sessionExpires>'2016-12-19 11:18:48' LIMIT 1
User is logged in
[1] SELECT * FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_orders WHERE orderID=19 AND orderDeleted IS NULL LIMIT 1
Is paid?
[4] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/shop/result' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Website Config' AND (regionPage='/shop/result' 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=4 AND idx.itemRev=2)) 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/website_config.html
UPDATE perch2_shop_cart SET cartPricing='trade' WHERE cartID='82'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_cart WHERE cartID=82
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 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=22
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=8 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=82
[38] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Tax mode: inc
[1] SELECT * FROM perch2_shop_cart_items WHERE cartID=82 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=40 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 billingAddress, shippingAddress FROM perch2_shop_cart WHERE billingAddress IS NOT NULL AND cartID=82
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='22' AND orderID IS NULL AND addressSlug='shipping'
[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=13 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[12] 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)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2)
[1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch2_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[nil] SELECT rateID AS id, rateTitle AS title, rateValue AS rate FROM perch2_shop_tax_rates WHERE locationID=2 AND rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[1] SELECT * FROM perch2_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Standard Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Standard Shipping (Australia)’
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Standard Shipping (International)’ because: no price available for chosen shipping zone
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Rejecting shipping method ‘Express Shipping (Australia)’ because: cart weight is greater than the max
Qualifying shipping method ‘Express Shipping (Australia)’
[1] SELECT * FROM perch2_shop_shippings WHERE shippingID='5' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: Australia
[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_promotions WHERE promoFrom<='2016-12-19 00:18:00' AND promoTo>'2016-12-19 00:18:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Free Shipping in Australia for orders over $50) qualifies!
This is a free shipping promo
UPDATE perch2_shop_cart SET cartTotalItems='50', cartTotalProducts='1', cartTotalWithTax='137.50', cartTotalWithoutTax='125.00' WHERE cartID='82'
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='account' LIMIT 1
[3] 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=2 AND p.pageNew=0 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=2 AND p.pagePath='/shop/result' LIMIT 1
[3] Using template: /templates/navigation/item.html
Using template: /templates/shop/cart/cart_mini.html
Using template: /templates/search/search-form.html
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/shop/result' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-002-009', '000-002', '000') ORDER BY pageTreePosition DESC
Using template: /templates/navigation/level1.html
[4] Using template: /templates/navigation/level2.html
[1] SELECT * FROM perch2_shop_orders WHERE orderID=19 AND orderDeleted IS NULL LIMIT 1
Is paid?
[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=4 AND idx.itemRev=2)) 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/website_config.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer' LIMIT 1
[4] 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 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/result' LIMIT 1
[4] Using template: /templates/navigation/footer-menu.html
Using template: /templates/mailchimp/forms/subscribe.html
Using template: /templates/mailchimp/forms/subscribe.html
Request time: 0.1778
Process time: 0.1763
Memory: 6.9718

Any ideas?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you sure it's being called?

Am I sure what is being called? As I said a week ago, the issue is with the 'status' => 'wholesale' line in the below:

perch_shop_checkout('manual', [ 
'status' => 'wholesale', 
'return_url' => '/shop/result', 
'cancel_url' => '/shop', 
]);

I'll have to hire a developer to debug.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't see wholesale being used at all in the code, that's all.

Yep, I have no idea. As soon as the status line is removed it works fine. I've tested using pre-existing statuses (Eg. 'returned'), deleted and recreated the statuses so many times. I'm so over budget with this job now. Anyway, hired a developer. Hopefully they can sort it out.

Just an update for anyone having the same issue. There was no fix as such, the developer just advised to remove any reference perch_shop_order_successful as that won't return true when adding a status. The orders go through fine now but awkwardly there is no way to test to display a message if there was an error.