douyue1926 2013-08-01 20:14
浏览 41

从1.4.1.1迁移到1.7.0.2后,Magento产品在前端和后端都没有显示

Recently I upgraded magento on test server from 1.4.1.1 to 1.7.0.2

Previously all products are Virtual Products, no real shipping.

I upgraded magento through shell and it went smooth except this problem:

Old products are no way visible (either in frontend or backend) but they are visible in crosssells/related products when adding a new products (All products are visible only here)

I can edit any product by accessing url index.php/admin/catalog_product/edit/id/[id]

Even after saving/editing product, it is not visible on admin/frontend.

Category count is working fine.

When I added a new product, it is working fine. (With continuing id)

Tried full clearing of var folder and it's contents, reset file permissions, emptied database log tables and did everything that I know, but nothing is useful.

There are about 4500 products which I can't afford loosing. Please help me to show the correctly.

Some improvement:

After comparing this database with a newly created database, I found that, in the table catalog_product_entity_int there is no entry related to attribute visibility. Manually adding them to table with store id set to admin fixed the problem. But trying to do it through php code for all products. Tried the following code but is not working:

 <?php

 require_once("app/Mage.php");
 $store_id = '0';
 Mage::app()->setCurrentStore($store_id);

 $productModel = Mage::getModel('catalog/product');
 $products = $productModel->getCollection()->getAllIds();

 foreach($products as $productId)
 {
     $product = $productModel->load($productId);
     $product->setVisibility(4);
     $product->save();
     echo $productId.' Finished<br>';
 }

 ?>

But the above code is not working. Any help????

For some reason, above code didn't worked. So I used custom code to insert values directly into databse.

<?php
$con = mysql_connect($host, $user, $pass);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db, $con);


$sql=mysql_query("SELECT DISTINCT(entity_id) AS pid FROM magentocatalog_product_entity_int ORDER BY entity_id DESC;");
while($row = mysql_fetch_array($sql)) {
    if ($row['pid']<4152) { //Condition for Mangento 1.7.0.2 version products, below this pid, all are Magento 1.4.1.1. version products.
        $insquery=mysql_query("INSERT INTO `magentocatalog_product_entity_int` (`value_id`, `entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES ('', 4, 89, 0, ".$row['pid'].", 0);");//89 is attribute id and 4 is default value for showing in admin. Tested against newly created product which has these values.
        echo $row['pid']." Finished<br />";
    }
}


mysql_close($con);
?>

And products are now showing in admin but not in stores. So modified the above code to add values for each store. Problem is fixed. But still want to make sure is it was the right approach??

Note: In my Magento 1.4.1.1, the above two attributes can be removed from Attibute set, but not in Magento 1.7.0.2.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!