Skip to content

Instantly share code, notes, and snippets.

@larascasse
Created December 9, 2013 09:47
Show Gist options
  • Save larascasse/7869810 to your computer and use it in GitHub Desktop.
Save larascasse/7869810 to your computer and use it in GitHub Desktop.
Magmi Datapump
Sample Datapump API integration script example importing single item
// assuming that your script file is located in magmi/integration/scripts/myscript.php,
// include "magmi_defs.php" and "magmi_datapump.php" first (note: there are two folders "inc" in different subfolders).
require_once("../../inc/magmi_defs.php");
require_once("../inc/magmi_datapump.php");
// create a Product import Datapump using Magmi_DatapumpFactory
$dp=Magmi_DataPumpFactory::getDataPumpInstance("productimport");
// Begin import session with a profile & running mode, here profile is "default" & running mode is "create".
// Available modes: "create" creates and updates items, "update" updates only, "xcreate creates only.
// Important: for values other than "default" profile has to be an existing magmi profile
$dp->beginImportSession("default","create");
// Here we define a single "simple" item, with name, sku,price,attribute_set,store,description
$testitem=array("name"=>"test","sku"=>"testsku","price"=>"10.00","attribute_set"=>"Default","store"=>"admin","description"=>"ingested with Datapump API");
// Now ingest item into magento
$dp->ingest($testitem);
// End import Session
$dp->endImportSession();
// Look for further examples in "magmi/integration/samples"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment