If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Admin Tools / Email Address Exporter Question

Email Address Exporter Question

Started by mlm2005 on 12 Jul 2006, 9:56 PM · Views: 17,217

Results 41 to 59 of 59
16 Aug 2012, 4:26 PM
#41
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #41 by drbyte

You could use the DROP TABLE and CREATE TABLE and INSERT INTO statements, for just that table, from the original /zc_install/sql/mysql_zencart.sql script.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Aug 2012, 4:54 PM
#42
vancouverdude avatar

vancouverdude

New Zenner

Join Date:
Aug 2012
Posts:
4
Plugin Contributions:
0

Post #42 by vancouverdude

I did what you suggested and it worked great, the email exporter is working perfectly!

Thanks for your help!!!!

24 Sep 2012, 12:47 PM
#43
gbdriver avatar

gbdriver

New Zenner

Join Date:
Aug 2009
Posts:
14
Plugin Contributions:
0

Post #43 by gbdriver

vancouverdude:

I did what you suggested and it worked great, the email exporter is working perfectly!

Thanks for your help!!!!

Would you mind expanding on this. I have the same problem, I ran the following SQL statements, but I still have the problem:

Table structure for table 'newsletters'

DROP TABLE IF EXISTS newsletters;
CREATE TABLE newsletters (
newsletters_id int(11) NOT NULL auto_increment,
title varchar(255) NOT NULL default '',
content text NOT NULL,
content_html text NOT NULL,
module varchar(255) NOT NULL default '',
date_added datetime NOT NULL default '0001-01-01 00:00:00',
date_sent datetime default NULL,
status int(1) default NULL,
locked int(1) default '0',
PRIMARY KEY (newsletters_id)
) ENGINE=MyISAM;

Thanks, Rob

14 Oct 2012, 1:29 PM
#44
edywa avatar

edywa

New Zenner

Join Date:
Oct 2012
Posts:
2
Plugin Contributions:
0

Post #44 by edywa

I copied all the files into the respective folders but can't see the export email option in the tools menu. Tried it more than once and checked that the folders are correct but its still not working. I'm using v. 1.3.9b. Anybody can suggest a solution? thanks!

27 Oct 2012, 5:28 AM
#45
woodlandsprite avatar

woodlandsprite

Zen Follower

Join Date:
May 2006
Posts:
307
Plugin Contributions:
0

Post #45 by woodlandsprite

vancouverdude:

I did what you suggested and it worked great, the email exporter is working perfectly!

Thanks for your help!!!!

I'm going to second the plea for further details.
I'm completely new to modifying sql databases and I haven't any idea how to remove the remnants from the old newsletter subscribe mod from my database. I'm trying to rebuild from 1.3.0.2 onto 1.5.1

Thanks in advance to anyone who can assist.

Live again! http://spritelygoods.com Rebuilt on ZC v 1.5.1 from 1.3.0.2

27 Oct 2012, 6:13 AM
#46
woodlandsprite avatar

woodlandsprite

Zen Follower

Join Date:
May 2006
Posts:
307
Plugin Contributions:
0

Post #46 by woodlandsprite

ah ha!
I figured it out.

using the original /zc_install/sql/mysql_zencart.sql
search for all instances of "query_builder" and run the drop table, create table and insert into statements as a sql patch.

I realize this looks exactly like what Dr.Byte already suggested, but in my foggy brain, I did not latch onto the fact that it was the "query_builder" table that was of specific import.

Live again! http://spritelygoods.com Rebuilt on ZC v 1.5.1 from 1.3.0.2

10 Jan 2017, 12:59 AM
#47
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Post #47 by oavs

woodlandsprite:

ah ha!
I figured it out.

using the original /zc_install/sql/mysql_zencart.sql
search for all instances of "query_builder" and run the drop table, create table and insert into statements as a sql patch.

I realize this looks exactly like what Dr.Byte already suggested, but in my foggy brain, I did not latch onto the fact that it was the "query_builder" table that was of specific import.

OK I did that and still the same results. can some one suggest what else can be done please?

I have
Zencart 1.5.5d
EmailAddressExporter-151c2

===drop table==from Zencart 1.5.5d zc_install/sql/install/mysql_zencart.sql ===========

DROP TABLE IF EXISTS query_builder;
CREATE TABLE query_builder (
query_id int(11) NOT NULL auto_increment,
query_category varchar(40) NOT NULL default '',
query_name varchar(80) NOT NULL default '',
query_description TEXT NOT NULL,
query_string TEXT NOT NULL,
query_keys_list TEXT NOT NULL,
PRIMARY KEY (query_id),
UNIQUE KEY query_name (query_name)
) ENGINE=MyISAM COMMENT='Stores queries for re-use in Admin email and report modules';

===insert into statements=from Zencart 1.5.5d zc_install/sql/install/mysql_zencart.sql ================

Insert the default queries for "all customers" and "all newsletter subscribers"

INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '1', 'email', 'All Customers', 'Returns all customers name and email address for sending mass emails (ie: for newsletters, coupons, GVs, messages, etc).', 'select customers_email_address, customers_firstname, customers_lastname from TABLE_CUSTOMERS order by customers_lastname, customers_firstname, customers_email_address', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '2', 'email,newsletters', 'All Newsletter Subscribers', 'Returns name and email address of newsletter subscribers', 'select customers_firstname, customers_lastname, customers_email_address from TABLE_CUSTOMERS where customers_newsletter = '1'', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '3', 'email,newsletters', 'Dormant Customers (>3months) (Subscribers)', 'Subscribers who HAVE purchased something, but have NOT purchased for at least three months.', 'select max(o.date_purchased) as date_purchased, c.customers_email_address, c.customers_lastname, c.customers_firstname from TABLE_CUSTOMERS c, TABLE_ORDERS o WHERE c.customers_id = o.customers_id AND c.customers_newsletter = 1 GROUP BY c.customers_email_address, c.customers_lastname, c.customers_firstname HAVING max(o.date_purchased) <= subdate(now(),INTERVAL 3 MONTH) ORDER BY c.customers_lastname, c.customers_firstname ASC', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '4', 'email,newsletters', 'Active customers in past 3 months (Subscribers)', 'Newsletter subscribers who are also active customers (purchased something) in last 3 months.', 'select c.customers_email_address, c.customers_lastname, c.customers_firstname from TABLE_CUSTOMERS c, TABLE_ORDERS o where c.customers_newsletter = '1' AND c.customers_id = o.customers_id and o.date_purchased > subdate(now(),INTERVAL 3 MONTH) GROUP BY c.customers_email_address, c.customers_lastname, c.customers_firstname order by c.customers_lastname, c.customers_firstname ASC', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '5', 'email,newsletters', 'Active customers in past 3 months (Regardless of subscription status)', 'All active customers (purchased something) in last 3 months, ignoring newsletter-subscription status.', 'select c.customers_email_address, c.customers_lastname, c.customers_firstname from TABLE_CUSTOMERS c, TABLE_ORDERS o WHERE c.customers_id = o.customers_id and o.date_purchased > subdate(now(),INTERVAL 3 MONTH) GROUP BY c.customers_email_address, c.customers_lastname, c.customers_firstname order by c.customers_lastname, c.customers_firstname ASC', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '6', 'email,newsletters', 'Administrator', 'Just the email account of the current administrator', 'select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN where admin_id = $SESSION:admin_id', '');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string , query_keys_list ) VALUES ( '7', 'email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL', '');

Downunder QLD

10 Jan 2017, 1:39 AM
#48
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Post #48 by oavs

Only item from the drop down isn't working is "Dormant Customers (>3months)(Subscribers)(xxx)"
It is giving >> WARNING: An Error occurred, please refresh the page and try again. warning.

Rest of the drop downs are fine working???

Downunder QLD

10 Jan 2017, 6:27 PM
#49
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #49 by drbyte

oavs:

It is giving >> WARNING: An Error occurred, please refresh the page and try again. warning.
From the FAQs: http://www.zen-cart.com/content.php?311-warning-an-error-occurred-please-refresh-the-page-and-try-again

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Jan 2017, 9:49 PM
#50
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Post #50 by oavs

here is the log.

[11-Jan-2017 07:46:29 Australia/Brisbane] Request URI: /xxxx/email_export.php?action=save, IP address: 14.202.99.123
#1 mysqli_query() called at [/home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php:45]
#2 queryFactory->query() called at [/home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php:257]
#3 queryFactory->Execute() called at [/home/xxxxx/public_html/xxxx/email_export.php:88]

[11-Jan-2017 07:46:29 Australia/Brisbane] PHP Warning: mysqli_query(): Empty query in /home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php on line 45
[11-Jan-2017 07:46:29 Australia/Brisbane] Request URI: /xxxx/email_export.php?action=save, IP address: 14.202.99.123
#1 trigger_error() called at [/home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php:167]
#2 queryFactory->show_error() called at [/home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php:139]
#3 queryFactory->set_error() called at [/home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php:266]
#4 queryFactory->Execute() called at [/home/xxxxx/public_html/xxxx/email_export.php:88]

[11-Jan-2017 07:46:29 Australia/Brisbane] PHP Fatal error: 0: :: ==> (as called by) /home/xxxxx/public_html/xxxx/email_export.php on line 88 <== in /home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php on line 167

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

Lines 44-49 query_factory.php

  if(isset($queryLog)) $queryLog->start($query);
  $result = mysqli_query($link, $query);
  if(isset($queryLog)) $queryLog->stop($query, $result);
  if(isset($queryCache)) $queryCache->cache($query, $result);
  return($result);

}

Downunder QLD

12 Jan 2017, 7:27 PM
#51
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #51 by drbyte

It's not a problem with query_factory, because it's just executing the query given to it.
The email_export.php line 88 gives it a query, which it has just extracted from the database via lines 86-87, based on lines 72-73 which read whatever you chose from your dropdown menu.

Maybe the problem is that your server is being ultra sensitive about the kinds of data it allows to be submitted, and so could be treating the ">" symbol in "Dormant Customers (>3months) (Subscribers)" as a scary character (because > is the end of an HTML tag, and used in SQL queries).

To test that:

  • go into phpMyAdmin
  • to the query_builder table
  • to (what is normally) record #3
  • and look at the query_name field: Right now it should say: "Dormant Customers (>3months) (Subscribers)"
  • Change the >3 in there to >3 so that it displays a greater-than symbol via html encoded characters instead of the actual symbol.
    Save the change, and try the exporter again, after reloading the page.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Jan 2017, 11:52 PM
#52
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Post #52 by oavs

Excellent!!!!!

Thank you Dr. Byte. Great support !

It worked

Downunder QLD

19 Jan 2018, 9:13 AM
#53
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Post #53 by mesnitu

Is there another way, without having to change the default zc installation ?
I don't get it... in the send email, I have the option All, but in export I don't....

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

12 Mar 2019, 11:31 AM
#54
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Post #54 by giancalr

Hi I installed this plug in, Email Address Exporter but no phone numbers are exported, I have also made a change to the function but nothing, they are only exported surname name and email address

file function modify:

<?php /** * Register module into admin menu system */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if (function_exists('zen_register_admin_page')) { if (!zen_page_key_exists('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 = $db->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, customers_telephone from TABLE_CUSTOMERS order by customers_lastname, customers_firstname, customers_email_address, customers_telephone') { $db->Execute("UPDATE " . TABLE_QUERY_BUILDER . " set query_string='select customers_firstname, customers_lastname, customers_email_address, customers_telephone, 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, customers_telephone' where query_name = 'All Customers'"); } $result = $db->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, customers_telephone from TABLE_CUSTOMERS where customers_newsletter = '1'") { $db->Execute("UPDATE " . TABLE_QUERY_BUILDER . " set query_string='select customers_firstname, customers_lastname, customers_email_address, customers_telephone, 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'"); }

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com

13 Mar 2019, 5:07 AM
#55
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #55 by drbyte

Whatever code you quoted looks like it came from the reg_email_address_exporter.php file that comes with the plugin. I don't know why you would modify it.
The /admin/email_export.php file automatically outputs the customer telephone number if it is available in the query, and the reg_email_address_exporter.php automatically puts it into the query.

It seems like you may have an old version of it from before 2017? or maybe a very old Zen Cart that hasn't been upgraded?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Mar 2019, 10:52 AM
#58
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Post #58 by giancalr

Hello, for safety I made a new clean zen cart installation, and once the plug in is installed I confirm that the phone number is not exported, so the query that is proposed in the file does not work, we need a different query . Thank you

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com

19 Mar 2019, 12:01 PM
#59
giancalr avatar

giancalr

Zen Follower

Join Date:
Jul 2010
Location:
L'Aquila
Posts:
113
Plugin Contributions:
1

Post #59 by giancalr

Hello
the query to do on the DB to get the result is:
SELECT customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_newsletter
FROM zen_customers
WHERE customers_newsletter = 1

How do I insert it into the Tool? Thank you

Erboristeria La Spiga e Il Girasole Herbal Shop - https://www.erboristeriabio.com
Golden Eagle Herbal - https://www.erboristeriabio.it
Giraspiga - https://www.giraspiga.com