Forum
'terms_agreed' dosn't work in latest release
I have two shops, one is using Perch: 3.0.3 & Shop 1.2.2, the other one is on the latest release. I the checkout flow I use in both shop is:
<?php include('../../perch/runtime.php'); ?>
<?php include('../../header.php'); ?>
<?php
$cart = perch_shop_cart(['skip-template'=>true]);
if (!perch_member_logged_in()) {
include($_SERVER['DOCUMENT_ROOT'].'/anti/sklep/zamowienie/step-1-adres.php');
perch_shop_set_cart_property('terms_agreed', null);
}
else {
if (!perch_shop_cart_has_property('terms_agreed', true)) {
include($_SERVER['DOCUMENT_ROOT'].'/anti/sklep/zamowienie/step-2-dostawa.php');
} else {
if (isset($_POST['platnosc-przelewem'])){
$return_url = '...';
$cancel_url = '...';
perch_shop_checkout('manual', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
}
else {
$return_url = '...';
$cancel_url = '...';
perch_shop_checkout('paypal-express', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
}
}
}
?>
<?php include('../../footer.php'); ?>
confrim.html file
<div class="confirm">
<perch:form id="confirm" app="perch_shop">
<perch:input type="checkbox" value="false" id="terms" cart-property="terms_agreed" required="true" />
<perch:label for="terms">
Zgadzam się z <a href="../../regulamin/" target="_blank">regulaminem sklepu.</a>
</perch:label>
<div class="text-right">
<perch:input type="submit" value="Zapłać" class="btn--primary btn platnosc-karta" />
<input type="submit" class="btn--primary btn platnosc-przelewem" name="platnosc-przelewem" value="Potwierdź zamówienie">
<perch:input type="cms" />
</div>
</perch:form>
</div>
It works fine in the first shop Perch: 3.0.3 & Shop 1.2.2, but id does not work in the latest release. It does not redicrect to paypal or approve manual, it just stays on confirmation page.
Debug after submitting confirmation page on a not working site is:
Debug Message - Perch 3.0.8
[1] SELECT * FROM perch3_members_sessions WHERE sessionID='ccedfefbef8542ab96b2a523fa132a1c9eba8ebd' AND sessionHttpFootprint='51fd0d0f676325ff718ce6b06817941aab58b115' AND sessionExpires>'2017-08-09 17:33:58' LIMIT 1
User is logged in
[1] SELECT * FROM perch3_pages WHERE pagePath='/anti/sklep/zamowienie/index.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=45
[1] SELECT * FROM perch3_shop_cart WHERE cartID=45
[28] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT cartProperties FROM perch3_shop_cart WHERE cartID=45
UPDATE perch3_shop_cart SET cartProperties='{\"terms_agreed\":\"on\"}' WHERE cartID='45'
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[7] SELECT main.* FROM perch3_categories main WHERE 1=1 ORDER BY catTreePosition ASC
[7] Using template: /templates/categories/category.html
Using cart from cache.
[1] SELECT cartProperties FROM perch3_shop_cart WHERE cartID=45
Using cart from cache.
[1] Using template: /templates/shop/cart/cart_static.html
Missing variant.
[1] SELECT billingAddress, shippingAddress FROM perch3_shop_cart WHERE billingAddress IS NOT NULL AND cartID=45
[1] SELECT * FROM perch3_shop_customers WHERE memberID=35
[1] SELECT * FROM perch3_shop_addresses WHERE customerID='35' AND orderID IS NULL AND countryID>0 AND addressSlug='default'
[1] SELECT * FROM perch3_shop_addresses WHERE customerID='35' AND orderID IS NULL AND countryID>0 AND addressSlug='shipping'
Using template: /templates/shop/addresses/confirm.html
[1] SELECT * FROM perch3_shop_countries WHERE countryID='176' LIMIT 1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='176' LIMIT 1
Using shipping opts from cache.
Using shipping zone from cache.
[2] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_admin_index idx JOIN perch3_shop_shippings main ON idx.itemID=main.shippingID AND idx.itemKey='shippingID' JOIN perch3_shop_admin_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='shippingID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, shippingID ) as tbl WHERE (shippingID IN (1, 2)) GROUP BY itemID, sortval ORDER BY sortval ASC
[2] Using template: /templates/shop/shippings/options.html
[1] SELECT * FROM perch3_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 perch3_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=110 LIMIT 1
[1] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Using shipping opts from cache.
[2] SELECT * FROM perch3_shop_shippings WHERE shippingID IN (1, 2)
Using template: /templates/shop/shippings/method_form.html
Using template: /templates/shop/checkout/confirm.html
[7] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[0] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/anti/sklep/zamowienie/index.php' LIMIT 1
[7] Using template: /templates/navigation/item.html
Using template: /templates/forms/newsletter.html
Ah, this may have been what I saw as well. Downgrading to 1.2.2 and checkout worked again.
I think we've found the bug on this.
I've noticed the same issue on my site. Drew, will there be an update, or is the only option to use an older version of shop? I would downgrade, but I don't have version the files for 1.2.2 to downgrade to. I assume there isn't any archive of previous updates to an app. Is that correct?
Let me know if you would like me to email 1.2.2 to get you back up and running.