Magento – Migration of Product Ratings and Reviews

databasemagento-1.9migrationratingsreview

How do you migrate products reviews and ratings from one magento site to another?

Best Answer

The linked extension Product Review import/export (MK_Reviewexport) worked for me, after making a small change in app/code/local/MK/Reviewexport/Model/Convert/Adapter/Reviewimport.php where it contains unsafe raw SQL which does not take table prefixes into account.

This is my patch:

     public function saveRow( array $data )
     {
-          $write = Mage::getSingleton('core/resource')->getConnection('core_write');
-          $sku = $write->query('select entity_id from `catalog_product_entity` where sku = "'.$data['Sku'].'" ');
-          $sku = $sku->fetch();
-                  
-    if($sku)
+        $product_id = Mage::getResourceModel('catalog/product')->getIdBySku($data['Sku']);
+        if($product_id)
         {
-        $product_id = $sku['entity_id'];

It uses advanced dataflow profiles, so it's quite slow but for a one-shot migration script it was good enough for me. Also I deleted it afterwards because of potential unsecure code.

The good thing is that it uses the SKU as product identifier, so as long as your products still have the same SKU, the association works even with different entity_ids. The customer_id however must be the same. If your products also have the same entity_id, I would rather copy the reviews and rating tables.

One other thing to note is that the date was not preserved, all reviews are saved with the import timestamp.