require_once 'app/Mage.php';
Mage::app();
// IMPORTANT: Set up customer session.
// the rating/option model resource checks the customer session to get the customer ID.
$_session = Mage::getSingleton('customer/session')->setCustomer($_customer)->setCustomerAsLoggedIn($_customer);
// Add Review
$_review = Mage::getModel('review/review');
->setEntityPkValue($_product->getId())
->setStatusId($sc_to_mage_review_status[$row_source_review['Status']])
->setTitle($row_source_review['Title'])
->setDetail($row_source_review['Review'])
->setEntityId(1)
->setStoreId($store)
->setStores(array($store))
->setCustomerId($_customer->getId())
->setNickname($_customer->getFirstname())
->save();
Probable Error within these:
Check last comma of the array
$rating_options = array(
1 => array(1,2,3,4,5), // <== Look at your database table `rating_option` for these vals
2 => array(6,7,8,9,10),
3 => array(11,12,13,14,15)
);
Probable Error within these:
foreach($rating_options as $rating_id => $option_ids):
try {
$_rating = Mage::getModel('rating/rating')
->setRatingId($rating_id)
->setReviewId($_review->getId())
->addOptionVote($option_ids[$rating_value-1],$_product->getId());
} catch (Exception $e) {
die($e->getMessage());
}
endforeach;
I would suggest that instead of building your own import process that you investigate either the Magento core import/export process or a third party import/export process like FastSimple_Import or HO_Import
The reason I suggest that you do this is it will not only save you time but it should also help you avoid common mistakes that either the core module does not contain or that the third party developers have already found out and solved.
Best Answer
When you import data using Magento Import Export Functionality and Migrate from the One Version to Another version please follow the below steps.
Step 1: First Export the Both Version File and Identify What are changes in
Headers
. Because It will may differ Version to version.Step 2: Once you identify which Header are Changes or Updated Then Export the Latest data File From Old Version.
Step:3: Open That File in
notepad
orNoted ++
OREXCEL
And Changes the Header Name as per New Version. Sometimes Boolean Values also changes so also check values and update CVS file.Step 4: Once all Changes are done. Try to Upload CSV file on Latest Version and Check if you got this error Message or not.
Stps 5: If you not Found that error then you can import data.
NOTE: Before do any changes on live site please test on environment.