FarApp_Connector - Version 1.2.6

Version Notes

Import fix to workaround Magento bug with import bunches.

Download this release

Release Info

Developer FarApp
Extension FarApp_Connector
Version 1.2.6
Comparing to
See all releases


Code changes from version 1.2.5 to 1.2.6

app/code/community/FarApp/Connector/Model/Import/Entity/Abstract.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- /**
3
- */
4
- class FarApp_Connector_Model_Import_Entity_Abstract extends Mage_ImportExport_Model_Import_Entity_Abstract
5
- {
6
- protected function _saveValidatedBunches()
7
- {
8
- $source = $this->_getSource();
9
- $productDataSize = 0;
10
- $bunchRows = array();
11
- $startNewBunch = false;
12
- $nextRowBackup = array();
13
- $maxDataSize = Mage::getResourceHelper('importexport')->getMaxDataSize();
14
- $bunchSize = Mage::helper('importexport')->getBunchSize();
15
-
16
- $source->rewind();
17
- $this->_dataSourceModel->cleanBunches();
18
-
19
- while ($source->valid() || $bunchRows) {
20
- if ($startNewBunch || !$source->valid()) {
21
- if ($this->getEntityTypeCode() == 'catalog_product' && $startNewBunch && !array_values($nextRowBackup)[0]['sku']) {
22
- $arrKeys = array_keys($bunchRows);
23
- $arrNew = array();
24
- while(($tRow = array_pop($bunchRows))) {
25
- $tKey = array_pop($arrKeys);
26
- $arrNew[$tKey] = $tRow;
27
- if ($tRow['sku']) {
28
- break;
29
- }
30
- }
31
- $nextRowBackup = array_reverse($arrNew, TRUE) + $nextRowBackup;
32
- }
33
- if ($bunchRows) {
34
- $this->_dataSourceModel->saveBunch($this->getEntityTypeCode(), $this->getBehavior(), $bunchRows);
35
- }
36
-
37
- $bunchRows = $nextRowBackup;
38
- $productDataSize = strlen(serialize($bunchRows));
39
- $startNewBunch = false;
40
- $nextRowBackup = array();
41
- }
42
- if ($source->valid()) {
43
- if ($this->_errorsCount >= $this->_errorsLimit) { // errors limit check
44
- return;
45
- }
46
- $rowData = $source->current();
47
-
48
- $this->_processedRowsCount++;
49
-
50
- if ($this->validateRow($rowData, $source->key())) { // add row to bunch for save
51
- $rowData = $this->_prepareRowForDb($rowData);
52
- $rowSize = strlen(Mage::helper('core')->jsonEncode($rowData));
53
-
54
- $isBunchSizeExceeded = ($bunchSize > 0 && count($bunchRows) >= $bunchSize);
55
-
56
- if (($productDataSize + $rowSize) >= $maxDataSize || $isBunchSizeExceeded) {
57
- $startNewBunch = true;
58
- $nextRowBackup = array($source->key() => $rowData);
59
- } else {
60
- $bunchRows[$source->key()] = $rowData;
61
- $productDataSize += $rowSize;
62
- }
63
- }
64
- $source->next();
65
- }
66
- }
67
- return $this;
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/FarApp/Connector/Model/Import/Entity/Product.php CHANGED
@@ -9,6 +9,70 @@ class FarApp_Connector_Model_Import_Entity_Product extends Mage_ImportExport_Mod
9
  $this->_errorsLimit = 1000000000;
10
  }
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  protected function _createAttributeOption($attrType, $attrCode, array $rowData, $rowNum)
13
  {
14
  /** @var $attribute Mage_Eav_Model_Entity_Attribute */
@@ -95,7 +159,12 @@ class FarApp_Connector_Model_Import_Entity_Product extends Mage_ImportExport_Mod
95
  return '';
96
  }
97
  }
98
- return parent::_uploadMediaFiles($correctedBaseName);
 
 
 
 
 
99
  }
100
  else {
101
  return $destPath;
9
  $this->_errorsLimit = 1000000000;
10
  }
11
 
12
+ protected function _saveValidatedBunches()
13
+ {
14
+ $source = $this->_getSource();
15
+ $productDataSize = 0;
16
+ $bunchRows = array();
17
+ $startNewBunch = false;
18
+ $nextRowBackup = array();
19
+ $maxDataSize = Mage::getResourceHelper('importexport')->getMaxDataSize();
20
+ $bunchSize = Mage::helper('importexport')->getBunchSize();
21
+
22
+ $source->rewind();
23
+ $this->_dataSourceModel->cleanBunches();
24
+
25
+ while ($source->valid() || $bunchRows) {
26
+ if ($startNewBunch || !$source->valid()) {
27
+ if ($startNewBunch && !array_values($nextRowBackup)[0]['sku']) {
28
+ $arrKeys = array_keys($bunchRows);
29
+ $arrNew = array();
30
+ while(($tRow = array_pop($bunchRows))) {
31
+ $tKey = array_pop($arrKeys);
32
+ $arrNew[$tKey] = $tRow;
33
+ if ($tRow['sku']) {
34
+ break;
35
+ }
36
+ }
37
+ $nextRowBackup = array_reverse($arrNew, TRUE) + $nextRowBackup;
38
+ }
39
+ if ($bunchRows) {
40
+ $this->_dataSourceModel->saveBunch($this->getEntityTypeCode(), $this->getBehavior(), $bunchRows);
41
+ }
42
+
43
+ $bunchRows = $nextRowBackup;
44
+ $productDataSize = strlen(serialize($bunchRows));
45
+ $startNewBunch = false;
46
+ $nextRowBackup = array();
47
+ }
48
+ if ($source->valid()) {
49
+ if ($this->_errorsCount >= $this->_errorsLimit) { // errors limit check
50
+ return;
51
+ }
52
+ $rowData = $source->current();
53
+
54
+ $this->_processedRowsCount++;
55
+
56
+ if ($this->validateRow($rowData, $source->key())) { // add row to bunch for save
57
+ $rowData = $this->_prepareRowForDb($rowData);
58
+ $rowSize = strlen(Mage::helper('core')->jsonEncode($rowData));
59
+
60
+ $isBunchSizeExceeded = ($bunchSize > 0 && count($bunchRows) >= $bunchSize);
61
+
62
+ if (($productDataSize + $rowSize) >= $maxDataSize || $isBunchSizeExceeded) {
63
+ $startNewBunch = true;
64
+ $nextRowBackup = array($source->key() => $rowData);
65
+ } else {
66
+ $bunchRows[$source->key()] = $rowData;
67
+ $productDataSize += $rowSize;
68
+ }
69
+ }
70
+ $source->next();
71
+ }
72
+ }
73
+ return $this;
74
+ }
75
+
76
  protected function _createAttributeOption($attrType, $attrCode, array $rowData, $rowNum)
77
  {
78
  /** @var $attribute Mage_Eav_Model_Entity_Attribute */
159
  return '';
160
  }
161
  }
162
+ if (is_file($fullTempPath)) {
163
+ return parent::_uploadMediaFiles($correctedBaseName);
164
+ }
165
+ else {
166
+ return '';
167
+ }
168
  }
169
  else {
170
  return $destPath;
app/code/community/FarApp/Connector/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <FarApp_Connector>
12
- <version>1.2.5</version>
13
  </FarApp_Connector>
14
  </modules>
15
  <global>
9
  <config>
10
  <modules>
11
  <FarApp_Connector>
12
+ <version>1.2.6</version>
13
  </FarApp_Connector>
14
  </modules>
15
  <global>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FarApp_Connector</name>
4
- <version>1.2.5</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.farapp.com/p/farapp-subscription-form">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connector to sync product data from FarApp to Magento. FarApp currently supports NetSuite and other backends.</summary>
10
  <description>FarApp is a cloud-based solution for posting product data to storefronts, retrieving orders from storefront and posting fulfillments to storefronts. We support various backends including NetSuite, X-Cart, 3D-Cart, and more. This connector allows full product data posting to Magento from FarApp. It has the the extra benefits of allowing FarApp to dynamically push new product data, automatically creating new attribute options and importing external images (features not provided by Magento).</description>
11
  <notes>Import fix to workaround Magento bug with import bunches.</notes>
12
  <authors><author><name>FarApp</name><user>FarApp</user><email>support@farapp.com</email></author></authors>
13
- <date>2015-10-02</date>
14
- <time>23:19:08</time>
15
- <contents><target name="magecommunity"><dir name="FarApp"><dir name="Connector"><dir name="Model"><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="765dc8fbab996f17b9f049cc8aa906a0"/><file name="Array.php" hash="6ca62c702dcb9512ec429563ac1ce1a2"/></dir><dir name="Entity"><file name="Order.php" hash="14a2f735cf8fc5e8f2bcd6682a1e56b1"/></dir></dir><file name="Export.php" hash="01643ef101731c6d98bbc523642f95a0"/><dir name="Import"><dir name="Entity"><file name="Abstract.php" hash="55491d3ef329c6079ec9cf01c8d294e0"/><file name="Customer.php" hash="376978f635c73605d428037cca8cf594"/><file name="Order.php" hash="38579396825a1bd3ad59de84278085f6"/><file name="Product.php" hash="b1b6b5cbbd4799889ff87e06e38567e8"/><file name="minVersion2.php" hash="8df670fd68516ba1629304ae8ab6c812"/></dir></dir><file name="Import.php" hash="5f226d5505bf8e258a4e61f43b09b25a"/><dir name="Order"><dir name="Creditmemo"><file name="Api.php" hash="edb85d34679eab92e8990a0dd065632e"/></dir><dir name="Invoice"><file name="Api.php" hash="f133255dae51ab9c44c71ca9cc702d0a"/></dir></dir></dir><dir name="controllers"><file name="ExportController.php" hash="c51395789ff9eed363f20d5ab08ff528"/><file name="ImportController.php" hash="ec66abaf46073b9491889a199d665992"/><file name="IndexController.php" hash="93918848d3ce7f6ad05688f89a730e75"/></dir><dir name="etc"><file name="api.xml" hash="25b50336e5bfbd139eeb81bbf321dd78"/><file name="config.xml" hash="2bffd75257f8e6ef4964e2fec88c49bf"/><file name="wsdl.xml" hash="831bf87f9939132a9d9be6327d1b6a8e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FarApp_Connector.xml" hash="ff3fe315c70239229cb5ff3a49d40967"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>5.7.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FarApp_Connector</name>
4
+ <version>1.2.6</version>
5
  <stability>stable</stability>
6
+ <license uri="https://www.farapp.com/signup/">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connector to sync product data from FarApp to Magento. FarApp currently supports NetSuite and other backends.</summary>
10
  <description>FarApp is a cloud-based solution for posting product data to storefronts, retrieving orders from storefront and posting fulfillments to storefronts. We support various backends including NetSuite, X-Cart, 3D-Cart, and more. This connector allows full product data posting to Magento from FarApp. It has the the extra benefits of allowing FarApp to dynamically push new product data, automatically creating new attribute options and importing external images (features not provided by Magento).</description>
11
  <notes>Import fix to workaround Magento bug with import bunches.</notes>
12
  <authors><author><name>FarApp</name><user>FarApp</user><email>support@farapp.com</email></author></authors>
13
+ <date>2015-10-15</date>
14
+ <time>19:34:44</time>
15
+ <contents><target name="magecommunity"><dir name="FarApp"><dir name="Connector"><dir name="Model"><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="765dc8fbab996f17b9f049cc8aa906a0"/><file name="Array.php" hash="6ca62c702dcb9512ec429563ac1ce1a2"/></dir><dir name="Entity"><file name="Order.php" hash="14a2f735cf8fc5e8f2bcd6682a1e56b1"/></dir></dir><file name="Export.php" hash="01643ef101731c6d98bbc523642f95a0"/><dir name="Import"><dir name="Entity"><file name="Customer.php" hash="376978f635c73605d428037cca8cf594"/><file name="Order.php" hash="38579396825a1bd3ad59de84278085f6"/><file name="Product.php" hash="34248781510b344e913baae45225ae27"/><file name="minVersion2.php" hash="8df670fd68516ba1629304ae8ab6c812"/></dir></dir><file name="Import.php" hash="5f226d5505bf8e258a4e61f43b09b25a"/><dir name="Order"><dir name="Creditmemo"><file name="Api.php" hash="edb85d34679eab92e8990a0dd065632e"/></dir><dir name="Invoice"><file name="Api.php" hash="f133255dae51ab9c44c71ca9cc702d0a"/></dir></dir></dir><dir name="controllers"><file name="ExportController.php" hash="c51395789ff9eed363f20d5ab08ff528"/><file name="ImportController.php" hash="ec66abaf46073b9491889a199d665992"/><file name="IndexController.php" hash="93918848d3ce7f6ad05688f89a730e75"/></dir><dir name="etc"><file name="api.xml" hash="25b50336e5bfbd139eeb81bbf321dd78"/><file name="config.xml" hash="21e0f69b4c8dc96576ad9781bbeecf6c"/><file name="wsdl.xml" hash="831bf87f9939132a9d9be6327d1b6a8e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FarApp_Connector.xml" hash="ff3fe315c70239229cb5ff3a49d40967"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>5.7.0</max></php></required></dependencies>
18
  </package>