3

我已经在 Magento 1.7.0.2 Shop 上安装并配置了 Mage_GoogleShopping 模块。尝试将产品添加到 Google 购物时,/var/log/system.log 显示以下错误:

2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePrice.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePrice.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(): Failed opening 'Mage/GoogleShopping/Model/Attribute/SalePrice.php' for inclusion (include_path='/path/to/shop/httpdocs/app/code/local:/path/to/shop/httpdocs/app/code/community:/path/to/shop/httpdocs/app/code/core:/path/to/shop/httpdocs/lib:.:')  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateFrom.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateFrom.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(): Failed opening 'Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateFrom.php' for inclusion (include_path='/path/to/shop/httpdocs/app/code/local:/path/to/shop/httpdocs/app/code/community:/path/to/shop/httpdocs/app/code/core:/path/to/shop/httpdocs/lib:.:')  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateTo.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateTo.php): failed to open stream: No such file or directory in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(): Failed opening 'Mage/GoogleShopping/Model/Attribute/SalePriceEffectiveDateTo.php' for inclusion (include_path='/path/to/shop/httpdocs/app/code/local:/path/to/shop/httpdocs/app/code/community:/path/to/shop/httpdocs/app/code/core:/path/to/shop/httpdocs/lib:.:')  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/Name.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/Name.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(): Failed opening 'Mage/GoogleShopping/Model/Attribute/Name.php' for inclusion (include_path='/path/to/shop/httpdocs/app/code/local:/path/to/shop/httpdocs/app/code/community:/path/to/shop/httpdocs/app/code/core:/path/to/shop/httpdocs/lib:.:')  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/Description.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(Mage/GoogleShopping/Model/Attribute/Description.php): failed to open stream: No such file or directory  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93
2012-09-12T12:31:27+00:00 ERR (3): Warning: include(): Failed opening 'Mage/GoogleShopping/Model/Attribute/Description.php' for inclusion (include_path='/path/to/shop/httpdocs/app/code/local:/path/to/shop/httpdocs/app/code/community:/path/to/shop/httpdocs/app/code/core:/path/to/shop/httpdocs/lib:.:')  in /path/to/shop/httpdocs/lib/Varien/Autoload.php on line 93

这个问题已经在 Magento 论坛上多次报告过,但是我还没有找到解决方案。

权限绝对没有问题。文件不存在。

4

1 回答 1

1

GoogleShopping-Module 尝试“即时”加载所有需要的属性的属性模型。如果此模型在 Mage/GoogleShopping/Model/Attributes/... 中不存在,则会发生错误...

要覆盖此类“Mage_GoogleShopping_Model_Type”中的方法“_createAttribute”,请为我修复它:

 /**
 * Create attribute instance using attribute's name
 *
 * @param string $name
 * @return Mage_GoogleShopping_Model_Attribute
 */
protected function _createAttribute($name)
{
    $modelName = 'googleshopping/attribute_' . $this->_prepareModelName($name);
    $useDefault = false;

    $className = Mage::app()->getConfig()->getModelClassName($modelName);

    if (class_exists($className)) {
        $attributeModel = Mage::getModel($modelName);
        $useDefault = !$attributeModel;
    } else {
        $useDefault = true;
    }
    if ($useDefault) {
        $attributeModel = Mage::getModel('googleshopping/attribute_default');
    }
    $attributeModel->setName($name);

    return $attributeModel;
}
于 2013-11-04T10:55:40.420 回答