Zen Cart Logo
Forums / General Questions / Insert Gift Certificate manualy to database

Insert Gift Certificate manualy to database

Locked

Views: 1,645

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
9 May 2007, 12:40 PM
#1
kallemd avatar

kallemd

New Zenner

Join Date:
May 2007
Posts:
14
Plugin Contributions:
0

Insert Gift Certificate manualy to database

Hi there,
I faced this problem today. I generated 1000 coupon_codes for same amount of gift certificates. My script entered them to database, but now when I try to use them with my test user I cant get the coupon_code work. So there is somekind of relation to other table or check somewhere, but I cant find it. Any ideas what I'm missing?

  • kAlle
9 May 2007, 12:47 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Insert Gift Certificate manualy to database

How did you make these?

Check the coupon database, what are the fields set to?

A new Gift Certificate would be:

coupon_id coupon_type coupon_code coupon_amount coupon_minimum_order coupon_start_date coupon_expire_date uses_per_coupon uses_per_user restrict_to_products restrict_to_categories restrict_to_customers coupon_active date_created date_modified coupon_zone_restriction
3 G 24ab70abc8 100.0000 0.0000 0001-01-01 00:00:00 0001-01-01 00:00:00 1 0 NULL NULL NULL Y 2007-05-09 08:43:04 0001-01-01 00:00:00 0

9 May 2007, 12:52 PM
#3
kallemd avatar

kallemd

New Zenner

Join Date:
May 2007
Posts:
14
Plugin Contributions:
0

Re: Insert Gift Certificate manualy to database

The values are exactly same as the one I generated via admin panel besides the coupon_id and coupon_code. I wonder is the coupon_code just random string?

9 May 2007, 12:56 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Insert Gift Certificate manualy to database

The code is just a random string ...

Providing the other fields are set correctly, it can be redeemed ...

What is coupon_type set to?

What is coupon_active set to?

9 May 2007, 1:03 PM
#5
kallemd avatar

kallemd

New Zenner

Join Date:
May 2007
Posts:
14
Plugin Contributions:
0

Re: Insert Gift Certificate manualy to database

Here is sample a row from database:

6
G
37bac01735
20.0000
0.0000
0001-01-01 00:00:00
0001-01-01 00:00:00
1
1
NULL
NULL
NULL
Y
2007-05-09 14:20:40
0001-01-01 00:00:00
0

9 May 2007, 2:16 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Insert Gift Certificate manualy to database

I cannot see what you may have broken on this ...

Have you tried switching to Classic to see if you can claim it?

And you are sure you are not claiming one that is claimed?

And you are sure that you have no typos?

More or less try this on one of your records:

1 set coupon_type to: G

2 set coupon_amount to: 20.00

3 set coupon_code to: ABC

4 set coupon_active to: Y

Now try to redeem it ...

10 May 2007, 7:19 AM
#7
kallemd avatar

kallemd

New Zenner

Join Date:
May 2007
Posts:
14
Plugin Contributions:
0

Re: Insert Gift Certificate manualy to database

*I cannot see what you may have broken on this ...
*Me either :frusty:
*Have you tried switching to Classic to see if you can claim it?
*What you mean by Classic?
*And you are sure you are not claiming one that is claimed?
*I'm sure. I have created now bunch of them and none of them work. Some I have entered to database via console, some via phpmyadmin and some with my php script.
*And you are sure that you have no typos?
*Well.. I'm pretty sure, since I have more or less copypasted almost dozen rows now.
*More or less try this on one of your records:
*I added this row, but I was not able to redeem it.
*1 set coupon_type to: G

2 set coupon_amount to: 20.00

3 set coupon_code to: ABC

4 set coupon_active to: Y

Now try to redeem it ...*

If I somehow manage to solve this I will inform you, but I just cant figure out whats wrong atm. Annoying..

10 May 2007, 2:11 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Insert Gift Certificate manualy to database

What I mean by switching to Classic is to literally switch your template from your custom one to the Classic Template that comes with Zen Cart to help rule out a template issue causing this problem ...

Are you able to create accounts, place orders from start to finish etc.?

11 May 2007, 11:49 AM
#9
kallemd avatar

kallemd

New Zenner

Join Date:
May 2007
Posts:
14
Plugin Contributions:
0

Re: Insert Gift Certificate manualy to database

Short break from this issue and deeper look into functions solved this problem.

gv_redeem/header.php

$gv_query = "SELECT c.coupon_id, c.coupon_amount
               FROM " . TABLE_COUPONS . " c, " . TABLE_COUPON_EMAIL_TRACK . " et
               WHERE coupon_code = :couponCode
               AND c.coupon_id = et.coupon_id
               AND c.coupon_type = 'G'";

So I was missing row in coupon_email_track table. Thank you for you help :clap:

11 May 2007, 3:46 PM
#10
wildwayne avatar

wildwayne

New Zenner

Join Date:
Mar 2007
Location:
Medford, OR
Posts:
4
Plugin Contributions:
0

Re: Insert Gift Certificate manualy to database

are you available to help me?

12 May 2007, 4:29 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Insert Gift Certificate manualy to database

Would help to have a question ... :smile: