Zen Cart Logo
Forums / Upgrading from 1.3.x to 1.3.9 / Couldn't find constant TABLE_SUBSCRIBERS

Couldn't find constant TABLE_SUBSCRIBERS

Locked

Views: 2,622

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
13 Mar 2007, 5:44 PM
#1
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Couldn't find constant TABLE_SUBSCRIBERS

I get the error below when trying to send Newsletters/Emails.

============
Warning: constant(): Couldn't find constant TABLE_SUBSCRIBERS in /home/jungilri/public_html/skateboardstickers/includes/functions/audience.php on line 113
1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE email_format != 'NONE' and confirmed = 1 and (customers_i
in:
[SELECT email_address as customers_email_address FROM WHERE email_format != 'NONE' and confirmed = 1 and (customers_id IS NULL or customers_id = 0) order by email_address ]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

} elseif ( substr( $val, 0, 6) == "TABLE_" ) {
//return the value of the CONSTANT with the name that $val has.  ie: TABLE_CUSTOMERS = zen_customers
**Line 113**  $val = constant($val);
} elseif ( substr( $val, 0, 9) == '$SESSION:' ) {
  //return the value of the SESSION var indicated
  $param = str_replace('$SESSION:', '', $val);
  $val = $_SESSION[$param];

I've just upgraded from an earlier version to 1.3.7 and have upgraded the database as required

13 Mar 2007, 5:50 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

You're missing a table in the dbase I think. (Help me here Merlin!).

Did you back-up your original dbase and did you compare the NEW dbase (from the fresh 1.3.7 install) with the ORIGINAL dbase (using, for example WINMERGE)?

... And did you follow the upgrade procedure rigorously?

13 Mar 2007, 8:10 PM
#3
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

I tested it rigorously on a test site called new_shop as laid out here. The only thing I didn't test was the email - everything else works perfect.

What do I need to do now to rectify this please?

13 Mar 2007, 10:35 PM
#4
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

If I remember, I may have added the newsletter subscribe mod in the previous version so am guessing this may be causing the problem? Would there be any way of removing any changes this made?

14 Mar 2007, 11:28 AM
#5
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

Can anyone help me with this please?

14 Mar 2007, 11:44 AM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

Did that mod require that you put in a SQL patch when you installed it on your previous version?

BACKUP YOUR DBASE FIRST, then maybe put in that SQL patch again...

NB: I'm NOT SURE if this will help, but from your original post, the problem is quite likely a missing table in the database.

Use my suggestion at your own risk. If you backup (do a SQL dump and save it) then at least you can restore it to current steeings if this doesn't work.

14 Mar 2007, 1:40 PM
#7
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

Hi.

No, it didn't require a patch. Yes, a missing table. I've tried replacing the new audience.php with the old and this hasn't done anything except bring up an error on line 146 instead of 113.

I have found the this http://www.zen-cart.com/forum/archive/index.php/t-37200.html but don't know where to put this in the phpMyAdmin - I am no expert whatsover in databases etc. :lookaroun

14 Mar 2007, 2:28 PM
#8
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

Okay... don't be TOO intimidated. Last week I had trouble SPELLING "database", now I feel confident tinkering with them!

That thread, with the PATCH CODE that Dr Byte has written has to be inserted into your database.

What it will do is "modify" (or correct) the existing table structure that's causing your problem.

Now... you need to have PHPMYADMIN access to your database...

BEFORE YOU START - BACKUP YOUR SHOP AND DATABASE

If you DO have phpmyadmin, then log into phpmyadmin and you will see TWO frames on screen.

The LEFT frame asks you to select the database you want to work on.

(Select the appropriate database now, so it features in the right frame)

The RIGHT frame then displays your database and all the tables.

At the top of the RIGHT FRAME you will see a link called: SQL

Click that link

You now get a big INPUT box appear with the words "Run SQL Query" at the top and a GO button at the bottom right.

PASTE THIS CODE BELOW into that input box. Don't alter it in any way. It's the code Dr Byte has on that other thread:

truncate table query_builder;
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string ) VALUES ( '1', 'email', 'All Customers', 'Returns all customers name and email address for sending mass emails (ie: for newsletters, coupons, GV's, 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 ) 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 ) VALUES ( '3', 'email,newsletters', 'Dormant Customers (>3months) (Subscribers)', 'Subscribers who HAVE purchased something, but have NOT purchased for at least three 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 order by c.customers_lastname, c.customers_firstname ASC');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string ) 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 order by c.customers_lastname, c.customers_firstname ASC');
INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string ) 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 order by c.customers_lastname, c.customers_firstname ASC');

Then click "GO"

If you did everything correctly, that will fix the table that's required.

Log out of PHPMYADMIN (green exit button in left frame) and then see if your shop's working properly.

If not, RESTORE your backup.

14 Mar 2007, 2:51 PM
#9
monkeytastic avatar

monkeytastic

Zen Follower

Join Date:
Dec 2006
Posts:
141
Plugin Contributions:
0

Re: Couldn't find constant TABLE_SUBSCRIBERS

Many thanks, erm Schoolboy :smartass:

That's exactly what I needed to know but have just reinstalled the newsletters only subscription mod which means everything is now working as it should be (apart from the 'lock' link is no longer there but is still possible to send newsletters/emails)

I appreciate the help as will be good to know for the next upgrade etc.

Thanks again.