简体   繁体   中英

Magento - Upgraded from 1.5 to 1.7 and getting an error in custom theme

After upgrading to 1.7 (all on a dev server thankfully!) I am getting the following error logs for the clients custom theme:

a:5:{i:0;s:93:"Invalid method Mage_Catalog_Block_Navigation::renderCategoriesAndChildrenMenuHtml(Array
(
)
)";i:1;s:3806:"#0 /var/www/vhosts/mydomain.co.uk/httpdocs/app/design/frontend/p365_mydomain/default/template/catalog/navigation/left.phtml(17): Varien_Object->__call('renderCategorie...', Array)
#1 /var/www/vhosts/mydomain.co.uk/httpdocs/app/design/frontend/p365_mydomain/default/template/catalog/navigation/left.phtml(17): Mage_Catalog_Block_Navigation->renderCategoriesAndChildrenMenuHtml()
#2 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/vhosts...')
#3 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/p365_s...')
#4 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#5 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#6 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#7 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#8 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#9 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#10 /var/www/vhosts/mydomain.co.uk/httpdocs/app/design/frontend/p365_mydomain/default/template/page/2columns-left.phtml(34): Mage_Core_Block_Abstract->getChildHtml('left')
#11 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/vhosts...')
#12 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/p365_s...')
#13 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#14 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#15 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#16 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#17 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#18 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#19 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#20 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->indexAction()
#21 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#22 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#23 /var/www/vhosts/mydomain.co.uk/httpdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#24 /var/www/vhosts/mydomain.co.uk/httpdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#25 /var/www/vhosts/mydomain.co.uk/httpdocs/index.php(87): Mage::run('', 'store')
#26 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:22:"mydomain_store_view";}

Theme is working fine on a 1.5 installation, but as the theme was made by someone else (and they installed the old version, I cannot be certain they didn't tinker with any core code etc

Googling found results for "Invalid method Mage_Catalog_Block_Navigation::renderCategoriesMenuHtml" but not "renderCategoriesAndChildrenMenuHtml". I thought it may have been a custom function, but I found it in the core code. Totally stumped on this one!

The default theme of Magento 1.5.0.0 calls the renderCategoriesMenuHtml and block contains only the function renderCategoriesMenuHtml . In your case, or someone corrected the core files, or a module that rewrites the Mage_Catalog_Block_Navigation .

One possible solution is to replace function renderCategoriesAndChildrenMenuHtml to renderCategoriesMenuHtml in file app/design/frontend/p365_mydomain/default/template/catalog/navigation/left.phtml or use default template for navigation/left with code:

<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="block block-layered-nav">
    <div class="block-title">
        <strong><span><?php echo $this->__('Browse By') ?></span></strong>
    </div>
    <div class="block-content">
        <dl id="narrow-by-list2">
            <dt><?php echo $this->__('Category') ?></dt>
            <dd>
                <ol>
                <?php foreach ($_categories as $_category): ?>
                    <?php if($_category->getIsActive()): ?>
                    <li>
                        <a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
                    </li>
                    <?php endif; ?>
                <?php endforeach ?>
                </ol>
            </dd>
        </dl>
        <script type="text/javascript">decorateDataList('narrow-by-list2')</script>
    </div>
</div>
<?php endif; ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM