Adventos_OrderExport - Version 1.3.1

Version Notes

Add new tag store language
Define export path multistore enviroment

Download this release

Release Info

Developer Karsten Hoffmann
Extension Adventos_OrderExport
Version 1.3.1
Comparing to
See all releases


Code changes from version 1.3.0 to 1.3.1

app/code/local/Adventos/OrderExport/Model/Observer.php CHANGED
@@ -60,6 +60,19 @@ class Adventos_OrderExport_Model_Observer
60
  $file = "SalesOrder_".$order->getId().".xml";
61
 
62
  $varExport = Mage::getBaseDir('export');
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  $exportPath = $varExport.DS.$file;
64
 
65
  $handle = fopen($exportPath,"w+");
@@ -201,37 +214,55 @@ class Adventos_OrderExport_Model_Observer
201
 
202
  public function generateCatalogInventoryFile($schedule){
203
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - START");
204
- try
205
  {
206
- $inventoryArray = array();
207
- $collection = Mage::getModel('catalog/product')->getCollection();
208
- // ->addAttributeToSelect('*') // select all attributes
209
- // ->setPageSize(10) // limit number of results returned
210
- // ->setCurPage(4); // set the offset (useful for pagination)
211
-
212
  foreach ($collection->load() as $item)
213
- {
214
- $inventoryArray[] = array(
215
- "sku" => $item->getSku(),
216
- "qty" => (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($item)->getQty(),
217
- );
218
- }
219
-
220
- $Xml = $this->toXml($inventoryArray,'catalogInventory');
221
- $file = "CatalogInventoryExport.xml";
222
-
223
- $varExport = Mage::getBaseDir('export');
224
- $exportPath = $varExport.DS.$file;
225
-
226
- $handle = fopen($exportPath,"w+");
227
- fwrite($handle,$Xml);
228
- fclose($handle);
229
- Mage::log("ADVENTOS OrderExport CatalogInventoryExport - DONE");
230
- }
231
- catch (Exception $e)
232
  {
233
  Mage::logException($e);
234
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - END");
236
  }
237
  }
60
  $file = "SalesOrder_".$order->getId().".xml";
61
 
62
  $varExport = Mage::getBaseDir('export');
63
+
64
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != null){
65
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != ""){
66
+ $OrderExportPath = Mage::getStoreConfig('catalog/orderexport/export_path');
67
+ if(!is_dir($varExport.DS.$OrderExportPath)){
68
+ Mage::log("ADVENTOS OrderExport Event - MultiShop ExportPath Folder not exist [".$OrderExportPath."]");
69
+ mkdir($varExport.DS.$OrderExportPath);
70
+ }
71
+ $file = $OrderExportPath."/".$file;
72
+ Mage::log("ADVENTOS OrderExport Event - Add MultiShop ExportPath [".$OrderExportPath."]");
73
+ }
74
+ }
75
+
76
  $exportPath = $varExport.DS.$file;
77
 
78
  $handle = fopen($exportPath,"w+");
214
 
215
  public function generateCatalogInventoryFile($schedule){
216
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - START");
217
+ try
218
  {
219
+ $inventoryArray = array();
220
+ $collection = Mage::getModel('catalog/product')->getCollection();
 
 
 
 
221
  foreach ($collection->load() as $item)
222
+ {
223
+ $inventoryArray[] = array(
224
+ "sku" => $item->getSku(),
225
+ "qty" => (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($item)->getQty(),
226
+ );
227
+ }
228
+ $Xml = $this->toXml($inventoryArray,'catalogInventory');
229
+ $file = "CatalogInventoryExport.xml";
230
+ $varExport = Mage::getBaseDir('export');
231
+ }
232
+ catch (Exception $e)
 
 
 
 
 
 
 
 
233
  {
234
  Mage::logException($e);
235
  }
236
+
237
+ $web_exported = @array();
238
+ $allStores = Mage::app()->getStores();
239
+ foreach ($allStores as $_eachStoreId => $val) {
240
+ $exportXml = $Xml;
241
+ $exportFile = $file;
242
+ $_storeId = Mage::app()->getStore($_eachStoreId)->getId();
243
+ $_webId = Mage::app()->getStore($_eachStoreId)->getWebsiteId();
244
+ $app = Mage::app()->setCurrentStore($_storeId);
245
+ if (Mage::getStoreConfig('catalog/orderexport/process')){
246
+ if (!in_array($_webId, $web_exported)){
247
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != null){
248
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != ""){
249
+ $orderExportPath = Mage::getStoreConfig('catalog/orderexport/export_path');
250
+ if(!is_dir($varExport.DS.$orderExportPath)){
251
+ mkdir($varExport.DS.$orderExportPath);
252
+ Mage::log("ADVENTOS OrderExport Event - Add MultiShop ExportPath [".$orderExportPath."]");
253
+ }
254
+ $exportFile = $orderExportPath."/".$exportFile;
255
+ }
256
+ }
257
+ $exportPath = $varExport.DS.$exportFile;
258
+ $handle = fopen($exportPath,"w+");
259
+ fwrite($handle,$exportXml);
260
+ fclose($handle);
261
+ Mage::log("ADVENTOS OrderExport CatalogInventoryExport - [".$orderExportPath."] Done");
262
+ }
263
+ array_push($web_exported, $_webId);
264
+ }
265
+ }
266
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - END");
267
  }
268
  }
app/code/local/Adventos/OrderExport/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Adventos_OrderExport>
5
- <version>1.2.0</version>
6
  </Adventos_OrderExport>
7
  </modules>
8
  <global>
@@ -46,6 +46,7 @@
46
  <process>0</process>
47
  <storage_id>2</storage_id>
48
  <store_language>de</store_language>
 
49
  </orderexport>
50
  </catalog>
51
  </default>
2
  <config>
3
  <modules>
4
  <Adventos_OrderExport>
5
+ <version>1.3.1</version>
6
  </Adventos_OrderExport>
7
  </modules>
8
  <global>
46
  <process>0</process>
47
  <storage_id>2</storage_id>
48
  <store_language>de</store_language>
49
+ <export_path></export_path>
50
  </orderexport>
51
  </catalog>
52
  </default>
app/code/local/Adventos/OrderExport/etc/system.xml CHANGED
@@ -36,6 +36,18 @@
36
  <show_in_website>1</show_in_website>
37
  <show_in_store>1</show_in_store>
38
  </store_language>
 
 
 
 
 
 
 
 
 
 
 
 
39
  </fields>
40
  </orderexport>
41
  </groups>
36
  <show_in_website>1</show_in_website>
37
  <show_in_store>1</show_in_store>
38
  </store_language>
39
+ <export_path translate="label">
40
+ <label>Export Path</label>
41
+ <comment>
42
+ <![CDATA[Specify MultiShop Installation Export Path
43
+ leave blank in Single Shop Installation]]>
44
+ </comment>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>4</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </export_path>
51
  </fields>
52
  </orderexport>
53
  </groups>
package.xml CHANGED
@@ -1,18 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adventos_OrderExport</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento integration for HeadOffice</summary>
10
  <description>Create Order XML file to integrate Magento with HeadOffice and synchronize stock, order status, invoice, shipments and credit memos.</description>
11
- <notes>Add new tag store language</notes>
 
12
  <authors><author><name>Karsten Hoffmann</name><user>adventos</user><email>karsten@adventos.de</email></author></authors>
13
- <date>2013-01-11</date>
14
- <time>09:52:23</time>
15
- <contents><target name="magelocal"><dir name="Adventos"><dir name="OrderExport"><dir name="Helper"><file name="Data.php" hash="f90dd7d2136cfb6349ba1d7ee939cd15"/></dir><dir name="Model"><dir name="Creditmemo"><dir name="Api"><file name="V2.php" hash="afba3391027e1ebe798253cdc034d034"/></dir><file name="Api.php" hash="c41e82cf79235d51f25d248719e93f92"/></dir><dir name="Invoice"><dir name="Api"><file name="V2.php" hash="ed0e742f85e0f450c3387bb8a7738033"/></dir><file name="Api.php" hash="280512b1ae37690871384b3cba0a3a2b"/></dir><file name="Observer.php" hash="8fe3a15cc5b67d661236ff9291200cec"/><dir name="Shipment"><dir name="Api"><file name="V2.php" hash="22acaee0fe176a65fc1071d4dab5d6f5"/></dir><file name="Api.php" hash="0b9bf452b7e36c1ee5cefbb3d6c5eb3b"/></dir></dir><dir name="etc"><file name="api.xml" hash="8126b41684e8ee21ed6c8916e29f67d3"/><file name="config.xml" hash="9705b7f42368d7c949e9d885ba81c701"/><file name="system.xml" hash="1d99dfcd52a16873b299faad7284a952"/><file name="wsdl.xml" hash="b3e1086c7e06ece8e0c0e5f537b1480f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adventos_OrderExport.xml" hash="479b13bf3a08de9f93f5f58d77d3f9bb"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adventos_OrderExport</name>
4
+ <version>1.3.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento integration for HeadOffice</summary>
10
  <description>Create Order XML file to integrate Magento with HeadOffice and synchronize stock, order status, invoice, shipments and credit memos.</description>
11
+ <notes>Add new tag store language&#xD;
12
+ Define export path multistore enviroment</notes>
13
  <authors><author><name>Karsten Hoffmann</name><user>adventos</user><email>karsten@adventos.de</email></author></authors>
14
+ <date>2013-01-23</date>
15
+ <time>09:29:16</time>
16
+ <contents><target name="magelocal"><dir name="Adventos"><dir name="OrderExport"><dir name="Helper"><file name="Data.php" hash="f90dd7d2136cfb6349ba1d7ee939cd15"/></dir><dir name="Model"><dir name="Creditmemo"><dir name="Api"><file name="V2.php" hash="afba3391027e1ebe798253cdc034d034"/></dir><file name="Api.php" hash="c41e82cf79235d51f25d248719e93f92"/></dir><dir name="Invoice"><dir name="Api"><file name="V2.php" hash="ed0e742f85e0f450c3387bb8a7738033"/></dir><file name="Api.php" hash="280512b1ae37690871384b3cba0a3a2b"/></dir><file name="Observer.php" hash="334de5c28e0217f39108640778724f09"/><dir name="Shipment"><dir name="Api"><file name="V2.php" hash="22acaee0fe176a65fc1071d4dab5d6f5"/></dir><file name="Api.php" hash="0b9bf452b7e36c1ee5cefbb3d6c5eb3b"/></dir></dir><dir name="etc"><file name="api.xml" hash="8126b41684e8ee21ed6c8916e29f67d3"/><file name="config.xml" hash="9f0f84a6b50dfdacfb3d861e19b172d6"/><file name="system.xml" hash="f261813f3d5fb14ddabda24dab86921b"/><file name="wsdl.xml" hash="b3e1086c7e06ece8e0c0e5f537b1480f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adventos_OrderExport.xml" hash="479b13bf3a08de9f93f5f58d77d3f9bb"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>