This is an example of my category CSV.
I never used datapump and I can't find any sample code.
I use this code to create a category tree:
ini_set('display_errors', '1');
error_reporting(E_ALL);
set_time_limit(0);
$url = "www.xxxxxxxxx.com/category.csv";
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
$app = Mage::app('default');
$exit= 0;
$continua = 0;
$cont = 0;
$f = fopen('php://temp', 'w+');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FILE, $f);
curl_exec($curl);
curl_close($curl);
rewind($f);
function searchForId($id, $array) {
foreach ($array as $key => $val) {
if ($val['id'] === $id) {
return $val['nombre'];
}
}
return null;
}
while (($data = fgetcsv($f, 10000 , ",")) !== FALSE ) {
$fila="";
foreach($data as $row) {
$fila= $fila.$row;
}
$datos = explode(";",$fila);
// ID_CATEGORY CATEGORY_NAME Father_CATEGORY
$clave = $datos[0];
$cat = $datos[1];
$padre = $datos[2];
$categoria[$cont] = array ('id'=>$clave, 'nombre'=>$cat);
$nomPad = searchForId($padre,$categoria);
}
Example Result:
[21] => Array
(
[id] => 160
[name] => Madera de Teca
)
[22] => Array
(
[id] => 163
[name] => Polyrattan Natur
)
[23] => Array
(
[id] => 165
[name] => Polyrattan / acero / cristal
)
[24] => Array
(
[id] => 166
[name] => Polyrattan / forja / cristal
)
How can use this in magmi datapump?
Do I need to import a category creator plugin? How can I combine the sample code with my own.