0

using magento 1.7.0.2 here, having already tested lot of recommended solutions (reindexing, clearing cache, assuring no url rewrite is done, etc) I give up and ask the question.

We are importing a bunch of products (around 150) into the demo store, together with 2 new categories and lot of new attributes (around 200). After some issues we finally managed to get the products shown both on backend and frontend, great.

But when clicking on any newly imported product we get the 404 error page from Magento with the "Whoops, our bad...". After 2 days searching and trying different approaches still haven't found a solution. Reindexing, clearing cache, checking the url rewrite option, changing 'localhost' for '127.0.0.1' on the core_config_data table, and some other solutions that worked for others, no use for us.

Any clue?

Other than the solutions found we have checked that the products are enabled, visibility is set for both catalog and search, there is a website assigned and quantity is bigger than zero. Also we manually created a product with all the correct attributes values and its description page is visible. Comparing (both using backend and database tables/fields) with the imported products averything seems to be exactly the same.

4

1 回答 1

0

我自己回答。感谢@sulman 指出了正确的方向。

是的,所有产品的可见性都很好,并且对于目录和搜索都正确设置。但问题是在我们的导入脚本中,我们没有检查属性是否存在以及是否正确分配给导入的产品。因此,该属性存在,但未链接到已经存在的可见性属性。

这里需要一个示例代码以防万一,请参阅if (isset($attributeId))检查属性是否存在的开头。

if (isset($attributeId))
    {
        $entityAttributeModel = Mage::getModel('catalog/product_attribute_api');
        $attributeList = $entityAttributeModel->items($attributeSetId);
        $attributeLink = $this->search($attributeList, 'attribute_id', $attributeId);

        if (sizeof($attributeLink) == 0)
        {
            $setup = new Mage_Eav_Model_Entity_Setup('core_setup');         
            $setup->addAttributeToGroup($this->getEntityTypeId(), $attributeSetId, $groupId, $attributeId);
        }       

        $model = Mage::getModel('catalog/resource_eav_attribute');
        $attribute = $model->load($attributeId);

    }
于 2012-07-24T11:19:12.317 回答