Skip to content

Commit

Permalink
v2.0.0 as encapsulated plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed May 30, 2024
0 parents commit d641674
Show file tree
Hide file tree
Showing 10 changed files with 820 additions and 0 deletions.
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Email Address Exporter plugin for Zen Cart

Add-On: Email Address Exporter Admin Tool
Designed for: Zen Cart v1.5.8+

Created by: DrByte
Some revisions added by: Swifty8078, Ooba_Scott, That Software Guy

Donations: Please support Zen Cart! [email protected] - Thank you!
===========================================================

NOTES:
This add-on was created to allow quick and easy exporting of email addresses from your Zen Cart shop.

This is especially useful if you are needing to manage mailing lists and/or send newsletters or mass-emailings from your personal computer.
One great tool to use this with is GroupMail, which you can get a free copy of here: https://www.shareasale.com/r.cfm?B=3937&U=151719&M=1465

As to export formats, you can choose from CSV, TXT (tab-delimited), XML, or HTML formats.

You can select any of the audiences available in your cart, using the pulldown menu provided.
The most common audience would be Newsletter recipients.

===========================================================

INSTALLATION:
Upload all files from the zc_plugins directory to the zc_plugins directory on your server, retaining folder structures.

In your Admin permissions panel, grant access to appropriate users using the Admin Access Management screen.

===========================================================

USE:
To use, just log into the admin area, click on "Tools", and click on "Export Email Addresses".

===========================================================

HISTORY:
March 10/05 - Initial Release
April 15/05 - Added XML format
May 11/05 - Added Save To File format, and tweaked streaming methods slightly
July 2012 - updated for Zen Cart v1.5.0
Sept 2012 - DrByte updated for Zen Cart v1.5.1, and to add ability to easily add more fields to the output, along with THREE-STEPS INSTRUCTIONS in the code on how to do it.
Nov 2013 - DrByte added a fix to prevent a database error from occurring when you forget to choose an export option
Dec 2013 - DrByte removed debug code left in previous update.
Dec 2014 - tidying
Aug 2017 - included telephone and company fields in export (requires them to be in the db query that feeds the exporter though). Also forced limits on filenames used for exporting.
misc updates
May 2024 - converted to encapsulated plugin (also removed Save To File On Server feature, since most people simply download directly anyway).
48 changes: 48 additions & 0 deletions zc_plugins/EmailAddressExporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Email Address Exporter plugin for Zen Cart

Add-On: Email Address Exporter Admin Tool
Designed for: Zen Cart v1.5.8+

Created by: DrByte
Some revisions added by: Swifty8078, Ooba_Scott, That Software Guy

Donations: Please support Zen Cart! [email protected] - Thank you!
===========================================================

NOTES:
This add-on was created to allow quick and easy exporting of email addresses from your Zen Cart shop.

This is especially useful if you are needing to manage mailing lists and/or send newsletters or mass-emailings from your personal computer.
One great tool to use this with is GroupMail, which you can get a free copy of here: https://www.shareasale.com/r.cfm?B=3937&U=151719&M=1465

As to export formats, you can choose from CSV, TXT (tab-delimited), XML, or HTML formats.

You can select any of the audiences available in your cart, using the pulldown menu provided.
The most common audience would be Newsletter recipients.

===========================================================

INSTALLATION:
Upload all files from the zc_plugins directory to the zc_plugins directory on your server, retaining folder structures.

In your Admin permissions panel, grant access to appropriate users using the Admin Access Management screen.

===========================================================

USE:
To use, just log into the admin area, click on "Tools", and click on "Export Email Addresses".

===========================================================

HISTORY:
March 10/05 - Initial Release
April 15/05 - Added XML format
May 11/05 - Added Save To File format, and tweaked streaming methods slightly
July 2012 - updated for Zen Cart v1.5.0
Sept 2012 - DrByte updated for Zen Cart v1.5.1, and to add ability to easily add more fields to the output, along with THREE-STEPS INSTRUCTIONS in the code on how to do it.
Nov 2013 - DrByte added a fix to prevent a database error from occurring when you forget to choose an export option
Dec 2013 - DrByte removed debug code left in previous update.
Dec 2014 - tidying
Aug 2017 - included telephone and company fields in export (requires them to be in the db query that feeds the exporter though). Also forced limits on filenames used for exporting.
misc updates
May 2024 - converted to encapsulated plugin (also removed Save To File On Server feature, since most people simply download directly anyway).
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* @copyright Copyright 2003-2024 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: DrByte 2024 May 27 Plugin version 2.0 $
*/

use Zencart\PluginSupport\ScriptedInstaller as ScriptedInstallBase;

class ScriptedInstaller extends ScriptedInstallBase
{
protected function executeInstall(): void
{
// de-register first because filename changed from pre-encapsulated version
zen_deregister_admin_pages(['emailExport']);
zen_register_admin_page('emailExport', 'BOX_TOOLS_EMAIL_EXPORT', 'FILENAME_EMAIL_EXPORT', '', 'tools', 'Y', 10);

// other tweaking to add slightly more flexibility when exporting email addresses
$result = $this->dbConn->Execute("SELECT query_string FROM " . TABLE_QUERY_BUILDER . " WHERE query_name = 'All Customers'");
if ($result->fields['query_string'] === 'SELECT customers_email_address, customers_firstname, customers_lastname FROM TABLE_CUSTOMERS ORDER BY customers_lastname, customers_firstname, customers_email_address') {
$this->dbConn->Execute(
"UPDATE " . TABLE_QUERY_BUILDER . " SET query_string='select customers_firstname, customers_lastname, customers_email_address, c.*, a.* from TABLE_CUSTOMERS c, TABLE_ADDRESS_BOOK a WHERE c.customers_id = a.customers_id AND c.customers_default_address_id = a.address_book_id ORDER BY customers_lastname, customers_firstname, customers_email_address'
WHERE query_name = 'All Customers'"
);
}
$result = $this->dbConn->Execute("SELECT query_string FROM " . TABLE_QUERY_BUILDER . " WHERE query_name = 'All Newsletter Subscribers'");
if ($result->fields['query_string'] === "SELECT customers_firstname, customers_lastname, customers_email_address FROM TABLE_CUSTOMERS WHERE customers_newsletter = '1'") {
$this->dbConn->Execute(
"UPDATE " . TABLE_QUERY_BUILDER . " SET query_string='select customers_firstname, customers_lastname, customers_email_address, c.*, a.* from TABLE_CUSTOMERS c, TABLE_ADDRESS_BOOK a WHERE c.customers_id = a.customers_id AND c.customers_default_address_id = a.address_book_id AND customers_newsletter = 1'
WHERE query_name = 'All Newsletter Subscribers'"
);
}
}

protected function executeUninstall(): void
{
zen_deregister_admin_pages(['emailExport']);
}
}
Loading

0 comments on commit d641674

Please sign in to comment.