Forum
Perch Shop 1.2 cartPricing mode issue
Since upgrading to Perch Shop 1.2 (from 1.1) I have an issue with cart pricing whereby the cart totals and subtotals are being miscalculated for products which are marked with 'Use sale price'. Products that don't have this setting enabled are fine.
- I'm using
total_items_discounted_with_tax_formatted
to display some totals and expect 1 product in the cart that has a sale price of £1000 not to be showing a cart total of £2000. - The product price (cartitem) is being output correctly, but any tag beginning with 'total_' is wrong.
- I've tried clearing all database tables, ensuring sessions are destroyed where appropriate (to clear cache) and reinstalling Shop 1.2 to no avail.
- There are no discounts or promotions setup (and never have been).
- When I revert to Shop 1.1 everything works perfectly.
The perch2_shop_cart
table tells me the cart is in 'standard' cartPricing
mode, I noticed when I change this to 'sale' everything is fine.
Any thoughts on what could be causing this issue? Many thanks Chris
Custom cart template:
<perch:if id="product_count" match="gt" value="0">
<div id="summary" class="large-3 large-push-9 columns">
<h3>Subtotal (<perch:shop id="item_count" /> item<perch:if id="item_count" match="gt" value="1">s</perch:if>): <perch:shop id="total_items_discounted_with_tax_formatted" /></h3>
<a href="/shop/checkout" class="checkout button large">Proceed to Checkout</a>
<p><b>Order Total includes VAT</b></p>
<table>
<tr>
<th>Total before VAT</th>
<td><perch:shop id="total_items_formatted" /></td>
</tr>
<tr>
<th>VAT</th>
<td><perch:shop id="total_items_tax_formatted" /></td>
</tr>
<tr>
<th>Order Total<br> <small>(excluding delivery)</small></th>
<td><perch:shop id="total_items_discounted_with_tax_formatted" /></td>
</tr>
</table>
</div>
<div id="cart" class="large-9 large-pull-3 columns">
<h3>Your cart</h3>
<perch:form id="cart" app="perch_shop" target="_self" action="#summary">
<perch:input type="submit" value="Update" hidden="true" aria-hidden="true" />
<table class="cart-core">
<tr>
<th></th>
<th></th>
<th>Quantity</th>
<th>Price</th>
</tr>
<perch:cartitems>
<tr<perch:if exists="on_sale"> class="special"</perch:if>>
<td><a href="/<perch:categories id="category" set="shop"><perch:if exists="perch_item_first"><perch:category id="catPath" /></perch:if></perch:categories><perch:cartitem id="slug" />/"><perch:cartitem id="image" type="image" width="80" height="80" density="2" bucket="shop/products" output="tag" /></a></td>
<td>
<div class="p-title">
<a href="/<perch:categories id="category" set="shop"><perch:if exists="perch_item_first"><perch:category id="catPath" /></perch:if></perch:categories><perch:cartitem id="slug" />/">
<perch:cartitem id="title" />
</a>
<perch:if exists="on_sale"> <span class="special">sale item</span></perch:if>
<perch:if exists="is_variant"><i class="v-disc"><perch:cartitem id="variant_desc" /></i></perch:if>
</div>
<perch:if exists="is_variant">
<p><i class="v-disc"><perch:cartitem id="variant_desc" /></i></p>
</perch:if>
<div class="desc">
<perch:cartitem id="description" type="textarea" markdown="true" words="20" append="..." />
</div>
<div class="money show-for-small-only">
<perch:if exists="on_sale"><s><perch:cartitem id="price" type="shop_currency_value" /></s> </perch:if>
<perch:cartitem id="price_with_tax_formatted" />
</div>
</td>
<td>
<perch:input class="item_qty" id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" max="<perch:cartitem id="stock_level" />" pattern="\d*" />
<perch:if id="quantity" match="eq" value="{stock_level}">
<p class="no-stock">Max in cart</p>
</perch:if>
<perch:if id="stock_level" match="gte" value="11">
<button type="submit" class="update button small">Update</button>
</perch:if>
<button type="submit" class="button small remove" name="del:<perch:cartitem id="identifier" />" value="1">Remove</button>
</td>
<td class="money show-for-medium">
<perch:if exists="on_sale"><s><perch:cartitem id="price" type="shop_currency_value" /></s><br></perch:if>
<perch:cartitem id="price_with_tax_formatted" />
</td>
</tr>
</perch:cartitems>
<tr class="total">
<th colspan="3">
Subtotal (<perch:shop id="item_count" /> item<perch:if id="item_count" match="gt" value="1">s</perch:if>)
</th>
<td class="money">
<perch:shop id="total_items_discounted_with_tax_formatted" />
</td>
</tr>
</table>
<perch:input type="cms" />
</perch:form>
<div class="continue">
<perch:form id="empty_cart" app="perch_shop" target="_self" action="?empty_cart">
<button type="submit" id="empty_cart" class="button small remove">Empty cart</button><br><br>
</perch:form>
<div>
<a href="/shop/checkout" class="checkout button large">Proceed to Checkout</a> <span class="or">or</span>
<a href="/shop" class="button medium">Continue shopping</a>
</div>
</div>
</div>
<perch:else />
<div class="large-12 columns empty-cart">
<h3>Your cart</h3>
<p><perch:shop id="empty_cart_message" encode="false" /></p>
<div class="continue">
<a href="/shop" class="button medium">Continue shopping</a>
</div>
</div>
</perch:if>
Diagnostics:
Perch Runway: 3.0.4
Production mode: Development (10)
Installed apps: content (3.0.4), assets (3.0.4), categories (3.0.4), perch_forms (1.9), perch_gallery (2.8.9), perch_shop_orders (1.2), perch_shop_products (1.2), chirp_seo (1), perch_shop (1.2), perch_comments (1.2.1), perch_members (1.6.1), perch_mailchimp (3.1)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_categories (17), perch2_category_counts (0), perch2_category_sets (1), perch2_chirp_seo (1), perch2_collection_index (40), perch2_collection_items (8), perch2_collection_revisions (4), perch2_collections (0), perch2_comments (0), perch2_comments_votes (0), perch2_content_index (598), perch2_content_items (227), perch2_content_locks (0), perch2_content_regions (25), perch2_forms (2), perch2_forms_responses (2), perch2_gallery_albums (6), perch2_gallery_image_versions (714), perch2_gallery_images (119), perch2_mailchimp_campaigns (0), perch2_mailchimp_imports (0), perch2_mailchimp_lists (1), perch2_mailchimp_subscribers (69), perch2_mailchimp_subscriptions (71), perch2_mailchimp_webhooks (1), perch2_members (1), perch2_members_forms (2), perch2_members_member_tags (0), perch2_members_sessions (0), perch2_members_tags (0), perch2_menu_items (17), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_routes (7), perch2_page_templates (25), perch2_pages (19), perch2_resource_log (536), perch2_resource_tags (0), perch2_resources (146), perch2_resources_to_tags (0), perch2_settings (43), perch2_shop_addresses (4), perch2_shop_admin_index (170), perch2_shop_brands (9), perch2_shop_cart (1), perch2_shop_cart_data (16), perch2_shop_cart_items (12), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (1), perch2_shop_emails (1), perch2_shop_index (668), perch2_shop_option_values (0), perch2_shop_options (0), perch2_shop_order_items (2), perch2_shop_order_promotions (0), perch2_shop_order_statuses (9), perch2_shop_orders (1), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (0), perch2_shop_product_options (0), perch2_shop_product_tags (0), perch2_shop_products (8), perch2_shop_promotions (0), perch2_shop_sales (0), perch2_shop_search (8), perch2_shop_shipping_zone_countries (3), perch2_shop_shipping_zones (3), perch2_shop_shippings (2), perch2_shop_tax_exhibits (4), perch2_shop_tax_group_rates (1), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (0), perch2_user_passwords (1), perch2_user_privileges (80), perch2_user_role_privileges (23), perch2_user_roles (2), perch2_users (2)
Users: 2
App runtimes:
<?php
$apps_list = array(
'perch_members',
'perch_shop',
'perch_forms',
'perch_mailchimp',
'perch_gallery',
'perch_comments',
'chirp_seo'
);
Scheduled tasks for perch_comments: delete_spam_comments (1440 mins)
Scheduled tasks for perch_mailchimp: import_data (1 mins)
Editor plug-ins:
H1: c80ca109caff299553e99f2fd257bdba
L1: 45f1adfe02a3a4d1a863b7793c677f10
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
headerColour: #f5aa25
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.31: done
latest_version:
on_sale_version:
headerScheme: light
perch_gallery_bucket_mode: dynamic
perch_gallery_bucket: gallery
perch_mailchimp_api_key:
perch_mailchimp_campaign_url: /404/
perch_members_login_page: /login.php?r={returnURL}
perch_shop_price_tax_mode: inc
perch_shop_product_url: /shop/{slug}/{slug}/{sku}/
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: Invoice %d
dashboard: 0
hide_pwd_reset: 1
content_hideNonEditableRegions: 1
content_frontend_edit: 0
perch_gallery_basicUpload: 0
logoPath:
perch_gallery_update: 2.8.5
perch_shop_update: 1.2
perch_members_update: 1.4
perch_mailchimp_secret: deacab8
perch_comments_akismet_key:
perch_comments_max_spam_days: 0
update_runway_2.8.32: done
perch_shop_trade_price_tax_mode: exc
update_runway_3.0: done
siteOffline: 0
chirp_seo_license_key:
update_runway_3.0.2: done
perch_shop_site_url:
update_runway_3.0.4: done
content_skip_region_list: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME:
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE:
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM:
PERCH_EMAIL_FROM_NAME:
PERCH_LOGINPATH: /modify
PERCH_PATH:
PERCH_CORE:
PERCH_RESFILEPATH:
PERCH_RESPATH: /modify/resources
PERCH_SCHEDULE_SECRET:
PERCH_SITEPATH: /
PERCH_HTML5: 1
PERCH_DEBUG: 1
PERCH_PRODUCTION_MODE: 10
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: ed79f7a54b300ef2b1e6
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH:
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
PERCH_SHOP_VERSION: 1.2
Hosting settings
PHP: 5.6.30
Zend: 2.6.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.6.35
Free disk space: 22.58 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, pgsql, pdo_pgsql, igbinary, memcached, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTPS: on
SSL_TLS_SNI:
SSL_SERVER_S_DN_C:
SSL_SERVER_S_DN_ST:
SSL_SERVER_S_DN_L:
SSL_SERVER_S_DN_O:
SSL_SERVER_S_DN_CN:
SSL_SERVER_S_DN_Email:
SSL_SERVER_I_DN_C:
SSL_SERVER_I_DN_ST:
SSL_SERVER_I_DN_L:
SSL_SERVER_I_DN_O:
SSL_SERVER_I_DN_CN:
SSL_SERVER_I_DN_Email:
SSL_VERSION_INTERFACE: mod_ssl/2.2.31
SSL_VERSION_LIBRARY: OpenSSL/1.0.2j
SSL_PROTOCOL: TLSv1.2
SSL_SECURE_RENEG: true
SSL_COMPRESS_METHOD: NULL
SSL_CIPHER:
SSL_CIPHER_EXPORT: false
SSL_CIPHER_USEKEYSIZE: 128
SSL_CIPHER_ALGKEYSIZE: 128
SSL_CLIENT_VERIFY: NONE
SSL_SERVER_M_VERSION: 1
SSL_SERVER_M_SERIAL: BC7E3396F86B8E74
SSL_SERVER_V_START: Mar 11 01:22:58 2017 GMT
SSL_SERVER_V_END: Mar 9 01:22:58 2027 GMT
SSL_SERVER_S_DN:
SSL_SERVER_I_DN:
SSL_SERVER_A_KEY: rsaEncryption
SSL_SERVER_A_SIG: sha1WithRSAEncryption
HTTP_HOST:
HTTP_CONNECTION: keep-alive
HTTP_CACHE_CONTROL: max-age=0
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_REFERER:
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch, br
HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4
HTTP_COOKIE: cmsa=1; p_m=; PHPSESSID=b8122bbf7710011b6c2837b790385072
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache
SERVER_NAME:
SERVER_ADDR: ::1
SERVER_PORT: 443
REMOTE_ADDR: ::1
DOCUMENT_ROOT:
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME:
REMOTE_PORT: 58669
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /modify/core/settings/diagnostics/?extended
SCRIPT_NAME: /modify/core/settings/diagnostics/index.php
PHP_SELF: /modify/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1496044952.39
REQUEST_TIME: 1496044952
argc: 1
Adding example cart output:
We'll take a look at it.
Thanks Drew, much appreciated.
Fixed in Perch shop 1.2.1.