Hello friends,

I am working on e commerce site these days. Every goes well but now i am stuck on discount functionality.

My client wants to have following functionality in the site

1)- i want to offer simple discounts: 10% off, 20% off with voucher or code number
2)- i want to offer discounts for multiple purchases: buy 1 get 50% off next purchase, buy 2 get 1 free
3)- recommend a friend and get a discount

Can any one shares his/her views regarding how these can work with the shop?


Thanks
navi

ok fine. when ever user bought a firstproduct it will store on database. then administrator assign discount percentage for that user. this percentage store in database with userid. next time when ever same user come to buy products then check percentage is available or not.

Hello Navi,

Hope you find some solution from here, I will give you some logic..

1)- i want to offer simple discounts: 10% off, 20% off with voucher or code number
2)- i want to offer discounts for multiple purchases: buy 1 get 50% off next purchase, buy 2 get 1 free
3)- recommend a friend and get a discount

Make one table for discount type, give admin to control to feed data:

id discount Name value unit
1 20% simple 10 %
2 10% simple 20 %
3 Buy 1 get 50% 50 %
4 Buy 2 get 1 free 100 %
5 Recommend friend & get 15% 15 %

Now you can integrate this discount type with Two way.

1) you directly give the one discount id field into product table (if you want just one discount for one product)
2) Otherwise make one associations table for product-discount.

id discount_id product_id

3) Now admin can give one or multiple discount to any product at the time of add/edit product.

4) If you give different panel for admin to manage this product-discount, then it is also possible by giving one selection box for product & multi-selection box for discount.

Hope you find some help with this..:-):?:

Hello Hemant,
thanks for the reply.
your post was helpful but still i am confused.
How the system will work on frontend?

For Frontend:

1) When any end user select any product for add to cart (eg.

product1).

2) your code get discount_id from the product-discount table

accordingly selected product_id.

3) Now you have one or multiple discount_id.

4) If it is one just reduce value of discount from total price.

5) If you have multiple discount_id then you need to reduce that

all price from the total price.

I hope this help you for go ahead


Hello Hemant,
thanks for the reply.
your post was helpful but still i am confused.
How the system will work on frontend?

I am planning to build separte admin section for discount.
Where admin can assign the particular product to multiple discount types.

thanks hemant. I will let you know if i stuck somewhere.

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.