【问题标题】:Add My Order link active in customer account添加我的订单链接在客户帐户中处于活动状态
【发布时间】:2017-11-04 17:11:18
【问题描述】:

当客户登录到他/她的帐户时,现在默认 magento 中显示给客户的活动菜单是 Account Dashboard

我想在客户登录帐户时显示我的订单。 我使用了这种和平的代码。

<customer_account>
<reference name="customer_account_navigation">
            <action method="setActive"><name>orders</name><path>sales/order/history/</path></action>
        </reference>
</customer_account>

但它没有用。请建议我任何解决方案或给我一个替代的想法来做到这一点。

【问题讨论】:

    标签: php magento magento-1.9.1


    【解决方案1】:

    您可以在控制器中尝试以下代码。

    $this->loadLayout();
    
    // add layout handle so that we will have the customer navigation on the right hand side
    
        $layout = $this->getLayout();
        $update = $layout->getUpdate();
        $this->addActionLayoutHandles();
        $update->addHandle('customer_account'); // add the customer navigation bar on the side
        $this->loadLayoutUpdates();
        $this->generateLayoutXml();
        $this->generateLayoutBlocks();
        $navigationBlock = $layout->getBlock('customer_account_navigation');
        // make sure we have an instantiation    
        if ($navigationBlock) {
            $navigationBlock->setActive('path/to/highlight'); // example: 'customer/address'
        }
        $this->_isLayoutLoaded = true;
    
        // render the layout
        $this->renderLayout();
    

    所以,请试试这个,如果有任何疑问,请告诉我。

    谢谢

    【讨论】:

    • 哪个控制器?我没有使用自定义模块的第三方。所以我应该通过覆盖它来更改核心控制器,如果是,那么告诉我控制器名称
    【解决方案2】:

    打开app\code\core\Mage\Customer\controllers\AccountController.php

    在公共函数loginPostAction() 中查找代码$this-&gt;_loginPostRedirect() 和 替换为$this-&gt;_redirect('sales/order/history/');

    【讨论】:

      猜你喜欢
      • 2011-08-26
      • 1970-01-01
      • 1970-01-01
      • 2017-12-30
      • 2017-02-03
      • 2022-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多