0

i have build a project where wordpress themes can be purchased. Build with Codeigniter
how to implement multiple coupons for a single Theme / Item for % discount.
i need some help regarding database design.

2
Contributors
4
Replies
22
Views
2 Years
Discussion Span
Last Post by mangel.murti
0

thank for your reply.

i have admin panel from where coupons is created and store to below table.

coupon_id , couponname , couponcode, precentageoff, startdate , enddate,apply_to

below is table Where all themes is stored

theme_id,price, name etc....

i am able to calculate % of individual by coupon code for a perticular theme.

but let say theme_id --->12 which has coupon_id 2,3,4 how to achive this.

Edited by mangel.murti: clarify

1

You could relate those tables by adding another table that stores only theme_id and coupon_id. For example...

coupon_id  coupon_name  coupon_code ...
1          Blah1        ....
2          Blah2        ....
3          Blah3        ....
4          Blah4        ....

theme_id  price  name ....
1         100    Theme1
2         50    Theme1
3         40    Theme1

theme_id  coupon_id
1         2
1         3
2         2
2         4

The above table data shows that you have 4 coupon data and 3 themes. The third table relate the theme to coupon. It means that your theme ID 1 is related to coupon 2 and 3. Theme ID 2 is related to coupon 2 and 4. Theme 3 has no coupon. It is a many-to-many relationship.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.