0

OK so I'm using C4B Freeproduct extension for this. This basically adds in functionality for you to choose a product as a free gift if certain criteria are met. This adds the functionality directly to the shopping cart price rules promo section.

This is basically what it adds to the shopping cart rules section of the site

So I don't know why it won't apply a rule more then once, but it only applies it once. The modules observer.php contains this:

 /**
 * Make sure that a gift is only added once, create a free item and add it to the cart.
 * 
 * @param Mage_Sales_Model_Quote $quote
 * @param Mage_Sales_Model_Quote_Item $item
 * @param Mage_Sales_Model_Quote_Item $rule
 */   
protected static function _handleGift(Mage_Sales_Model_Quote $quote,
                                      Mage_Sales_Model_Quote_Item $item,
                                      Mage_SalesRule_Model_Rule $rule) {
    if ($rule->getIsApplied()) {
        return;
    }

    $qty = (integer) $rule->getDiscountAmount();
    if ($qty) {
        $freeItem = self::_getFreeQuoteItem($quote, $rule->getGiftSku(), $item->getStoreId(), $qty);
        self::_addAndApply($quote, $freeItem, $rule);
    }
}

I cannot figure out for the life of me how to modify this at all to allow a rule follow the Maximimum Qty Discount Applied To Field: but If anyone can help in this it's most appreciated. I have tried for the past 4 days modifying code creating functions and I just keep running into a dead end. Can someone please help here.

  • How would you expect this setting to take effect? "Maximum qty" is used for percentage discounts, i.e. "10% off for maximum 5 products". But what should "2 free gifts for maximum 5 products" mean? You either get 2 free gifts, or not. If you are looking for "number of free gifts based on number of ordered items" and then set a limit to that, the extension is not made for this (I know, because I was involved in its development) – Fabian Schmengler Dec 30 '16 at 21:50
  • Thats what why im trying to extend this further then what was provided. Im very new to Magento and all magentos nuances are a little much for me to grasp when i havent fully gone rhrough everything which I currently dpnt have time to do – user47507 Dec 30 '16 at 21:54
  • I also dont understand why the maximum quantitt couldnt work if implemented. Saying maximum 5 gifts of this gift product allowed per order – user47507 Dec 30 '16 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy