1

目前,我在 Magento 管理员中编辑订单后遇到问题。该页面总是被重定向到另一个 URL,其基础属于订单所属的商店视图。此页面需要重新登录管理员。

例如,我有两个基本 URL,每个都属于一个商店视图:

www.example.old.com //old store view (default)
www.example.new.com //new store view

系统使用www.example.old.com默认的基本 URL。因此,在www.example.old.com我为新商店创建订单并为其开票时。然后在提交发票时,页面从

http://www.example.old.com/index.php/admin/sales_order_invoice/new/order_id/1234/

http://www.example.new.com/admin/sales_order/view/order_id/1234/

它需要再次登录。

我将重定向代码跟踪到Mage_Core_Model_Url

public function getRouteUrl($routePath=null, $routeParams=null)
    ...
    $url = $this->getBaseUrl().$this->getRoutePath($routeParams);

public function getBaseUrl($params = array())
    ....
    if (isset($params['_store'])) {
        $this->setStore($params['_store']);
    }
    ....
    return $this->getStore()->getBaseUrl($this->getType(), $this->getSecure());

然后我不知道该怎么办。没有参数_store,但似乎 Magento 根据正在处理的订单确定要运行的商店视图,当它应该在整个管理员中保持相同的基本 URL 时。

4

3 回答 3

0

原因是 Magento 将上下文切换到订单存储,因为它需要正确翻译电子邮件模板。

查看Mage_Core_Model_Template 类有两个方法_applyDesignConfig 和_cancelDesignConfig。第一个函数切换上下文并记住旧上下文,第二个函数应该全部返回。但是,有一个错误。查看更多信息:http: //www.magthemes.com/magento-blog/magento-142-multiwebsite-admin-redirect-problem-quick-workaround/#comment-1084

于 2014-02-19T07:37:39.267 回答
0

您是否尝试过在后端的商店之间启用客户数据共享?抱歉新手回答,还在学习magento

于 2012-07-30T07:34:17.940 回答
0

对于那些可能仍然对这个旧条目感兴趣的人,我分享我的解决方案。这不是一个好方法,实际上它是一种硬编码重定向,以避免返回到不确定的 URL,但它为我解决了这个问题。

在发生重定向的控制器动作中,修改

$this->_redirect(..., array(... => ...));

$this->_redirect(..., array(... => ..., '_store' => Mage::app()->getStore($storeId)));

这可确保重定向始终转到指定的商店。

于 2012-09-10T08:56:54.147 回答