Buy One Get One Free Scripting Strategy in Magento
My objective is to create a buy xyz get xyz free, where x, y, and z are separate products. When purchasing EITHER x, y, or z, the customer can one of x, y, or z products for free.
I've tried to create this function within Magento's price rules, but I have not had any success whatsoever. I've read pretty much everything on the internet regarding these rules and have gotten nowhere. I'm thinking about creating a page that allows the user to select the products they would like to pur开发者_如何转开发chase in sequence, then using that information to add a bundled cart item to the user's cart. There may be a simpler way, though, and I'm wondering if anyone has any insight.
Please note that the items in question are configurable items with two attribute sets, just to make it interesting.
I'd hook into the Shopping Cart price rules engine for this. The system is designed to apply a set of rules an alter the price of a cart. I'd
Figure out where the pricing rules are applied
Override that method using the config override system built into Magento
Have the override method first call its parent, so that all original pricing rules are applied
Once that's done, include you custom logic at the end
Next, and related to #4, create new model objects that keep track of which products are buy one/get one, and (optionally) create a UI in the admin to manage these relationships. These are the models you'd be looking at in #4 to apply your rules.
Good luck.
So since I was unable to acquire the time resource to implement Alan's answer, I got a workaround going for this by adding custom options to the configurable products, which were dropdowns of the different "bogo" products. This is flawed in that it does NOT account for stock, but in my situation, it worked in the time being.
精彩评论