Forums / Addon Admin Tools / Preview Email

Preview Email

Views: 12,184

Results 21 to 40 of 54
1 Jul 2024, 7:55 AM
#21
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Preview Email

nicksab:

Anyone got this plugin to work with ZC 2.0.1?

On my test upgrade site, I am getting an error 500 when trying to preview any of emails option.

Logs are as follow:

[01-Jul-2024 02:25:28 UTC] Request URI: /upgrade/sweety/index.php?cmd=preview_email, IP address: 24.4.88.128, Language id 1
#0 /includes/modules/require_languages.php(13): zen_debug_error_handler()
#1 /sweety/includes/functions/extra_functions/preview_email.php(232): require('/home/zch1akhw6...')
#2 /sweety/preview_email.php(102): build_welcome_email()
#3 /sweety/index.php(16): require('/home/zch1akhw6...')
--> PHP Warning: Undefined variable $languageLoader in /includes/modules/require_languages.php on line 13.

[01-Jul-2024 02:25:28 UTC] PHP Fatal error: Uncaught Error: Call to a member function setCurrentPage() on null in /includes/modules/require_languages.php:13
Stack trace:
#0 /sweety/includes/functions/extra_functions/preview_email.php(232): require()
#1 /sweety/preview_email.php(102): build_welcome_email()
#2 /sweety/index.php(16): require('/home/zch1akhw6...')
#3 {main}
thrown in /includes/modules/require_languages.php on line 13

[01-Jul-2024 02:25:28 UTC] Request URI: /upgrade/sweety/index.php?cmd=preview_email, IP address: 24.4.88.128
--> PHP Fatal error: Uncaught Error: Call to a member function setCurrentPage() on null in /includes/modules/require_languages.php:13
Stack trace:
#0 /sweety/includes/functions/extra_functions/preview_email.php(232): require()
#1 /sweety/preview_email.php(102): build_welcome_email()
#2 /sweety/index.php(16): require('/home/zch1akhw6...')
#3 {main}
thrown in /includes/modules/require_languages.php on line 13.

[01-Jul-2024 02:25:28 UTC] Request URI: /upgrade/sweety/index.php?cmd=preview_email, IP address: 24.4.88.128
--> PHP Fatal error: Uncaught Error: Call to a member function setCurrentPage() on null in /includes/modules/require_languages.php:13
Stack trace:
#0 /sweety/includes/functions/extra_functions/preview_email.php(232): require()
#1 /sweety/preview_email.php(102): build_welcome_email()
#2 /sweety/index.php(16): require('/home/zch1akhw6...')
#3 {main}
thrown in /includes/modules/require_languages.php on line 13.

> 
> Thank you for your assistance

Scroll up the page a couple of posts, to where I posted the same log file, and read on from there.

Simon

1 Jul 2024, 10:05 AM
#22
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

This is still on my list. Will update ASAP.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Jul 2024, 7:55 PM
#23
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Preview Email

simon1066:

Scroll up the page a couple of posts, to where I posted the same log file, and read on from there.

ugh another example of me posting before fully reading

sorry

2 Jul 2024, 7:55 PM
#24
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Preview Email

swguy:

This is still on my list. Will update ASAP.

thank you in advance

2 Jul 2024, 9:40 PM
#25
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

OK Github is up to date now for the 1.5.8/2.0.x version of this plugin.

https://github.com/scottcwilson/zencart_preview_email/

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

3 Jul 2024, 2:57 PM
#26
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

Updated in the Plugins Library.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

4 Jul 2024, 8:43 AM
#27
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Preview Email

swguy:

Updated in the Plugins Library.

Great, thank you for doing that.

Simon

7 Jul 2024, 2:02 PM
#28
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Preview Email

ZC v1.5.8a & ZC v2.0.1
Preview Email v2.0

E.g. Previewing the Welcome Email

The content is populated from the defines in \includes\languages\english\lang.create_account.php even when there is an override at **\includes\languages\english\MY_TEMPLATE\lang.create_account.php
**
How do I ensure the template override file is used?

Simon

7 Jul 2024, 2:45 PM
#29
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

Fixed in Github. Please retest.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

7 Jul 2024, 2:51 PM
#30
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Preview Email

swguy:

Fixed in Github. Please retest.

Looks good. Thank you.

Simon

17 Nov 2024, 4:20 PM
#31
dirks avatar

dirks

New Zenner

Join Date:
Sep 2024
Location:
Noord Holland
Posts:
24
Plugin Contributions:
4

Re: Preview Email

Dutch translation (in you're admin folder):

DirkS

Falling is not bad, staying down is.
Zen Cart version 1.5.8a, PHP version 7.4.33

23 Sep 2026, 5:46 PM
#32
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: Preview Email

Preview Email Pro is available for editing these emails, not just previewing them.

Preview Email shows you every email your store sends, names the template file and stylesheet behind each one, and then leaves you to open those files by hand. Pro closes that gap. Every row on Tools > Preview Email gets an Edit button, and every HTML preview gets edit links, opening the email's template or the shared email_common.css in an editor beside a live preview, rendered by Preview Email from your draft with the same sample data and the same placeholder warnings. So you see a change before you save it.

A Show list adds two views for the rules a plain preview can't reach: the email with every optional block filled with sample content, and a specimen of every rule in the stylesheet, captioned with the templates that use it. Every save is copied to a timestamped backup under email/ first, with one-click restore, and Save and Send Test mails the saved result to any address as HTML or plain text.

It runs on Zen Cart 1.5.8 through 3.0.0 and requires the free Preview Email 3.0.0 or later to be installed and enabled first. Single Store License, in three tiers, with a year of updates and support. Details and purchase:

https://myzencartzone.com/index.php?main_page=product_info&products_id=22

The free Preview Email stays free and does everything it always has. Pro just adds editing.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

28 Sep 2026, 10:29 AM
#33
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

zc_plugins/PreviewEmail/v3.0.0/shared/emails/core/checkout.php line 120 needs a check for isset($order->delivery) otherwise you get a blank page on pickup orders.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

28 Sep 2026, 10:44 AM
#34
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

I note on the preview order confirmation email, the model number is added after the name, but in the real sent email, the model number is not shown.

Looking at ./v3.0.0/shared/emails/core/checkout.php confirms what I was thinking - you are fabricating an email from scratch without regard to what's actually in includes/classes/order.php. This is completely wrong.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

28 Sep 2026, 5:06 PM
#35
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: Preview Email

Scott — thanks for taking the time to go through it, and especially for catching the pickup order. You're right on that one. On pickup, virtual, and other no-ship orders, the order class sets the delivery address to false, and the Order Confirmation preview was dereferencing it and blanking the page. That's fixed in **v3.0.1**: the delivery address now shows n/a on those orders, the same as the confirmation email Zen Cart itself sends for them. It's on GitHub now:

https://github.com/dbltoe/Preview_Email/releases/tag/v3.0.1

That was an unfortunate miss on a case we should have covered, and I appreciate you flagging it.

On the model number: the preview is built to mirror what includes/classes/order.php puts in the sent email. send_order_email() appends (model) after the product name, when the product has a model, and nothing when it doesn't, so for the same order, the preview should match what your customer receives. If you're seeing a model in the preview that the real email leaves off, I'd genuinely like to run it down with you — the preview picks one of your recent orders to build from, so it's easy for it to land on an order whose product has a model when the email you're comparing against didn't. If your store uses a customized order class, that's worth knowing too. Point me at a specific order number, and I'll trace it.

For a bit of context and a reminder of where 3.0.0 went after the 1.x/2.x line you built — a lot of the work went into breadth and into keeping it faithful to what core actually sends:

- **Packaged as an encapsulated zc_plugin.** Installed and removed via Modules > Plugin Manager, with no files to copy into admin and no SQL patch, from a single codebase that runs on Zen Cart 1.5.8 through 3.0.0.

- **Every email the store can send**, not only the twelve with template files: the store copies of the order, welcome, coupon, gift-certificate and status emails, the low-stock notice, Ask a Question, the pending-review notice, the newsletter, the admin password reset, the admin sign-in code, the account-changed notice and payment-module alerts.

- **Add-on emails found automatically.** Any installed plugin can ship an email_preview/ folder describing its emails, and a store can describe its own the same way; definitions are bundled for Social Contact Footer, Admin Add Customer, Fraud Screen, Back in Stock and Recover Cart Sales.

- **The plain-text part previewed as well as the HTML**, since that's what a TEXT-only customer receives.

- **Test sends** of any email to any address, forced to HTML or plain text for that one send.

- **Unfilled $PLACEHOLDERs flagged**, so you can see what would go out as literal text.

- **Invented sample data** when a store has no orders, customers, products, or coupons yet, instead of an error.

- **Runs on PHP 7.4 through 8.5**, and clears the 500s on a fresh 2.2.2 install under PHP 8.4 (Checkout, Password Forgotten, Welcome).

And kept on purpose, because they were good ideas: the sample-data approach, the direct_test.html convention, and the custom_preview_email.php hook, so a store that customized 2.x isn't broken.

Thanks again for the review — this kind of feedback is exactly what makes it better.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

28 Sep 2026, 5:16 PM
#36
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: Preview Email

Quick update: Preview Email v3.0.1 has been submitted to the Plugins Library and is pending review. While it works its way through the review queue, you can download it now from GitHub:

https://github.com/dbltoe/Preview_Email/releases/tag/v3.0.1

It fixes the Order Confirmation preview blanking on pickup, virtual, and other no-ship orders. Upload zc_plugins/PreviewEmail/v3.0.1/ and it upgrades in place from 3.0.0 through Modules > Plugin Manager.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

28 Sep 2026, 5:53 PM
#37
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

On the model number: the preview is built to mirror what includes/classes/order.php puts in the sent email.

You can't copy the code that generates the output (as you have done) and then claim it's a preview. It's not a preview. If includes/classes/order.php changes underneath you, this plugin shows something different from what is actually sent. Look at how I did it and fix it, please.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

29 Sep 2026, 1:56 AM
#38
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: Preview Email

Scott — following up on this, because you were right that the copied markup can drift, and being that specific is what let us fix it properly. Thank you for that.

First, on "look at how I did it": our order-email preview is built the same way yours is. build_checkout_email() in the 2.x line loads a recent order with new order($oID) and rebuilds the product table by hand (preview_email.php lines ~310-334); ours does the same. And it has to, because the real generator can't be driven for a past order:

- order::send_order_email() builds the product table from $this->products_ordered_html, and that property is only ever filled in create_add_products() — during checkout, from the live cart. Load a stored order with new order($oID) and it's never set. It's a typed public string, so reading it after a plain load throws "must not be accessed before initialization" — the exact 2.2.1 fatal you reported for the 2.1 build.

- send_order_email() also reads $_SESSION['sendto'] and $_SESSION['customer_id'], and it calls zen_mail() to actually send.

So there's no way to preview a stored order by calling core's own generator — the confirmation email is assembled at checkout, once, from the cart and session, and sent. Any preview of a past order, yours or ours, has to rebuild that markup. That's the constraint, not a shortcut.

What your point does correctly identify is the real risk: a hand-rebuilt table can fall out of step with order.php. So we've done two things in v3.0.2:

1. Made our rebuild byte-for-byte identical to send_order_email() — the product row, the "\n\t"-option-value attribute format from create_add_products(), the one-time-charges row, and the totals rows. (That also corrected two places ours had quietly diverged.)

2. Added a test that reads includes/classes/order.php straight from a running store, pulls out core's own products_ordered_html, attribute, and totals expressions, evaluates them, and asserts our output matches them exactly — and fails if it ever stops matching. It's confirmed identical across Zen Cart 1.5.8 through 3.0.0.

So if a future Zen Cart change alters the confirmation email, that test breaks and we update the preview, rather than it silently showing something the customer never receives. That's the outcome you were pushing for, and it's a genuinely better plugin for it.

Appreciate you taking the time to be specific — it turned "this can drift" into "this can't drift without us knowing."

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Sep 2026, 2:00 AM
#39
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: Preview Email

Preview Email v3.0.2 is out.

This release makes the Order Confirmation preview an exact match for the email your customers actually receive. The product lines, their options, any one-time charges, and the order totals are now built the same way Zen Cart itself builds the confirmation email, so what you see in the preview is what gets sent, down to the character. A test that ships with the plugin reads your store's own order class and checks the preview against it, so it stays in step with Zen Cart from 1.5.8 through 3.0.0.

It follows v3.0.1, which stopped the preview blanking on pickup, virtual, and other orders with no delivery address.

You can download it now from GitHub while it works through the Plugins Library review queue:

https://github.com/dbltoe/Preview_Email/releases/tag/v3.0.2

Upload zc_plugins/PreviewEmail/v3.0.2/ and it upgrades in place through Modules > Plugin Manager. Thanks to swguy, whose review prompted this one.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

30 Sep 2026, 11:34 AM
#40
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: Preview Email

This still doesn't work.

Here's what I send for the product list:

1 x WHS0059 Baby's Breath - Excellence, 250gm Bunch $15.00

Here's what the preview shows (the default):

1 x Baby's Breath - Excellence, 250gm Bunch (WHS0059) $15.00

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.