Forum
Promo Deletes Product(s) in Cart at Checkout
sooo ... if I use no promo code, everything works as normal ...
if I add a promo code (5% off), then AFTER checkout it deletes the products ... you the customer pays for the items, but all the products are deleted from the cart so nothing shows up!
when viewing the confirmation page with payment, everything appears correctly ...
when I look in the database under perch3_shop_order_items
all I see is shipping
and no product ... it's like its literally being deleted from the database
this is the debug on the success page ...
Debug Message - Perch 3.0.10
[1] SELECT * FROM perch3_members_sessions WHERE sessionID='76515018eb349d49c07a9c0efbeb9782e80ddca8' AND sessionHttpFootprint='1e5c8adc7811abc667632b38899990ad78c0ea2c' AND sessionExpires>'2017-10-12 23:18:50' LIMIT 1
User is logged in
[1] SELECT * FROM perch3_pages WHERE pagePath='/hta.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=8
[1] SELECT * FROM perch3_shop_cart WHERE cartID=8
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[4] SELECT main.* FROM perch3_categories main WHERE 1=1 ORDER BY catTreePosition ASC
[4] Using template: /templates/categories/menu-mobile.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[4] SELECT main.* FROM perch3_categories main WHERE 1=1 ORDER BY catTreePosition ASC
[4] Using template: /templates/categories/menu-navbar.html
[1] SELECT * FROM perch3_shop_orders WHERE orderID=94 AND orderDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_customers WHERE memberID=12
[9] SELECT statusKey FROM perch3_shop_order_statuses WHERE statusDeleted IS NULL ORDER BY statusIndex ASC
[1] SELECT * FROM perch3_shop_orders WHERE customerID=12 AND orderID=94 AND orderStatus IN ('paid', 'processing', 'cancelled', 'dispatched', 'returned', 'partial_refund', 'refunded')
[1] SELECT * FROM perch3_shop_order_items WHERE orderID='94' ORDER BY itemID ASC
[1] SELECT * FROM perch3_shop_order_statuses WHERE statusKey='paid' AND statusDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=59 LIMIT 1
[1] SELECT * FROM perch3_shop_shippings WHERE shippingID=3 AND shippingDeleted IS NULL LIMIT 1
[31] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 AND currencyID=59
[1] SELECT promoID FROM perch3_shop_order_promotions WHERE orderID=94
[1] SELECT * FROM perch3_shop_promotions WHERE promoID=2 LIMIT 1
[1] Using template: /templates/shop/orders/order.html
[1] SELECT * FROM perch3_shop_customers WHERE memberID=12
[2] SELECT main.* FROM perch3_shop_addresses main WHERE 1=1 AND (customerID=12) AND addressDeleted IS NULL AND orderID IS NULL ORDER BY addressTitle ASC
[2] Using template: /templates/shop/addresses/list.html
[1] SELECT * FROM perch3_shop_countries WHERE countryID='58' LIMIT 1
[1] SELECT * FROM perch3_shop_countries WHERE countryID='58' LIMIT 1
DELETE FROM perch3_shop_cart WHERE cartID='8'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch3_shop_cart WHERE cartID=0
[1] SELECT * FROM perch3_shop_cart WHERE cartID=0
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=0 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch3_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=0 LIMIT 1
[1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 AND currencyID=59
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=0
Tax mode: inc
[nil] SELECT * FROM perch3_shop_cart_items WHERE cartID=0 ORDER BY itemID ASC
[1] SELECT * FROM perch3_members WHERE memberID='12' LIMIT 1
Using template: /templates/members/forms/set_password.html
Perch: 3.0.10
Production mode: Production (100)
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_forms (1.9.1), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2)
DB driver: PDO
DB tables: custom_most_popular (0), perch3_categories (4), perch3_category_counts (0), perch3_category_sets (1), perch3_content_index (52), perch3_content_items (19), perch3_content_regions (6), perch3_forms (1), perch3_forms_responses (0), perch3_members (5), perch3_members_forms (1), perch3_members_member_tags (0), perch3_members_sessions (3), perch3_members_tags (0), perch3_menu_items (13), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (6), perch3_resource_log (1783), perch3_resource_tags (0), perch3_resources (1491), perch3_resources_to_tags (0), perch3_settings (31), perch3_shop_addresses (184), perch3_shop_admin_index (160), perch3_shop_brands (1), perch3_shop_cart (0), perch3_shop_cart_data (4), perch3_shop_cart_items (4), perch3_shop_countries (50), perch3_shop_currencies (152), perch3_shop_customers (12), perch3_shop_emails (1), perch3_shop_index (12978), perch3_shop_option_values (107), perch3_shop_options (1), perch3_shop_order_items (9), perch3_shop_order_promotions (3), perch3_shop_order_statuses (9), perch3_shop_orders (6), perch3_shop_orders_meta (1), perch3_shop_product_files (0), perch3_shop_product_option_values (121), perch3_shop_product_options (86), perch3_shop_product_tags (0), perch3_shop_products (224), perch3_shop_promotions (2), perch3_shop_sales (0), perch3_shop_search (203), perch3_shop_shipping_zone_countries (50), perch3_shop_shipping_zones (4), perch3_shop_shippings (5), perch3_shop_tax_exhibits (191), perch3_shop_tax_group_rates (56), perch3_shop_tax_groups (2), perch3_shop_tax_locations (28), perch3_shop_tax_rates (40), perch3_shop_variants (135), perch3_user_passwords (0), perch3_user_privileges (72), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (2)
Users: 2
App runtimes:
<?php
$apps_list = [
'content',
'categories',
'perch_members',
'perch_shop',
'perch_forms',
];
Editor plug-ins:
H1: 8f4d668e1c91ebaf59bc1287cd7dc318
L1: 97d1f766ac7b08a09f98dff79590a26b
F1: 3b606135b33e6a102526838f4152a807
headerColour: #04ffb6
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.0.8
update_3.0.8: done
latest_version:
on_sale_version: 3.0.10
perch_shop_update: 1.2.5
headerScheme: light
perch_members_login_page: /accounts/login.php
perch_shop_price_tax_mode: inc
perch_shop_product_url: /product/{slug}
perch_shop_default_currency: 59
perch_shop_reporting_currency: 59
dashboard: 1
hide_pwd_reset: 0
keyboardShortcuts: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 1
logoPath: /perch/resources/logo-2.png
perch_members_update: 1.4
update_3.0.9: done
assets_restrict_buckets: 0
perch_shop_site_url: https://www.becalistyle.com
update_3.0.10: done
perch_shop_invoice_number_format: Invoice-%d
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_SERVER: localhost
PERCH_DB_USERNAME: stuntdawg
PERCH_DB_DATABASE: becalistyle
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: blake.myers@xenoplexus.com
PERCH_EMAIL_FROM_NAME: BeCali Orders
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/bmyers/Sites/becalistyle/perch
PERCH_CORE: /Users/bmyers/Sites/becalistyle/perch/core
PERCH_RESFILEPATH: /Users/bmyers/Sites/becalistyle/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_DEBUG: 1
PERCH_EMAIL_METHOD: smtp
PERCH_EMAIL_HOST: smtp.postmarkapp.com
PERCH_EMAIL_AUTH: 1
PERCH_EMAIL_PORT: 587
PERCH_EMAIL_USERNAME: xxxxxx
PERCH_TEMPLATE_FILTERS: 1
PERCH_RUNWAY:
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: 23f8a1427c17ade109a3
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/bmyers/Sites/becalistyle/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
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_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SHOP_VERSION: 1.2.5
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.1.8
Zend: 3.1.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
MySQL server: 5.6.31
Free disk space: 768.02 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, json, ldap, mbstring, session, standard, odbc, mysqlnd, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, Phar, posix, Reflection, mysqli, shmop, SimpleXML, soap, sockets, exif, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, apache2handler, geoip, imagick, mcrypt
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
HTTP_HOST: becalistyle.local
HTTP_ACCEPT_ENCODING: br, gzip, deflate
HTTP_COOKIE: PHPSESSID=t6dqu5im3n7htbdrimftgo7cq8; cmsa=1; p_m=76515018eb349d49c07a9c0efbeb9782e80ddca8
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_REFERER: https://becalistyle.local/perch/core/settings/diagnostics/
HTTP_DNT: 1
HTTP_X_FORWARDED_PROTO: https
HTTP_X_FORWARDED_PORT: 443
HTTP_X_FORWARDED_FOR: 127.0.0.1
HTTP_X_FORWARDED_HOST: becalistyle.local
HTTP_X_FORWARDED_SERVER: becalistyle.local
HTTP_CONNECTION: Keep-Alive
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SIGNATURE: <address>Apache Server at becalistyle.local Port 443</address>
SERVER_SOFTWARE: Apache
SERVER_NAME: becalistyle.local
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 443
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: /Users/bmyers/Sites/becalistyle
REQUEST_SCHEME: https
CONTEXT_DOCUMENT_ROOT: /Users/bmyers/Sites/becalistyle
SERVER_ADMIN: admin@example.com
SCRIPT_FILENAME: /Users/bmyers/Sites/becalistyle/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 52971
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1507843323.152
REQUEST_TIME: 1507843323
Do you get any MySQL errors on the insert?
None that were viewable on screen ... I believe it’s happening at checkout() which is called via AJAX ... but it’s returning the appropriate JSON response to continue to the next step (I hold redirects).
I will check my php/mysql logs.
here's what I found ... I removed checkout from AJAX and had it run with a debugger from a regular page.
I've narrowed it down to this ...
it looks like it wants to insert the shipping but not the product into the database
here's the whole log for better context ....
okay ... I got it figured out ... here's the issue ... I have a currency set to having . separate thousands and , separate the decimal ... the promo is for 5% ... so when it calculates the 5% the number is
329,5
... well, since perch is not placing that number in single quotes (or at least changing the , back to a .) theinsert
thinks the , in the 329,5 is marking another column.so, either perch needs to make sure that it is placing the values in single quotes AND overriding the decimal separator of , to a . ... I could hack perch core to fix it, but I'm afraid that I'd only mess it up more. I'll leave that up to the experts.
if I use a flat amount it works. I tried switching the currency back to a . based separator but for some reason it still tried to calculate it with a ,
for now, I'll instruct my client to only use flat amounts until this is resolved.
ON A SIDE note ... I also have the currency set to 0 decimal places ... so I think perch should also be rounding this number up from
329.5
to330
to match what should be expected in according to the currency. that would also resolve the issue.Where do you have that set?
Under Shop > Currencies > Hungarian
I find that this page has many settings that mess up Perch ...
Perch doesn’t play well with the Zero Decimal setting either ... sometimes it honors it, sometimes it doesn’t.
It gave me errors with PayPal (via Braintree) too as PayPal won’t accept Hungarian Forints with any decimal place ... rejects the charge
I found the issue ...
setlocale(LC_ALL, 'hu_HU');
it was doing this:
which would result in
329,50
.after I removed it, it returned
329.50
I discovered it because after I returned the Currency settings BACK to using
.
instead of,
I was still getting that error ... after I removed this everything processed appropriately!I'm sorry if I stressed you out!