0

I am using Magento 1.9.3

For your convenience I am explaining with example:

Lets imagine two products.

Product1

Regular Price : 50

Group Price : 55

Product2

Regular Price : 60

Group Price : 55

When Regular Price is lower than Group Price it showing Regular Price.

Again when Regular Price is higher than Group Price it showing Group Price.

Always showing lower price.

For product1: 50 < 55 getting 50

For product2: 55 > 60 getting 55

But in both case I need to show the price: 55 (Group Price)

Can I do that?

1
  • I have the same problem but I couldn't solve it with your suggestion. Can you please give me more details? step by step. Thank you Commented Oct 30, 2019 at 8:20

1 Answer 1

1

You need to modify _applyGroupPrice and getBasePrice method.

app/code/core/Mage/Catalog/Model/Product/Type/Price.php

Overwrite this class and remove min function from there.

[Update]

Overwrite config:

<global>
    <models>
        <catalog>
            <rewrite>
                <product_type_price>SR_MagentoCommunity_Model_Product_Type_Price</product_type_price>
            </rewrite>
        </catalog>
    </models>
</global>

app/code/local/SR/MagentoCommunity/Model/Product/Type/Price.php

<?php

class SR_MagentoCommunity_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price
{
    public function getBasePrice($product, $qty = null)
    {
        $price = (float)$product->getPrice();
        $groupPrice = $product->getGroupPrice();
        if (is_numeric($groupPrice) && $groupPrice && ($groupPrice != $price)) {
            return $groupPrice;
        }

        return parent::getBasePrice($product, $qty);
    }

    /**
     * Get product group price
     *
     * @param Mage_Catalog_Model_Product $product
     * @return float
     */
    public function getGroupPrice($product)
    {

        $groupPrices = $product->getData('group_price');
        if (is_null($groupPrices)) {
            $attribute = $product->getResource()->getAttribute('group_price');
            if ($attribute) {
                $attribute->getBackend()->afterLoad($product);
                $groupPrices = $product->getData('group_price');
            }
        }

        if (is_null($groupPrices) || !is_array($groupPrices)) {
            return $product->getPrice();
        }

        $customerGroup = $this->_getCustomerGroupId($product);

        $matchedPrice = 0;
        foreach ($groupPrices as $groupPrice) {
            if ($groupPrice['cust_group'] == $customerGroup) {
                $matchedPrice = $groupPrice['website_price'];
                break;
            }
        }

        return $matchedPrice;
    }
}
4
  • Sohel bhai, Can you please tell me little bit details. I tried but couldn't solve by your suggestion.
    – SA Soibal
    Commented May 6, 2019 at 6:01
  • @SASoibal I will post update today.
    – Sohel Rana
    Commented May 6, 2019 at 6:57
  • Check updated answer.
    – Sohel Rana
    Commented May 6, 2019 at 10:29
  • Wroked like a charm bro. Thanks a lot.
    – SA Soibal
    Commented May 7, 2019 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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