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.

Recommended Answers

All 4 Replies

So what is your design so far???

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.