3

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.

6
  • See my answer. Not everyone has a catalog they're unable to reorganize or change; and no extension can account for every business rule you may have. Creating this extension would be pretty trivial IMHO.
    – philwinkle
    Commented Sep 4, 2013 at 15:06
  • Hi, I can offer my own Gift Promotions module, which has the ability to add configurables, as selectable products, in the cart. Code is well written with many events fired to allow further customization. See proxiblue.com.au/magento-free-gift-promotions-extension.html - contact me via the contact page, and I can send you some code examples. media.proxiblue.com.au/media/catalog/product/cache/1/image/700x/…
    – ProxiBlue
    Commented Feb 12, 2014 at 3:24
  • @ProxiBlue I had tried your extension at the time of posting this question and it did not cater for what we wanted. Whether that has changed now? Either way, we wanted to offer any simple product of a configurable/grouped product type as a free gift on any product type (just to clarify).
    – zigojacko
    Commented Feb 12, 2014 at 9:33
  • @GeoffJackson-zigojacko Maybe I am misundertsanding your words: When you say 'offer any simple of configurable', is that not the same as saying 'offer a configurable, allowing the customer to select the assocaited simple' (like when you do a normal configurable?) - or does what you want differ from that?
    – ProxiBlue
    Commented Feb 12, 2014 at 12:19
  • @ProxiBlue - No, we wanted the ability to select any product type (simple products) in the catalog and show these as free gift in a dropdown list. Without seeing an example of the configurable offered with the simple product options all within a free gift model, it's hard to confirm whether this would have worked or not.
    – zigojacko
    Commented Feb 12, 2014 at 12:26

1 Answer 1

6

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!

  • Create one 'free' product
  • Set their visibility to be 'Not Visibile Individually'
  • Set the 100+ custom options on the product
  • Create a System > Configuration input field and tab set to manage the ID of the free product (alternatively create a product attribute or attribute set that identifies the product as a free product type). I will use the former as a suggested approach.

Then, create a new block and template to display the custom options from this product:

<?php

class YourCompany_YourModule_Block_Freeproduct extends Mage_Core_Block_Abstract
{

    protected $_freeProduct;

    public function getFreeProduct()
    {
        if(!isset($this->_freeProduct)){
            $id = Mage::getStoreConfig('system/freeproduct/free_product_id');
            $this->_freeProduct = Mage::getModel('catalog/product')->load($id);
        }

        return $this->_freeProduct;
    }

    public function getFreeProductOptions()
    {
        if($product = $this->getFreeProduct()){
            if(!$product->hasOptions()){
                return;
            }

            return $product->getOptions();
        }
    }

}

And make use of getFreeProductOptions in your template/phtml file:

<?php if($options = $this->getFreeProductOptions()): ?>

    <select name="free_product">
        <?php foreach($options as $option): ?>
            <option value="<?php echo $option->getId();?>"><?php echo $option->getTitle(); ?></option>
        <?php endforeach; ?>
    </select>

<?php endif; ?>

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's catalog/product/view.phtml file. This way, the free_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!

3
  • Hey Phil, thanks for your answer. I still don't get how your solution will ensure that each of these options that can be offered as the free gift link to the products in the catalog and deduct from quantity. I'm essentially trying to offer a simple product (associated product) of a configurable product as the free gifts. We're already using custom options for this at present but of course, they just work independently as opposed to deducting qty when selected as free gift.
    – zigojacko
    Commented Sep 4, 2013 at 16:22
  • So tracking inventory is important to you, then. I absolutely missed that in the original question. In this case my solution is no more effective than your own solution. I will rework my answer to display the list of related products instead.
    – philwinkle
    Commented Sep 4, 2013 at 19:54
  • Top man, thanks Phil. I was toying with the idea of utilising the cross sells feature for this (this feature currently isn't being used for anything). But hey, I'll wait to see what you recommend as I'm sure it'll be a better approach. :) Thanks again.
    – zigojacko
    Commented Sep 5, 2013 at 7:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.