Forum
Shop Email Templates Duplication
I have copied over the email templates for perch shop but now in the control panel there are duplicates in the list of templates to choose from. The template select field now looks like this:
Order dispatched
Order dispatched
Order paid
Order paid
I have tested this on a fresh install too, with the same results.
Further to this, after the initial email gets sent (triggered by status 'paid') any subsequent emails for that order using the same template (i.e. by changing the status to 'created' and then back to 'paid' again) have some data missing:
Item – <perch:orderitem id="title" type="hidden" />
Options – <perch:orderitem id="variant_desc" type="hidden" />
Quantity – <perch:orderitem id="quantity" type="hidden" />
Unit price – <perch:orderitem id="price_without_tax" type="hidden" format="$:%.2n" />
By missing I mean they don't render in the email.
Could these two be related?
The templates are just the default ones this far while I test.
Here's my diagnostics:
Perch: 2.8.30
Production mode: Production (100)
Installed apps: content (2.8.30), assets (2.8.30), categories (2.8.30), 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)
DB driver: PDO
DB tables: perch2_categories (86), perch2_category_counts (0), perch2_category_sets (1), perch2_content_index (848), perch2_content_items (8), perch2_content_regions (1), perch2_forms (0), perch2_forms_responses (0), perch2_members (76), perch2_members_forms (2), perch2_members_member_tags (0), perch2_members_sessions (1), perch2_members_tags (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (1), perch2_resource_log (1006), perch2_resource_tags (0), perch2_resources (826), perch2_resources_to_tags (0), perch2_settings (35), perch2_shop_addresses (169), perch2_shop_admin_index (246), perch2_shop_brands (1), perch2_shop_cart (16), perch2_shop_cart_data (78), perch2_shop_cart_items (38), perch2_shop_countries (248), perch2_shop_currencies (1), perch2_shop_customers (76), perch2_shop_emails (1), perch2_shop_index (10812), perch2_shop_option_values (20), perch2_shop_options (5), perch2_shop_order_items (32), perch2_shop_order_promotions (0), perch2_shop_order_statuses (9), perch2_shop_orders (25), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (19), perch2_shop_product_options (5), perch2_shop_product_tags (0), perch2_shop_products (223), perch2_shop_promotions (0), perch2_shop_search (219), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (1), perch2_shop_shippings (6), perch2_shop_tax_exhibits (46), perch2_shop_tax_group_rates (1), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (34), perch2_user_passwords (0), perch2_user_privileges (70), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
$apps_list = array(
'content',
'categories',
'perch_forms',
'perch_members',
'perch_shop'
);
Editor plug-ins: markitup
H1: efe77763824a956c38ef94e242ceb589
L1: b0a67eb80acfa57c890721a731a015f9
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.13: done
latest_version: 2.8.15
on_sale_version: 2.8.31
headerScheme: light
perch_members_login_page: /members/login.php?r={returnURL}
perch_moltin_client_id: O9nzWOg4q2Dk5nXKS5c5q22kKUsLXx5hd1EcCnlJ
perch_moltin_client_secret: AbdIXbSPuMxdi02hyRgIjSTZ615e00kpcpvWiikO
perch_moltin_category_set: 1
perch_moltin_site_url: https://
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_moltin_update: 0.8
update_2.8.14: done
perch_shop_update: 1.0.6
perch_shop_price_tax_mode: exc
perch_shop_site_url: https://
perch_shop_default_currency: 1
perch_members_update: 1.4
update_2.8.21: done
update_2.8.23: done
perch_shop_product_url: /shop/products/{slug}
update_2.8.24: done
update_2.8.26: done
update_2.8.30: done
perch_shop_reporting_currency: 1
perch_shop_invoice_number_format: Invoice%d
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_DATABASE: perch_opt4
PERCH_DB_SERVER: localhost
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: toby@pixelpen.co.uk
PERCH_EMAIL_FROM_NAME: Toby Martin
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/Toby/Sites/opt4mobility/admin
PERCH_CORE: /Users/Toby/Sites/opt4mobility/admin/core
PERCH_RESFILEPATH: /Users/Toby/Sites/opt4mobility/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_DEBUG: 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_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/Toby/Sites/opt4mobility/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
PERCH_SHOP_VERSION: 1.0.6
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS
PHP: 7.0.0
Zend: 3.0.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $
MySQL server: 5.5.42
Free disk space: 60.77 GB
Extensions: Core, date, 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, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysqli, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, cgi-fcgi, imap, mcrypt, pgsql, pdo_pgsql
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
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x0
ORIG_SCRIPT_NAME: /fcgi-bin/php7.0.0.fcgi
ORIG_PATH_TRANSLATED: /Users/Toby/Sites/opt4mobility/admin/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php7.0.0.fcgi
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /admin/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 52951
SCRIPT_FILENAME: /Users/Toby/Sites/opt4mobility/admin/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Users/Toby/Sites/opt4mobility
REMOTE_ADDR: ::1
SERVER_PORT: 8888
SERVER_ADDR: ::1
SERVER_NAME: loc.o
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_COOKIE: cmsa=1; p_m=c90ce34b99ef834ba0f8c484c9868651382ac11d; _ga=GA1.2.1696672089.1468244631; PHPSESSID=4176c5704ab9efc89a7b86cca454b534
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_REFERER: https://loc.o:8888/admin/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2791.0 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: keep-alive
HTTP_HOST: loc.o:8888
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
REDIRECT_proto: http
FCGI_ROLE: RESPONDER
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1468492308.73
REQUEST_TIME: 1468492308
argc: 1
An order should only move forward through the statuses. If it's been paid for and then somehow not paid for again, that should result in the order moving forward to refunded or cancelled, and a new order should be raised in order to pay again.
Okay thanks, I was just using the status change as a way to trigger the emails while I build them out rather than having to create a dummy order each time.
May I propose a send test email feature?
Any thoughts on the duplicate template names?
Do the templates have the same file names?
Yes, I just copied the templates from
addons/apps/perch_shop/templates/shop/emails
On both installations I have the perch folder renamed as
admin
if this helps.It's probably just a bug. If you name yours differently then you'll be able to see which is which in the list.
I have encounter exactly the same problems as Toby.
When switching between statuses in the admin area, an email is sent as expected. However, the
<perch:orderitems>
tags in the email template are not rendered correctly. Inspecting the html content of the email shows that the opening tag has been replaced but not the closing tag. Here is an example from one of the emails.The same email when initiated by a call to the
PerchShop_Runtime.class.php
checkout()
function renders correctly. In both situations, theitems
array was populated by order items.Any ideas on how to fix or work around this would be appreciated :)
I had the issue with duplicate Shop email templates showing up in the template list, too. I expected the custom templates to simply override the originals as that's what typically happens when a default template is copied out of an app and into /perch/templates without a change to the filename. I’m fine with the workaround for now, which for me was to add a client prefix to the custom template filenames so I could identify which was which.
I’m also having the same issue outlined by Stephen Holt — <perch:orderitems> data does not appear in the Order dispatched email. I have not found a workaround for this, so would love to hear of one. Automatically sending an email upon order status change from "paid" to "dispatched" would be a really handy feature, if it worked correctly. I’ve confirmed that this same behavior happens when using the default Order paid template, its not just with my custom template.
I'm seeing this too. The default template is just sending an empty table, something like:
Item Options Quantity Unit Price Total Total 4.17 Shipping:
Tax 0.83 Grand total £5.00