When to use:
Magento has a native “buy x get y” sales rule in promotions. Magento’s x and y refer to a same product. For example, if a product offer is “buy 3 get 2”, you have to buy 5 of this product then only pay for 3 of them.
Quite often the store owners want to give an offer which let customers choose from a wide range of products, (the programme add them up, get a total quantity of subselect), and offer another selection of products for free. It is useful if the store have two ranges of products, among which prices are almost the same. Let’s make it clear to you: in this module, “buy x get y” means “Buy X selection of products, Get another Y selection for free”.
I wrote some quick and dirty codes to do “Buy X selection of products, Get another Y selection for free” quite a while ago, but this release refactors the codes into a standard standalone Magento extension.
How to install:
Copy the whole “app” folder, merge to magento/app. That’s it.
If you are logged in Magento backend when doing installation, that’s fine. But you have to log out and log in again to access Buy X Get Y configuration section in System Configuration.
How to use:
Log in Magento backend, go to Promotions -> Shopping Cart Price Rules, create a new rule whose name must start with “[bxgy]”;
In “Rule Information” tab, apart from the Rule Name, set up everything else as if it is normal Magento sales rule;

In “Conditions” tab, create a product total quantity subselect. The product subselect should match the selection of X product in the offer, and condition is “equals or greater than”, and quantity should match the quantity of X product used as qualifier;
* Do not create more than one subselect. Result is unpredictable otherwise.
* The condition must be “equals or greater than” and the quantity must be the threshold quantity of the offer. Although the calculation of the free quota of Y product is not dependent on the quantity (it is dependent on the settings in “Actions” tab), the offer validation is still Magento original logic. This module changes the discount amount after the offer validation. In other words, you must think about when to trigger Magento native “buy x get y”, and do the same conditions for this module.

In “Actions” tab, set Apply to “Buy X get Y (discount amount is Y)” (although this is not normal buy_x_get_y action, the program still check this simple_action), set Discount amount to offer free quota, set Maximum Qty Discount is Applied to to 0, set Discount Qty Step (Buy X) to offer quantity qualifier. For example, if the offer is “buy any 3 of X products, and get any 2 of Y products free”, then set Discount amount to 3, set Maximum Qty Discount is Applied to to 0, set Discount Qty Step (Buy X) to 2. Then, in “Apply the rule only to cart items matching the following conditions (leave blank for all items)”, create a combination of conditions which match the selection of Y product in the offer. Multi combination is OK;

In “Label” tab, enter the offer labels as normal. It is not required, but if you leave it blank, the “ugly” Rule Name “[bxgy]***” will be used is discount description;
Now save the rule, and go to System -> Configuration -> Buy X Get Y -> Buy X selection of products, Get another Y selection for free, set up the offer reminder message in cart. It is not required. And if it is not set up, the offer is still taking effect as long as the sales rule is enabled.
How is it created:
This module is created by koukou1985’s module creator (http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table). Thanks to koukou1985.
How good is it:
This module does not override any Mage classes. It is safe to use with other extensions as long as namespace and module name do not conflict.
FAQ:
Q: Why this module does not work?
A: I won’t cover all reasons that make my module not working. I only point out caveats of my module, and expect you to have common knowledge of Magento, such as “refresh the cache to see the newly installed features”. All caveats are in above sections. So, if you are stuck, go back to the top and read again.
Download BuyXGetY.tar.gz
Update: a new version of bxgy module is available at http://blog.goods-pro.com/1764/magento-extension-bxgy-0-1-1-is-released/
2011/02/21 Update again: please checkout a newer release. Always leave comments on the newest release post. The comment on this post is closed.