FarApp_Connector - Version 1.2.5

Version Notes

Import fix to workaround Magento bug with import bunches.

Download this release

Release Info

Developer FarApp
Extension FarApp_Connector
Version 1.2.5
Comparing to
See all releases


Code changes from version 1.2.4 to 1.2.5

app/code/community/FarApp/Connector/Model/Import/Entity/Abstract.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <FarApp_Connector>
12
- <version>1.2.4</version>
13
  </FarApp_Connector>
14
  </modules>
15
  <global>
9
  <config>
10
  <modules>
11
  <FarApp_Connector>
12
+ <version>1.2.5</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.4</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>Added support for posting online credit memos.</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>21:33:37</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="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="6cf085440e5593959e82036771f3ee10"/><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.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>