0

I'm writing my own RWD theme for magento, magento is really stubborn and I do have lot of patience :D
Got an error now.
Here is my custom header.phtml

<div id="topbar">
    <div class="container">
        <div class="row">
            <div class="col-md-8">
                <?php echo $this->getChildHtml('topbar_cmslinks') ?>
            </div>
            <div class="user-links col-md-4">
                <span class="welcome pull-left">
                    <?php echo $this->getLayout()->getBlock('header')->getWelcome() ?>
                </span>
                <ul class="list-inline pull-left">
                    <?php if ($this->helper('customer')->isLoggedIn()): ?>
                    <li>
                        <a title="<?php echo $this->__('My Account') ?>" href="<?php echo $this->getUrl('customer/account') ?>">
                        <?php echo $this->__('My Account') ?>
                        </a>
                    </li>
                    <li>
                        <a title="Log Out" href="<?php echo $this->getUrl('customer/account/logout') ?>">
                        <?php echo $this->__('Logout') ?></a>
                    </li>
                    <?php else: ?>
                        <li>
                            <a href="<?php echo $this->getUrl('customer/account/login/')?>">
                            <?php echo $this->__('Login') ?></a></li>
                        </li>
                            <a href="<?php echo $this->getUrl('customer/account/create/')?>">
                            <?php echo $this->__('Create Account') ?></a></li>
                    <?php endif;?>
                </ul>
            </div>
        </div>
    </div>
</div>  

And the error that I got after saving that phtml file and refreshing magento was:

a:5:{i:0;s:73:"Invalid method Mage_Cms_Block_Block::(Array
(
    [0] => top_cmslinks
)
)";i:1;s:2124:"#0 [internal function]: Varien_Object->__call('', Array)
#1 [internal function]: Mage_Cms_Block_Block->('top_cmslinks')
#2 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Model\Layout.php(348): call_user_func_array(Array, Array)
#3 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Model\Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Model\Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Controller\Varien\Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 C:\wamp\www\finalcustommagento\app\code\core\Mage\Cms\Helper\Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 C:\wamp\www\finalcustommagento\app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 C:\wamp\www\finalcustommagento\app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction()
#11 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 C:\wamp\www\finalcustommagento\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 C:\wamp\www\finalcustommagento\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#15 C:\wamp\www\finalcustommagento\index.php(87): Mage::run('', 'store')
#16 {main}";s:3:"url";s:30:"/finalcustommagento/index.php/";s:11:"script_name";s:29:"/finalcustommagento/index.php";s:4:"skin";s:7:"default";}  

Struck here, please help me.
Here is custom layout file.

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <remove name="catalog.compare.sidebar"/>
        <remove name="right.reports.product.compared"/>
        <remove name="right.permanent.callout"/>
        <!-- <reference name=""
        <remove name="checkout_cart_link"/> -->
        <reference name="header">
            <block type="cms/block" name="top_cmslinks" as="top_cmslinks">
                <action type="setBlockId">
                    <block_id>top_cmslinks</block_id>
                </action>
            </block>
        </reference> 
    </default>   
</layout>
  • By the error message it seams to me you have something else in one of the layout files. Something like <action...> but without a method attribute. Please post your custom layout file. – Marius Jul 3 '14 at 7:26
  • @Marius: I've edited the question and added custom layout file. – brainReader Jul 3 '14 at 7:33
1

As I suspected, this is your problem:

<action type="setBlockId">
    <block_id>top_cmslinks</block_id>
</action>

Should be

<action method="setBlockId">
    <block_id>top_cmslinks</block_id>
</action>

replace type with method.

  • Can you tell me about disabling wysiwyg compiler in magento? It is messing my custom links in header part. – brainReader Jul 3 '14 at 7:42
  • @AjayKulkarni I don't understand what you mean. I think it's best to ask an other question and explain what the problem is. Maybe add some screenshots as visual aid. – Marius Jul 3 '14 at 7:48
  • Okay, Marius.... – brainReader Jul 3 '14 at 7:49

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.