2016-04-08 28 views
1

Prodcuts incelemesi için Magento eklentisi https://www.magentocommerce.com/magento-connect/product-review-import-export.html kullanıyorum.İthalat Profili Ürünler Gözden geçirme ithalat/ihracat

Bir Magento sitesinden inceleme aldım ve başka bir web sitesinde içe aktarmaya çalışıyorum.

Ürünü içe aktarırken "İşlenen% 0/1 kayıtlar" mesajını gösterip gösterilmemesini sağlayın, Ürünlerin içe aktarılmasında işlem yok.

Importing Preview

ben ama yine de hiçbir şey olmuyor "/ Adaptör/Reviewimport.php dönüştürme/app/kod/yerel/MK/Reviewexport/Modeli" benim masa öneki değiştirdik.

Çok uzun süre bekledi ama bana "İşlem Gördüğüm 0% 0/1 kayıtları" göstermeye devam ediyorum Çok fazla yorum aldım ve bu yüzden çalışmıyordum Tüm değerlendirmeleri CSV'den kaldırdım ve yalnızca bir inceleme yaptım.

Bu uzantı tarafından oluşturulan: https://magento.stackexchange.com/users/599/mufaddal

+0

Onun iyi magento bağlamak kullanarak devoloper iletişim kurması için bir kod olduğunu. – fresher

+0

Geliştirici yanıt vermiyor, Kişisel e-posta da yapıyordum çalıştı. –

cevap

1

Neyse ben belirtti uzantısı tarafından ihraç değerlendirmeleri ithalatı için özel bir komut dosyası yaparak sorunu çözdükten. İşte

<?php 
    ini_set('memory_limit', '128M'); 
    error_reporting(E_ALL); 
    ini_set('display_errors', '1'); 

    require_once 'app/Mage.php'; 
    Mage::app(); 

    $fileLocation = "var/import/import_review.csv"; 
    $fp = fopen($fileLocation, 'r'); 
    $count = 1; 

    while($data = fgetcsv($fp)){ 
     if($count > 1){ 
      //intiate requirement varibles 
      $_createdAt  = $data[0]; 
      $_sku   = $data[1]; 
      $_catalog  = Mage::getModel('catalog/product'); 
      $_productId  = $_catalog->getIdBySku($_sku); 
      $_statusId  = $data[2]; 
      $_title   = $data[3]; 
      $_detail  = $data[4]; 
      $_customerId = NULL; 
      $_nickname  = $data[5]; 

      //load magento review model and assign values 
      $review = Mage::getModel('review/review'); 
      $review->setCreatedAt($_createdAt); //created date and time 
      $review->setEntityPkValue($_productId);//product id 
      $review->setStatusId($_statusId); // status id 
      $review->setTitle($_title); // review title 
      $review->setDetail($_detail); // review detail 
      $review->setEntityId(1); // leave it 1 
      $review->setStoreId(Mage::app()->getStore()->getId()); // store id 
      $review->setCustomerId($_customerId); //null is for administrator 
      $review->setNickname($_nickname); //customer nickname 
      $review->setReviewId($review->getId());//set current review id 
      $review->setStores(array(Mage::app()->getStore()->getId()));//store id's 
      $review->save(); 
      $review->aggregate(); 

      //set review ratings 
      if($data[7]){ 
       $arr_data = explode("@",$data[7]); 
       if(!empty($arr_data)) { 
        foreach($arr_data as $each_data) { 
         $arr_rating = explode(":",$each_data); 
         if($arr_rating[1] != 0) { 
          Mage::getModel('rating/rating') 
          ->setRatingId($arr_rating[0]) 
          ->setReviewId($review->getId()) 
          ->setCustomerId($_customerId) 
          ->addOptionVote($arr_rating[1], $_productId); 
         } 
        } 
       } 
       $review->aggregate(); 
      } 
     } 
     // if($count == 5){ 
     //  die("total $count reviews are imported!"); 
     // } 
     $count++; 
    } 

    echo "total $count reviews are imported!"; 
?> 
İlgili konular