mytrash Posted February 29, 2012 Share Posted February 29, 2012 Hello I am developing module which allows user to buy product with zero price when he buys another (expensive) product. I am able to find that user is adding expensive product to cart. At this moment I would like to add another product to cart automatically with zero price. Example: There are 3 products on my stock: id name price 1 Bottle of vine 100 Eur 2 Table 200 Eur 3 Expensive Car 10000 Eur You can buy each product independently, but when you buy Expensive Car I would like to add Bottle of vine with ZERO price. At this time I am able to add Bottle of vine (I am using $cart->updateQty method), but the price of the vine in the cart is 100 Eur :-( and I need 0 Eur. Than you for your help. Myth Link to comment Share on other sites More sharing options...
bellini13 Posted February 29, 2012 Share Posted February 29, 2012 perhaps you could create a voucher for the free product, and when you add the bottle of vine product, apply the voucher code at the same time. Link to comment Share on other sites More sharing options...
mytrash Posted March 8, 2012 Author Share Posted March 8, 2012 Hello, thank you for your answer. Is it possible to generate voucher in code on specified product? Is there any example how to do that? I am not able to find any example. Link to comment Share on other sites More sharing options...
bellini13 Posted March 8, 2012 Share Posted March 8, 2012 to get a list of discounts available for a customer, you would do something like this $discounts = Discount::getVouchersForProduct($id_category_current, (int)$id_customer); the above will return you an array of discount information, so you will need to find the discount you want to apply. once you find it, then to add a discount to the cart, you would do something like this. $cart->addDiscount($id_discount); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now