categorie di importazione in Magento tramite lo script
Domanda
Ciao Ho appena iniziato a imparare Magento. Ora stavo cercando di categoria importazione in Magento attraverso script.
i miei Magento aspetto codice come
<?php
require_once 'businessclasses.php';
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
umask(0);
$count = 0;
echo "<pre>";
$data= new getCSV();
$rows=$data->getRootCategories(); // Gets the list of root categories.
foreach($rows as $row) {
echo $categoryName = $row['us']; // Name of Category
// Create category object
$category = Mage::getModel('catalog/category');
$category->setStoreId(1); // 'US-Store' store is assigned to this category
$rootCategory['name'] = $categoryName;
$rootCategory['path'] = "1/23/25"; // this is the catgeory path
$rootCategory['display_mode'] = "PRODUCTS";
$rootCategory['is_active'] = 1;
$rootCategory['is_anchor'] = 1;
$rootCategory['thumbnail'] = $row['catimg'].'.jpg';
$category->addData($rootCategory);
try {
$category->save();
echo $rootCategoryId = $category->getId();
}
catch (Exception $e){
echo $e->getMessage();
}
}
?>
Ora la categoria sta importando con successo ma immagine non è la creazione di lì. E 'un'immagine categoria non visualizza lì.
chiunque aiutareCan? Grazie in anticipo.
Soluzione 2
Ciao ragazzi ho ottenuto il mio errore.
$category->setStoreId(0); // <-- I was giving this Store ID wrong.
Altri suggerimenti
Io uso qualcosa come URapidflow, la sua molto più facile e ha tutte le funzionalità costruito in per l'importazione, anche magmi è utile strumento per controllare e il suo libero.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange