We need to the ability to provide customers who purchase a particular product type (attribute type) a free type of gift with that product.
The products offered as a free gift are associate products of a configurable product. They need to be linked so that when this free gift is selected, it deducts from this SKU's quantity in inventory.
There are about 100 of these types of products that will be offered as a free gift – so ideally presenting the options in a dropdown menu would be preferred.
We've checked out about 10 'free gift extensions' now for Magento (and can't find any more) and none of them can do what we want or are wrote appallingly. They mostly auto add products at cart based on a rule like total amount. They're all limited in functionality and offer mininal to no flexibility.
I'm unable to add this as a configurable option due to the setup.
I can create them as a custom option but then they do not link up with the actual product SKU's and deduct from quantity in inventory.
Can anyone advise of an extension that can do this or the best way to implement this ability? It's looking more and more likely that we'll have to write our own extension to do this but find it hard to believe there would not be something out there that does this already.
Best Answer
As you've mentioned there are 10+ extensions that do this. No extension is going to fulfill your every business rule out of the box - make it yourself!
Then, create a new block and template to display the custom options from this product:
And make use of
getFreeProductOptions
in your template/phtml file:You will want to call this block that renders the template from inside a
getChildHtml
and locate that inside of the<form>
element on your theme'scatalog/product/view.phtml
file. This way, thefree_product
value comes along for the ride with an add to cart button click.All you have to do then is create an observer of the cart add postdispatch event and examine the request object. From there you'll have the chosen option id to add to the cart. Voila!
Best of luck!