Jump to content
Sign in to follow this  
Jon Burdon

Coupon Problem

Recommended Posts

I just installed addon GV and DC RC1 RC2 RC2a v1.2 in to my demo shop.

 

I logged in with a dummy account and tried to buy an item. I got this error at checkout:

 

"Fatal error: Call to undefined function tep_count_active_coupons() in /home/fhlinux133/p/planetprimary.co.uk/user/htdocs/catalog/checkout_payment.php on line 318"

 

I have no payment method set up yet.

 

 

Any ideas?

Share this post


Link to post
Share on other sites

function tep_count_active_coupons() {

 $coupon_query = tep_db_query("select count(*) as total from " . TABLE_COUPONS . " where coupon_status = '1'");
 $coupons = tep_db_fetch_array($coupon_query);

 return $coupons['total'];
}

Add to /catalog/includes/functions/general.php at the bottom BEFORE the closing PHP tag:

 

?>

It was probably in the install directions somewhere...

:huh:

 

Backup the file before editing.

 

You break it - You bought it.

:o


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Brill. That seems to have fixed that..... and thrown up a new error when I checkout....

 

 

"1146 - Table 'planetprim1.TABLE_COUPONS' doesn't exist

 

select count(*) as total from TABLE_COUPONS where coupon_status = '1'

 

[TEP STOP]"

Share this post


Link to post
Share on other sites

I found an SQL file that I have not installed. It looks like this:

CREATE TABLE coupon_to_customer (

coupon_id int(11) NOT NULL default '0',

customer_id int(11) NOT NULL default '0',

order_id int(11) NOT NULL default '0',

redeem_date datetime NOT NULL default '0000-00-00 00:00:00',

PRIMARY KEY (coupon_id,customer_id,order_id)

) TYPE=MyISAM;

 

CREATE TABLE coupons (

coupon_id int(11) NOT NULL auto_increment,

coupon_code varchar(32) NOT NULL default '',

coupon_amount decimal(15,4) NOT NULL default '0.0000',

coupon_type tinyint(1) NOT NULL default '0',

coupon_status tinyint(1) NOT NULL default '0',

coupon_use tinyint(1) NOT NULL default '0',

PRIMARY KEY (coupon_id)

) TYPE=MyISAM;

 

Is that what is causing the problem? The installation instructions don't seem to say what I need to do with it.

Share this post


Link to post
Share on other sites

Probably assumed you would know :-)

 

See my useful threads link for a guide on "running" sql commands/code.

 

Enjoy

 

G

Edited by geoffreywalton

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites
Probably assumed you would know :-)

 

See my useful threads link for a guide on "running" sql commands/code.

 

Enjoy

 

G

Where can I find these? I have done a few searched which reveal nothing. Sorry to ask again.

Share this post


Link to post
Share on other sites

I have now run the sql code successfully on my phpmyadmin tool. Never done that before!

 

I still have this checkout error:

 

"

1146 - Table 'planetprim1.TABLE_COUPONS' doesn't exist

 

select count(*) as total from TABLE_COUPONS where coupon_status = '1'

 

[TEP STOP]"

Share this post


Link to post
Share on other sites
I have now run the sql code successfully on my phpmyadmin tool. Never done that before!

 

I still have this checkout error:

 

"

1146 - Table 'planetprim1.TABLE_COUPONS' doesn't exist

 

select count(*) as total from TABLE_COUPONS where coupon_status = '1'

 

[TEP STOP]"

Did you double check that you created the table coupons?


I am currently just learning osCommerce and PHP, but am always willing to help out.

 

Have successfully installed the following: Discount Coupons, UPS shipping module, Ultimate SEO URL's, Easy Meta Tags for SEO 1.0, Google XML Sitemap SEO v1.3, HTML Editor for Email and Newsletters.

Share this post


Link to post
Share on other sites

Either you can't follow directions very well, or the contrib has some crappy instructions...

:huh:

 

My guess is you were supposed ot add something to /catalog/includes/database_tables.php like:

 

  define('TABLE_COUPONS', '[size=5][color="#FF0000"][b]?????????????????????[/b][/color][/size]');


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

I mucked around again with re-uploading stuff file by file and checking stuff carefully. I tried following all the advice above.... and hey presto something I did made it work!!! Thanks.

 

Sometimes instructions are just far too brief for us first timers.

Share this post


Link to post
Share on other sites

Now that the code doesn't throw back an error, I have set up a coupon in my admin tool.

 

Then as a user I get to the Payment Information page and I just see

 

TABLE_HEADING_COUPON

and TEXT_COUPON_ENTERED

 

instead of a discount being applied.

 

Any thoughts?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×