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>
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>
  • 1
    I agree, this is one of those things that Magento needs inline. – RussellAlbin Jan 6 '16 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. – Biagio Arobba Mar 2 '16 at 17:22

Your Answer

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

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