Adventos_OrderExport - Version 1.3.3

Version Notes

add product_discount_percent

Download this release

Release Info

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


Code changes from version 1.3.2 to 1.3.3

app/code/local/Adventos/OrderExport/Model/Observer.php CHANGED
@@ -33,7 +33,7 @@ class Adventos_OrderExport_Model_Observer
33
  $webSite = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
34
 
35
  $this->_exportOrder($order);
36
- Mage::log("ADVENTOS OrderExport Event - Store: ".$storeId);
37
  }
38
  catch (Exception $e)
39
  {
@@ -139,17 +139,19 @@ class Adventos_OrderExport_Model_Observer
139
  "product_name" => $item->getName(),
140
  "product_qty" => $item->getQtyOrdered(),
141
  "product_price" => $item->getPrice(),
 
142
  "product_row_discount_amount" => $item->getDiscountAmount(),
143
  "product_row_price" => $item->getQtyOrdered() * $item->getPrice() - $item->getDiscountAmount(),
144
  "product_order_id" => $order->getRealOrderId(),
145
  "product_order_item_id" => $item->getId(),
 
146
  );
147
  }
148
 
149
  $streetBA = $order->getBillingAddress()->getStreet();
150
  $streetSA = $order->getShippingAddress()->getStreet();
151
 
152
- $customerGroupId = $order->getCustomerGroupId ();
153
  $customerGroupName = "";
154
 
155
  $group = Mage::getModel ('customer/group')->load ($customerGroupId);
@@ -163,16 +165,16 @@ class Adventos_OrderExport_Model_Observer
163
  $customerEmail = $customer->getEmail();
164
  }
165
 
166
- $exportVatGroup = Mage::getStoreConfig('catalog/orderexport/B2B_HomeGroup');
167
- $exportVatGroup = explode(",", $exportVatGroup);
168
-
169
- if (in_array($customerGroupId, $exportVatGroup)) {
170
- $order->getBillingAddress()->getvat_id() ? $billing_vat_id = $order->getBillingAddress()->getCountry().$order->getBillingAddress()->getvat_id() : $billing_vat_id = "";
171
- $order->getShippingAddress()->getvat_id() ? $shipping_vat_id = $order->getShippingAddress()->getCountry().$order->getShippingAddress()->getvat_id() : $shipping_vat_id = "";
172
- }else{
173
- $billing_vat_id = "";
174
- $shipping_vat_id = "";
175
- }
176
 
177
  $saleorder = array(
178
  "id" => $order->getRealOrderId(),
@@ -182,7 +184,7 @@ class Adventos_OrderExport_Model_Observer
182
  "hofakt_language" => Mage::getStoreConfig('catalog/orderexport/store_language'),
183
  "payment" => $order->getPayment()->getMethod(),
184
  "shipping_amount" => $order->getShippingAmount(),
185
- "discount_amount" => $order->getDiscountAmount(),
186
  "discount_descr" => $order->getDiscountDescription(),
187
  "net_total" => $order->getSubtotal(),
188
  "tax_amount" => $order->getTaxAmount(),
@@ -229,7 +231,7 @@ class Adventos_OrderExport_Model_Observer
229
  }
230
 
231
  public function generateCatalogInventoryFile($schedule){
232
- Mage::log("ADVENTOS OrderExport CatalogInventoryExport - START");
233
  try
234
  {
235
  $inventoryArray = array();
@@ -246,39 +248,39 @@ class Adventos_OrderExport_Model_Observer
246
  $varExport = Mage::getBaseDir('export');
247
  }
248
  catch (Exception $e)
249
- {
250
- Mage::logException($e);
251
- }
252
-
253
- $web_exported = @array();
254
- $allStores = Mage::app()->getStores();
255
- foreach ($allStores as $_eachStoreId => $val) {
256
- $exportXml = $Xml;
257
- $exportFile = $file;
258
- $_storeId = Mage::app()->getStore($_eachStoreId)->getId();
259
- $_webId = Mage::app()->getStore($_eachStoreId)->getWebsiteId();
260
- $app = Mage::app()->setCurrentStore($_storeId);
261
- if (Mage::getStoreConfig('catalog/orderexport/process')){
262
- if (!in_array($_webId, $web_exported)){
263
- if (Mage::getStoreConfig('catalog/orderexport/export_path') != null){
264
- if (Mage::getStoreConfig('catalog/orderexport/export_path') != ""){
265
- $orderExportPath = Mage::getStoreConfig('catalog/orderexport/export_path');
266
- if(!is_dir($varExport.DS.$orderExportPath)){
267
- mkdir($varExport.DS.$orderExportPath);
268
- Mage::log("ADVENTOS OrderExport Event - Add MultiShop ExportPath [".$orderExportPath."]");
269
- }
270
- $exportFile = $orderExportPath."/".$exportFile;
271
- }
272
- }
273
- $exportPath = $varExport.DS.$exportFile;
274
- $handle = fopen($exportPath,"w+");
275
- fwrite($handle,$exportXml);
276
- fclose($handle);
277
- Mage::log("ADVENTOS OrderExport CatalogInventoryExport - [".$orderExportPath."] Done");
278
- }
279
- array_push($web_exported, $_webId);
280
- }
281
- }
282
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - END");
283
  }
284
- }
33
  $webSite = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
34
 
35
  $this->_exportOrder($order);
36
+ Mage::log("ADVENTOS OrderExport Event - Store: ".$storeId);
37
  }
38
  catch (Exception $e)
39
  {
139
  "product_name" => $item->getName(),
140
  "product_qty" => $item->getQtyOrdered(),
141
  "product_price" => $item->getPrice(),
142
+ "product_discount_percent" => $item->getDiscountPercent(),
143
  "product_row_discount_amount" => $item->getDiscountAmount(),
144
  "product_row_price" => $item->getQtyOrdered() * $item->getPrice() - $item->getDiscountAmount(),
145
  "product_order_id" => $order->getRealOrderId(),
146
  "product_order_item_id" => $item->getId(),
147
+ "product_description" => "",
148
  );
149
  }
150
 
151
  $streetBA = $order->getBillingAddress()->getStreet();
152
  $streetSA = $order->getShippingAddress()->getStreet();
153
 
154
+ $customerGroupId = $order->getCustomerGroupId();
155
  $customerGroupName = "";
156
 
157
  $group = Mage::getModel ('customer/group')->load ($customerGroupId);
165
  $customerEmail = $customer->getEmail();
166
  }
167
 
168
+ $exportVatGroup = Mage::getStoreConfig('catalog/orderexport/B2B_HomeGroup');
169
+ $exportVatGroup = explode(",", $exportVatGroup);
170
+
171
+ if (in_array($customerGroupId, $exportVatGroup)) {
172
+ $order->getBillingAddress()->getvat_id() ? $billing_vat_id = $order->getBillingAddress()->getCountry().$order->getBillingAddress()->getvat_id() : $billing_vat_id = "";
173
+ $order->getShippingAddress()->getvat_id() ? $shipping_vat_id = $order->getShippingAddress()->getCountry().$order->getShippingAddress()->getvat_id() : $shipping_vat_id = "";
174
+ }else{
175
+ $billing_vat_id = "";
176
+ $shipping_vat_id = "";
177
+ }
178
 
179
  $saleorder = array(
180
  "id" => $order->getRealOrderId(),
184
  "hofakt_language" => Mage::getStoreConfig('catalog/orderexport/store_language'),
185
  "payment" => $order->getPayment()->getMethod(),
186
  "shipping_amount" => $order->getShippingAmount(),
187
+ "discount_amount" => 0,
188
  "discount_descr" => $order->getDiscountDescription(),
189
  "net_total" => $order->getSubtotal(),
190
  "tax_amount" => $order->getTaxAmount(),
231
  }
232
 
233
  public function generateCatalogInventoryFile($schedule){
234
+ Mage::log("ADVENTOS OrderExport CatalogInventoryExport - START");
235
  try
236
  {
237
  $inventoryArray = array();
248
  $varExport = Mage::getBaseDir('export');
249
  }
250
  catch (Exception $e)
251
+ {
252
+ Mage::logException($e);
253
+ }
254
+
255
+ $web_exported = @array();
256
+ $allStores = Mage::app()->getStores();
257
+ foreach ($allStores as $_eachStoreId => $val) {
258
+ $exportXml = $Xml;
259
+ $exportFile = $file;
260
+ $_storeId = Mage::app()->getStore($_eachStoreId)->getId();
261
+ $_webId = Mage::app()->getStore($_eachStoreId)->getWebsiteId();
262
+ $app = Mage::app()->setCurrentStore($_storeId);
263
+ if (Mage::getStoreConfig('catalog/orderexport/process')){
264
+ if (!in_array($_webId, $web_exported)){
265
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != null){
266
+ if (Mage::getStoreConfig('catalog/orderexport/export_path') != ""){
267
+ $orderExportPath = Mage::getStoreConfig('catalog/orderexport/export_path');
268
+ if(!is_dir($varExport.DS.$orderExportPath)){
269
+ mkdir($varExport.DS.$orderExportPath);
270
+ Mage::log("ADVENTOS OrderExport Event - Add MultiShop ExportPath [".$orderExportPath."]");
271
+ }
272
+ $exportFile = $orderExportPath."/".$exportFile;
273
+ }
274
+ }
275
+ $exportPath = $varExport.DS.$exportFile;
276
+ $handle = fopen($exportPath,"w+");
277
+ fwrite($handle,$exportXml);
278
+ fclose($handle);
279
+ Mage::log("ADVENTOS OrderExport CatalogInventoryExport - [".$orderExportPath."] Done");
280
+ }
281
+ array_push($web_exported, $_webId);
282
+ }
283
+ }
284
  Mage::log("ADVENTOS OrderExport CatalogInventoryExport - END");
285
  }
286
+ }
app/code/local/Adventos/OrderExport/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Adventos_OrderExport>
5
- <version>1.3.2</version>
6
  </Adventos_OrderExport>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Adventos_OrderExport>
5
+ <version>1.3.3</version>
6
  </Adventos_OrderExport>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,19 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adventos_OrderExport</name>
4
- <version>1.3.2</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>added addressID and vatId to both addresses export vat only when order customer group set in backend&#xD;
12
  </notes>
13
  <authors><author><name>Karsten Hoffmann</name><user>adventos</user><email>karsten@adventos.de</email></author></authors>
14
- <date>2013-03-20</date>
15
- <time>15:08:43</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="cb4c069b82ec33747b6218998c4b3feb"/><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="79ceae9a80cd5d4488c7e4f5cfdf6e62"/><file name="system.xml" hash="6204155a5c875e4db24c107fb375ff25"/><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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adventos_OrderExport</name>
4
+ <version>1.3.3</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 product_discount_percent&#xD;
12
  </notes>
13
  <authors><author><name>Karsten Hoffmann</name><user>adventos</user><email>karsten@adventos.de</email></author></authors>
14
+ <date>2013-03-27</date>
15
+ <time>11:51:05</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="145ac63cdb2a1912903d5594715cf6bd"/><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="0a1341b03323609250a88fd0bf34d021"/><file name="system.xml" hash="6204155a5c875e4db24c107fb375ff25"/><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>