Magento无法应用目录规则

时间:2013-05-09 04:22:46

标签: php magento magento-1.7

从Magento Professional迁移到Magento社区后,我在尝试运行促销>>内的“应用规则”功能时遇到了问题目录价格规则。

我收到的确切消息如下:

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

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

感谢您的帮助!

3 个答案:

答案 0 :(得分:2)

在Model 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];
}

如果您看到抛出异常的行请求的网站代码无效:$ id

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

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

答案 1 :(得分:0)

您能否查看您迁移到magento社区的补丁。我希望错过编码。在执行代码期间打印了某种数组。

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

感谢。

答案 2 :(得分:0)

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