1

从 Magento Professional 迁移到 Magento Community 后,我在尝试运行 Promotions >> Catalog Price Rules 中的“Apply Rules”功能时遇到了问题。

我收到的确切消息如下:

“无法应用规则。请求的网站代码无效:数组”

有没有人见过这个?我似乎无法找到/任何/有关错误的信息。

谢谢你的帮助!

4

3 回答 3

2

在模型 App.php 中

应用程序/代码/核心/法师/核心/模型/App.php

public function getWebsite($id=null)
{
    if (is_null($id)) {
        $id = $this->getStore()->getWebsiteId();
    } elseif ($id instanceof Mage_Core_Model_Website) {
        return $id;
    } elseif ($id === true) {
        return $this->_website;
    }

    if (empty($this->_websites[$id])) {
        $website = Mage::getModel('core/website');
        if (is_numeric($id)) {
            $website->load($id);
            if (!$website->hasWebsiteId()) {
                throw Mage::exception('Mage_Core', 'Invalid website id requested.');
            }
        } elseif (is_string($id)) {
            $websiteConfig = $this->_config->getNode('websites/'.$id);
            if (!$websiteConfig) {
                throw Mage::exception('Mage_Core', 'Invalid website code requested: '.$id);
            }
            $website->loadConfig($id);
        }
        $this->_websites[$website->getWebsiteId()] = $website;
        $this->_websites[$website->getCode()] = $website;
    }
    return $this->_websites[$id];
}

如果您看到抛出异常的行 Invalid website code requested :$id

这是您的情况发生的例外情况,因为分配给网站的价格规则不存在或错误的 ID 或与此相关的内容。

尝试删除规则并重新添加。

于 2013-05-09T05:51:32.543 回答
0

您能否检查一下您迁移到 magento 社区的补丁。我希望有些东西错过了编码。在执行代码期间打印出某种数组。

https://chat.stackoverflow.com/transcript/message/9332922#9332922

谢谢。

于 2013-05-10T01:58:41.010 回答
0

从 1.5.1.0 迁移到 1.7.0.2 Magento CE 时,我遇到了同样的问题。问题在于目录规则表的“website_ids”和“customer_group_ids”列。这些列在 1.7.0.2 数据库中不存在,但是如果您尝试从迁移的 Magento 存储中删除它们,您将无法保存任何规则。我找到的解决方案是我直接在数据库中为这两列分配了 NULL 值,然后应用规则按钮起作用。但是,如果您再次保存规则,则需要重复该作业。

于 2013-07-15T14:31:32.397 回答