How stupid is that?! They really removed importFromTextArray() the only easy way to import something, this is stupid! In the beginning I liked Magento but with each update it all goes wrong, they change methods within the templates (!), they remove API-methods and so on. Each time I do a upgrade my whole shop explodes and I have to spend days on fixing it.
This is not a preview/beta anymore, Varien! Wake up! Otherwise we’ll find some other CMS which works at least within one main version without rewriting templates and plugins every update.
I think I will not update my shop for a long time when I get it working with 1.1.6 :-(
The importFromTextArray($productArrayToImport) function has been replaced by fromArray($productArrayToImport). The functionality is the same as before. To retrieve data from the object in array format, you can use $product->toArray().
I dont’ think that fromArray() replace importFromTextArray()…
The first is just a setData() with stock management.
The second is (was !) a product save in the database with a more complex array in parameter (product type, categories, etc.)
Well, I was bummed to find out the import script I have been using everytime I install a new version of Magento doesn’t work anymore because importFromTextArray() has been replaced. I managed to modify the script from this thread to make the import work again. However, the only thing I can’t get to work is the importing of images using addImageToMediaGallery. Does anyone have any ideas on this? It appears that the function still exists and works the same way, so I can’t figure out why it doesn’t work anymore.
Here is the script I ran to import.
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
tza79, thanks for the insight—you pointed me in the right direction! In regard to addImageToMediaGallery(), I’ve never used that method prior to 1.1.6, but it started working for me once I provided absolute paths to my media (some previous examples seemed to provide relative paths to /media/import/).
Have you resolve the issue with the images import? It’s seems to import something in the DB because it’s show a entry in the image admin of the product, but nothing more (no label, no thumbnail)
This should help those who miss the importFromTextArray method.
Also, if this helps, the addImage doc shows:
/** * Add image to media gallery and return new filename * * @param Mage_Catalog_Model_Product $product * @param string $file file path of image in file system * @param string|array $mediaAttribute code of attribute with type 'media_image', * leave blank if image should be only in gallery * @param boolean $move if true, it will move source file * @param boolean $exclude mark image as disabled in product page view * @return string */
We wrote a command line product import tool that creates configurable and simple products from a .csv file. Once the products are setup in Magento the tool can be run again to update product details like inventory levels. This type of tool is perfect for enterprise-class Magento deployments where many thousands of products must be created and maintained from a back-office system like SAP or Oracle. Can you imagine the amount time it would take to manually create configurable products for thousands of simple products for a large apparel retailer?