Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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?

Link to comment
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 >

Link to comment
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]"

Link to comment
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.

Link to comment
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 ======>>>>>.

Link to comment
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]"

Link to comment
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.

Link to comment
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 >

Link to comment
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.

Link to comment
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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...