Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I have to import products in Magento using a direct connection to the database
    text
    copied!<p>I have about 50.000 of records to import in a Magento store. What I have already tested: The file is about 50 MB.</p> <ul> <li>Splitted files</li> <li>API</li> <li>Magento Classes</li> </ul> <p>Splitting the file doesn't improve the speed of the importing of the products. Api are very slow. Magento Classes are slow.</p> <p>This is a snipped of code using the Magento Classes:</p> <pre><code>// Build the product $product-&gt;setIsMassupdate(true) -&gt;setExcludeUrlRewrite(true) -&gt;setManufacturer($this-&gt;addManufacturers(utf8_encode($record[4]))) -&gt;setSku($record[3]) -&gt;setAttributeSetId($this-&gt;attribute_set)# 9 is for default -&gt;setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) -&gt;setName(utf8_encode($record[5])) -&gt;setCategoryIds($this-&gt;getCategories(array($record[0], $record[1], $record[2]))) # some cat id's, -&gt;setWebsiteIDs(array(1)) # Website id, 1 is default -&gt;setDescription(utf8_encode($record[6])) -&gt;setShortDescription($this-&gt;shortText(utf8_encode($record[6]), 150)) -&gt;setPrice($price) # Set some price -&gt;setSpecialPrice($special_price) -&gt;setWeight($record[12]) -&gt;setStatus( Mage_Catalog_Model_Product_Status::STATUS_ENABLED ) -&gt;setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) -&gt;setTaxClassId(2) // default tax class -&gt;setPixmaniaimg($record[10]) -&gt;setStockData(array('is_in_stock' =&gt; $inStock, 'qty' =&gt; $qty)) -&gt;setCreatedAt(strtotime('now')); $product-&gt;save(); $ID = is_numeric($productID) ? $productID : $product-&gt;getId(); </code></pre> <p><strong>So the above method is correct but it spends about 5 hours in order to insert only 2300 records!!</strong></p> <p>Which are the simple SQL inserts that I have to execute in the Magento DB in order to add a new product?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload