Forum

Thread tagged as: Question, Shop

Using Template Filters in Order Emails

I have a template filter set up in perch, which works perfectly fine on the website. However when I go to apply that filter to a tag in the Order Email that Perch sends after payment is received, the template filter is not applied. I don't know how to view the debugger for an email ... so unfortunately I don't have one to send you. Only the basic information from Perch.

I can see below that I have 1 template filter registered which is correct.

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_wishlist (0), perch3_categories (4), perch3_category_counts (0), perch3_category_sets (1), perch3_content_index (108), perch3_content_items (34), perch3_content_regions (7), perch3_forms (1), perch3_forms_responses (0), perch3_members (1), perch3_members_forms (1), perch3_members_member_tags (0), perch3_members_sessions (1), perch3_members_tags (0), perch3_menu_items (13), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (7), perch3_resource_log (1783), perch3_resource_tags (0), perch3_resources (1494), perch3_resources_to_tags (0), perch3_settings (31), perch3_shop_addresses (9), perch3_shop_admin_index (192), perch3_shop_brands (1), perch3_shop_cart (101), perch3_shop_cart_data (27), perch3_shop_cart_items (5), perch3_shop_countries (53), perch3_shop_currencies (152), perch3_shop_customers (1), perch3_shop_emails (2), perch3_shop_index (13092), perch3_shop_option_values (107), perch3_shop_options (1), perch3_shop_order_items (6), perch3_shop_order_promotions (0), perch3_shop_order_statuses (9), perch3_shop_orders (3), perch3_shop_orders_meta (1), perch3_shop_product_files (0), perch3_shop_product_option_values (122), perch3_shop_product_options (86), perch3_shop_product_tags (0), perch3_shop_products (225), perch3_shop_promotions (1), perch3_shop_sales (0), perch3_shop_search (203), perch3_shop_shipping_zone_countries (52), perch3_shop_shipping_zones (5), perch3_shop_shippings (6), perch3_shop_tax_exhibits (239), perch3_shop_tax_group_rates (56), perch3_shop_tax_groups (2), perch3_shop_tax_locations (28), perch3_shop_tax_rates (77), perch3_shop_variants (136), 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: exc
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: Europe/Budapest
PERCH_EMAIL_FROM: info@becalistyle.com
PERCH_EMAIL_FROM_NAME: BeCalifornia KFT.
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: xxxxxxxxxxxxxxxxxxxxx
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: 767.92 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=2g8071m7moilnmoo5g136390bf; cmsa=1; p_m=b5d6ef103f9f38d83253830a1c775843f32b0277
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: 58981
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: 1508256742.176
REQUEST_TIME: 1508256742
Blake Myers

Blake Myers 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you verified if the template filter isn't being invoked, or if it's being invoked but failing somehow?

There are nothing in my php error logs ... is there a way to view the debugger as the email is sent or some way to view if it’s being invoked or failing?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The only way would be to log something from inside your filter.

smart idea ... this is why we love guys so much :) I'll try that, thanks!

Drew McLellan said:

The only way would be to log something from inside your filter.

okay ... so it's obviously not being invoked because when I told it to write a txt file it didn't ... but when I opened up the website, the text file was made.

any thoughts now?

Drew McLellan

Drew McLellan 2638 points
Perch Support

My suspicion is that the filters aren't being registered in that context, but I'm not sure why. They should be.

I don't think I'll have an immediate solution.