2
votes

Is the following scenario possible in Magento?.

Tiering pricing and bulk discount will be applicable to the same order. I want 4% discount on total over $200. However the tiering priced product price will not be considered toward bulk discount Rule.

e.g I have 4 product

product 1 price = 10  and having tier price = $8 for 5+ products
product 2 price = 10
product 3 price = 100
product 4 price = 140

so if i order like

product 1 qty-6  price = $48
priduct 2 qty-1  price = 10
priduct 3 qty-1  price = 100
priduct 4 qty-1  price = 140

we apply tier pricing for Product 1, which will not be eligible for bulk pricing. However the remaining amount will still be eligible for bulk pricing. This means, 4% discount will be applied to $250 (10 + 100 + 140).

I need to substract the product total which has tier price applied in the cart and need to check the remaining product total against my shopping cart rules for discount.

can any one please guide me how do i achieve this?

1
Have you tried to create it and it doesn't work or what ? - Meabed

1 Answers

0
votes
public static function calculatePrice($basePrice, $specialPrice, $specialPriceFrom, $specialPriceTo,
            $rulePrice = false, $wId = null, $gId = null, $productId = null)
    {
        Varien_Profiler::start('__PRODUCT_CALCULATE_PRICE__');
        if ($wId instanceof Mage_Core_Model_Store) {
            $sId = $wId->getId();
            $wId = $wId->getWebsiteId();
        } else {
            $sId = Mage::app()->getWebsite($wId)->getDefaultGroup()->getDefaultStoreId();
        }

        $finalPrice = $basePrice;
        if ($gId instanceof Mage_Customer_Model_Group) {
            $gId = $gId->getId();
        }

        $finalPrice = self::calculateSpecialPrice($finalPrice, $specialPrice,          $specialPriceFrom, $specialPriceTo, $sId);

        if ($rulePrice === false) {
            $storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
            $rulePrice = Mage::getResourceModel('catalogrule/rule')
                ->getRulePrice($storeTimestamp, $wId, $gId, $productId);
        }

        if ($rulePrice !== null && $rulePrice !== false) {
            $finalPrice = min($finalPrice, $rulePrice);
        }

        $finalPrice = max($finalPrice, 0);
        Varien_Profiler::stop('__PRODUCT_CALCULATE_PRICE__');
        return $finalPrice;
    }

in Mage_Catalog_Model_Product_Type_Price has

 if ($rulePrice === false) {
            $storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
            $rulePrice = Mage::getResourceModel('catalogrule/rule')
                ->getRulePrice($storeTimestamp, $wId, $gId, $productId);
        }

So within $rulePrice == false check for qty of product and whether any bulk pricing applicable if yes then

if ($rulePrice === false) {
            $storeTimestamp = Mage::app()->getLocale()->storeTimeStamp($sId);
            $flag = $this->someCheckFunction()  // This function you will have to write
            if($flag == 1) {

            $rulePrice = Mage::getResourceModel('catalogrule/rule')
                ->getRulePrice($storeTimestamp, $wId, $gId, $productId);
           }
        }