用户'中出现错误404;这是我的账户magento

用户'中出现错误404;这是我的账户magento,magento,module,account,Magento,Module,Account,我正在创建一个模块,用于在用户的myaccount中创建新选项卡。我已成功添加名为“我的特殊产品”的选项卡。 问题是,当我点击该选项卡时,它会重定向到404错误页面。我无法解决这个问题 我的布局xml(customtabs.xml)代码是: 纽塔布 客户/纽塔布/ 我的特产 顾客:我的特殊产品 我的模板页面位于template\customer\newtab\newtab.phtml 模块“Customtabs”的My config.xml为: 0.1.0 Fishpig_Customta

我正在创建一个模块,用于在用户的myaccount中创建新选项卡。我已成功添加名为“我的特殊产品”的选项卡。 问题是,当我点击该选项卡时,它会重定向到404错误页面。我无法解决这个问题

我的布局xml(customtabs.xml)代码是:


纽塔布
客户/纽塔布/
我的特产
顾客:我的特殊产品
我的模板页面位于template\customer\newtab\newtab.phtml

模块“Customtabs”的My config.xml为:


0.1.0
Fishpig_Customtabs_块
Fishpig_Customtabs_模型
Fishpig\u自定义选项卡\u帮助程序
Customtabs.xml
customtabs.xml
独生子女
自定义选项卡/观察者
saveProductTabData

任何人都可以帮我解决问题。

您将此选项卡的url设置为
customer/newtab/
所以,你应该在某个地方有
newtab
的控制器

  • 首先,您需要在模块的config.xml中添加
    部分,将其放入

  • 将块文件添加为app/code/local/Fishpig/Customtabs/block/Customtabs.php

  • 然后把代码放在那里

    class Fishpig_Customtabs_Block_Customtabs extends Mage_Core_Block_Template
    {
        public function _prepareLayout()
        {
            return parent::_prepareLayout();
        }
    
        public function getCustomtabs()     
        { 
            if (!$this->hasData('customtabs')) {
                $this->setData('customtabs', Mage::registry('customtabs'));
            }
            return $this->getData('customtabs');
    
        }
    }
    
    并在customtabs.xml文件中更改块类型

    <block type="customtabs/customtabs" name="customer_newtab_newtab" template="customer/newtab/newtab.phtml" />
    

    您将此选项卡的url设置为
    customer/newtab/
    所以,你应该在某个地方有
    newtab
    的控制器

  • 首先,您需要在模块的config.xml中添加
    部分,将其放入

  • 将块文件添加为app/code/local/Fishpig/Customtabs/block/Customtabs.php

  • 然后把代码放在那里

    class Fishpig_Customtabs_Block_Customtabs extends Mage_Core_Block_Template
    {
        public function _prepareLayout()
        {
            return parent::_prepareLayout();
        }
    
        public function getCustomtabs()     
        { 
            if (!$this->hasData('customtabs')) {
                $this->setData('customtabs', Mage::registry('customtabs'));
            }
            return $this->getData('customtabs');
    
        }
    }
    
    并在customtabs.xml文件中更改块类型

    <block type="customtabs/customtabs" name="customer_newtab_newtab" template="customer/newtab/newtab.phtml" />
    
    
    
    谢谢Tejas,404错误已解决,但页面为空,表示不显示newtab、phtml的内容。你能帮我一个忙吗?你把block设置为“customer/newtab_newtab”,你有block文件吗?是的,我把newtab.phtm文件放在customer/newtab/newtab.phtmlcheck上面回答中的第5点,你应该如何创建block文件。我得到了解决方案:谢谢Tejas,404错误已经解决了,但页面是空白的,表示newtab的内容,不显示phtml。你能帮我一下吗?你把block设置为“customer/newtab_newtab”,你有block文件吗?是的,我把newtab.phtm文件放在customer/newtab/newtab.phtmlcheck上面答案中的第5点,关于如何创建block文件我得到了解决方案:
    class Fishpig_Customtabs_NewtabController extends Mage_Core_Controller_Front_Action
    {
        public function indexAction()
        {         
    
            if(!Mage::getSingleton('customer/session')->isLoggedIn())
            {
                Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
                return false;
            }    
            $this->loadLayout();
            $this->_initLayoutMessages('customer/session');
    
            $this->getLayout()->getBlock('head')->setTitle($this->__('My Special Products'));
            $this->renderLayout();
        }
    
    }
    
    class Fishpig_Customtabs_Block_Customtabs extends Mage_Core_Block_Template
    {
        public function _prepareLayout()
        {
            return parent::_prepareLayout();
        }
    
        public function getCustomtabs()     
        { 
            if (!$this->hasData('customtabs')) {
                $this->setData('customtabs', Mage::registry('customtabs'));
            }
            return $this->getData('customtabs');
    
        }
    }
    
    <block type="customtabs/customtabs" name="customer_newtab_newtab" template="customer/newtab/newtab.phtml" />