From 17dab556991e08b72e8c29607a32fa216a1e1133 Mon Sep 17 00:00:00 2001 From: Vince Dimitrov Date: Wed, 4 Jan 2017 11:44:51 +0000 Subject: [PATCH 1/6] [BUG] Fix for default Enterprise Import tool --- src/app/code/community/AvS/FastSimpleImport/etc/config.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/code/community/AvS/FastSimpleImport/etc/config.xml b/src/app/code/community/AvS/FastSimpleImport/etc/config.xml index 370ef364..3da5083c 100644 --- a/src/app/code/community/AvS/FastSimpleImport/etc/config.xml +++ b/src/app/code/community/AvS/FastSimpleImport/etc/config.xml @@ -24,6 +24,11 @@ AvS_FastSimpleImport_Model_Import_Entity_Product + + + AvS_FastSimpleImport_Model_Import_Entity_Product + + From fe357765c8c5561990a04fbc0ae89b2b287f804e Mon Sep 17 00:00:00 2001 From: Hans Nieser Date: Sat, 27 May 2017 14:47:07 +0200 Subject: [PATCH 2/6] Fix saving of stockItem data for multi-warehouse setups --- .../AvS/FastSimpleImport/Model/Import/Entity/Product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php index 8074488d..130415b7 100644 --- a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php +++ b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php @@ -1411,6 +1411,7 @@ protected function _saveStockItem() /** @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ $stockItem = Mage::getModel('cataloginventory/stock_item'); + $stockItem->setStockId($row['stock_id']); $stockItem->loadByProduct($row['product_id']); $existStockData = $stockItem->getData(); From 6bab87353b6c54da4d0bd74fc7c7840d06181988 Mon Sep 17 00:00:00 2001 From: Andreas von Studnitz Date: Thu, 21 Sep 2017 11:02:25 +0200 Subject: [PATCH 3/6] Add license information to composer.json --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 9f2f19d4..9fd3e5e4 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,9 @@ "type": "magento-module", "description": "Wrapper for Magento ImportExport functionality, which imports products and customers from arrays", "homepage": "https://github.com/avstudnitz/AvS_FastSimpleImport", + "license": [ + "OSL-3.0" + ], "suggest": { "magento-hackathon/magento-composer-installer": "*" } From f97a0b180a32149937c7f829d47b8f9af5156a82 Mon Sep 17 00:00:00 2001 From: Andreas von Studnitz Date: Thu, 21 Sep 2017 11:05:53 +0200 Subject: [PATCH 4/6] Update Readme --- README.markdown | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 52776b27..dd6c2a75 100644 --- a/README.markdown +++ b/README.markdown @@ -7,12 +7,9 @@ Wrapper for Magento ImportExport functionality which imports data from arrays Facts ----- -- version: 0.7.0 +- version: 0.8.2 - extension key: AvS_FastSimpleImport -- extension on Magento Connect: n/a -- Magento Connect 1.0 extension key: n/a -- Magento Connect 2.0 extension key: n/a -- Composer name: avstudnitz/fast-simple-import (included in http://packages.firegento.com/) +- Composer name: avstudnitz/fast-simple-import (included in http://packages.firegento.com/ and Packagist) - [Extension on GitHub](https://github.com/avstudnitz/AvS_FastSimpleImport) - [Direct download link](https://github.com/avstudnitz/AvS_FastSimpleImport/tarball/master) - [Documentation](http://avstudnitz.github.io/AvS_FastSimpleImport/) @@ -73,6 +70,10 @@ Paul Hachmang http://www.h-o.nl/ [@paales](https://twitter.com/paales) +Simon Sprankel +http://simonsprankel.de/ +[@SimonSprankel](https://twitter.com/SimonSprankel) + License ------- From 8b7052962f3abb71afe18f048b600af7e2ee95e0 Mon Sep 17 00:00:00 2001 From: Andre Flitsch Date: Fri, 5 Oct 2018 14:19:49 +0200 Subject: [PATCH 5/6] refactor to allow for downloadable urls as well as files --- .../Model/Import/Entity/Product.php | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php index 927922ee..0ddc9f55 100644 --- a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php +++ b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php @@ -98,7 +98,7 @@ class AvS_FastSimpleImport_Model_Import_Entity_Product extends AvS_FastSimpleImp protected $_mediaValueTableName; /** @var string */ protected $_downloadableLinksTableName; - + /** * Attributes with index (not label) value. * @@ -1394,18 +1394,26 @@ protected function _saveProducts() $mediaGallery[$rowSku][] = $mediaImageData; } - // 4. Downloadable files phase - if (!empty($rowData['downloadable_links_file']) && - !empty($rowData['downloadable_links_title']) && + // 4. Downloadable links phase + if (!empty($rowData['downloadable_links_title']) && !empty($rowData['downloadable_links_nod']) && $rowData['_type'] === 'downloadable') { - $downloadableLinkData = array( + $downloadableLinkData = [ 'title' => $rowData['downloadable_links_title'], 'number_of_downloads' => $rowData['downloadable_links_nod'], - 'file' => $rowData['downloadable_links_file'], 'store_id' => Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID - ); + ]; + + // downloadable files + if (!empty($rowData['downloadable_links_file'])) { + $downloadableLinkData['file'] = $rowData['downloadable_links_file']; + $downloadableLinkData['link_type'] = 'file'; + // downloadable urls + } elseif (!empty($rowData['downloadable_links_url'])) { + $downloadableLinkData['url'] = $rowData['downloadable_links_url']; + $downloadableLinkData['link_type'] = 'url'; + } $downloadableData[$rowSku][] = $downloadableLinkData; } @@ -2047,19 +2055,29 @@ protected function _saveDownloadableLinks(array $downloadableData) } foreach ($downloadableLink as $insertValue) { + + $linkType = $insertValue['link_type']; + $fieldToSelect = 'link_' . $linkType; + $alreadyImported = $this->_connection->fetchOne($this->_connection->select() - ->from($downloadableLinkTableName, array('link_file')) + ->from($downloadableLinkTableName, array($fieldToSelect)) ->where('product_id IN (?)', $productId) - ->where('link_file = (?)', $insertValue['file'])); + ->where("$fieldToSelect = (?)", $insertValue[$linkType])); - if (!in_array($insertValue['file'], $insertedDownloadableLinks) && !$alreadyImported) { + if (!in_array($insertValue[$linkType], $insertedDownloadableLinks) && !$alreadyImported) { $valueArr = array( 'product_id' => $productId, - 'link_file' => $insertValue['file'], - 'link_type' => 'file', 'number_of_downloads' => $insertValue['number_of_downloads'], ); + if ($insertValue['file']) { + $valueArr['link_file'] = $insertValue['file']; + $valueArr['link_type'] = 'file'; + } elseif ($insertValue['url']) { + $valueArr['link_url'] = $insertValue['url']; + $valueArr['link_type'] = 'url'; + } + $this->_connection ->insertOnDuplicate($downloadableLinkTableName, $valueArr, array('product_id')); @@ -2074,8 +2092,10 @@ protected function _saveDownloadableLinks(array $downloadableData) $this->_connection ->insertOnDuplicate($downloadableLinkTitleTableName, $valueArr, array('link_id')); - $this->moveDownloadableFile($insertValue['file']); - $insertedDownloadableLinks[] = $insertValue['file']; + if ($linkType == 'file') { + $this->moveDownloadableFile($insertValue[$fieldToSelect]); + } + $insertedDownloadableLinks[] = $insertValue[$fieldToSelect]; } From 03b956af25db1bd43024c3cde185a7beaafc9721 Mon Sep 17 00:00:00 2001 From: Andre Flitsch Date: Thu, 11 Oct 2018 15:44:45 +0200 Subject: [PATCH 6/6] correct check for existing keys Signed-off-by: Andre Flitsch --- .../FastSimpleImport/Model/Import/Entity/Product.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php index 0ddc9f55..87e7468e 100644 --- a/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php +++ b/src/app/code/community/AvS/FastSimpleImport/Model/Import/Entity/Product.php @@ -2070,10 +2070,10 @@ protected function _saveDownloadableLinks(array $downloadableData) 'number_of_downloads' => $insertValue['number_of_downloads'], ); - if ($insertValue['file']) { + if (array_key_exists('file', $insertValue)) { $valueArr['link_file'] = $insertValue['file']; $valueArr['link_type'] = 'file'; - } elseif ($insertValue['url']) { + } elseif (array_key_exists('url', $insertValue)) { $valueArr['link_url'] = $insertValue['url']; $valueArr['link_type'] = 'url'; } @@ -2095,9 +2095,9 @@ protected function _saveDownloadableLinks(array $downloadableData) if ($linkType == 'file') { $this->moveDownloadableFile($insertValue[$fieldToSelect]); } - $insertedDownloadableLinks[] = $insertValue[$fieldToSelect]; - - + if (array_key_exists($fieldToSelect, $insertValue)) { + $insertedDownloadableLinks[] = $insertValue[$fieldToSelect]; + } } } }