0

I'm using two modules: Webtex_CustomerPrices and FireGento_MageSetup.

There's a block created inside customtierprices.xml(Webtex_CustomerPrices module):

<catalog_product_view>
    <reference name="content">
       <block type="customerprices/catalog_product_price" name="customtierprices">
           <action method="setTemplate">
               <template>customerprices/customertierprices.phtml</template>
           </action>
       </block>
    </reference>
</catalog_product_view>

When I write this code in customtierprices.phtml, before any other code:

echo get_class($this);

I'm getting this output: FireGento_MageSetup_Block_Catalog_Product_Price

How is that possible? In the .xml file it is clearly stated that it should be an instance of customerprices/catalog_product_price

Thanks!

2 Answers 2

1

The class in FireGento/MageSetup/Block/Catalog/Product/Price/Abstract.php is extended as follows:

abstract class FireGento_MageSetup_Block_Catalog_Product_Price_Abstract
    extends Mage_Catalog_Block_Product_Price
{  }    

But what I needed was:

abstract class FireGento_MageSetup_Block_Catalog_Product_Price_Abstract
    extends Webtex_Customerprices_Block_Catalog_Product_Price
{  }

Now I can use Webtex_Customerprices methods in customertierprices.phtml.

I still don't understand though how this could override the block with defined type that was explicitly created in the xml file.

EDIT

Above solution caused 'unknown class' problems on other pages(catalog, search etc.).

I've reverted to default parent class in Abstract.php and manually created Webtex_Customerprices object in customertierprices.phtml

$wcuObj = new Webtex_Customerprices_Block_Catalog_Product_Price();
$_tierPrices = $wcuObj->getCustomTierPrices();

Then $this->getTierPrices() works fine as it exists somewhere down the inheritance chain starting from FireGento_MageSetup_Block_Catalog_Product_Price

0

You can check config.xml of the FireGento_MageSetup extension - it might have rewrites of the catalog_product_price block.

1
  • Thanks for your comment Dmitry but I haven't found such override in MageSetup's xml files.
    – Alan
    Commented Feb 16, 2015 at 11:45

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.