0

I want to override block "upsell_products" in my custom module. I've create a module "Parus_Upsell" with the files below. If the module is enable the block just disappears from product view page, but when is disabled the blocks shows normally. It looks like the rewrite works normally and magento can find the block (i tried to call new Parus_Upsell_Block_Upsell; and var_dump(mageFindClassFile('Parus_Upsell_Block_Upsell')); and var_dump(Mage::getConfig()->getBlockClassName('catalog/product_list_upsell')); and it all works correctly returning my class name and correct paths. Moreover, if call print_r ($this->getSortedChildren()); from the theme view.phtml it returns all children blocks except "upsell_products" (if I disable the module, the block comes back to layout). But if I in fact haven't overridden yet anything with the block class, why it doesn't show content from default block? Magento version is 1.9.2

/app/code/local/Parus/Upsell/Block/Upsell.php

<?php
class Parus_Upsell_Block_Upsell extends Mage_Catalog_Block_Product_List_Upsell {
}

/app/code/local/Parus/Upsell/etc/config.xml

<?xml version="1.0"?>
<config>
 <modules>
 <Parus_Upsell>
 <version>0.1.0</version>
 </Parus_Upsell>
 </modules>
 <global>
 <blocks>
 <parus_upsell>
 <class>Parus_Upsell_Block</class>
 </parus_upsell>
 <catalog>
 <rewrite>
 <product_list_upsell>
 Parus_Upsell_Block_Upsell
 </product_list_upsell>
 </rewrite>
 </catalog>
 </blocks>
 <helpers>
 <parus_upsell>
 <class>Parus_Upsell_Helper</class>
 </parus_upsell>
 </helpers>
 </global>
</config>

/app/etc/modules/Parus_Upsell.xml

<?xml version="1.0"?>
 <config>
 <modules>
 <Parus_Upsell>
 <active>active</active>
 <codePool>local</codePool>
 </Parus_Upsell>
 </modules>
 </config>
asked Jan 6, 2016 at 15:48

1 Answer 1

2
<product_list_upsell>
 Parus_Upsell_Block_Upsell
</product_list_upsell>

should be in one line:

<product_list_upsell>Parus_Upsell_Block_Upsell</product_list_upsell>
answered Jan 6, 2016 at 17:43
2
  • 1
    I agree, this is one of those things that Magento needs inline. Commented Jan 6, 2016 at 19:57
  • Ugh, that got me. Sorry to rant, but it would be helpful if Magento simply used an XML parser to read this kind of information. Commented Mar 2, 2016 at 17:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.