Lengow_Export - Version 2.1.0

Version Notes

New version of Lengow's Connector

Download this release

Release Info

Developer Ludovic
Extension Lengow_Export
Version 2.1.0
Comparing to
See all releases


Code changes from version 2.0.2 to 2.1.0

Files changed (92) hide show
  1. app/code/community/Lengow/.DS_Store +0 -0
  2. app/code/community/Lengow/Dashboard/Block/Adminhtml/Dashboard/Charts.php +1 -1
  3. app/code/community/Lengow/Dashboard/Block/Adminhtml/Dashboard/Diagrams.php +1 -1
  4. app/code/community/Lengow/Dashboard/Model/Config.php +2 -2
  5. app/code/community/Lengow/Dashboard/etc/config.xml +14 -14
  6. app/code/community/Lengow/Export/.DS_Store +0 -0
  7. app/code/community/Lengow/Export/Block/Adminhtml/Product.php +3 -3
  8. app/code/community/Lengow/Export/Block/Adminhtml/Product/Grid.php +3 -3
  9. app/code/community/Lengow/Export/Helper/Data.php +4 -5
  10. app/code/community/Lengow/Export/Helper/Security.php +10 -10
  11. app/code/community/Lengow/Export/Model/.DS_Store +0 -0
  12. app/code/community/Lengow/Export/Model/Catalog/Product.php +129 -46
  13. app/code/community/Lengow/Export/Model/Config.php +110 -55
  14. app/code/community/Lengow/Export/Model/Feed/Csv.php +1 -1
  15. app/code/community/Lengow/Export/Model/Feed/Xml.php +1 -1
  16. app/code/community/Lengow/Export/Model/Generate.php +293 -139
  17. app/code/community/Lengow/Export/Model/Observer.php +42 -26
  18. app/code/community/Lengow/Export/Model/Source/Attributes.php +1 -1
  19. app/code/community/Lengow/Export/Model/Source/Types.php +1 -1
  20. app/code/community/Lengow/Export/Model/System/Config/Backend/Apikey.php +2 -2
  21. app/code/community/Lengow/Export/Model/System/Config/Source/Category/Level.php +5 -16
  22. app/code/community/Lengow/Export/Model/System/Config/Source/Getattributes.php +4 -1
  23. app/code/community/Lengow/Export/Model/System/Config/Source/Status.php +1 -1
  24. app/code/community/Lengow/Export/Model/System/Config/Source/Types.php +7 -7
  25. app/code/community/Lengow/Export/controllers/Adminhtml/Lengow/ExportController.php +25 -13
  26. app/code/community/Lengow/Export/controllers/FeedController.php +64 -37
  27. app/code/community/Lengow/Export/etc/config.xml +47 -38
  28. app/code/community/Lengow/Export/etc/system.xml +129 -120
  29. app/code/community/Lengow/Feed/Block/Adminhtml/Feed.php +3 -3
  30. app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Grid.php +40 -50
  31. app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Renderer/Migrate.php +1 -1
  32. app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Renderer/Url.php +1 -1
  33. app/code/community/Lengow/Feed/Helper/Data.php +3 -3
  34. app/code/community/Lengow/Feed/Model/Feed.php +25 -25
  35. app/code/community/Lengow/Feed/controllers/Adminhtml/Lengow/FeedController.php +16 -16
  36. app/code/community/Lengow/Feed/etc/config.xml +20 -20
  37. app/code/community/Lengow/Feed/etc/system.xml +3 -3
  38. app/code/community/Lengow/Sync/Block/Adminhtml/Log.php +2 -2
  39. app/code/community/Lengow/Sync/Block/Adminhtml/Log/Grid.php +4 -4
  40. app/code/community/Lengow/Sync/Block/Adminhtml/Order.php +1 -1
  41. app/code/community/Lengow/Sync/Block/Adminhtml/Order/Grid.php +3 -3
  42. app/code/community/Lengow/Sync/Block/Adminhtml/Order/Tab.php +24 -16
  43. app/code/community/Lengow/Sync/Block/Payment/Info/Purchaseorder.php +2 -2
  44. app/code/community/Lengow/Sync/Helper/Data.php +56 -17
  45. app/code/community/Lengow/Sync/Model/Config.php +118 -78
  46. app/code/community/Lengow/Sync/Model/Connector.php +10 -10
  47. app/code/community/Lengow/Sync/Model/Customer/Customer.php +116 -24
  48. app/code/community/Lengow/Sync/Model/File.php +27 -0
  49. app/code/community/Lengow/Sync/Model/Import.php +443 -190
  50. app/code/community/Lengow/Sync/Model/Log.php +6 -4
  51. app/code/community/Lengow/Sync/Model/Marketplace.php +36 -17
  52. app/code/community/Lengow/Sync/Model/Mysql4/Log.php +1 -1
  53. app/code/community/Lengow/Sync/Model/Mysql4/Log/Collection.php +1 -1
  54. app/code/community/Lengow/Sync/Model/Observer.php +139 -78
  55. app/code/community/Lengow/Sync/Model/Order.php +140 -288
  56. app/code/community/Lengow/Sync/Model/Payment/Method/Lengow.php +5 -7
  57. app/code/community/Lengow/Sync/Model/Quote.php +147 -0
  58. app/code/community/Lengow/Sync/Model/Quote/Exception.php +54 -0
  59. app/code/community/Lengow/Sync/Model/Shipping/Carrier/Lengow.php +8 -10
  60. app/code/community/Lengow/Sync/Model/System/Config/Source/Shipping/Carrier.php +24 -0
  61. app/code/community/Lengow/Sync/Model/System/Config/Source/Shipping/Method.php +52 -0
  62. app/code/community/Lengow/Sync/controllers/Adminhtml/Lengow/LogController.php +4 -4
  63. app/code/community/Lengow/Sync/controllers/Adminhtml/Lengow/OrderController.php +137 -85
  64. app/code/community/Lengow/Sync/controllers/ApiController.php +2 -2
  65. app/code/community/Lengow/Sync/etc/config.xml +49 -31
  66. app/code/community/Lengow/Sync/etc/marketplaces.xml +3456 -450
  67. app/code/community/Lengow/Sync/etc/system.xml +96 -47
  68. app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-install-2.0.0.0.php +8 -6
  69. app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-upgrade-2.0.0.0-2.0.0.1.php +2 -1
  70. app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-upgrade-2.0.2-2.1.0.php +94 -0
  71. app/code/community/Lengow/Tracker/Block/Adminhtml/System/Config/Check.php +1 -1
  72. app/code/community/Lengow/Tracker/Block/Adminhtml/System/Config/Check/Point.php +3 -3
  73. app/code/community/Lengow/Tracker/Block/Tag/Capsule.php +18 -13
  74. app/code/community/Lengow/Tracker/Block/Tag/Simple.php +2 -2
  75. app/code/community/Lengow/Tracker/Block/Tracker.php +13 -13
  76. app/code/community/Lengow/Tracker/Helper/Check.php +4 -4
  77. app/code/community/Lengow/Tracker/Model/Config.php +24 -5
  78. app/code/community/Lengow/Tracker/Model/Tracker.php +1 -1
  79. app/code/community/Lengow/Tracker/etc/config.xml +20 -20
  80. app/code/community/Lengow/Tracker/etc/plugins.xml +1 -1
  81. app/code/community/Lengow/Tracker/etc/system.xml +10 -10
  82. app/design/adminhtml/default/default/layout/lengow.xml +5 -6
  83. app/design/adminhtml/default/default/template/lengow/check/point.phtml +5 -5
  84. app/design/adminhtml/default/default/template/lengow/dashboard/charts.phtml +7 -7
  85. app/design/adminhtml/default/default/template/lengow/export/product.phtml +3 -3
  86. app/design/adminhtml/default/default/template/lengow/feed/grid.phtml +1 -1
  87. app/design/adminhtml/default/default/template/lengow/sales/order/tab/info.phtml +2 -2
  88. app/design/frontend/base/default/layout/lengow.xml +1 -1
  89. app/design/frontend/base/default/template/lengow/tracker/simpletag.phtml +1 -1
  90. app/locale/fr_FR/Lengow_Connector.csv +24 -3
  91. media/lengow/import.flag +0 -0
  92. package.xml +6 -6
app/code/community/Lengow/.DS_Store DELETED
Binary file
app/code/community/Lengow/Dashboard/Block/Adminhtml/Dashboard/Charts.php CHANGED
@@ -14,7 +14,7 @@ class Lengow_Dashboard_Block_Adminhtml_Dashboard_Charts extends Mage_Core_Block_
14
  public function __construct() {
15
  parent::__construct();
16
 
17
- $this->setData('config_model', Mage::getSingleton('dashboard/config'));
18
  $this->setData('id_client', $this->getData('config_model')->get('general/login'));
19
  $this->setData('id_group', $this->getData('config_model')->get('general/group'));
20
  $this->setData('api_key', $this->getData('config_model')->get('general/api_key'));
14
  public function __construct() {
15
  parent::__construct();
16
 
17
+ $this->setData('config_model', Mage::getSingleton('lendashboard/config'));
18
  $this->setData('id_client', $this->getData('config_model')->get('general/login'));
19
  $this->setData('id_group', $this->getData('config_model')->get('general/group'));
20
  $this->setData('api_key', $this->getData('config_model')->get('general/api_key'));
app/code/community/Lengow/Dashboard/Block/Adminhtml/Dashboard/Diagrams.php CHANGED
@@ -21,7 +21,7 @@ class Lengow_Dashboard_Block_Adminhtml_Dashboard_Diagrams extends Mage_Adminhtml
21
  parent::_prepareLayout();
22
  $this->addTab('lengow', array(
23
  'label' => Mage::helper('adminhtml')->__('Lengow'),
24
- 'content' => $this->getLayout()->createBlock('dashboard/adminhtml_dashboard_charts')->toHtml(),
25
  'active' => false
26
  ));
27
  }
21
  parent::_prepareLayout();
22
  $this->addTab('lengow', array(
23
  'label' => Mage::helper('adminhtml')->__('Lengow'),
24
+ 'content' => $this->getLayout()->createBlock('lendashboard/adminhtml_dashboard_charts')->toHtml(),
25
  'active' => false
26
  ));
27
  }
app/code/community/Lengow/Dashboard/Model/Config.php CHANGED
@@ -6,7 +6,7 @@
6
  * @category Lengow
7
  * @package Lengow_Dashboard
8
  * @author Romain Le Polh <romain@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Dashboard_Model_Config extends Varien_Object {
@@ -16,7 +16,7 @@ class Lengow_Dashboard_Model_Config extends Varien_Object {
16
  }
17
 
18
  public function get($key) {
19
- return Mage::getStoreConfig('tracker/' . $key, $this->_id_store);
20
  }
21
 
22
  }
6
  * @category Lengow
7
  * @package Lengow_Dashboard
8
  * @author Romain Le Polh <romain@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Dashboard_Model_Config extends Varien_Object {
16
  }
17
 
18
  public function get($key) {
19
+ return Mage::getStoreConfig('lentracker/' . $key, $this->_id_store);
20
  }
21
 
22
  }
app/code/community/Lengow/Dashboard/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Lengow_Dashboard>
5
- <version>2.0.1.5</version>
6
  </Lengow_Dashboard>
7
  </modules>
8
  <admin>
@@ -10,7 +10,7 @@
10
  <adminhtml>
11
  <args>
12
  <modules>
13
- <dashboard before="Mage_Adminhtml">Lengow_Dashboard_Adminhtml</dashboard>
14
  </modules>
15
  </args>
16
  </adminhtml>
@@ -18,10 +18,10 @@
18
  </admin>
19
  <global>
20
  <models>
21
- <dashboard>
22
  <class>Lengow_Dashboard_Model</class>
23
  <resourceModel>dashboard_mysql4</resourceModel>
24
- </dashboard>
25
  <dashboard_mysql4>
26
  <class>Lengow_Dashboard_Model_Mysql4</class>
27
  <entities>
@@ -32,21 +32,21 @@
32
  </dashboard_mysql4>
33
  </models>
34
  <resources>
35
- <dashboard_setup>
36
  <connection>
37
  <use>core_setup</use>
38
  </connection>
39
- </dashboard_setup>
40
- <dashboard_write>
41
  <connection>
42
  <use>core_write</use>
43
  </connection>
44
- </dashboard_write>
45
- <dashboard_read>
46
  <connection>
47
  <use>core_read</use>
48
  </connection>
49
- </dashboard_read>
50
  </resources>
51
  <blocks>
52
  <adminhtml>
@@ -54,14 +54,14 @@
54
  <dashboard_diagrams>Lengow_Dashboard_Block_Adminhtml_Dashboard_Diagrams</dashboard_diagrams>
55
  </rewrite>
56
  </adminhtml>
57
- <dashboard>
58
  <class>Lengow_Dashboard_Block</class>
59
- </dashboard>
60
  </blocks>
61
  <helpers>
62
- <dashboard>
63
  <class>Lengow_Dashboard_Helper</class>
64
- </dashboard>
65
  </helpers>
66
  </global>
67
  <adminhtml>
2
  <config>
3
  <modules>
4
  <Lengow_Dashboard>
5
+ <version>2.1.0</version>
6
  </Lengow_Dashboard>
7
  </modules>
8
  <admin>
10
  <adminhtml>
11
  <args>
12
  <modules>
13
+ <lendashboard before="Mage_Adminhtml">Lengow_Dashboard_Adminhtml</lendashboard>
14
  </modules>
15
  </args>
16
  </adminhtml>
18
  </admin>
19
  <global>
20
  <models>
21
+ <lendashboard>
22
  <class>Lengow_Dashboard_Model</class>
23
  <resourceModel>dashboard_mysql4</resourceModel>
24
+ </lendashboard>
25
  <dashboard_mysql4>
26
  <class>Lengow_Dashboard_Model_Mysql4</class>
27
  <entities>
32
  </dashboard_mysql4>
33
  </models>
34
  <resources>
35
+ <lendashboard_setup>
36
  <connection>
37
  <use>core_setup</use>
38
  </connection>
39
+ </lendashboard_setup>
40
+ <lendashboard_write>
41
  <connection>
42
  <use>core_write</use>
43
  </connection>
44
+ </lendashboard_write>
45
+ <lendashboard_read>
46
  <connection>
47
  <use>core_read</use>
48
  </connection>
49
+ </lendashboard_read>
50
  </resources>
51
  <blocks>
52
  <adminhtml>
54
  <dashboard_diagrams>Lengow_Dashboard_Block_Adminhtml_Dashboard_Diagrams</dashboard_diagrams>
55
  </rewrite>
56
  </adminhtml>
57
+ <lendashboard>
58
  <class>Lengow_Dashboard_Block</class>
59
+ </lendashboard>
60
  </blocks>
61
  <helpers>
62
+ <lendashboard>
63
  <class>Lengow_Dashboard_Helper</class>
64
+ </lendashboard>
65
  </helpers>
66
  </global>
67
  <adminhtml>
app/code/community/Lengow/Export/.DS_Store DELETED
Binary file
app/code/community/Lengow/Export/Block/Adminhtml/Product.php CHANGED
@@ -24,11 +24,11 @@ class Lengow_Export_Block_Adminhtml_Product extends Mage_Adminhtml_Block_Widget_
24
  */
25
  protected function _prepareLayout() {
26
  $this->_addButton('export', array(
27
- 'label' => Mage::helper('export')->__('See the export feed'),
28
- 'onclick' => 'popWin(\''.$this->getUrl('lengow/feed').'\', \'_blank\')',
29
  'class' => 'add'
30
  ));
31
- $this->setChild('grid', $this->getLayout()->createBlock('export/adminhtml_product_grid', 'product.grid'));
32
  return parent::_prepareLayout();
33
  }
34
 
24
  */
25
  protected function _prepareLayout() {
26
  $this->_addButton('export', array(
27
+ 'label' => Mage::helper('lenexport')->__('See the export feed'),
28
+ 'onclick' => 'popWin(\''.$this->getUrl('lengow/feed', array('_current'=>true)).'\', \'_blank\')',
29
  'class' => 'add'
30
  ));
31
+ $this->setChild('grid', $this->getLayout()->createBlock('lenexport/adminhtml_product_grid', 'product.grid'));
32
  return parent::_prepareLayout();
33
  }
34
 
app/code/community/Lengow/Export/Block/Adminhtml/Product/Grid.php CHANGED
@@ -41,7 +41,7 @@ class Lengow_Export_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_Wi
41
  'left');
42
 
43
  if ($store->getId()) {
44
- //$collection->setStoreId($store->getId());
45
  $collection->addStoreFilter($store);
46
  $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
47
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
@@ -154,7 +154,7 @@ class Lengow_Export_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_Wi
154
  1 => Mage::helper('catalog')->__('Yes'));
155
  $this->addColumn('lengow_product',
156
  array(
157
- 'header'=> Mage::helper('export')->__('Publish on Lengow'),
158
  'width' => '70px',
159
  'index' => 'lengow_product',
160
  'type' => 'options',
@@ -180,7 +180,7 @@ class Lengow_Export_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_Wi
180
  $options = array(0 => Mage::helper('catalog')->__('No'),
181
  1 => Mage::helper('catalog')->__('Yes'));
182
  $this->getMassactionBlock()->addItem('publish', array(
183
- 'label'=> Mage::helper('export')->__('Change Lengow\'s publication'),
184
  'url' => $this->getUrl('*/*/massPublish', array('_current'=>true)),
185
  'additional' => array(
186
  'visibility' => array(
41
  'left');
42
 
43
  if ($store->getId()) {
44
+ $collection->setStoreId($store->getId());
45
  $collection->addStoreFilter($store);
46
  $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
47
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
154
  1 => Mage::helper('catalog')->__('Yes'));
155
  $this->addColumn('lengow_product',
156
  array(
157
+ 'header'=> Mage::helper('lenexport')->__('Publish on Lengow'),
158
  'width' => '70px',
159
  'index' => 'lengow_product',
160
  'type' => 'options',
180
  $options = array(0 => Mage::helper('catalog')->__('No'),
181
  1 => Mage::helper('catalog')->__('Yes'));
182
  $this->getMassactionBlock()->addItem('publish', array(
183
+ 'label'=> Mage::helper('lenexport')->__('Change Lengow\'s publication'),
184
  'url' => $this->getUrl('*/*/massPublish', array('_current'=>true)),
185
  'additional' => array(
186
  'visibility' => array(
app/code/community/Lengow/Export/Helper/Data.php CHANGED
@@ -55,7 +55,7 @@ class Lengow_Export_Helper_Data extends Mage_Core_Helper_Abstract {
55
  * @return string $value
56
  */
57
  public function cleanData($value, $convert = false, $html = false) {
58
- if ($convert)
59
  $value = htmlentities($value);
60
  if(is_array($value))
61
  return $value;
@@ -93,11 +93,11 @@ class Lengow_Export_Helper_Data extends Mage_Core_Helper_Abstract {
93
  }
94
 
95
  public function convertHTML($html) {
96
- $html = str_replace(array('"', "\r", "\n"),
97
- array('"""', '', ''),
98
  trim(nl2br($html)));
99
  return $html;
100
- }
101
 
102
  protected function _convert($content) {
103
  if (!mb_check_encoding($content, 'UTF-8') OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32'))) {
@@ -105,5 +105,4 @@ class Lengow_Export_Helper_Data extends Mage_Core_Helper_Abstract {
105
  }
106
  return $content;
107
  }
108
-
109
  }
55
  * @return string $value
56
  */
57
  public function cleanData($value, $convert = false, $html = false) {
58
+ if ($convert && $html)
59
  $value = htmlentities($value);
60
  if(is_array($value))
61
  return $value;
93
  }
94
 
95
  public function convertHTML($html) {
96
+ $html = str_replace(array('"', "\r", "\n"),
97
+ array('"""', '', ''),
98
  trim(nl2br($html)));
99
  return $html;
100
+ }
101
 
102
  protected function _convert($content) {
103
  if (!mb_check_encoding($content, 'UTF-8') OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32'))) {
105
  }
106
  return $content;
107
  }
 
108
  }
app/code/community/Lengow/Export/Helper/Security.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Lengow
6
  * @package Lengow_Export
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Helper_Security extends Mage_Core_Helper_Abstract {
@@ -14,13 +14,13 @@ class Lengow_Export_Helper_Security extends Mage_Core_Helper_Abstract {
14
  * Lengow IP.
15
  */
16
  public static $IPS_LENGOW = array(
17
- '127.0.0.1' ,
18
- '95.131.137.18' ,
19
- '95.131.137.19' ,
20
- '95.131.137.21' ,
21
- '95.131.137.26' ,
22
- '95.131.137.27' ,
23
- '88.164.17.227' ,
24
  '88.164.17.216' ,
25
  '109.190.78.5' ,
26
  '80.11.36.123' ,
@@ -30,7 +30,7 @@ class Lengow_Export_Helper_Security extends Mage_Core_Helper_Abstract {
30
  '82.127.207.67' ,
31
  '80.14.226.127' ,
32
  '80.236.15.223' ,
33
- );
34
 
35
  /**
36
  * Check if current IP is authorized.
@@ -38,7 +38,7 @@ class Lengow_Export_Helper_Security extends Mage_Core_Helper_Abstract {
38
  * @return boolean.
39
  */
40
  public function checkIP() {
41
- $ips = Mage::getStoreConfig('export/global/valid_ip');
42
  $ips = trim(str_replace(array("\r\n", ',', '-', '|', ' '), ';', $ips), ';');
43
  $ips = explode(';', $ips);
44
  $authorized_ips = array_merge($ips, self::$IPS_LENGOW);
5
  * @category Lengow
6
  * @package Lengow_Export
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
+ * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Helper_Security extends Mage_Core_Helper_Abstract {
14
  * Lengow IP.
15
  */
16
  public static $IPS_LENGOW = array(
17
+ '127.0.0.1' ,
18
+ '95.131.137.18' ,
19
+ '95.131.137.19' ,
20
+ '95.131.137.21' ,
21
+ '95.131.137.26' ,
22
+ '95.131.137.27' ,
23
+ '88.164.17.227' ,
24
  '88.164.17.216' ,
25
  '109.190.78.5' ,
26
  '80.11.36.123' ,
30
  '82.127.207.67' ,
31
  '80.14.226.127' ,
32
  '80.236.15.223' ,
33
+ );
34
 
35
  /**
36
  * Check if current IP is authorized.
38
  * @return boolean.
39
  */
40
  public function checkIP() {
41
+ $ips = Mage::getStoreConfig('lenexport/performances/valid_ip');
42
  $ips = trim(str_replace(array("\r\n", ',', '-', '|', ' '), ';', $ips), ';');
43
  $ips = explode(';', $ips);
44
  $authorized_ips = array_merge($ips, self::$IPS_LENGOW);
app/code/community/Lengow/Export/Model/.DS_Store DELETED
Binary file
app/code/community/Lengow/Export/Model/Catalog/Product.php CHANGED
@@ -4,12 +4,12 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
12
-
13
  /**
14
  * Config model export
15
  *
@@ -20,32 +20,52 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
20
  /**
21
  * Initialize resources
22
  */
23
- protected function _construct() {
 
24
  $this->_init('catalog/product');
25
- $this->_config_model = Mage::getSingleton('export/config');
26
  }
27
 
28
- public function getShippingInfo($product_instance) {
 
 
 
 
 
 
 
 
29
  $data['shipping-name'] = '';
30
  $data['shipping-price'] = '';
 
31
  $carrier = $this->_config_model->get('data/default_shipping_method');
32
  if(empty($carrier))
33
  return $data;
34
  $carrierTab = explode('_',$carrier);
35
- list($carrierCode,$methodCode) = $carrierTab;
36
  $data['shipping-name'] = ucfirst($methodCode);
37
- $shippingPrice = 0;
38
  $countryCode = $this->_config_model->get('data/shipping_price_based_on');
39
  $shippingPrice = $this->_getShippingPrice($product_instance, $carrier, $countryCode);
40
  if(!$shippingPrice) {
41
  $shippingPrice = $this->_config_model->get('data/default_shipping_price');
42
  }
43
  $data['shipping-price'] = $shippingPrice;
44
-
45
  return $data;
46
  }
47
-
48
- protected function _getShippingPrice($product_instance, $carrierValue, $countryCode = 'FR') {
 
 
 
 
 
 
 
 
 
 
49
  $carrierTab = explode('_', $carrierValue);
50
  list($carrierCode, $methodCode) = $carrierTab;
51
  $shipping = Mage::getModel('shipping/shipping');
@@ -66,8 +86,17 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
66
  }
67
  return false;
68
  }
69
-
70
- protected function _getShippingRateRequest($product_instance, $countryCode = 'FR') {
 
 
 
 
 
 
 
 
 
71
  /** @var $request Mage_Shipping_Model_Rate_Request */
72
  $request = Mage::getModel('shipping/rate_request');
73
  $storeId = $request->getStoreId();
@@ -76,7 +105,7 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
76
  ->setRegionId('')
77
  ->setCity('')
78
  ->setPostcode('');
79
- }
80
  $item = Mage::getModel('sales/quote_item');
81
  $item->setStoreId($storeId);
82
  $item->setOptions($this->getCustomOptions())
@@ -97,8 +126,23 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
97
  $request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency());
98
  return $request;
99
  }
100
-
101
- public function getPrices($product_instance, $configurable_instance = null) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  /* @var $configurable_instance Mage_Catalog_Model_Product */
103
  if ($configurable_instance) {
104
  $price = $configurable_instance->getPrice();
@@ -118,7 +162,7 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
118
  $configurableOldPrice += (float) ( $priceChange['is_percent'] ? ( ( (float) $priceChange['pricing_value'] ) * $price / 100 ) : $priceChange['pricing_value'] );
119
  $configurablePrice += (float) ( $priceChange['is_percent'] ? ( ( (float) $priceChange['pricing_value'] ) * $finalPrice / 100 ) : $priceChange['pricing_value'] );
120
  }
121
- }
122
  }
123
  }
124
  }
@@ -129,21 +173,15 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
129
  array('product' => $configurable_instance)
130
  );
131
  $configurablePrice = $configurable_instance->getConfigurablePrice();
132
- $price_including_tax = Mage::helper('tax')->getPrice(
133
- $product_instance->setTaxPercent(null),
134
- $product_instance->getPrice() + $configurableOldPrice
135
- );
136
- $final_price_including_tax = Mage::helper('tax')->getPrice(
137
- $product_instance->setTaxPercent(null),
138
- $product_instance->getFinalPrice() + $configurablePrice
139
- );
140
  } else if($product_instance->getTypeId() == 'grouped') {
141
  $price = 0;
142
  $final_price = 0;
143
  $childs = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_instance->getId());
144
  $childs = $childs[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED];
145
  foreach ($childs as $value) {
146
- $product = Mage::getModel('export/catalog_product')->load($value);
147
  $price += $product->getPrice();
148
  $final_price += $product->getFinalPrice();
149
  }
@@ -158,26 +196,58 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
158
  true
159
  );
160
  } else {
161
- $price_including_tax = Mage::helper('tax')->getPrice(
162
- $product_instance->setTaxPercent(null),
163
- $product_instance->getPrice()
164
- );
165
- $final_price_including_tax = Mage::helper('tax')->getPrice(
166
- $product_instance->setTaxPercent(null),
167
- $product_instance->getFinalPrice()
168
- );
 
169
  }
170
  $discount_amount = Mage::helper('directory')->currencyConvert($price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()) - Mage::helper('directory')->currencyConvert($final_price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode());
171
  $data['price-ttc'] = round(Mage::helper('directory')->currencyConvert($final_price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()), 2);
172
  $data['price-before-discount'] = round(Mage::helper('directory')->currencyConvert($price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()), 2);
173
  $data['discount-amount'] = $discount_amount > 0 ? round($discount_amount, 2) : '0';
174
  $data['discount-percent'] = $discount_amount > 0 ? round(($discount_amount * 100) / $price_including_tax, 0) : '0';
175
- $data['start-date-discount'] = $product_instance->getSpecialFromDate;
176
- $data['end-date-discount'] = $product_instance->getSpecialToDate;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  return $data;
178
  }
179
-
180
- public function getCategories($product_instance, $parent_instance, $id_store) {
 
 
 
 
 
 
 
 
 
 
181
  $id_root_category = Mage::app()->getStore($id_store)->getRootCategoryId();
182
  if($product_instance->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE && isset($parent_instance)) {
183
  $categories = $parent_instance->getCategoryCollection()
@@ -188,6 +258,11 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
188
  ->addPathsFilter('1/' . $id_root_category . '/')
189
  ->exportToArray();
190
  }
 
 
 
 
 
191
  $max_level = $this->_config_model->get('data/levelcategory');
192
  $current_level = 0;
193
  $category_buffer = false;
@@ -204,7 +279,7 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
204
  else
205
  $categories = array();
206
  $data['category'] = '';
207
- $data['category-url'] = '';
208
  for($i = 1; $i <= $max_level; $i++) {
209
  $data['category-sub-'.($i)] = '';
210
  $data['category-url-sub-'.($i)] = '';
@@ -232,18 +307,25 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
232
  $c->clearInstance();
233
  }
234
  $data['category-breadcrumb'] = implode(' > ', $ariane);
 
 
 
 
235
  unset($categories, $category, $ariane);
 
236
  return $data;
237
  }
238
 
239
  /**
240
  * Merge images child with images' parents.
241
  *
242
- * @param array $images of child's product
243
- * @param array $images of parent's product
244
- * @return array images merged
 
245
  */
246
- public function getImages($images, $parentimages = false) {
 
247
  if($parentimages !== false) {
248
  $images = array_merge($parentimages, $images);
249
  $_images = array();
@@ -258,17 +340,18 @@ class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
258
  unset($_images, $_ids, $parentimages);
259
  }
260
  $data = array();
261
- for($i = 1; $i < 6; $i++) {
 
262
  $data['image-url-'.$i] = '';
263
  }
264
  $c = 1;
265
  foreach($images as $i) {
266
  $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $i['file'];
267
  $data['image-url-' . $c++] = $url;
268
- if($i == 6)
269
  break;
270
  }
271
- return $data;
272
  }
273
 
274
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Catalog_Product extends Mage_Catalog_Model_Product {
12
+
13
  /**
14
  * Config model export
15
  *
20
  /**
21
  * Initialize resources
22
  */
23
+ protected function _construct()
24
+ {
25
  $this->_init('catalog/product');
26
+ $this->_config_model = Mage::getSingleton('lenexport/config');
27
  }
28
 
29
+ /**
30
+ * Get Shipping info
31
+ *
32
+ * @param Mage_Catalog_Model_Product $product_instance
33
+ *
34
+ * @return array
35
+ */
36
+ public function getShippingInfo($product_instance)
37
+ {
38
  $data['shipping-name'] = '';
39
  $data['shipping-price'] = '';
40
+ $data['shipping-delay'] = $this->_config_model->get('data/default_shipping_delay');
41
  $carrier = $this->_config_model->get('data/default_shipping_method');
42
  if(empty($carrier))
43
  return $data;
44
  $carrierTab = explode('_',$carrier);
45
+ list($carrierCode,$methodCode) = $carrierTab;
46
  $data['shipping-name'] = ucfirst($methodCode);
47
+ $shippingPrice = 0;
48
  $countryCode = $this->_config_model->get('data/shipping_price_based_on');
49
  $shippingPrice = $this->_getShippingPrice($product_instance, $carrier, $countryCode);
50
  if(!$shippingPrice) {
51
  $shippingPrice = $this->_config_model->get('data/default_shipping_price');
52
  }
53
  $data['shipping-price'] = $shippingPrice;
54
+
55
  return $data;
56
  }
57
+
58
+ /**
59
+ * Get shipping price
60
+ *
61
+ * @param Mage_Catalog_Model_Product $product_instance
62
+ * @param string $carrierValue
63
+ * @param string $countryCode
64
+ *
65
+ * @return mixed
66
+ */
67
+ protected function _getShippingPrice($product_instance, $carrierValue, $countryCode = 'FR')
68
+ {
69
  $carrierTab = explode('_', $carrierValue);
70
  list($carrierCode, $methodCode) = $carrierTab;
71
  $shipping = Mage::getModel('shipping/shipping');
86
  }
87
  return false;
88
  }
89
+
90
+ /**
91
+ * Get Shipping rate request
92
+ *
93
+ * @param Mage_Catalog_Model_Product $product_instance
94
+ * @param string $countryCode
95
+ *
96
+ * @return Mage_Shipping_Model_Rate_Request
97
+ */
98
+ protected function _getShippingRateRequest($product_instance, $countryCode = 'FR')
99
+ {
100
  /** @var $request Mage_Shipping_Model_Rate_Request */
101
  $request = Mage::getModel('shipping/rate_request');
102
  $storeId = $request->getStoreId();
105
  ->setRegionId('')
106
  ->setCity('')
107
  ->setPostcode('');
108
+ }
109
  $item = Mage::getModel('sales/quote_item');
110
  $item->setStoreId($storeId);
111
  $item->setOptions($this->getCustomOptions())
126
  $request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency());
127
  return $request;
128
  }
129
+
130
+ /**
131
+ * Get price
132
+ *
133
+ * @param Mage_Catalog_Model_Product $product_instance
134
+ * @param Mage_Catalog_Model_Product $configurable_instance
135
+ *
136
+ * @return array
137
+ */
138
+ public function getPrices($product_instance, $configurable_instance = null)
139
+ {
140
+ $store = Mage::app()->getStore();
141
+ $config = Mage::helper('tax')->priceIncludesTax($store);
142
+ $calculator = Mage::getSingleton('tax/calculation');
143
+ $taxClassId = $product_instance->getTaxClassId();
144
+ $request = $calculator->getRateRequest(null, null, null, $store);
145
+ $taxPercent = $calculator->getRate($request->setProductClassId($taxClassId));
146
  /* @var $configurable_instance Mage_Catalog_Model_Product */
147
  if ($configurable_instance) {
148
  $price = $configurable_instance->getPrice();
162
  $configurableOldPrice += (float) ( $priceChange['is_percent'] ? ( ( (float) $priceChange['pricing_value'] ) * $price / 100 ) : $priceChange['pricing_value'] );
163
  $configurablePrice += (float) ( $priceChange['is_percent'] ? ( ( (float) $priceChange['pricing_value'] ) * $finalPrice / 100 ) : $priceChange['pricing_value'] );
164
  }
165
+ }
166
  }
167
  }
168
  }
173
  array('product' => $configurable_instance)
174
  );
175
  $configurablePrice = $configurable_instance->getConfigurablePrice();
176
+ $price = $product_instance->getPrice() + $configurableOldPrice;
177
+ $final_price = $product_instance->getFinalPrice() + $configurablePrice;
 
 
 
 
 
 
178
  } else if($product_instance->getTypeId() == 'grouped') {
179
  $price = 0;
180
  $final_price = 0;
181
  $childs = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_instance->getId());
182
  $childs = $childs[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED];
183
  foreach ($childs as $value) {
184
+ $product = Mage::getModel('lenexport/catalog_product')->load($value);
185
  $price += $product->getPrice();
186
  $final_price += $product->getFinalPrice();
187
  }
196
  true
197
  );
198
  } else {
199
+ $price = $product_instance->getPrice();
200
+ $final_price = $product_instance->getFinalPrice();
201
+ }
202
+ if(!$config) {
203
+ $price_including_tax = $price + $calculator->calcTaxAmount($price, $taxPercent, false);
204
+ $final_price_including_tax = $final_price + $calculator->calcTaxAmount($final_price, $taxPercent, false);
205
+ } else {
206
+ $price_including_tax = $price;
207
+ $final_price_including_tax = $final_price;
208
  }
209
  $discount_amount = Mage::helper('directory')->currencyConvert($price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()) - Mage::helper('directory')->currencyConvert($final_price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode());
210
  $data['price-ttc'] = round(Mage::helper('directory')->currencyConvert($final_price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()), 2);
211
  $data['price-before-discount'] = round(Mage::helper('directory')->currencyConvert($price_including_tax, $this->getOriginalCurrency(), $this->getCurrentCurrencyCode()), 2);
212
  $data['discount-amount'] = $discount_amount > 0 ? round($discount_amount, 2) : '0';
213
  $data['discount-percent'] = $discount_amount > 0 ? round(($discount_amount * 100) / $price_including_tax, 0) : '0';
214
+ $data['start-date-discount'] = $product_instance->getSpecialFromDate();
215
+ $data['end-date-discount'] = $product_instance->getSpecialToDate();
216
+ // retrieving promotions
217
+ $dateTs = Mage::app()->getLocale()->storeTimeStamp($product_instance->getStoreId());
218
+ if (method_exists(Mage::getResourceModel('catalogrule/rule'), 'getRulesFromProduct'))
219
+ $promo = Mage::getResourceModel('catalogrule/rule')->getRulesFromProduct($dateTs, $product_instance->getStoreId(), 1, $product_instance->getId());
220
+ elseif (method_exists(Mage::getResourceModel('catalogrule/rule'), 'getRulesForProduct'))
221
+ $promo = Mage::getResourceModel('catalogrule/rule')->getRulesForProduct($dateTs, $product_instance->getStoreId(), $product_instance->getId());
222
+ if (count($promo))
223
+ {
224
+ $promo = $promo[0];
225
+ if (isset($promo['from_time']))
226
+ $from = $promo['from_time'];
227
+ else
228
+ $from = $promo['from_date'];
229
+
230
+ if (isset($promo['to_time']))
231
+ $to = $promo['to_time'];
232
+ else
233
+ $to = $promo['to_date'];
234
+ $data['start-date-discount'] = date('Y-m-d H:i:s', strtotime($from));
235
+ $data['end-date-discount'] = is_null($to) ? '' : date('Y-m-d H:i:s', strtotime($to));
236
+ }
237
  return $data;
238
  }
239
+
240
+ /**
241
+ * Get categories and breadcrumb
242
+ *
243
+ * @param Mage_Catalog_Model_Product $product_instance
244
+ * @param Mage_Catalog_Model_Product $parent_instance
245
+ * @param integer $id_store
246
+ *
247
+ * @return array
248
+ */
249
+ public function getCategories($product_instance, $parent_instance, $id_store, &$categoryCache = array())
250
+ {
251
  $id_root_category = Mage::app()->getStore($id_store)->getRootCategoryId();
252
  if($product_instance->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE && isset($parent_instance)) {
253
  $categories = $parent_instance->getCategoryCollection()
258
  ->addPathsFilter('1/' . $id_root_category . '/')
259
  ->exportToArray();
260
  }
261
+ if (isset($categoryCache[key($categories)])){
262
+ return $categoryCache[key($categories)];
263
+ }
264
+
265
+
266
  $max_level = $this->_config_model->get('data/levelcategory');
267
  $current_level = 0;
268
  $category_buffer = false;
279
  else
280
  $categories = array();
281
  $data['category'] = '';
282
+ $data['category-url'] = '';
283
  for($i = 1; $i <= $max_level; $i++) {
284
  $data['category-sub-'.($i)] = '';
285
  $data['category-url-sub-'.($i)] = '';
307
  $c->clearInstance();
308
  }
309
  $data['category-breadcrumb'] = implode(' > ', $ariane);
310
+ $maxDimension = count($categories)-1;
311
+ if ($maxDimension>=0){
312
+ $categoryCache[$categories[count($categories)-1]] = $data;
313
+ }
314
  unset($categories, $category, $ariane);
315
+
316
  return $data;
317
  }
318
 
319
  /**
320
  * Merge images child with images' parents.
321
  *
322
+ * @param array $images of child's product
323
+ * @param array $parentimages of parent's product
324
+ *
325
+ * @return array images merged
326
  */
327
+ public function getImages($images, $parentimages = false)
328
+ {
329
  if($parentimages !== false) {
330
  $images = array_merge($parentimages, $images);
331
  $_images = array();
340
  unset($_images, $_ids, $parentimages);
341
  }
342
  $data = array();
343
+ $max_image = $this->_config_model->getCountExportImages();
344
+ for($i = 1; $i < $max_image + 1; $i++) {
345
  $data['image-url-'.$i] = '';
346
  }
347
  $c = 1;
348
  foreach($images as $i) {
349
  $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $i['file'];
350
  $data['image-url-' . $c++] = $url;
351
+ if($i == $max_image + 1)
352
  break;
353
  }
354
+ return $data;
355
  }
356
 
357
  }
app/code/community/Lengow/Export/Model/Config.php CHANGED
@@ -4,43 +4,43 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Config extends Varien_Object {
12
 
13
-
14
  /**
15
  * Config key "Enable manage orders"
16
  */
17
  const ENABLED = 'active';
18
-
19
  /**
20
  * Config key "Filter by attribute"
21
  */
22
  const EXPORT_ONLY_SELECTED = 'global/export_only_selected';
23
-
24
  /**
25
  * Config key "Export soldout"
26
  */
27
- const EXPORT_SOLDOUT = 'export_soldout';
28
 
29
  /**
30
  * Config key "Export count images"
31
  */
32
  const COUNT_IMAGES = 'data/count_images';
33
-
34
  /**
35
  * Config key "Filter by attribute"
36
  */
37
  const LIMIT_PRODUCT = 'limit_product';
38
-
39
  /**
40
  * Config key "Attributes kow"
41
  */
42
  const ATTRIBUTES_KNOW = 'attributes_know';
43
-
44
  /**
45
  * Config key "Attributes unkow"
46
  */
@@ -50,139 +50,175 @@ class Lengow_Export_Model_Config extends Varien_Object {
50
  * Config key "Auto export product"
51
  */
52
  const AUTOEXPORT_NEWPRODUCT = 'autoexport_newproduct';
53
-
54
  /*
55
  * @var array $_attributesKnow
56
  */
57
  protected $_attributesKnow = null;
58
-
59
  /**
60
  * @var array $_attributesUnKnow
61
  */
62
  protected $_attributesUnKnow = null;
63
-
64
  protected $_attributesSelected = null;
65
 
 
 
66
  protected $_id_store;
67
 
68
- public function setStore($id_store) {
 
 
 
 
 
 
69
  $this->_id_store = $id_store;
70
  }
71
 
72
- public function get($key) {
73
- return Mage::getStoreConfig('export/' . $key, $this->_id_store);
 
 
 
 
 
 
 
 
74
  }
75
-
76
  /**
77
  * Return config var
78
  *
79
  * @param string $key Var path key
80
  * @param int $id_store Store View Id
 
81
  * @return mixed
82
  */
83
- public function getConfigData($key, $group = 'global', $id_store = null) {
 
84
  if (!$this->hasData($key)) {
85
- $value = Mage::getStoreConfig('export/' . $group . '/' . $key, $id_store);
86
  $this->setData($key, $value);
87
  }
88
  return $this->getData($key);
89
  }
90
-
91
  /**
92
  * Return config var
93
  *
94
  * @param string $key Var path key
95
  * @param int $id_store Store View Id
 
96
  * @return mixed
97
  */
98
- public function getConfigFlag($key, $group = 'global', $id_store = null) {
 
99
  if (!$this->hasData($key)) {
100
- $value = Mage::getStoreConfigFlag('export/' . $group . '/' . $key, $id_store);
101
  $this->setData($key, $value);
102
  }
103
  return $this->getData($key);
104
  }
105
-
106
-
107
- public function getAny($group, $key, $id_store = null) {
108
- return Mage::getStoreConfig('export/' . $group . '/' . $key, $id_store);
 
109
  }
110
 
111
  /**
112
  * Retrieve if export is active
113
- *
114
  * @return boolean
115
  */
116
- public function isEnabled() {
 
117
  return $this->getConfigFlag(self::ENABLED);
118
  }
119
-
120
  /**
121
  * Retrieve if export is active
122
- *
123
  * @return boolean
124
  */
125
- public function onlySelectedProducts() {
 
126
  return $this->get(self::EXPORT_ONLY_SELECTED);
127
  }
128
-
129
  /**
130
  * Retrieve if export sold out products
131
  *
132
  * @return boolean
133
  */
134
- public function isExportSoldout() {
135
- return $this->getConfigFlag(self::EXPORT_SOLDOUT);
 
136
  }
137
-
138
  /**
139
  * Retrieve limit of product in query
140
- *
141
  * @return int
142
  */
143
- public function getLimitProduct() {
 
144
  return (int) $this->getConfigData(self::LIMIT_PRODUCT);
145
  }
146
-
147
  /**
148
  * Retrieve limit of product in query
149
- *
150
  * @return int
151
  */
152
- public function getCountExportImages() {
153
- return (int) $this->getConfigData(self::COUNT_IMAGES);
 
154
  }
155
 
156
  /**
157
  * Auto export new product
158
- *
159
  * @return int
160
  */
161
- public function isAutoExportProduct() {
 
162
  return (int) $this->getConfigData(self::AUTOEXPORT_NEWPRODUCT);
163
  }
164
-
165
  /**
166
  * Return Attributes Unknowed in array with key=>value
167
  * key = node adn value = inner text
168
  * @param int $id_store
169
- * @return array
 
170
  */
171
- public function getMappgingAttributesUnKnow($id_store = null) {
 
172
  //if(is_null($this->_attributesUnKnow))
173
  if($this->_attributesUnKnow === null || !isset($this->_attributesUnKnow) || empty($this->_attributesUnKnow)) {
174
- $this->_attributesUnKnow = Mage::getStoreConfig('export/attributes_unknow', $id_store);
175
  }
176
-
177
  return $this->_attributesUnKnow;
178
  }
179
-
180
- public function getSelectedAttributes($id_store = null) {
181
 
 
 
 
 
 
 
 
 
 
182
  $tab = array();
183
- $this->_attributesSelected = array();
184
  if($this->_attributesSelected === null || !isset($this->_attributesSelected) || empty($this->_attributesSelected)) {
185
- $val = Mage::getStoreConfig('export/attributelist/attributes', $id_store);
186
  if(!empty($val)) {
187
  $tab = explode(',',$val);
188
  $this->_attributesSelected = array_flip($tab);
@@ -195,16 +231,35 @@ class Lengow_Export_Model_Config extends Varien_Object {
195
  }
196
  return $this->_attributesSelected;
197
  }
198
-
199
  /**
200
  * Return ALL Attributes Knowed and Unknowed in array with key=>value
201
  * key = node adn value = inner text
202
- * @return array
203
  * @param int $id_store
 
 
204
  */
205
- public function getMappingAllAttributes($id_store = null) {
 
206
  return $this->getSelectedAttributes($id_store);
207
  }
208
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Config extends Varien_Object {
12
 
13
+
14
  /**
15
  * Config key "Enable manage orders"
16
  */
17
  const ENABLED = 'active';
18
+
19
  /**
20
  * Config key "Filter by attribute"
21
  */
22
  const EXPORT_ONLY_SELECTED = 'global/export_only_selected';
23
+
24
  /**
25
  * Config key "Export soldout"
26
  */
27
+ const EXPORT_SOLDOUT = 'global/export_soldout';
28
 
29
  /**
30
  * Config key "Export count images"
31
  */
32
  const COUNT_IMAGES = 'data/count_images';
33
+
34
  /**
35
  * Config key "Filter by attribute"
36
  */
37
  const LIMIT_PRODUCT = 'limit_product';
38
+
39
  /**
40
  * Config key "Attributes kow"
41
  */
42
  const ATTRIBUTES_KNOW = 'attributes_know';
43
+
44
  /**
45
  * Config key "Attributes unkow"
46
  */
50
  * Config key "Auto export product"
51
  */
52
  const AUTOEXPORT_NEWPRODUCT = 'autoexport_newproduct';
53
+
54
  /*
55
  * @var array $_attributesKnow
56
  */
57
  protected $_attributesKnow = null;
58
+
59
  /**
60
  * @var array $_attributesUnKnow
61
  */
62
  protected $_attributesUnKnow = null;
63
+
64
  protected $_attributesSelected = null;
65
 
66
+ protected $_attributesHtml = array();
67
+
68
  protected $_id_store;
69
 
70
+ /**
71
+ * Set Store
72
+ *
73
+ * @param int $id_store
74
+ */
75
+ public function setStore($id_store)
76
+ {
77
  $this->_id_store = $id_store;
78
  }
79
 
80
+ /**
81
+ * Get any paramater for lenexport
82
+ *
83
+ * @param string $key
84
+ *
85
+ * @return mixed
86
+ */
87
+ public function get($key)
88
+ {
89
+ return Mage::getStoreConfig('lenexport/' . $key, $this->_id_store);
90
  }
91
+
92
  /**
93
  * Return config var
94
  *
95
  * @param string $key Var path key
96
  * @param int $id_store Store View Id
97
+ *
98
  * @return mixed
99
  */
100
+ public function getConfigData($key, $group = 'global', $id_store = null)
101
+ {
102
  if (!$this->hasData($key)) {
103
+ $value = Mage::getStoreConfig('lenexport/' . $group . '/' . $key, $id_store);
104
  $this->setData($key, $value);
105
  }
106
  return $this->getData($key);
107
  }
108
+
109
  /**
110
  * Return config var
111
  *
112
  * @param string $key Var path key
113
  * @param int $id_store Store View Id
114
+ *
115
  * @return mixed
116
  */
117
+ public function getConfigFlag($key, $group = 'global', $id_store = null)
118
+ {
119
  if (!$this->hasData($key)) {
120
+ $value = Mage::getStoreConfigFlag('lenexport/' . $group . '/' . $key, $id_store);
121
  $this->setData($key, $value);
122
  }
123
  return $this->getData($key);
124
  }
125
+
126
+
127
+ public function getAny($group, $key, $id_store = null)
128
+ {
129
+ return Mage::getStoreConfig('lenexport/' . $group . '/' . $key, $id_store);
130
  }
131
 
132
  /**
133
  * Retrieve if export is active
134
+ *
135
  * @return boolean
136
  */
137
+ public function isEnabled()
138
+ {
139
  return $this->getConfigFlag(self::ENABLED);
140
  }
141
+
142
  /**
143
  * Retrieve if export is active
144
+ *
145
  * @return boolean
146
  */
147
+ public function onlySelectedProducts()
148
+ {
149
  return $this->get(self::EXPORT_ONLY_SELECTED);
150
  }
151
+
152
  /**
153
  * Retrieve if export sold out products
154
  *
155
  * @return boolean
156
  */
157
+ public function isExportSoldout()
158
+ {
159
+ return $this->get(self::EXPORT_SOLDOUT);
160
  }
161
+
162
  /**
163
  * Retrieve limit of product in query
164
+ *
165
  * @return int
166
  */
167
+ public function getLimitProduct()
168
+ {
169
  return (int) $this->getConfigData(self::LIMIT_PRODUCT);
170
  }
171
+
172
  /**
173
  * Retrieve limit of product in query
174
+ *
175
  * @return int
176
  */
177
+ public function getCountExportImages()
178
+ {
179
+ return (int) $this->get(self::COUNT_IMAGES);
180
  }
181
 
182
  /**
183
  * Auto export new product
184
+ *
185
  * @return int
186
  */
187
+ public function isAutoExportProduct()
188
+ {
189
  return (int) $this->getConfigData(self::AUTOEXPORT_NEWPRODUCT);
190
  }
191
+
192
  /**
193
  * Return Attributes Unknowed in array with key=>value
194
  * key = node adn value = inner text
195
  * @param int $id_store
196
+ *
197
+ * @return array
198
  */
199
+ public function getMappgingAttributesUnKnow($id_store = null)
200
+ {
201
  //if(is_null($this->_attributesUnKnow))
202
  if($this->_attributesUnKnow === null || !isset($this->_attributesUnKnow) || empty($this->_attributesUnKnow)) {
203
+ $this->_attributesUnKnow = Mage::getStoreConfig('lenexport/attributes_unknow', $id_store);
204
  }
205
+
206
  return $this->_attributesUnKnow;
207
  }
 
 
208
 
209
+ /**
210
+ * Get Selected attributes
211
+ *
212
+ * @param int $id_store
213
+ *
214
+ * @return array
215
+ */
216
+ public function getSelectedAttributes($id_store = null)
217
+ {
218
  $tab = array();
219
+ $this->_attributesSelected = array();
220
  if($this->_attributesSelected === null || !isset($this->_attributesSelected) || empty($this->_attributesSelected)) {
221
+ $val = Mage::getStoreConfig('lenexport/attributelist/attributes', $id_store);
222
  if(!empty($val)) {
223
  $tab = explode(',',$val);
224
  $this->_attributesSelected = array_flip($tab);
231
  }
232
  return $this->_attributesSelected;
233
  }
234
+
235
  /**
236
  * Return ALL Attributes Knowed and Unknowed in array with key=>value
237
  * key = node adn value = inner text
238
+ *
239
  * @param int $id_store
240
+ *
241
+ * @return array
242
  */
243
+ public function getMappingAllAttributes($id_store = null)
244
+ {
245
  return $this->getSelectedAttributes($id_store);
246
  }
247
+
248
+ /**
249
+ * Get Html attributes
250
+ *
251
+ * @param int $id_store
252
+ *
253
+ * @return array
254
+ */
255
+ public function getHtmlAttributes($id_store = null)
256
+ {
257
+ if (count($this->_attributesHtml) == 0) {
258
+ $attributes = Mage::getStoreConfig('lenexport/data/html_attributes', $id_store);
259
+ if(!empty($attributes))
260
+ $this->_attributesHtml = explode(',', $attributes);
261
+ }
262
+ return $this->_attributesHtml;
263
+ }
264
 
265
  }
app/code/community/Lengow/Export/Model/Feed/Csv.php CHANGED
@@ -25,7 +25,7 @@ class Lengow_Export_Model_Feed_Csv extends Lengow_Export_Model_Feed_Abstract {
25
  */
26
  public static $CSV_EOL = "\r\n";
27
 
28
- protected $_content_type = 'text/plain';
29
 
30
  public function getContentType() {
31
  return $this->_content_type;
25
  */
26
  public static $CSV_EOL = "\r\n";
27
 
28
+ protected $_content_type = 'text/csv';
29
 
30
  public function getContentType() {
31
  return $this->_content_type;
app/code/community/Lengow/Export/Model/Feed/Xml.php CHANGED
@@ -10,7 +10,7 @@
10
  */
11
  class Lengow_Export_Model_Feed_Xml extends Lengow_Export_Model_Feed_Abstract {
12
 
13
- protected $_content_type = 'text/xml';
14
 
15
  public function getContentType() {
16
  return $this->_content_type;
10
  */
11
  class Lengow_Export_Model_Feed_Xml extends Lengow_Export_Model_Feed_Abstract {
12
 
13
+ protected $_content_type = 'application/xml';
14
 
15
  public function getContentType() {
16
  return $this->_content_type;
app/code/community/Lengow/Export/Model/Generate.php CHANGED
@@ -4,8 +4,8 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Generate extends Varien_Object {
@@ -30,68 +30,87 @@ class Lengow_Export_Model_Generate extends Varien_Object {
30
 
31
  protected $_time = null;
32
 
 
 
 
 
 
 
33
  protected $_excludes = array('media_gallery',
34
- 'tier_price',
35
- 'short_description',
36
- 'description',
37
- 'quantity');
38
  /**
39
  * Default fields.
40
  */
41
  public static $DEFAULT_FIELDS = array('sku' => 'sku' ,
42
- 'entity_id' => 'product-id' ,
43
- 'parent-id' => 'parent-id' ,
44
- 'qty' => 'qty' ,
45
- 'name' => 'name' ,
46
- 'description' => 'description' ,
47
- 'short_description' => 'short_description' ,
48
- 'price-ttc' => 'price-ttc' ,
49
- 'shipping-name' => 'shipping-name' ,
50
- 'image-url-1' => 'image-url-1' ,
51
- 'product-url' => 'product-url');
52
 
53
  /**
54
  * Construct generator
55
  * Set models
56
  */
57
- public function __construct() {
58
- $this->_config_model = Mage::getSingleton('export/config');
59
- $this->_product_model = Mage::getModel('export/catalog_product');
 
60
  $this->_eav_model = Mage::getResourceModel('eav/entity_attribute_collection');
61
  $this->_stream = $this->_config_model->get('performances/usesavefile') ? false : true;
62
- $this->_helper = Mage::helper('export/data');
 
63
  }
64
 
65
  /**
66
  * Make the feed
67
  *
68
- * @param integer $id_store ID of store
69
- * @param varchar $mode The mode of export
70
- * size : display only count of products to export
71
- * full : export simple product + configured product
72
- * xxx,yyy : export xxx type product + yyy type product
73
- * @param varchar $format Format of export
74
- * @param varchar $types Type(s) of product
75
- * @param varchar $status Status of product to export
76
- * @param boolean $export_child Export child of product
77
- * @param boolean $out_of_stock Export product out of stock
 
 
 
 
 
78
  *
79
  * @return Mage_Catalog_Model_Product
80
  */
81
  public function exec($id_store,
82
- $mode = null,
83
- $format = 'csv',
84
- $types = null,
85
- $status = null,
86
- $export_child = null,
87
- $out_of_stock = null,
88
- $selected_products = null,
89
- $stream = null,
90
- $limit = null,
91
- $offset = null,
92
- $ids_product = null) {
 
 
 
 
 
93
  $this->_id_store = $id_store;
94
- $this->_format = $format;
 
95
  // Get products list to export
96
  $products = $this->_getProductsCollection($types, $status, $export_child, $out_of_stock, $selected_products, $limit, $offset, $ids_product);
97
  // Mode size, return count of products
@@ -101,11 +120,11 @@ class Lengow_Export_Model_Generate extends Varien_Object {
101
  $this->_stream = $stream;
102
  if(!$this->_stream) {
103
  header('Content-Type: text/html; charset=utf-8');
104
- echo date('Y-m-d h:i:s') . ' - Start export<br />';
105
  flush();
106
  }
107
  // Gestion des attributs à exporter
108
- $attributes_to_export = $this->_config_model->getMappingAllAttributes();
109
  $products_data = array();
110
  $this->_attrs = array();
111
  $feed = Mage::getModel('Lengow_Export_Model_Feed_' . ucfirst($this->_format));
@@ -113,10 +132,18 @@ class Lengow_Export_Model_Generate extends Varien_Object {
113
  $last = false;
114
  $total_product = count($products);
115
  $pi = 1;
 
116
  if(!$this->_stream) {
117
- echo date('Y-m-d h:i:s') . ' - Find ' . $total_product . ' products<br />';
118
  flush();
119
  }
 
 
 
 
 
 
 
120
  // Generate data
121
  foreach($products as $p) {
122
  $array_data = array();
@@ -124,33 +151,29 @@ class Lengow_Export_Model_Generate extends Varien_Object {
124
  $pi++;
125
  if($total_product < $pi)
126
  $last = true;
127
- $product = $this->_product_model
128
- ->setStoreId($this->_id_store)
129
- ->setOriginalCurrency($this->getOriginalCurrency())
130
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
131
- ->load($p['entity_id']);
132
- $product_instance = Mage::getModel('catalog/product')
133
- ->setOriginalCurrency($this->getOriginalCurrency())
134
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
135
- ->setStoreId($this->_id_store)
136
- ->load($p['entity_id']);
137
-
138
  $data = $product->getData();
139
  // Load first parent if exist
140
- $parents = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($p['entity_id']);
141
  $parent_instance = null;
142
  $configurable_instance = null;
143
  $parent_id = null;
144
  $product_type = 'simple';
145
  $variation_name = '';
146
- if($product_instance->getTypeId() == 'configurable') {
 
147
  $product_type = 'parent';
148
- $variations = $product_instance
149
- ->setOriginalCurrency($this->getOriginalCurrency())
150
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
151
- ->setStoreId($this->_id_store)
152
- ->getTypeInstance(true)
153
- ->getConfigurableAttributesAsArray($product_instance);
 
154
  if($variations) {
155
  foreach ($variations as $variation) {
156
  $variation_name .= $variation['frontend_label'] . ',';
@@ -158,12 +181,47 @@ class Lengow_Export_Model_Generate extends Varien_Object {
158
  $variation_name = rtrim($variation_name, ',');
159
  }
160
  }
161
- if($product_instance->getTypeId() == 'simple') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  $parents = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($p['entity_id']);
163
  if(!empty($parents)) {
164
- $parent_instance = Mage::getModel('catalog/product')->load($parents[0]);
 
 
165
  // Exclude if parent is disabled
166
- if(($parent_instance && $parent_instance->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
 
167
  if(!$this->_stream) {
168
  if($pi % 20 == 0)
169
  echo date('Y-m-d h:i:s') .' - Export ' . $pi . ' products<br />';
@@ -182,19 +240,9 @@ class Lengow_Export_Model_Generate extends Varien_Object {
182
  }
183
  if($parent_instance && $parent_instance->getId() && $parent_instance->getTypeId() == 'configurable') {
184
  $parent_id = $parent_instance->getId();
185
- $parent = $this->_product_model
186
- ->setOriginalCurrency($this->getOriginalCurrency())
187
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
188
- ->setStoreId($this->_id_store)
189
- ->load($parent_id);
190
- $parent_instance = Mage::getModel('catalog/product')
191
- ->setOriginalCurrency($this->getOriginalCurrency())
192
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
193
- ->setStoreId($this->_id_store)
194
- ->load($parent_id);
195
- $configurable_instance = $parent_instance;
196
  $variations = $parent_instance->getTypeInstance(true)
197
- ->getConfigurableAttributesAsArray($parent_instance);
198
  if($variations) {
199
  foreach ($variations as $variation) {
200
  $variation_name .= $variation['frontend_label'] . ',';
@@ -207,69 +255,64 @@ class Lengow_Export_Model_Generate extends Varien_Object {
207
  }
208
  $parents = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($parent_id ? $parent_id : $p['entity_id']);
209
  if(!empty($parents)) {
210
- $parent_instance = Mage::getModel('catalog/product')
 
 
 
211
  ->getCollection()
212
  ->addAttributeToFilter('type_id','grouped')
213
  ->addAttributeToFilter('entity_id', array('in' => $parents))
214
  ->getFirstItem();
215
- if($parent_instance && $parent_instance->getId()) {
216
- //$parent_id = $parent_instance->getId();
217
- $parent = $this->_product_model
218
- ->setOriginalCurrency($this->getOriginalCurrency())
219
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
220
- ->setStoreId($this->_id_store)
221
- ->load($parent_id);
222
- $parent_instance = Mage::getModel('catalog/product')
223
- ->setOriginalCurrency($this->getOriginalCurrency())
224
- ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
225
- ->setStoreId($this->_id_store)
226
- ->load($parent_id);
227
- }
228
  }
229
- $qty = $product_instance->getData('stock_item');
230
  // Default data
231
- $array_data['sku'] = $product_instance->getSku();
232
- $array_data['product_id'] = $product_instance->getId();
233
  $array_data['qty'] = (integer) $qty->getQty();
234
  if($this->_config_model->get('data/without_product_ordering'))
235
  $array_data['qty'] = $array_data['qty'] - (integer) $qty->getQtyOrdered();
236
- $array_data = array_merge($array_data, $product->getCategories($product_instance, $parent_instance, $this->_id_store));
237
- $array_data = array_merge($array_data, $product->getPrices($product_instance, $configurable_instance));
238
- $array_data = array_merge($array_data, $product->getShippingInfo($product_instance));
 
 
 
239
  // Images, gestion de la fusion parent / enfant
240
- if($this->_config_model->get('data/parentsimages') && $parent !== false)
241
- $array_data = array_merge($array_data, $product->getImages($data['media_gallery']['images'], $parent->getData('media_gallery')));
242
  else
243
  $array_data = array_merge($array_data, $product->getImages($data['media_gallery']['images']));
244
- $array_data['name'] = $product_instance->getName();
245
- if($product_instance->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE && isset($parent_instance)) {
 
246
  $array_data['product-url'] = $parent_instance->getUrlInStore() ? $parent_instance->getUrlInStore() : $parent_instance->getProductUrl();
247
- $array_data['name'] = $parent_instance->getName();
248
- $array_data['description'] = $this->_helper->cleanData($parent_instance->getDescription(), false, $this->_config_model->get('data/keephtml'));
249
- $array_data['short_description'] = $this->_helper->cleanData($parent_instance->getShortDescription(), false, $this->_config_model->get('data/keephtml'));
250
  } else {
251
- $array_data['product-url'] = $product_instance->getUrlInStore() ? $product_instance->getUrlInStore() : $product_instance->getProductUrl();
252
- $array_data['description'] = $this->_helper->cleanData($product_instance->getDescription(), false, $this->_config_model->get('data/keephtml'));
253
- $array_data['short_description'] = $this->_helper->cleanData($product_instance->getShortDescription(), false, $this->_config_model->get('data/keephtml'));
 
254
  }
255
  $array_data['parent_id'] = $parent_id;
256
  // Product variation
257
  $array_data['product_type'] = $product_type;
258
  $array_data['product_variation'] = $variation_name;
259
- $array_data['image_default'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product_instance->getImage();
260
- $array_data['child_name'] = $product_instance->getName();
261
  // Selected attributes to export with Frond End value of current shop
262
  if(!empty($attributes_to_export)) {
263
  foreach($attributes_to_export as $field => $attr) {
264
  if(!in_array($field, $this->_excludes) && !isset($array_data[$field])) {
265
- if($product_instance->getData($field) === null)
266
  $array_data[$attr] = '';
267
- else if(is_array($product_instance->getData($field)))
268
- $array_data[$attr] = implode(',', $product_instance->getData($field));
269
- else if($this->_config_model->get('performances/formatdata'))
270
- $array_data[$attr] = $this->_helper->cleanData($product_instance->getResource()->getAttribute($field)->getFrontend()->getValue($product_instance), true);
271
  else
272
- $array_data[$attr] = $this->_helper->cleanData($product_instance->getResource()->getAttribute($field)->getFrontend()->getValue($product_instance));
273
  }
274
  }
275
  }
@@ -294,25 +337,94 @@ class Lengow_Export_Model_Generate extends Varien_Object {
294
  }
295
  // Fix Sébastien Ledan
296
  if(method_exists($product, 'clearInstance')) {
297
- $product->clearInstance();
298
- $product_instance->clearInstance();
299
- if($parent != null)
300
- $parent->clearInstance();
301
- if($parent_instance != null)
302
- $parent_instance->clearInstance();
303
  }
304
  unset($array_data);
305
  }
306
  $this->_write($feed->makeFooter());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  if(!$this->_stream) {
 
 
308
  $this->_copyFile();
309
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
310
- Mage::app()->setCurrentStore($this->getCurrentStore());
311
  $url_file = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'lengow' . DS . $store_code . DS . $this->_filename . '.' . $this->_format;
312
  echo $this->_helper->__('Your feed is available here : %s' , '<a href="' . $url_file . '">' . $url_file . '</a>');
 
 
 
 
 
 
 
 
313
  }
314
  }
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  protected function _getProductsCollection($types = null,
317
  $status = null,
318
  $export_child = null,
@@ -320,7 +432,8 @@ class Lengow_Export_Model_Generate extends Varien_Object {
320
  $selected_products = null,
321
  $limit = null,
322
  $offset = null,
323
- $ids_product = null) {
 
324
  // Filter types
325
  if($types) {
326
  $_types = explode(',', $types);
@@ -334,15 +447,16 @@ class Lengow_Export_Model_Generate extends Varien_Object {
334
  $products = $this->_product_model
335
  ->getCollection()
336
  ->addAttributeToSelect('sku')
 
337
  ->addStoreFilter($this->_id_store)
338
  ->addAttributeToFilter('type_id', array('in' => $_types))
339
  ->joinField('store_id', Mage::getConfig()->getTablePrefix() . 'catalog_category_product_index', 'store_id', 'product_id=entity_id', '{{table}}.store_id = '.$this->_id_store, 'left');
340
  // Filter status
341
  if(is_null($status))
342
- $status = $this->_config_model->get('global/productstatus');
343
- if($status == Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
344
  $products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
345
- else if($status == Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
346
  $products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED));
347
  // Export only selected products
348
  if($selected_products) {
@@ -373,14 +487,19 @@ class Lengow_Export_Model_Generate extends Varien_Object {
373
  }
374
 
375
  /**
376
- * Filter out of stock product
377
- **/
378
- protected function _getOutOfStockSQL($out_of_stock = false) {
 
 
 
 
 
379
  // Filter product without stock
380
  if(!$out_of_stock) {
381
  $config = (int)Mage::getStoreConfigFlag(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
382
  $sql = '({{table}}.`is_in_stock` = 1) '
383
- . ' OR IF({{table}}.`use_config_manage_stock` = 1, ' . $config . ', {{table}}.`manage_stock`) = 0';
384
  unset($config);
385
  return $sql;
386
  }
@@ -388,8 +507,11 @@ class Lengow_Export_Model_Generate extends Varien_Object {
388
 
389
  /**
390
  * Return attributes to export
 
 
391
  */
392
- protected function _getAttributesFromConfig() {
 
393
  $attributes = $this->_config_model->getSelectedAttributes();
394
  foreach($attributes as $name => $value)
395
  self::$DEFAULT_FIELDS[$name] = $value;
@@ -397,9 +519,14 @@ class Lengow_Export_Model_Generate extends Varien_Object {
397
  }
398
 
399
  /**
400
- * Retourne les attributs matchés par le client
 
 
 
 
401
  */
402
- protected function getAttributesFromConfig($exist = false) {
 
403
  $attributes = $this->_config_model->getMappingAllAttributes();
404
  if($exist) {
405
  $product = Mage::getModel('catalog/product');
@@ -415,9 +542,11 @@ class Lengow_Export_Model_Generate extends Varien_Object {
415
 
416
  /**
417
  * File generation
 
 
418
  */
419
-
420
- protected function _write($data) {
421
  if($this->_stream == false) {
422
  if(!$this->_file) {
423
  $this->_initFile();
@@ -431,7 +560,11 @@ class Lengow_Export_Model_Generate extends Varien_Object {
431
  }
432
  }
433
 
434
- protected function _initFile() {
 
 
 
 
435
  $this->_time = time();
436
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
437
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS . $store_code . DS;
@@ -441,10 +574,31 @@ class Lengow_Export_Model_Generate extends Varien_Object {
441
  $this->_file->streamOpen($this->_filename . '.' . $this->_time . '.' . $this->_format, 'w+');
442
  }
443
 
444
- protected function _copyFile() {
 
 
 
 
445
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
446
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS . $store_code . DS;
447
  copy($file_path . $this->_filename . '.' . $this->_time . '.' . $this->_format, $file_path . $this->_filename . '.' . $this->_format);
448
  unlink($file_path . $this->_filename . '.' . $this->_time . '.' . $this->_format);
449
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Generate extends Varien_Object {
30
 
31
  protected $_time = null;
32
 
33
+ protected $_clear_parent_cache = 0;
34
+
35
+ protected $categoryCache = array();
36
+
37
+ var $storeParents = array();
38
+
39
  protected $_excludes = array('media_gallery',
40
+ 'tier_price',
41
+ 'short_description',
42
+ 'description',
43
+ 'quantity');
44
  /**
45
  * Default fields.
46
  */
47
  public static $DEFAULT_FIELDS = array('sku' => 'sku' ,
48
+ 'entity_id' => 'product-id' ,
49
+ 'parent-id' => 'parent-id' ,
50
+ 'qty' => 'qty' ,
51
+ 'name' => 'name' ,
52
+ 'description' => 'description' ,
53
+ 'short_description' => 'short_description' ,
54
+ 'price-ttc' => 'price-ttc' ,
55
+ 'shipping-name' => 'shipping-name' ,
56
+ 'image-url-1' => 'image-url-1' ,
57
+ 'product-url' => 'product-url');
58
 
59
  /**
60
  * Construct generator
61
  * Set models
62
  */
63
+ public function __construct()
64
+ {
65
+ $this->_config_model = Mage::getSingleton('lenexport/config');
66
+ $this->_product_model = Mage::getModel('lenexport/catalog_product');
67
  $this->_eav_model = Mage::getResourceModel('eav/entity_attribute_collection');
68
  $this->_stream = $this->_config_model->get('performances/usesavefile') ? false : true;
69
+ $this->_helper = Mage::helper('lenexport/data');
70
+ $this->_format = $this->_config_model->get('data/format');
71
  }
72
 
73
  /**
74
  * Make the feed
75
  *
76
+ * @param integer $id_store ID of store
77
+ * @param varchar $mode The mode of export
78
+ * size : display only count of products to export
79
+ * full : export simple product + configured product
80
+ * xxx,yyy : export xxx type product + yyy type product
81
+ * @param varchar $format Format of export
82
+ * @param varchar $types Type(s) of product
83
+ * @param varchar $status Status of product to export
84
+ * @param boolean $export_child Export child of product
85
+ * @param boolean $out_of_stock Export product out of stock
86
+ * @param boolean $selected_products Export selected product
87
+ * @param boolean $stream Export in file or not
88
+ * @param integer $limit The number of product to be exported
89
+ * @param integer $offset From what product export
90
+ * @param array $ids_product Ids product to export
91
  *
92
  * @return Mage_Catalog_Model_Product
93
  */
94
  public function exec($id_store,
95
+ $mode = null,
96
+ $format = null,
97
+ $types = null,
98
+ $status = null,
99
+ $export_child = null,
100
+ $out_of_stock = null,
101
+ $selected_products = null,
102
+ $stream = null,
103
+ $limit = null,
104
+ $offset = null,
105
+ $ids_product = null)
106
+ {
107
+
108
+ //store start time export
109
+ $time_start = $this->microtime_float();
110
+
111
  $this->_id_store = $id_store;
112
+ if (!is_null($format))
113
+ $this->_format = $format;
114
  // Get products list to export
115
  $products = $this->_getProductsCollection($types, $status, $export_child, $out_of_stock, $selected_products, $limit, $offset, $ids_product);
116
  // Mode size, return count of products
120
  $this->_stream = $stream;
121
  if(!$this->_stream) {
122
  header('Content-Type: text/html; charset=utf-8');
123
+ echo date('Y-m-d h:i:s') . ' - Start export in store ' . Mage::app()->getStore($this->_id_store)->getName() . '(' . $this->_id_store . ')<br />';
124
  flush();
125
  }
126
  // Gestion des attributs à exporter
127
+ $attributes_to_export = $this->_config_model->getMappingAllAttributes($this->_id_store);
128
  $products_data = array();
129
  $this->_attrs = array();
130
  $feed = Mage::getModel('Lengow_Export_Model_Feed_' . ucfirst($this->_format));
132
  $last = false;
133
  $total_product = count($products);
134
  $pi = 1;
135
+ Mage::helper('lensync/data')->log('Find ' . $total_product . ' product' . ($total_product > 1 ? 's ' : ' '));
136
  if(!$this->_stream) {
137
+ echo date('Y-m-d h:i:s') . ' - Find ' . $total_product . ' product' . ($total_product > 1 ? 's ' : ' ') . '<br />';
138
  flush();
139
  }
140
+ // Product counter
141
+ $count_simple = 0;
142
+ $count_simple_disabled = 0;
143
+ $count_configurable = 0;
144
+ $count_bundle = 0;
145
+ $count_grouped = 0;
146
+ $count_virtual = 0;
147
  // Generate data
148
  foreach($products as $p) {
149
  $array_data = array();
151
  $pi++;
152
  if($total_product < $pi)
153
  $last = true;
154
+ $product = Mage::getModel('lenexport/catalog_product')
155
+ ->setStoreId($this->_id_store)
156
+ ->setOriginalCurrency($this->getOriginalCurrency())
157
+ ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
158
+ ->load($p['entity_id']);
 
 
 
 
 
 
159
  $data = $product->getData();
160
  // Load first parent if exist
161
+ $parents = null;
162
  $parent_instance = null;
163
  $configurable_instance = null;
164
  $parent_id = null;
165
  $product_type = 'simple';
166
  $variation_name = '';
167
+ if($product->getTypeId() == 'configurable') {
168
+ $count_configurable++;
169
  $product_type = 'parent';
170
+ $product_temp = $product;
171
+ $variations = $product_temp
172
+ ->setOriginalCurrency($this->getOriginalCurrency())
173
+ ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
174
+ ->setStoreId($this->_id_store)
175
+ ->getTypeInstance(true)
176
+ ->getConfigurableAttributesAsArray($product);
177
  if($variations) {
178
  foreach ($variations as $variation) {
179
  $variation_name .= $variation['frontend_label'] . ',';
181
  $variation_name = rtrim($variation_name, ',');
182
  }
183
  }
184
+ if($product->getTypeId() == 'virtual') {
185
+ $count_virtual++;
186
+ $product_type = 'virtual';
187
+ }
188
+ if($product->getTypeId() == 'grouped' || $product->getTypeId() == 'bundle') {
189
+ if($product->getTypeId() == 'bundle') {
190
+ $count_bundle++;
191
+ $product_type = 'bundle';
192
+ } else {
193
+ $count_grouped++;
194
+ $product_type = 'grouped';
195
+ }
196
+ // get quantity for bundle or grouped products
197
+ $childrenIds = array();
198
+ $qtys = array();
199
+ $childrenIds = array_reduce(
200
+ $product->getTypeInstance(true)->getChildrenIds($product->getId()),
201
+ function (array $reduce, $value) {
202
+ return array_merge($reduce, $value);
203
+ }, []);
204
+ foreach ($childrenIds as $childrenId) {
205
+ $product_temporary = Mage::getModel('catalog/product')
206
+ ->setOriginalCurrency($this->getOriginalCurrency())
207
+ ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
208
+ ->setStoreId($this->_id_store)
209
+ ->load($childrenId);
210
+ $qtys[] = $product_temporary->getData('stock_item')->getQty();
211
+ unset($product_temporary);
212
+ }
213
+ $qty_temp = min($qtys) > 0 ? min($qtys) : 0;
214
+ }
215
+ if($product->getTypeId() == 'simple') {
216
+ $count_simple++;
217
  $parents = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($p['entity_id']);
218
  if(!empty($parents)) {
219
+
220
+ $parent_instance = $this->_getParentEntity((int)$parents[0]);
221
+
222
  // Exclude if parent is disabled
223
+ if($parent_instance && $parent_instance->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
224
+ $count_simple_disabled++;
225
  if(!$this->_stream) {
226
  if($pi % 20 == 0)
227
  echo date('Y-m-d h:i:s') .' - Export ' . $pi . ' products<br />';
240
  }
241
  if($parent_instance && $parent_instance->getId() && $parent_instance->getTypeId() == 'configurable') {
242
  $parent_id = $parent_instance->getId();
243
+
 
 
 
 
 
 
 
 
 
 
244
  $variations = $parent_instance->getTypeInstance(true)
245
+ ->getConfigurableAttributesAsArray($parent_instance);
246
  if($variations) {
247
  foreach ($variations as $variation) {
248
  $variation_name .= $variation['frontend_label'] . ',';
255
  }
256
  $parents = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($parent_id ? $parent_id : $p['entity_id']);
257
  if(!empty($parents)) {
258
+ $temp_instance = Mage::getModel('catalog/product')
259
+ ->setOriginalCurrency($this->getOriginalCurrency())
260
+ ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
261
+ ->setStoreId($this->_id_store)
262
  ->getCollection()
263
  ->addAttributeToFilter('type_id','grouped')
264
  ->addAttributeToFilter('entity_id', array('in' => $parents))
265
  ->getFirstItem();
266
+
267
+ $parent_instance = $this->_getParentEntity($temp_instance->getId());
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
+ $qty = $product->getData('stock_item');
270
  // Default data
271
+ $array_data['sku'] = $product->getSku();
272
+ $array_data['product_id'] = $product->getId();
273
  $array_data['qty'] = (integer) $qty->getQty();
274
  if($this->_config_model->get('data/without_product_ordering'))
275
  $array_data['qty'] = $array_data['qty'] - (integer) $qty->getQtyOrdered();
276
+ if($product->getTypeId() == 'grouped' || $product->getTypeId() == 'bundle')
277
+ $array_data['qty'] = (integer) $qty_temp;
278
+ $array_data['status'] = $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED ? 'Disabled' : 'Enabled';
279
+ $array_data = array_merge($array_data, $product->getCategories($product, $parent_instance, $this->_id_store, $this->categoryCache));
280
+ $array_data = array_merge($array_data, $product->getPrices($product, $configurable_instance));
281
+ $array_data = array_merge($array_data, $product->getShippingInfo($product));
282
  // Images, gestion de la fusion parent / enfant
283
+ if($this->_config_model->get('data/parentsimages') && isset($parent_instance) && $parent_instance !== false)
284
+ $array_data = array_merge($array_data, $product->getImages($data['media_gallery']['images'], $parent_instance->getData('media_gallery')));
285
  else
286
  $array_data = array_merge($array_data, $product->getImages($data['media_gallery']['images']));
287
+ // formatdata -> replace special chars with html chars
288
+ $formatData = $this->_config_model->get('data/formatdata') == 1 ? true : false;
289
+ if($product->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE && isset($parent_instance)) {
290
  $array_data['product-url'] = $parent_instance->getUrlInStore() ? $parent_instance->getUrlInStore() : $parent_instance->getProductUrl();
291
+ $array_data['name'] = $this->_helper->cleanData($parent_instance->getName(), $formatData, in_array('name', $this->_config_model->getHtmlAttributes()));
292
+ $array_data['description'] = $this->_helper->cleanData($parent_instance->getDescription(), $formatData, in_array('description', $this->_config_model->getHtmlAttributes()));
293
+ $array_data['short_description'] = $this->_helper->cleanData($parent_instance->getShortDescription(), $formatData, in_array('short_description', $this->_config_model->getHtmlAttributes()));
294
  } else {
295
+ $array_data['product-url'] = $product->getUrlInStore() ? $product->getUrlInStore() : $product->getProductUrl();
296
+ $array_data['name'] = $this->_helper->cleanData($product->getName(), $formatData, in_array('name', $this->_config_model->getHtmlAttributes()));
297
+ $array_data['description'] = $this->_helper->cleanData($product->getDescription(), $formatData, in_array('description', $this->_config_model->getHtmlAttributes()));
298
+ $array_data['short_description'] = $this->_helper->cleanData($product->getShortDescription(), $formatData, in_array('short_description', $this->_config_model->getHtmlAttributes()));
299
  }
300
  $array_data['parent_id'] = $parent_id;
301
  // Product variation
302
  $array_data['product_type'] = $product_type;
303
  $array_data['product_variation'] = $variation_name;
304
+ $array_data['image_default'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();
305
+ $array_data['child_name'] = $product->getName();
306
  // Selected attributes to export with Frond End value of current shop
307
  if(!empty($attributes_to_export)) {
308
  foreach($attributes_to_export as $field => $attr) {
309
  if(!in_array($field, $this->_excludes) && !isset($array_data[$field])) {
310
+ if($product->getData($field) === null)
311
  $array_data[$attr] = '';
312
+ else if(is_array($product->getData($field)))
313
+ $array_data[$attr] = implode(',', $product->getData($field));
 
 
314
  else
315
+ $array_data[$attr] = $this->_helper->cleanData($product->getResource()->getAttribute($field)->getFrontend()->getValue($product), $formatData, in_array($field, $this->_config_model->getHtmlAttributes()));
316
  }
317
  }
318
  }
337
  }
338
  // Fix Sébastien Ledan
339
  if(method_exists($product, 'clearInstance')) {
340
+ $product->clearInstance();
 
 
 
 
 
341
  }
342
  unset($array_data);
343
  }
344
  $this->_write($feed->makeFooter());
345
+ // Product counter and warning
346
+ $total_simple = $count_simple - $count_simple_disabled;
347
+ $total = $count_configurable + $count_grouped + $count_bundle + $count_virtual + $total_simple;
348
+ $message_count = 'Export ' . $total . ' product' . ($total_product > 1 ? 's ' : '') . ' ('
349
+ . $total_simple . ' simple product' . ($total_simple > 1 ? 's ' : '') . ', '
350
+ . $count_configurable . ' configurable product' . ($count_configurable > 1 ? 's ' : '') . ', '
351
+ . $count_bundle . ' bundle product' . ($count_bundle > 1 ? 's ' : '') . ', '
352
+ . $count_grouped . ' grouped product' . ($count_grouped > 1 ? 's ' : '') . ', '
353
+ . $count_virtual . ' virtual product' . ($count_virtual > 1 ? 's ' : '') . ')';
354
+ Mage::helper('lensync/data')->log($message_count);
355
+ if ($count_simple_disabled > 1) {
356
+ if ($count_simple_disabled == 1)
357
+ $message_warning = 'WARNING ! 1 simple product is associated with a disabled configurable product';
358
+ else
359
+ $message_warning = 'WARNING ! ' . $count_simple_disabled . ' simple products are associated with configurable products disabled';
360
+ Mage::helper('lensync/data')->log($message_warning);
361
+ if (!$this->_stream) {
362
+ echo date('Y-m-d h:i:s') .' - ' . $message_warning . '<br />';
363
+ flush();
364
+ }
365
+ }
366
  if(!$this->_stream) {
367
+ echo date('Y-m-d h:i:s') .' - ' . $message_count . '<br />';
368
+ flush();
369
  $this->_copyFile();
370
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
 
371
  $url_file = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'lengow' . DS . $store_code . DS . $this->_filename . '.' . $this->_format;
372
  echo $this->_helper->__('Your feed is available here : %s' , '<a href="' . $url_file . '">' . $url_file . '</a>');
373
+ Mage::helper('lensync/data')->log('Export of the store ' . Mage::app()->getStore($this->_id_store)->getName() . '(' . $this->_id_store . ') generated a file here : ' . $url_file);
374
+ }
375
+
376
+ $time_end = $this->microtime_float();
377
+ $time = $time_end - $time_start;
378
+ if(!$this->_stream) {
379
+ echo "<br/> Memory Usage ".memory_get_usage()/1000000;
380
+ echo "<br/> Execution time $time secondes";
381
  }
382
  }
383
 
384
+ /**
385
+ * Temporary store Parent Identity
386
+ *
387
+ * @param integer $parent_id Parent Entity Id
388
+ *
389
+ * @return object Catalog/product
390
+ */
391
+ protected function _getParentEntity($parent_id){
392
+ $this->_clear_parent_cache ++;
393
+ if (!isset($this->storeParents[$parent_id])){
394
+ $parent = Mage::getModel('lenexport/catalog_product')
395
+ ->setStoreId($this->_id_store)
396
+ ->setOriginalCurrency($this->getOriginalCurrency())
397
+ ->setCurrentCurrencyCode($this->getCurrentCurrencyCode())
398
+ ->load($parent_id);
399
+ $this->storeParents[$parent_id] = $parent;
400
+ }
401
+ if ($this->_clear_parent_cache>300){
402
+ if(method_exists($this->storeParents[0], 'clearInstance')) {
403
+ $maxStoreParent = count($this->storeParents);
404
+ for ($i = 0; $i < $maxStoreParent; $i++) {
405
+ $this->storeParents[0]->clearInstance();
406
+ }
407
+ }
408
+ $this->_clear_parent_cache = 0;
409
+ $this->storeParents = null;
410
+ }
411
+ return $this->storeParents[$parent_id];
412
+ }
413
+
414
+ /**
415
+ * Get products collection for export
416
+ *
417
+ * @param varchar $types Type(s) of product
418
+ * @param varchar $status Status of product to export
419
+ * @param boolean $export_child Export child of product
420
+ * @param boolean $out_of_stock Export product out of stock
421
+ * @param boolean $selected_products Export selected product
422
+ * @param integer $limit The number of product to be exported
423
+ * @param integer $offset From what product export
424
+ * @param array $ids_product Ids product to export
425
+ *
426
+ * @return array
427
+ */
428
  protected function _getProductsCollection($types = null,
429
  $status = null,
430
  $export_child = null,
432
  $selected_products = null,
433
  $limit = null,
434
  $offset = null,
435
+ $ids_product = null)
436
+ {
437
  // Filter types
438
  if($types) {
439
  $_types = explode(',', $types);
447
  $products = $this->_product_model
448
  ->getCollection()
449
  ->addAttributeToSelect('sku')
450
+ ->setStoreId($this->_id_store)
451
  ->addStoreFilter($this->_id_store)
452
  ->addAttributeToFilter('type_id', array('in' => $_types))
453
  ->joinField('store_id', Mage::getConfig()->getTablePrefix() . 'catalog_category_product_index', 'store_id', 'product_id=entity_id', '{{table}}.store_id = '.$this->_id_store, 'left');
454
  // Filter status
455
  if(is_null($status))
456
+ $status = (string) $this->_config_model->get('global/productstatus');
457
+ if($status === (string) Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
458
  $products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
459
+ else if($status === (string) Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
460
  $products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED));
461
  // Export only selected products
462
  if($selected_products) {
487
  }
488
 
489
  /**
490
+ * Filter out of stock product
491
+ *
492
+ * @param boolean $out_of_stock
493
+ *
494
+ * @return string
495
+ **/
496
+ protected function _getOutOfStockSQL($out_of_stock = false)
497
+ {
498
  // Filter product without stock
499
  if(!$out_of_stock) {
500
  $config = (int)Mage::getStoreConfigFlag(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
501
  $sql = '({{table}}.`is_in_stock` = 1) '
502
+ . ' OR IF({{table}}.`use_config_manage_stock` = 1, ' . $config . ', {{table}}.`manage_stock`) = 0';
503
  unset($config);
504
  return $sql;
505
  }
507
 
508
  /**
509
  * Return attributes to export
510
+ *
511
+ * @return array
512
  */
513
+ protected function _getAttributesFromConfig()
514
+ {
515
  $attributes = $this->_config_model->getSelectedAttributes();
516
  foreach($attributes as $name => $value)
517
  self::$DEFAULT_FIELDS[$name] = $value;
519
  }
520
 
521
  /**
522
+ * Return attributes match by the customer
523
+ *
524
+ * @param boolean $exist
525
+ *
526
+ * @return array
527
  */
528
+ protected function getAttributesFromConfig($exist = false)
529
+ {
530
  $attributes = $this->_config_model->getMappingAllAttributes();
531
  if($exist) {
532
  $product = Mage::getModel('catalog/product');
542
 
543
  /**
544
  * File generation
545
+ *
546
+ * @param array $data
547
  */
548
+ protected function _write($data)
549
+ {
550
  if($this->_stream == false) {
551
  if(!$this->_file) {
552
  $this->_initFile();
560
  }
561
  }
562
 
563
+ /**
564
+ * Create File for export
565
+ */
566
+ protected function _initFile()
567
+ {
568
  $this->_time = time();
569
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
570
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS . $store_code . DS;
574
  $this->_file->streamOpen($this->_filename . '.' . $this->_time . '.' . $this->_format, 'w+');
575
  }
576
 
577
+ /**
578
+ * Copies the file to the correct folder
579
+ */
580
+ protected function _copyFile()
581
+ {
582
  $store_code = Mage::app()->getStore($this->_id_store)->getCode();
583
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS . $store_code . DS;
584
  copy($file_path . $this->_filename . '.' . $this->_time . '.' . $this->_format, $file_path . $this->_filename . '.' . $this->_format);
585
  unlink($file_path . $this->_filename . '.' . $this->_time . '.' . $this->_format);
586
  }
587
+
588
+ /**
589
+ * get microtime float
590
+ */
591
+ protected function microtime_float()
592
+ {
593
+ list($usec, $sec) = explode(" ", microtime());
594
+ return ((float)$usec + (float)$sec);
595
+ }
596
+
597
+
598
+ protected function stop($time_start, $string){
599
+ $time_end = $this->microtime_float();
600
+ $time = $time_end - $time_start;
601
+ if ($time<0.0001){ $time = 0;}
602
+ echo round($time,4)." &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $string secondes <br/>";
603
+ }
604
  }
app/code/community/Lengow/Export/Model/Observer.php CHANGED
@@ -1,48 +1,64 @@
1
  <?php
 
2
  /**
3
  * Lengow export model observer
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_Model_Observer {
12
 
13
- public function cron($observer) {
14
- $store_collection = Mage::getResourceModel('core/store_collection')
15
- ->addFieldToFilter('is_active', 1);
16
- $exceptions = array();
17
- foreach($store_collection as $store) {
18
- try {
19
- if(Mage::getStoreConfig('export/performances/active_cron', $store)) {
20
- $generate = Mage::getModel('export/generate');
21
- $format =Mage::getStoreConfig('export/data/format', $store);
22
- $generate->exec($store->getId(), null, $format, null, null, null, null, null, false, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
- } catch (Exception $e) {
25
- Mage::log($e->getMessage());
26
- Mage::log($e->getTraceAsString());
27
  }
 
28
  }
29
  return $this;
30
  }
31
 
32
- public function autoExportProduct($observer) {
33
- $_config = Mage::getSingleton('export/config');
 
 
 
 
34
  if($_config->isAutoExportProduct()) {
35
  $_product = $observer->getEvent()->getProduct();
36
- $_product->setData('lengow_product', 1);
37
- $_resource = Mage::getResourceModel('catalog/product');
38
- $_entity_type_id = $_resource->getEntityType()->getId();
39
  try {
40
- $_product_ressource = new Varien_Object(array('entity_id' => $_product->getId(),
41
- 'id' => $_product->getId(),
42
- 'entity_type_id' => $_entity_type_id,
43
- 'store_id' => Mage::app()->getStore()->getId(),
44
- 'lengow_product' => 1));
45
- $_resource->saveAttribute($_product_ressource, 'lengow_product');
46
  } catch (Exception $e) {
47
  Mage::log($e->getMessage());
48
  Mage::log($e->getTraceAsString());
1
  <?php
2
+
3
  /**
4
  * Lengow export model observer
5
  *
6
  * @category Lengow
7
  * @package Lengow_Export
8
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
9
+ * @copyright 2015 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Export_Model_Observer {
13
 
14
+ /**
15
+ * Exports products for each store with cron job
16
+ */
17
+ public function export($observer)
18
+ {
19
+ if(Mage::getStoreConfig('lenexport/performances/active_cron')) {
20
+ // clean old log (20 days)
21
+ Mage::helper('lensync/data')->cleanLog();
22
+ Mage::helper('lensync/data')->log('## Start cron export ##');
23
+ set_time_limit(0);
24
+ ini_set('memory_limit', '1G');
25
+ $store_collection = Mage::getResourceModel('core/store_collection')
26
+ ->addFieldToFilter('is_active', 1);
27
+ $exceptions = array();
28
+ foreach($store_collection as $store) {
29
+ try {
30
+ if(Mage::getStoreConfig('lenexport/global/active_store', $store)) {
31
+ Mage::helper('lensync/data')->log('Start cron export in Store ' . $store->getName() . '(' . $store->getId() . ')');
32
+ $_configModel = Mage::getSingleton('lenexport/config');
33
+ $_configModel->setStore($store->getId());
34
+ $format =Mage::getStoreConfig('lenexport/data/format', $store);
35
+ $generate = Mage::getModel('lenexport/generate');
36
+ $generate->setCurrentStore($store->getId());
37
+ $generate->setOriginalCurrency($store->getCurrentCurrencyCode());
38
+ $generate->exec($store->getId(), null, $format, null, null, null, null, null, false, false);
39
+ } else {
40
+ Mage::helper('lensync/data')->log('Stop cron export - Store ' . $store->getName() . '(' . $store->getId() . ') is disabled');
41
+ }
42
+ } catch (Exception $e) {
43
+ Mage::log($e->getMessage());
44
+ Mage::log($e->getTraceAsString());
45
  }
 
 
 
46
  }
47
+ Mage::helper('lensync/data')->log('## End cron export ##');
48
  }
49
  return $this;
50
  }
51
 
52
+ /**
53
+ * Adds new products to the selection Lengow
54
+ */
55
+ public function autoExportProduct($observer)
56
+ {
57
+ $_config = Mage::getSingleton('lenexport/config');
58
  if($_config->isAutoExportProduct()) {
59
  $_product = $observer->getEvent()->getProduct();
 
 
 
60
  try {
61
+ $_product->setLengowProduct(1);
 
 
 
 
 
62
  } catch (Exception $e) {
63
  Mage::log($e->getMessage());
64
  Mage::log($e->getTraceAsString());
app/code/community/Lengow/Export/Model/Source/Attributes.php CHANGED
@@ -11,7 +11,7 @@
11
  class Lengow_Export_Model_Source_Attributes {
12
 
13
  public function toOptionArray() {
14
- $attributes = Mage::getSingleton('export/convert_parser_product')->getExternalAttributes();
15
  array_unshift($attributes, array('value' => 'none' ,
16
  'label' => Mage::helper('adminhtml')->__('Select attribut to map')));
17
  return $attributes;
11
  class Lengow_Export_Model_Source_Attributes {
12
 
13
  public function toOptionArray() {
14
+ $attributes = Mage::getSingleton('lenexport/convert_parser_product')->getExternalAttributes();
15
  array_unshift($attributes, array('value' => 'none' ,
16
  'label' => Mage::helper('adminhtml')->__('Select attribut to map')));
17
  return $attributes;
app/code/community/Lengow/Export/Model/Source/Types.php CHANGED
@@ -11,7 +11,7 @@
11
  class Lengow_Export_Model_Source_Types {
12
 
13
  public function toOptionArray() {
14
- $attributes = Mage::getSingleton('export/convert_parser_product')->getExternalAttributes();
15
  array_unshift($attributes, array('value' => 'none' ,
16
  'label' => $this->__('Sélectionnez l\'attribut à mapper')));
17
  return $attributes;
11
  class Lengow_Export_Model_Source_Types {
12
 
13
  public function toOptionArray() {
14
+ $attributes = Mage::getSingleton('lenexport/convert_parser_product')->getExternalAttributes();
15
  array_unshift($attributes, array('value' => 'none' ,
16
  'label' => $this->__('Sélectionnez l\'attribut à mapper')));
17
  return $attributes;
app/code/community/Lengow/Export/Model/System/Config/Backend/Apikey.php CHANGED
@@ -11,12 +11,12 @@ class Lengow_Export_Model_System_Config_Backend_Apikey extends Mage_Core_Model_C
11
  protected function _beforeSave() {
12
  parent::_beforeSave();
13
  if((boolean)$this->getFieldsetDataValue('enabled') && $this->getValue() == '')
14
- Mage::throwException(Mage::helper('sync')->__('API Key (Token) is empty'));
15
  if($this->isValueChanged()) {
16
  /* @var $service Lengow_Export_Model_ManageOrders_Service */
17
  $service = Mage::getSingleton('Lengow_Export/manageorders_service');
18
  if((boolean)$this->getFieldsetDataValue('enabled') && !$service->checkApiKey($this->getValue()))
19
- Mage::throwException(Mage::helper('sync')->__('API key (Token) not valid'));
20
 
21
  }
22
  }
11
  protected function _beforeSave() {
12
  parent::_beforeSave();
13
  if((boolean)$this->getFieldsetDataValue('enabled') && $this->getValue() == '')
14
+ Mage::throwException(Mage::helper('lensync')->__('API Key (Token) is empty'));
15
  if($this->isValueChanged()) {
16
  /* @var $service Lengow_Export_Model_ManageOrders_Service */
17
  $service = Mage::getSingleton('Lengow_Export/manageorders_service');
18
  if((boolean)$this->getFieldsetDataValue('enabled') && !$service->checkApiKey($this->getValue()))
19
+ Mage::throwException(Mage::helper('lensync')->__('API key (Token) not valid'));
20
 
21
  }
22
  }
app/code/community/Lengow/Export/Model/System/Config/Source/Category/Level.php CHANGED
@@ -12,22 +12,11 @@
12
  class Lengow_Export_Model_System_Config_Source_Category_Level extends Mage_Core_Model_Config_Data {
13
 
14
  public function toOptionArray() {
15
- return array(
16
- array('value' => 1,
17
- 'label' => 1),
18
- array('value' => 2,
19
- 'label' => 2),
20
- array('value' => 3,
21
- 'label' => 3),
22
- array('value' => 4,
23
- 'label' => 4),
24
- array('value' => 5,
25
- 'label' => 5),
26
- array('value' => 6,
27
- 'label' => 6),
28
- array('value' => 'all',
29
- 'label' => Mage::helper('adminhtml')->__('All')),
30
- );
31
  }
32
 
33
  }
12
  class Lengow_Export_Model_System_Config_Source_Category_Level extends Mage_Core_Model_Config_Data {
13
 
14
  public function toOptionArray() {
15
+ $array = array();
16
+ for($i = 1; $i <= 10; $i++) {
17
+ $array[] = array('value' => $i, 'label' => $i);
18
+ }
19
+ return $array;
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  }
app/code/community/Lengow/Export/Model/System/Config/Source/Getattributes.php CHANGED
@@ -15,7 +15,10 @@ class Lengow_Export_Model_System_Config_Source_Getattributes extends Mage_Core_M
15
  ->setEntityTypeFilter(Mage::getModel('catalog/product')
16
  ->getResource()
17
  ->getTypeId());
18
- $attributeArray = array();
 
 
 
19
  foreach ($attribute as $option) {
20
  $attributeArray[] = array(
21
  'value' => $option->getAttributeCode(),
15
  ->setEntityTypeFilter(Mage::getModel('catalog/product')
16
  ->getResource()
17
  ->getTypeId());
18
+ $attributeArray = array();
19
+ $attributeArray[] = array('value' => 'none',
20
+ 'label' => '',
21
+ );
22
  foreach ($attribute as $option) {
23
  $attributeArray[] = array(
24
  'value' => $option->getAttributeCode(),
app/code/community/Lengow/Export/Model/System/Config/Source/Status.php CHANGED
@@ -18,7 +18,7 @@ class Lengow_Export_Model_System_Config_Source_Status extends Mage_Core_Model_Co
18
  array('value' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED,
19
  'label' => Mage::helper('adminhtml')->__('Disabled')),
20
  array('value' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED . ',' . Mage_Catalog_Model_Product_Status::STATUS_DISABLED,
21
- 'label' => Mage::helper('adminhtml')->__('Enable') . ', ' . Mage::helper('adminhtml')->__('Disabled')),
22
  );
23
  }
24
 
18
  array('value' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED,
19
  'label' => Mage::helper('adminhtml')->__('Disabled')),
20
  array('value' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED . ',' . Mage_Catalog_Model_Product_Status::STATUS_DISABLED,
21
+ 'label' => Mage::helper('adminhtml')->__('Enabled') . ', ' . Mage::helper('adminhtml')->__('Disabled')),
22
  );
23
  }
24
 
app/code/community/Lengow/Export/Model/System/Config/Source/Types.php CHANGED
@@ -6,26 +6,26 @@
6
  * @category Lengow
7
  * @package Lengow_Export
8
  * @author Ludovic Drin <ludovic@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Export_Model_System_Config_Source_Types extends Mage_Core_Model_Config_Data {
13
 
14
  public function toOptionArray() {
15
  return array(
16
- array('value' => 'configurable',
17
  'label' => Mage::helper('adminhtml')->__('Configurable')),
18
- array('value' => 'simple',
19
  'label' => Mage::helper('adminhtml')->__('Simple')),
20
- array('value' => 'bundle',
21
  'label' => Mage::helper('adminhtml')->__('Bundle')),
22
- array('value' => 'grouped',
23
  'label' => Mage::helper('adminhtml')->__('Grouped')),
24
- array('value' => 'virtual',
25
  'label' => Mage::helper('adminhtml')->__('Virtual')),
26
  );
27
  }
28
-
29
  public function toSelectArray() {
30
  $select = array();
31
  foreach($this->toOptionArray() as $option) {
6
  * @category Lengow
7
  * @package Lengow_Export
8
  * @author Ludovic Drin <ludovic@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Export_Model_System_Config_Source_Types extends Mage_Core_Model_Config_Data {
13
 
14
  public function toOptionArray() {
15
  return array(
16
+ array('value' => 'configurable',
17
  'label' => Mage::helper('adminhtml')->__('Configurable')),
18
+ array('value' => 'simple',
19
  'label' => Mage::helper('adminhtml')->__('Simple')),
20
+ array('value' => 'bundle',
21
  'label' => Mage::helper('adminhtml')->__('Bundle')),
22
+ array('value' => 'grouped',
23
  'label' => Mage::helper('adminhtml')->__('Grouped')),
24
+ array('value' => 'virtual',
25
  'label' => Mage::helper('adminhtml')->__('Virtual')),
26
  );
27
  }
28
+
29
  public function toSelectArray() {
30
  $select = array();
31
  foreach($this->toOptionArray() as $option) {
app/code/community/Lengow/Export/controllers/Adminhtml/Lengow/ExportController.php CHANGED
@@ -22,35 +22,47 @@ class Lengow_Export_Adminhtml_Lengow_ExportController extends Mage_Adminhtml_Con
22
  public function gridAction() {
23
  $this->loadLayout();
24
  $this->getResponse()->setBody(
25
- $this->getLayout()->createBlock('export/adminhtml_product_grid')->toHtml()
26
  );
27
  }
28
 
29
  public function massPublishAction() {
30
  $_product_ids = (array) $this->getRequest()->getParam('product');
31
- $_store_id = (int)$this->getRequest()->getParam('store', 0);
32
- $_publish = (int)$this->getRequest()->getParam('publish');
33
  $resource = Mage::getResourceModel('catalog/product');
34
  $_entity_type_id = $resource->getEntityType()->getId();
35
  try {
36
- foreach ($_product_ids as $_product_id) {
37
- $product = new Varien_Object(array('entity_id' => $_product_id,
38
- 'id' => $_product_id,
39
- 'entity_type_id' => $_entity_type_id,
40
- 'store_id' => $_store_id,
41
- 'lengow_product' => $_publish));
42
- $resource->saveAttribute($product,'lengow_product');
43
-
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
  $this->_getSession()->addSuccess(
46
- Mage::helper('export')->__('Total of %d record(s) were successfully updated', count($_product_ids))
47
  );
48
  }
49
  catch (Mage_Core_Model_Exception $e) {
50
  $this->_getSession()->addError($e->getMessage());
51
  }
52
  catch (Exception $e) {
53
- $this->_getSession()->addException($e, $e->getMessage() . Mage::helper('export')->__('There was an error while updating product(s) publication'));
54
  }
55
 
56
  $this->_redirect('*/*/', array('store'=> $_store_id));
22
  public function gridAction() {
23
  $this->loadLayout();
24
  $this->getResponse()->setBody(
25
+ $this->getLayout()->createBlock('lenexport/adminhtml_product_grid')->toHtml()
26
  );
27
  }
28
 
29
  public function massPublishAction() {
30
  $_product_ids = (array) $this->getRequest()->getParam('product');
31
+ $_store_id = (integer) $this->getRequest()->getParam('store', Mage::app()->getStore()->getId());
32
+ $_publish = (integer) $this->getRequest()->getParam('publish');
33
  $resource = Mage::getResourceModel('catalog/product');
34
  $_entity_type_id = $resource->getEntityType()->getId();
35
  try {
36
+ //update all attribute in one query
37
+ $product_action = Mage::getSingleton('catalog/product_action');
38
+ if ($_store_id != 0) {
39
+ $defaultStoreProductToUpdate = array();
40
+ foreach ($_product_ids as $_product_id) {
41
+ $lengow_product_value = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_product_id, 'lengow_product', 0);
42
+ if ($lengow_product_value === false){
43
+ $defaultStoreProductToUpdate[] = $_product_id;
44
+ }
45
+ }
46
+ //need to set default value if not set
47
+ if (count($defaultStoreProductToUpdate)>0){
48
+ $product_action->updateAttributes($defaultStoreProductToUpdate, array('lengow_product' => 0), 0);
49
+ }
50
+ if ($_store_id != 0){
51
+ //set value for other store
52
+ $product_action->updateAttributes($_product_ids, array('lengow_product' => $_publish), $_store_id);
53
+ }
54
+ } else {
55
+ $product_action->updateAttributes($_product_ids, array('lengow_product' => $_publish), $_store_id);
56
  }
57
  $this->_getSession()->addSuccess(
58
+ Mage::helper('lenexport')->__('Total of %d record(s) were successfully updated', count($_product_ids))
59
  );
60
  }
61
  catch (Mage_Core_Model_Exception $e) {
62
  $this->_getSession()->addError($e->getMessage());
63
  }
64
  catch (Exception $e) {
65
+ $this->_getSession()->addException($e, $e->getMessage() . Mage::helper('lenexport')->__('There was an error while updating product(s) publication'));
66
  }
67
 
68
  $this->_redirect('*/*/', array('store'=> $_store_id));
app/code/community/Lengow/Export/controllers/FeedController.php CHANGED
@@ -4,58 +4,85 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_FeedController extends Mage_Core_Controller_Front_Action {
12
 
13
- public function indexAction() {
 
 
 
 
 
 
14
  set_time_limit(0);
15
- ini_set('memory_limit', '1G');
16
  $mode = $this->getRequest()->getParam('mode');
17
- $helper = Mage::helper('export/security');
18
  if($helper->checkIp()) {
19
- $this->_configModel = Mage::getSingleton('export/config');
 
20
  try {
21
  $this->loadLayout(false);
22
  $this->renderLayout();
23
  } catch (Exception $e) {
24
  Mage::throwException($e);
25
  }
26
- $generate = Mage::getSingleton('export/generate');
27
- $generate->setCurrentStore(Mage::app()->getStore()->getId());
28
- $_default_store = Mage::getModel('core/store')->load(Mage::app()
29
- ->getWebsite(true)
30
- ->getDefaultGroup()
31
- ->getDefaultStoreId());
32
- $generate->setOriginalCurrency($_default_store->getCurrentCurrencyCode());
33
- $id_store = (integer) $this->getRequest()->getParam('store', Mage::app()->getStore()->getId());
 
 
34
  Mage::app()->getStore()->setCurrentStore($id_store);
35
- $format = (string) $this->getRequest()->getParam('format', 'csv');
36
- $types = $this->getRequest()->getParam('product_type', null);
37
- $export_child = $this->getRequest()->getParam('export_child', null);
38
- $status = $this->getRequest()->getParam('product_status', null);
39
- $out_of_stock = $this->getRequest()->getParam('product_out_of_stock', null);
40
- $selected_products = $this->getRequest()->getParam('selected_products', null);
41
- $stream = $this->getRequest()->getParam('stream', null);
42
- $limit = $this->getRequest()->getParam('limit', null);
43
- $offset = $this->getRequest()->getParam('offset', null);
44
- $ids_product = $this->getRequest()->getParam('ids_product', null);
45
- if($locale = $this->getRequest()->getParam('locale', null)) {
46
- // changing locale works!
47
- Mage::app()->getLocale()->setLocale($locale);
48
- // needed to add this
49
- Mage::app()->getTranslator()->setLocale($locale);
50
- // translation now works
51
- Mage::app()->getTranslator()->init('frontend', true);
52
- }
53
- if($currency = $this->getRequest()->getParam('currency', null)) {
54
- $generate->setCurrentCurrencyCode($currency);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
- $generate->exec($id_store, $mode, $format, $types, $status, $export_child, $out_of_stock, $selected_products, $stream, $limit, $offset, $ids_product);
57
  } else {
58
- echo Mage::helper('export')->__('Unauthorised IP : %s', $_SERVER['REMOTE_ADDR']);
59
  }
60
- }
61
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Export
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Export_FeedController extends Mage_Core_Controller_Front_Action {
12
 
13
+ /**
14
+ * Exports products for each store
15
+ */
16
+ public function indexAction()
17
+ {
18
+ // clean old log (20 days)
19
+ Mage::helper('lensync/data')->cleanLog();
20
  set_time_limit(0);
21
+ ini_set('memory_limit', '1G');
22
  $mode = $this->getRequest()->getParam('mode');
23
+ $helper = Mage::helper('lenexport/security');
24
  if($helper->checkIp()) {
25
+ Mage::helper('lensync/data')->log('## Start manual export ##');
26
+ $_configModel = Mage::getSingleton('lenexport/config');
27
  try {
28
  $this->loadLayout(false);
29
  $this->renderLayout();
30
  } catch (Exception $e) {
31
  Mage::throwException($e);
32
  }
33
+
34
+ // get store
35
+ $storeCode = $this->getRequest()->getParam('code', null);
36
+ if ($storeCode) //if store code is in URL
37
+ $id_store = (int) Mage::getModel('core/store')->load($storeCode, 'code')->getId();
38
+ else // if store id is in URL
39
+ $id_store = (integer) $this->getRequest()->getParam('store', Mage::app()->getStore()->getId());
40
+
41
+ // config store
42
+ $_configModel->setStore($id_store);
43
  Mage::app()->getStore()->setCurrentStore($id_store);
44
+
45
+ // check if store is enable for export
46
+ if(Mage::getStoreConfig('lenexport/global/active_store', Mage::app()->getStore($id_store))) {
47
+
48
+ $generate = Mage::getSingleton('lenexport/generate');
49
+ $generate->setCurrentStore($id_store);
50
+ $generate->setOriginalCurrency(Mage::app()->getStore()->getCurrentCurrencyCode());
51
+
52
+ // other params
53
+ $format = $this->getRequest()->getParam('format', null);
54
+ $types = $this->getRequest()->getParam('product_type', null);
55
+ $export_child = $this->getRequest()->getParam('export_child', null);
56
+ $status = $this->getRequest()->getParam('product_status', null);
57
+ $out_of_stock = $this->getRequest()->getParam('product_out_of_stock', null);
58
+ $selected_products = $this->getRequest()->getParam('selected_products', null);
59
+ $stream = $this->getRequest()->getParam('stream', null);
60
+ $limit = $this->getRequest()->getParam('limit', null);
61
+ $offset = $this->getRequest()->getParam('offset', null);
62
+ $ids_product = $this->getRequest()->getParam('ids_product', null);
63
+
64
+ if ($locale = $this->getRequest()->getParam('locale', null)) {
65
+ // changing locale works!
66
+ Mage::app()->getLocale()->setLocale($locale);
67
+ // needed to add this
68
+ Mage::app()->getTranslator()->setLocale($locale);
69
+ // translation now works
70
+ Mage::app()->getTranslator()->init('frontend', true);
71
+ }
72
+ if($currency = $this->getRequest()->getParam('currency', null)) {
73
+ $generate->setCurrentCurrencyCode($currency);
74
+ }
75
+ Mage::helper('lensync/data')->log('Start manual export in store ' . Mage::app()->getStore($id_store)->getName() . '(' . $id_store . ')');
76
+ $generate->exec($id_store, $mode, $format, $types, $status, $export_child, $out_of_stock, $selected_products, $stream, $limit, $offset, $ids_product);
77
+ } else {
78
+ Mage::helper('lensync/data')->log('Stop manual export - Store ' . Mage::app()->getStore($id_store)->getName() . '(' . $id_store . ') is disabled');
79
+ header('Content-Type: text/html; charset=utf-8');
80
+ echo 'Stop manual export - Store ' . Mage::app()->getStore($id_store)->getName() . '(' . $id_store . ') is disabled';
81
+ flush();
82
  }
83
+ Mage::helper('lensync/data')->log('## End manual export ##');
84
  } else {
85
+ echo Mage::helper('lenexport')->__('Unauthorised IP : %s', $_SERVER['REMOTE_ADDR']);
86
  }
87
+ }
88
  }
app/code/community/Lengow/Export/etc/config.xml CHANGED
@@ -2,22 +2,22 @@
2
  <config>
3
  <modules>
4
  <Lengow_Export>
5
- <version>2.0.1.5</version>
6
  </Lengow_Export>
7
  </modules>
8
  <admin>
9
  <routers>
10
- <export>
11
  <use>admin</use>
12
  <args>
13
  <module>Lengow_Export</module>
14
  <frontName>lengow</frontName>
15
  </args>
16
- </export>
17
  <adminhtml>
18
  <args>
19
  <modules>
20
- <export before="Mage_Adminhtml">Lengow_Export_Adminhtml</export>
21
  </modules>
22
  </args>
23
  </adminhtml>
@@ -25,10 +25,10 @@
25
  </admin>
26
  <global>
27
  <models>
28
- <export>
29
  <class>Lengow_Export_Model</class>
30
  <resourceModel>export_mysql4</resourceModel>
31
- </export>
32
  <export_mysql4>
33
  <class>Lengow_Export_Model_Mysql4</class>
34
  <entities>
@@ -39,42 +39,42 @@
39
  </export_mysql4>
40
  </models>
41
  <resources>
42
- <export_setup>
43
  <connection>
44
  <use>core_setup</use>
45
  </connection>
46
- </export_setup>
47
- <export_write>
48
  <connection>
49
  <use>core_write</use>
50
  </connection>
51
- </export_write>
52
- <export_read>
53
  <connection>
54
  <use>core_read</use>
55
  </connection>
56
- </export_read>
57
  </resources>
58
  <blocks>
59
- <export>
60
  <class>Lengow_Export_Block</class>
61
- </export>
62
  </blocks>
63
  <helpers>
64
- <export>
65
  <class>Lengow_Export_Helper</class>
66
- </export>
67
  </helpers>
68
  <events>
69
- <catalog_product_new_action>
70
  <observers>
71
- <lengow__export_product_new_action>
72
  <type>singleton</type>
73
  <class>Lengow_Export_Model_Observer</class>
74
  <method>autoExportProduct</method>
75
- </lengow__export_product_new_action>
76
  </observers>
77
- </catalog_product_new_action>
78
  </events>
79
  </global>
80
  <frontend>
@@ -103,7 +103,7 @@
103
  <title>Lengow</title>
104
  <sort_order>20</sort_order>
105
  <children>
106
- <export translate="title" module="export">
107
  <title>Manage Products Export</title>
108
  <action>adminhtml/lengow_export</action>
109
  <sort_order>200</sort_order>
@@ -119,19 +119,19 @@
119
  <children>
120
  <config>
121
  <children>
122
- <export translate="title" module="export">
123
  <title>Products</title>
124
- </export>
125
  </children>
126
  </config>
127
  </children>
128
  </system>
129
- <lengow translate="title" module="export">
130
  <title>Lengow</title>
131
  <children>
132
- <export translate="title" module="export">
133
  <title>Manage Products Export</title>
134
- </export>
135
  </children>
136
  </lengow>
137
  </children>
@@ -141,38 +141,47 @@
141
  </adminhtml>
142
  <crontab>
143
  <jobs>
144
- <lengow_export_feed>
145
  <schedule>
146
  <cron_expr>0 */4 * * *</cron_expr>
147
  </schedule>
148
  <run>
149
- <model>export/observer::cron</model>
150
  </run>
151
- </lengow_export_feed>
152
  </jobs>
153
  </crontab>
154
  <default>
155
- <export>
156
  <global>
157
- <valid_ip></valid_ip>
158
  <export_only_selected>0</export_only_selected>
 
159
  <export_soldout>0</export_soldout>
160
  <producttype>simple,configurable</producttype>
 
161
  </global>
162
  <data>
163
- <default_shipping_delay>2</default_shipping_delay>
 
 
 
 
 
 
 
164
  <default_shipping_price></default_shipping_price>
165
  <default_shipping_method>flatrate_flatrate</default_shipping_method>
166
- <shipping_price_based_on>FR</shipping_price_based_on>
167
- <formatdata>0</formatdata>
168
- <levelcategory>5</levelcategory>
169
- <count_images>5</count_images>
170
- <keephtml>0</keephtml>
171
  </data>
 
 
 
172
  <performances>
 
173
  <usesavefile>0</usesavefile>
174
  <active_cron>0</active_cron>
175
  </performances>
176
- </export>
177
  </default>
178
  </config>
2
  <config>
3
  <modules>
4
  <Lengow_Export>
5
+ <version>2.1.0</version>
6
  </Lengow_Export>
7
  </modules>
8
  <admin>
9
  <routers>
10
+ <lenexport>
11
  <use>admin</use>
12
  <args>
13
  <module>Lengow_Export</module>
14
  <frontName>lengow</frontName>
15
  </args>
16
+ </lenexport>
17
  <adminhtml>
18
  <args>
19
  <modules>
20
+ <lenexport before="Mage_Adminhtml">Lengow_Export_Adminhtml</lenexport>
21
  </modules>
22
  </args>
23
  </adminhtml>
25
  </admin>
26
  <global>
27
  <models>
28
+ <lenexport>
29
  <class>Lengow_Export_Model</class>
30
  <resourceModel>export_mysql4</resourceModel>
31
+ </lenexport>
32
  <export_mysql4>
33
  <class>Lengow_Export_Model_Mysql4</class>
34
  <entities>
39
  </export_mysql4>
40
  </models>
41
  <resources>
42
+ <lenexport_setup>
43
  <connection>
44
  <use>core_setup</use>
45
  </connection>
46
+ </lenexport_setup>
47
+ <lenexport_write>
48
  <connection>
49
  <use>core_write</use>
50
  </connection>
51
+ </lenexport_write>
52
+ <lenexport_read>
53
  <connection>
54
  <use>core_read</use>
55
  </connection>
56
+ </lenexport_read>
57
  </resources>
58
  <blocks>
59
+ <lenexport>
60
  <class>Lengow_Export_Block</class>
61
+ </lenexport>
62
  </blocks>
63
  <helpers>
64
+ <lenexport>
65
  <class>Lengow_Export_Helper</class>
66
+ </lenexport>
67
  </helpers>
68
  <events>
69
+ <catalog_product_save_before>
70
  <observers>
71
+ <yourmodule>
72
  <type>singleton</type>
73
  <class>Lengow_Export_Model_Observer</class>
74
  <method>autoExportProduct</method>
75
+ </yourmodule>
76
  </observers>
77
+ </catalog_product_save_before>
78
  </events>
79
  </global>
80
  <frontend>
103
  <title>Lengow</title>
104
  <sort_order>20</sort_order>
105
  <children>
106
+ <export translate="title" module="lenexport">
107
  <title>Manage Products Export</title>
108
  <action>adminhtml/lengow_export</action>
109
  <sort_order>200</sort_order>
119
  <children>
120
  <config>
121
  <children>
122
+ <lenexport translate="title" module="lenexport">
123
  <title>Products</title>
124
+ </lenexport>
125
  </children>
126
  </config>
127
  </children>
128
  </system>
129
+ <lengow translate="title" module="lenexport">
130
  <title>Lengow</title>
131
  <children>
132
+ <lenexport translate="title" module="lenexport">
133
  <title>Manage Products Export</title>
134
+ </lenexport>
135
  </children>
136
  </lengow>
137
  </children>
141
  </adminhtml>
142
  <crontab>
143
  <jobs>
144
+ <export_feed_lengow>
145
  <schedule>
146
  <cron_expr>0 */4 * * *</cron_expr>
147
  </schedule>
148
  <run>
149
+ <model>lenexport/observer::export</model>
150
  </run>
151
+ </export_feed_lengow>
152
  </jobs>
153
  </crontab>
154
  <default>
155
+ <lenexport>
156
  <global>
157
+ <active_store>0</active_store>
158
  <export_only_selected>0</export_only_selected>
159
+ <autoexport_newproduct>0</autoexport_newproduct>
160
  <export_soldout>0</export_soldout>
161
  <producttype>simple,configurable</producttype>
162
+ <productstatus></productstatus>
163
  </global>
164
  <data>
165
+ <format>csv</format>
166
+ <count_images>5</count_images>
167
+ <parentsimages>0</parentsimages>
168
+ <levelcategory>5</levelcategory>
169
+ <without_product_ordering>0</without_product_ordering>
170
+ <formatdata>0</formatdata>
171
+ <html_attribute>0</html_attribute>
172
+ <shipping_price_based_on>FR</shipping_price_based_on>
173
  <default_shipping_price></default_shipping_price>
174
  <default_shipping_method>flatrate_flatrate</default_shipping_method>
175
+ <default_shipping_delay>2</default_shipping_delay>
 
 
 
 
176
  </data>
177
+ <attributelist>
178
+ <attributes>0</attributes>
179
+ </attributelist>
180
  <performances>
181
+ <valid_ip></valid_ip>
182
  <usesavefile>0</usesavefile>
183
  <active_cron>0</active_cron>
184
  </performances>
185
+ </lenexport>
186
  </default>
187
  </config>
app/code/community/Lengow/Export/etc/system.xml CHANGED
@@ -1,44 +1,45 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
- <lengow translate="label" module="export">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
- <export translate="label" module="export">
11
  <label>Export Configuration</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
14
  <sort_order>90</sort_order>
15
  <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
  <global translate="label comment">
20
  <label>Global</label>
21
  <show_in_default>1</show_in_default>
22
- <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
24
  <sort_order>1</sort_order>
25
  <fields>
26
- <valid_ip>
27
- <label>Ip authorised to export</label>
28
- <comment><![CDATA[Authorized acces to catalog export by IP, separated by ;]]></comment>
29
- <frontend_type>text</frontend_type>
30
- <sort_order>6</sort_order>
31
  <show_in_default>1</show_in_default>
32
- <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
34
- </valid_ip>
 
 
35
  <export_only_selected>
36
  <label>Export only selected product</label>
37
  <comment></comment>
38
  <frontend_type>select</frontend_type>
39
- <sort_order>9</sort_order>
40
  <show_in_default>1</show_in_default>
41
- <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  <source_model>adminhtml/system_config_source_yesno</source_model>
44
  </export_only_selected>
@@ -46,45 +47,45 @@
46
  <label><![CDATA[Auto export new product]]></label>
47
  <comment><![CDATA[Auto export a new product on Lengow]]></comment>
48
  <frontend_type>select</frontend_type>
49
- <sort_order>60</sort_order>
50
  <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
  <show_in_store>1</show_in_store>
53
  <source_model>adminhtml/system_config_source_yesno</source_model>
54
- </autoexport_newproduct>
55
  <export_soldout>
56
  <label>Export product out of stock</label>
57
- <comment></comment>
58
  <frontend_type>select</frontend_type>
59
- <sort_order>60</sort_order>
60
  <show_in_default>1</show_in_default>
61
- <show_in_website>1</show_in_website>
62
  <show_in_store>1</show_in_store>
63
  <source_model>adminhtml/system_config_source_yesno</source_model>
64
  </export_soldout>
65
  <producttype>
66
  <label>Product type to export</label>
67
- <comment></comment>
68
  <frontend_type>multiselect</frontend_type>
69
- <sort_order>70</sort_order>
70
  <show_in_default>1</show_in_default>
71
- <show_in_website>1</show_in_website>
72
  <show_in_store>1</show_in_store>
73
- <source_model>export/system_config_source_types</source_model>
74
- </producttype>
75
  <productstatus>
76
  <label>Status of product to export</label>
77
- <comment></comment>
78
  <frontend_type>select</frontend_type>
79
- <sort_order>80</sort_order>
80
  <show_in_default>1</show_in_default>
81
- <show_in_website>1</show_in_website>
82
  <show_in_store>1</show_in_store>
83
- <source_model>export/system_config_source_status</source_model>
84
  </productstatus>
85
  <!--<productchildren>
86
  <label>Export child product</label>
87
- <comment>Export child for configurable product</comment>
88
  <frontend_type>select</frontend_type>
89
  <sort_order>90</sort_order>
90
  <show_in_default>1</show_in_default>
@@ -98,76 +99,93 @@
98
  <label>Data</label>
99
  <comment></comment>
100
  <show_in_default>1</show_in_default>
101
- <show_in_website>1</show_in_website>
102
  <show_in_store>1</show_in_store>
103
  <sort_order>2</sort_order>
104
  <fields>
105
- <levelcategory>
106
- <label>Level max for category</label>
107
- <comment></comment>
108
  <frontend_type>select</frontend_type>
109
  <sort_order>10</sort_order>
110
  <show_in_default>1</show_in_default>
111
- <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
113
- <source_model>export/system_config_source_category_level</source_model>
114
- </levelcategory>
 
 
 
 
 
 
 
 
 
115
  <parentsimages>
116
  <label>Merge images with parents products if exist</label>
117
- <comment></comment>
118
  <frontend_type>select</frontend_type>
119
- <sort_order>10</sort_order>
120
  <show_in_default>1</show_in_default>
121
- <show_in_website>1</show_in_website>
122
  <show_in_store>1</show_in_store>
123
  <source_model>adminhtml/system_config_source_yesno</source_model>
124
  </parentsimages>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  <formatdata>
126
  <label>Convert data</label>
127
- <comment><![CDATA[Replace spcecial chars with html chars]]></comment>
128
  <frontend_type>select</frontend_type>
129
- <sort_order>20</sort_order>
130
  <show_in_default>1</show_in_default>
131
- <show_in_website>1</show_in_website>
132
  <show_in_store>1</show_in_store>
133
  <source_model>adminhtml/system_config_source_yesno</source_model>
134
  </formatdata>
135
- <keephtml>
136
- <label>Keep html</label>
137
- <comment><![CDATA[Keep html chars in descrption]]></comment>
138
- <frontend_type>select</frontend_type>
139
- <sort_order>20</sort_order>
140
  <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
  <show_in_store>1</show_in_store>
143
- <source_model>adminhtml/system_config_source_yesno</source_model>
144
- </keephtml>
145
  <shipping_price_based_on>
146
  <label>Country shipping</label>
147
  <comment>Default country for shipping cost</comment>
148
  <frontend_type>select</frontend_type>
149
  <source_model>adminhtml/system_config_source_country</source_model>
150
- <sort_order>30</sort_order>
151
- <show_in_default>1</show_in_default>
152
- <show_in_website>1</show_in_website>
153
- <show_in_store>1</show_in_store>
154
- </shipping_price_based_on>
155
- <default_shipping_delay>
156
- <label>Delay of shipping</label>
157
- <comment></comment>
158
- <frontend_type>text</frontend_type>
159
- <sort_order>40</sort_order>
160
  <show_in_default>1</show_in_default>
161
- <show_in_website>1</show_in_website>
162
  <show_in_store>1</show_in_store>
163
- </default_shipping_delay>
164
  <default_shipping_price>
165
  <label>Shipping cost</label>
166
  <comment>Default shipping cost if matching find</comment>
167
  <frontend_type>text</frontend_type>
168
- <sort_order>50</sort_order>
169
  <show_in_default>1</show_in_default>
170
- <show_in_website>1</show_in_website>
171
  <show_in_store>1</show_in_store>
172
  </default_shipping_price>
173
  <default_shipping_method>
@@ -175,89 +193,80 @@
175
  <comment>Default shipping method to calculate shipping cost</comment>
176
  <frontend_type>select</frontend_type>
177
  <source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
178
- <sort_order>60</sort_order>
179
- <show_in_default>1</show_in_default>
180
- <show_in_website>1</show_in_website>
181
- <show_in_store>1</show_in_store>
182
- </default_shipping_method>
183
- <format>
184
- <label>Format</label>
185
- <frontend_type>select</frontend_type>
186
- <sort_order>10</sort_order>
187
  <show_in_default>1</show_in_default>
188
- <show_in_website>1</show_in_website>
189
  <show_in_store>1</show_in_store>
190
- <source_model>export/system_config_source_format</source_model>
191
- </format>
192
- <without_product_ordering>
193
- <label>Stock without products ordering</label>
194
- <frontend_type>select</frontend_type>
195
- <sort_order>70</sort_order>
196
  <show_in_default>1</show_in_default>
197
- <show_in_website>1</show_in_website>
198
  <show_in_store>1</show_in_store>
199
- <source_model>adminhtml/system_config_source_yesno</source_model>
200
- </without_product_ordering>
201
- <count_images>
202
- <label>Images max</label>
203
- <frontend_type>select</frontend_type>
204
- <sort_order>80</sort_order>
 
 
 
 
 
 
 
 
 
 
205
  <show_in_default>1</show_in_default>
206
- <show_in_website>1</show_in_website>
207
  <show_in_store>1</show_in_store>
208
- <source_model>export/system_config_source_images</source_model>
209
- </count_images>
210
  </fields>
211
- </data>
212
  <performances translate="label comment">
213
  <label>Performances</label>
214
  <show_in_default>1</show_in_default>
215
- <show_in_website>1</show_in_website>
216
- <show_in_store>1</show_in_store>
217
- <sort_order>3</sort_order>
218
  <fields>
 
 
 
 
 
 
 
 
 
219
  <usesavefile>
220
  <label>Save feed on file</label>
221
  <comment><![CDATA[Save the feed on a file]]></comment>
222
  <frontend_type>select</frontend_type>
223
- <sort_order>40</sort_order>
224
  <show_in_default>1</show_in_default>
225
- <show_in_website>1</show_in_website>
226
- <show_in_store>1</show_in_store>
227
  <source_model>adminhtml/system_config_source_yesno</source_model>
228
  </usesavefile>
229
  <active_cron>
230
  <label><![CDATA[Active cron]]></label>
231
  <comment><![CDATA[Active the scheduled task for export your feed every 4h]]></comment>
232
  <frontend_type>select</frontend_type>
233
- <sort_order>60</sort_order>
234
  <show_in_default>1</show_in_default>
235
- <show_in_website>1</show_in_website>
236
- <show_in_store>1</show_in_store>
237
  <source_model>adminhtml/system_config_source_yesno</source_model>
238
  </active_cron>
239
  </fields>
240
  </performances>
241
- <!-- selection des attributs -->
242
- <attributelist translate="label">
243
- <label>Products attributes</label>
244
- <show_in_default>1</show_in_default>
245
- <show_in_website>1</show_in_website>
246
- <show_in_store>1</show_in_store>
247
- <sort_order>20</sort_order>
248
- <fields>
249
- <attributes translate="label">
250
- <label>Select attributes to export</label>
251
- <frontend_type>multiselect</frontend_type>
252
- <source_model>export/system_config_source_getattributes</source_model>
253
- <sort_order>4</sort_order>
254
- <show_in_default>1</show_in_default>
255
- <show_in_website>1</show_in_website>
256
- <show_in_store>1</show_in_store>
257
- </attributes>
258
- </fields>
259
- </attributelist>
260
  </groups>
261
- </export>
262
  </sections>
263
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
+ <lengow translate="label" module="lenexport">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
+ <lenexport translate="label" module="lenexport">
11
  <label>Export Configuration</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
14
  <sort_order>90</sort_order>
15
  <show_in_default>1</show_in_default>
16
+ <show_in_website>0</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
  <global translate="label comment">
20
  <label>Global</label>
21
  <show_in_default>1</show_in_default>
22
+ <show_in_website>0</show_in_website>
23
  <show_in_store>1</show_in_store>
24
  <sort_order>1</sort_order>
25
  <fields>
26
+ <active_store>
27
+ <label>Enabled store</label>
28
+ <frontend_type>select</frontend_type>
29
+ <sort_order>10</sort_order>
 
30
  <show_in_default>1</show_in_default>
31
+ <show_in_website>0</show_in_website>
32
  <show_in_store>1</show_in_store>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <comment>Enable store to export</comment>
35
+ </active_store>
36
  <export_only_selected>
37
  <label>Export only selected product</label>
38
  <comment></comment>
39
  <frontend_type>select</frontend_type>
40
+ <sort_order>20</sort_order>
41
  <show_in_default>1</show_in_default>
42
+ <show_in_website>0</show_in_website>
43
  <show_in_store>1</show_in_store>
44
  <source_model>adminhtml/system_config_source_yesno</source_model>
45
  </export_only_selected>
47
  <label><![CDATA[Auto export new product]]></label>
48
  <comment><![CDATA[Auto export a new product on Lengow]]></comment>
49
  <frontend_type>select</frontend_type>
50
+ <sort_order>30</sort_order>
51
  <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
  <show_in_store>1</show_in_store>
54
  <source_model>adminhtml/system_config_source_yesno</source_model>
55
+ </autoexport_newproduct>
56
  <export_soldout>
57
  <label>Export product out of stock</label>
58
+ <comment></comment>
59
  <frontend_type>select</frontend_type>
60
+ <sort_order>40</sort_order>
61
  <show_in_default>1</show_in_default>
62
+ <show_in_website>0</show_in_website>
63
  <show_in_store>1</show_in_store>
64
  <source_model>adminhtml/system_config_source_yesno</source_model>
65
  </export_soldout>
66
  <producttype>
67
  <label>Product type to export</label>
68
+ <comment></comment>
69
  <frontend_type>multiselect</frontend_type>
70
+ <sort_order>50</sort_order>
71
  <show_in_default>1</show_in_default>
72
+ <show_in_website>0</show_in_website>
73
  <show_in_store>1</show_in_store>
74
+ <source_model>lenexport/system_config_source_types</source_model>
75
+ </producttype>
76
  <productstatus>
77
  <label>Status of product to export</label>
78
+ <comment></comment>
79
  <frontend_type>select</frontend_type>
80
+ <sort_order>60</sort_order>
81
  <show_in_default>1</show_in_default>
82
+ <show_in_website>0</show_in_website>
83
  <show_in_store>1</show_in_store>
84
+ <source_model>lenexport/system_config_source_status</source_model>
85
  </productstatus>
86
  <!--<productchildren>
87
  <label>Export child product</label>
88
+ <comment>Export child for configurable product</comment>
89
  <frontend_type>select</frontend_type>
90
  <sort_order>90</sort_order>
91
  <show_in_default>1</show_in_default>
99
  <label>Data</label>
100
  <comment></comment>
101
  <show_in_default>1</show_in_default>
102
+ <show_in_website>0</show_in_website>
103
  <show_in_store>1</show_in_store>
104
  <sort_order>2</sort_order>
105
  <fields>
106
+ <format>
107
+ <label>Format</label>
 
108
  <frontend_type>select</frontend_type>
109
  <sort_order>10</sort_order>
110
  <show_in_default>1</show_in_default>
111
+ <show_in_website>0</show_in_website>
112
  <show_in_store>1</show_in_store>
113
+ <source_model>lenexport/system_config_source_format</source_model>
114
+ </format>
115
+ <count_images>
116
+ <label>Images max</label>
117
+ <frontend_type>select</frontend_type>
118
+ <sort_order>20</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>0</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <source_model>lenexport/system_config_source_images</source_model>
123
+ </count_images>
124
  <parentsimages>
125
  <label>Merge images with parents products if exist</label>
126
+ <comment></comment>
127
  <frontend_type>select</frontend_type>
128
+ <sort_order>30</sort_order>
129
  <show_in_default>1</show_in_default>
130
+ <show_in_website>0</show_in_website>
131
  <show_in_store>1</show_in_store>
132
  <source_model>adminhtml/system_config_source_yesno</source_model>
133
  </parentsimages>
134
+ <levelcategory>
135
+ <label>Level max for category</label>
136
+ <comment></comment>
137
+ <frontend_type>select</frontend_type>
138
+ <sort_order>40</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>0</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <source_model>lenexport/system_config_source_category_level</source_model>
143
+ </levelcategory>
144
+ <without_product_ordering>
145
+ <label>Stock without products ordering</label>
146
+ <frontend_type>select</frontend_type>
147
+ <sort_order>50</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>0</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ </without_product_ordering>
153
  <formatdata>
154
  <label>Convert data</label>
155
+ <comment><![CDATA[Replace special chars with html chars]]></comment>
156
  <frontend_type>select</frontend_type>
157
+ <sort_order>60</sort_order>
158
  <show_in_default>1</show_in_default>
159
+ <show_in_website>0</show_in_website>
160
  <show_in_store>1</show_in_store>
161
  <source_model>adminhtml/system_config_source_yesno</source_model>
162
  </formatdata>
163
+ <html_attributes>
164
+ <label>Keep html for the selected fields</label>
165
+ <frontend_type>multiselect</frontend_type>
166
+ <source_model>lenexport/system_config_source_getattributes</source_model>
167
+ <sort_order>70</sort_order>
168
  <show_in_default>1</show_in_default>
169
+ <show_in_website>0</show_in_website>
170
  <show_in_store>1</show_in_store>
171
+ </html_attributes>
 
172
  <shipping_price_based_on>
173
  <label>Country shipping</label>
174
  <comment>Default country for shipping cost</comment>
175
  <frontend_type>select</frontend_type>
176
  <source_model>adminhtml/system_config_source_country</source_model>
177
+ <sort_order>80</sort_order>
 
 
 
 
 
 
 
 
 
178
  <show_in_default>1</show_in_default>
179
+ <show_in_website>0</show_in_website>
180
  <show_in_store>1</show_in_store>
181
+ </shipping_price_based_on>
182
  <default_shipping_price>
183
  <label>Shipping cost</label>
184
  <comment>Default shipping cost if matching find</comment>
185
  <frontend_type>text</frontend_type>
186
+ <sort_order>90</sort_order>
187
  <show_in_default>1</show_in_default>
188
+ <show_in_website>0</show_in_website>
189
  <show_in_store>1</show_in_store>
190
  </default_shipping_price>
191
  <default_shipping_method>
193
  <comment>Default shipping method to calculate shipping cost</comment>
194
  <frontend_type>select</frontend_type>
195
  <source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
196
+ <sort_order>100</sort_order>
 
 
 
 
 
 
 
 
197
  <show_in_default>1</show_in_default>
198
+ <show_in_website>0</show_in_website>
199
  <show_in_store>1</show_in_store>
200
+ </default_shipping_method>
201
+ <default_shipping_delay>
202
+ <label>Delay of shipping</label>
203
+ <comment></comment>
204
+ <frontend_type>text</frontend_type>
205
+ <sort_order>110</sort_order>
206
  <show_in_default>1</show_in_default>
207
+ <show_in_website>0</show_in_website>
208
  <show_in_store>1</show_in_store>
209
+ </default_shipping_delay>
210
+ </fields>
211
+ </data>
212
+ <!-- selection des attributs -->
213
+ <attributelist translate="label">
214
+ <label>Product attributes</label>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>0</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <sort_order>3</sort_order>
219
+ <fields>
220
+ <attributes translate="label">
221
+ <label>Select attributes to export</label>
222
+ <frontend_type>multiselect</frontend_type>
223
+ <source_model>lenexport/system_config_source_getattributes</source_model>
224
+ <sort_order>10</sort_order>
225
  <show_in_default>1</show_in_default>
226
+ <show_in_website>0</show_in_website>
227
  <show_in_store>1</show_in_store>
228
+ </attributes>
 
229
  </fields>
230
+ </attributelist>
231
  <performances translate="label comment">
232
  <label>Performances</label>
233
  <show_in_default>1</show_in_default>
234
+ <show_in_website>0</show_in_website>
235
+ <show_in_store>0</show_in_store>
236
+ <sort_order>4</sort_order>
237
  <fields>
238
+ <valid_ip>
239
+ <label>Ip authorised to export</label>
240
+ <comment><![CDATA[Authorized acces to catalog export by IP, separated by ;]]></comment>
241
+ <frontend_type>text</frontend_type>
242
+ <sort_order>10</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>0</show_in_website>
245
+ <show_in_store>0</show_in_store>
246
+ </valid_ip>
247
  <usesavefile>
248
  <label>Save feed on file</label>
249
  <comment><![CDATA[Save the feed on a file]]></comment>
250
  <frontend_type>select</frontend_type>
251
+ <sort_order>10</sort_order>
252
  <show_in_default>1</show_in_default>
253
+ <show_in_website>0</show_in_website>
254
+ <show_in_store>0</show_in_store>
255
  <source_model>adminhtml/system_config_source_yesno</source_model>
256
  </usesavefile>
257
  <active_cron>
258
  <label><![CDATA[Active cron]]></label>
259
  <comment><![CDATA[Active the scheduled task for export your feed every 4h]]></comment>
260
  <frontend_type>select</frontend_type>
261
+ <sort_order>20</sort_order>
262
  <show_in_default>1</show_in_default>
263
+ <show_in_website>0</show_in_website>
264
+ <show_in_store>0</show_in_store>
265
  <source_model>adminhtml/system_config_source_yesno</source_model>
266
  </active_cron>
267
  </fields>
268
  </performances>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  </groups>
270
+ </lenexport>
271
  </sections>
272
  </config>
app/code/community/Lengow/Feed/Block/Adminhtml/Feed.php CHANGED
@@ -6,7 +6,7 @@
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Block_Adminhtml_Feed extends Mage_Adminhtml_Block_Widget_Container {
@@ -25,11 +25,11 @@ class Lengow_Feed_Block_Adminhtml_Feed extends Mage_Adminhtml_Block_Widget_Conta
25
  */
26
  protected function _prepareLayout() {
27
  $this->_addButton('migrate', array(
28
- 'label' => Mage::helper('feed')->__('Migrate all selected feeds'),
29
  'onclick' => 'form_grid_feed.submit()',
30
  'class' => 'save'
31
  ));
32
- $this->setChild('grid', $this->getLayout()->createBlock('feed/adminhtml_feed_grid', 'feed.grid'));
33
  return parent::_prepareLayout();
34
  }
35
 
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Block_Adminhtml_Feed extends Mage_Adminhtml_Block_Widget_Container {
25
  */
26
  protected function _prepareLayout() {
27
  $this->_addButton('migrate', array(
28
+ 'label' => Mage::helper('lenfeed')->__('Migrate all selected feeds'),
29
  'onclick' => 'form_grid_feed.submit()',
30
  'class' => 'save'
31
  ));
32
+ $this->setChild('grid', $this->getLayout()->createBlock('lenfeed/adminhtml_feed_grid', 'feed.grid'));
33
  return parent::_prepareLayout();
34
  }
35
 
app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Grid.php CHANGED
@@ -6,7 +6,7 @@
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_Grid {
@@ -23,31 +23,21 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
23
  $this->setUseAjax(true);
24
  $this->_filterVisibility = false;
25
  $this->_pagerVisibility = false;
26
- $this->_config_model = Mage::getSingleton('feed/config');
27
 
28
  // Set datas
29
- $this->setData('id_client', $this->_config_model->get('tracker/general/login'));
30
  $_lengow_ids_group = array();
31
  $_store_id = $this->getRequest()->getParam('store');
32
- /*if(!$_store_id) {
33
- $store_collection = Mage::getResourceModel('core/store_collection')
34
- ->addFieldToFilter('is_active', 1);
35
- foreach($store_collection as $store) {
36
- if(Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/group'))
37
- $_lengow_ids_group = array_merge($this->_getGroups(Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/group')), $_lengow_ids_group);
38
- }
39
- $_group = implode(',', $_lengow_ids_group);
40
- } else {*/
41
- $_group = Mage::getModel('sync/config')->setStore($_store_id)->getConfig('tracker/general/group');
42
- //}
43
  $this->setData('id_group', $_group);
44
- $this->setData('api_key', $this->_config_model->get('tracker/general/api_key'));
45
  $args = array();
46
  if(!empty($_store_id))
47
  $args['store'] = $_store_id;
48
  $this->setData('form_url', $this->getUrl('*/*/migrate', $args));
49
- $this->setData('json_feed', $this->_config_model->get('feed/general/json_feed'));
50
-
51
  }
52
 
53
  protected function _getStore() {
@@ -55,9 +45,9 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
55
  return Mage::app()->getStore($storeId);
56
  }
57
 
58
-
59
  protected function _prepareCollection() {
60
- $connector = Mage::helper('feed/data')->getConnector($this->getData('id_client'), $this->getData('api_key'));
61
 
62
  $args = array(
63
  'idClient' => (integer) $this->getData('id_client'),
@@ -84,18 +74,18 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
84
  $obj_feed->setData('product_child', (!empty($data_feeds->{$key}->product_child) ? $data_feeds->{$key}->product_child : ''));
85
  $obj_feed->setData('format', $data_feeds->{$key}->format);
86
  } else {
87
- // Apply default parameters
88
- $obj_feed->setData('selected_products', $this->_config_model->get('export/global/export_only_selected'));
89
- $obj_feed->setData('product_out_stock', $this->_config_model->get('export/global/export_soldout'));
90
- $obj_feed->setData('product_type', explode(',', $this->_config_model->get('export/global/producttype')));
91
- $obj_feed->setData('product_status', $this->_config_model->get('export/global/productstatus'));
92
- $obj_feed->setData('product_child', $this->_config_model->get('export/global/productchildren'));
93
- $obj_feed->setData('format', $this->_config_model->get('export/data/format'));
94
  }
95
  $collection->addItem($obj_feed);
96
  }
97
  } else {
98
- Mage::getSingleton('core/session')->addError(Mage::helper('feed')->__('Error API, please try to refresh the page.'));
99
  }
100
  $this->setCollection($collection);
101
  parent::_prepareCollection();
@@ -111,28 +101,28 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
111
  'field_name' => 'feed_id[]',
112
  ));
113
  $this->addColumn('id', array(
114
- 'header' => Mage::helper('feed')->__('Feed ID'),
115
  'width' => '50px',
116
  'index' => 'id',
117
  'filter' => false,
118
  'sortable' => false
119
  ));
120
  $this->addColumn('name', array(
121
- 'header' => Mage::helper('feed')->__('Feed Name'),
122
  'index' => 'name',
123
  'filter' => false,
124
  'sortable' => false,
125
  ));
126
  $this->addColumn('url', array(
127
- 'header' => Mage::helper('feed')->__('Current Feed'),
128
  'index' => 'url',
129
  'width' => '100px',
130
  'filter' => false,
131
  'sortable' => false,
132
- 'renderer' => 'feed/adminhtml_feed_renderer_url',
133
  ));
134
  $this->addColumn('selected_products', array(
135
- 'header' => Mage::helper('feed')->__('Export only selected product'),
136
  'index' => 'selected_products',
137
  'type' => 'select',
138
  'width' => '50px',
@@ -140,42 +130,42 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
140
  1 => __('Yes'),
141
  0 => __('No'),
142
  ),
143
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
144
  'filter' => false,
145
  'sortable' => false,
146
  ));
147
  $this->addColumn('product_out_stock', array(
148
- 'header' => Mage::helper('feed')->__('Export product out of stock'),
149
  'index' => 'product_out_stock',
150
  'options' => array(
151
  1 => __('Yes'),
152
  0 => __('No'),
153
  ),
154
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
155
  'filter' => false,
156
  'sortable' => false,
157
  ));
158
  $this->addColumn('product_type', array(
159
- 'header' => Mage::helper('feed')->__('Product type to export'),
160
  'index' => 'product_type',
161
- 'options' => Mage::getModel('export/system_config_source_types')->toSelectArray(),
162
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
163
  'filter' => false,
164
  'sortable' => false,
165
  'multiple' => true,
166
  ));
167
  $this->addColumn('product_status', array(
168
- 'header' => Mage::helper('feed')->__('Status of product to export'),
169
  'index' => 'product_status',
170
  'width' => '50px',
171
- 'options' => Mage::getModel('export/system_config_source_status')->toSelectArray(),
172
  'filter' => false,
173
  'sortable' => false,
174
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
175
  ));
176
  /*
177
  $this->addColumn('product_child', array(
178
- 'header' => Mage::helper('feed')->__('Export child product'),
179
  'index' => 'product_child',
180
  'width' => '50px',
181
  'options' => array(
@@ -184,28 +174,28 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
184
  ),
185
  'filter' => false,
186
  'sortable' => false,
187
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
188
  ));*/
189
  $this->addColumn('format', array(
190
- 'header' => Mage::helper('feed')->__('Format export'),
191
  'index' => 'format',
192
  'width' => '50px',
193
- 'options' => Mage::getModel('export/system_config_source_format')->toSelectArray(),
194
  'filter' => false,
195
  'sortable' => false,
196
- 'renderer' => 'feed/adminhtml_feed_renderer_select',
197
  ));
198
  $this->addColumn('action', array(
199
- 'header' => Mage::helper('feed')->__('Action'),
200
  'width' => '120',
201
  'align' => 'left',
202
  'filter' => false,
203
  'sortable' => false,
204
- 'renderer' => 'feed/adminhtml_feed_renderer_migrate',
205
  ));
206
  return parent::_prepareColumns();
207
  }
208
-
209
  protected function _prepareMassaction() {
210
 
211
  return $this;
@@ -217,7 +207,7 @@ class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_
217
 
218
  public function getRowUrl($row) {
219
  return '';
220
- }
221
 
222
  private function _getGroups($data) {
223
  $_groups = trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ',');
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Block_Adminhtml_Feed_Grid extends Mage_Adminhtml_Block_Widget_Grid {
23
  $this->setUseAjax(true);
24
  $this->_filterVisibility = false;
25
  $this->_pagerVisibility = false;
26
+ $this->_config_model = Mage::getSingleton('lenfeed/config');
27
 
28
  // Set datas
29
+ $this->setData('id_client', $this->_config_model->get('lentracker/general/login'));
30
  $_lengow_ids_group = array();
31
  $_store_id = $this->getRequest()->getParam('store');
32
+ $_group = Mage::getModel('lensync/config')->setStore($_store_id)->getConfig('lentracker/general/group');
 
 
 
 
 
 
 
 
 
 
33
  $this->setData('id_group', $_group);
34
+ $this->setData('api_key', $this->_config_model->get('lentracker/general/api_key'));
35
  $args = array();
36
  if(!empty($_store_id))
37
  $args['store'] = $_store_id;
38
  $this->setData('form_url', $this->getUrl('*/*/migrate', $args));
39
+ $this->setData('json_feed', $this->_config_model->get('lenfeed/general/json_feed'));
40
+
41
  }
42
 
43
  protected function _getStore() {
45
  return Mage::app()->getStore($storeId);
46
  }
47
 
48
+
49
  protected function _prepareCollection() {
50
+ $connector = Mage::helper('lenfeed/data')->getConnector($this->getData('id_client'), $this->getData('api_key'));
51
 
52
  $args = array(
53
  'idClient' => (integer) $this->getData('id_client'),
74
  $obj_feed->setData('product_child', (!empty($data_feeds->{$key}->product_child) ? $data_feeds->{$key}->product_child : ''));
75
  $obj_feed->setData('format', $data_feeds->{$key}->format);
76
  } else {
77
+ // Apply default parameters
78
+ $obj_feed->setData('selected_products', $this->_config_model->get('lenexport/global/export_only_selected'));
79
+ $obj_feed->setData('product_out_stock', $this->_config_model->get('lenexport/global/export_soldout'));
80
+ $obj_feed->setData('product_type', explode(',', $this->_config_model->get('lenexport/global/producttype')));
81
+ $obj_feed->setData('product_status', $this->_config_model->get('lenexport/global/productstatus'));
82
+ $obj_feed->setData('product_child', $this->_config_model->get('lenexport/global/productchildren'));
83
+ $obj_feed->setData('format', $this->_config_model->get('lenexport/data/format'));
84
  }
85
  $collection->addItem($obj_feed);
86
  }
87
  } else {
88
+ Mage::getSingleton('core/session')->addError(Mage::helper('lenfeed')->__('Error API, please try to refresh the page.'));
89
  }
90
  $this->setCollection($collection);
91
  parent::_prepareCollection();
101
  'field_name' => 'feed_id[]',
102
  ));
103
  $this->addColumn('id', array(
104
+ 'header' => Mage::helper('lenfeed')->__('Feed ID'),
105
  'width' => '50px',
106
  'index' => 'id',
107
  'filter' => false,
108
  'sortable' => false
109
  ));
110
  $this->addColumn('name', array(
111
+ 'header' => Mage::helper('lenfeed')->__('Feed Name'),
112
  'index' => 'name',
113
  'filter' => false,
114
  'sortable' => false,
115
  ));
116
  $this->addColumn('url', array(
117
+ 'header' => Mage::helper('lenfeed')->__('Current Feed'),
118
  'index' => 'url',
119
  'width' => '100px',
120
  'filter' => false,
121
  'sortable' => false,
122
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_url',
123
  ));
124
  $this->addColumn('selected_products', array(
125
+ 'header' => Mage::helper('lenfeed')->__('Export only selected product'),
126
  'index' => 'selected_products',
127
  'type' => 'select',
128
  'width' => '50px',
130
  1 => __('Yes'),
131
  0 => __('No'),
132
  ),
133
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
134
  'filter' => false,
135
  'sortable' => false,
136
  ));
137
  $this->addColumn('product_out_stock', array(
138
+ 'header' => Mage::helper('lenfeed')->__('Export product out of stock'),
139
  'index' => 'product_out_stock',
140
  'options' => array(
141
  1 => __('Yes'),
142
  0 => __('No'),
143
  ),
144
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
145
  'filter' => false,
146
  'sortable' => false,
147
  ));
148
  $this->addColumn('product_type', array(
149
+ 'header' => Mage::helper('lenfeed')->__('Product type to export'),
150
  'index' => 'product_type',
151
+ 'options' => Mage::getModel('lenexport/system_config_source_types')->toSelectArray(),
152
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
153
  'filter' => false,
154
  'sortable' => false,
155
  'multiple' => true,
156
  ));
157
  $this->addColumn('product_status', array(
158
+ 'header' => Mage::helper('lenfeed')->__('Status of product to export'),
159
  'index' => 'product_status',
160
  'width' => '50px',
161
+ 'options' => Mage::getModel('lenexport/system_config_source_status')->toSelectArray(),
162
  'filter' => false,
163
  'sortable' => false,
164
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
165
  ));
166
  /*
167
  $this->addColumn('product_child', array(
168
+ 'header' => Mage::helper('lenfeed')->__('Export child product'),
169
  'index' => 'product_child',
170
  'width' => '50px',
171
  'options' => array(
174
  ),
175
  'filter' => false,
176
  'sortable' => false,
177
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
178
  ));*/
179
  $this->addColumn('format', array(
180
+ 'header' => Mage::helper('lenfeed')->__('Format export'),
181
  'index' => 'format',
182
  'width' => '50px',
183
+ 'options' => Mage::getModel('lenexport/system_config_source_format')->toSelectArray(),
184
  'filter' => false,
185
  'sortable' => false,
186
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_select',
187
  ));
188
  $this->addColumn('action', array(
189
+ 'header' => Mage::helper('lenfeed')->__('Action'),
190
  'width' => '120',
191
  'align' => 'left',
192
  'filter' => false,
193
  'sortable' => false,
194
+ 'renderer' => 'lenfeed/adminhtml_feed_renderer_migrate',
195
  ));
196
  return parent::_prepareColumns();
197
  }
198
+
199
  protected function _prepareMassaction() {
200
 
201
  return $this;
207
 
208
  public function getRowUrl($row) {
209
  return '';
210
+ }
211
 
212
  private function _getGroups($data) {
213
  $_groups = trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ',');
app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Renderer/Migrate.php CHANGED
@@ -20,7 +20,7 @@ class Lengow_Feed_Block_Adminhtml_Feed_Renderer_Migrate extends Mage_Adminhtml_B
20
  public function render(Varien_Object $row) {
21
  return sprintf('<button type="submit" class="scalable save" name="submit" value="%s">%s</button>',
22
  $row->getData('id'),
23
- Mage::helper('feed')->__('Migrate Feed'));
24
  }
25
 
26
  }
20
  public function render(Varien_Object $row) {
21
  return sprintf('<button type="submit" class="scalable save" name="submit" value="%s">%s</button>',
22
  $row->getData('id'),
23
+ Mage::helper('lenfeed')->__('Migrate Feed'));
24
  }
25
 
26
  }
app/code/community/Lengow/Feed/Block/Adminhtml/Feed/Renderer/Url.php CHANGED
@@ -19,7 +19,7 @@ class Lengow_Feed_Block_Adminhtml_Feed_Renderer_Url extends Mage_Adminhtml_Block
19
  */
20
  public function render(Varien_Object $row) {
21
  $url = $row->getData('url');
22
- echo '<a class="popup-link" target="_blank" data-link="' . $url . '" href="' . $url . '">' . Mage::helper('feed')->__('View feed') . '</a>';
23
  }
24
 
25
  }
19
  */
20
  public function render(Varien_Object $row) {
21
  $url = $row->getData('url');
22
+ echo '<a class="popup-link" target="_blank" data-link="' . $url . '" href="' . $url . '">' . Mage::helper('lenfeed')->__('View feed') . '</a>';
23
  }
24
 
25
  }
app/code/community/Lengow/Feed/Helper/Data.php CHANGED
@@ -16,7 +16,7 @@ class Lengow_Feed_Helper_Data extends Mage_Core_Helper_Abstract {
16
  * @return array File format
17
  */
18
  public function getArrayFormat() {
19
- $format_array = Mage::getModel('export/system_config_source_format')->toOptionArray();
20
  $formats = array();
21
  foreach($format_array as $format) {
22
  $formats[] = $format['value'];
@@ -30,7 +30,7 @@ class Lengow_Feed_Helper_Data extends Mage_Core_Helper_Abstract {
30
  * @return array Product type
31
  */
32
  public function getProductTypeFormat() {
33
- $product_type_array = Mage::getModel('export/system_config_source_types')->toOptionArray();
34
  $types = array();
35
  foreach($product_type_array as $type) {
36
  $types[] = $type['value'];
@@ -43,7 +43,7 @@ class Lengow_Feed_Helper_Data extends Mage_Core_Helper_Abstract {
43
  * @return mixed Lengow connector object
44
  */
45
  public function getConnector($id_client, $api_key) {
46
- $connector = Mage::getSingleton('sync/connector');
47
  $connector->init((integer) $id_client, $api_key);
48
  return $connector;
49
  }
16
  * @return array File format
17
  */
18
  public function getArrayFormat() {
19
+ $format_array = Mage::getModel('lenexport/system_config_source_format')->toOptionArray();
20
  $formats = array();
21
  foreach($format_array as $format) {
22
  $formats[] = $format['value'];
30
  * @return array Product type
31
  */
32
  public function getProductTypeFormat() {
33
+ $product_type_array = Mage::getModel('lenexport/system_config_source_types')->toOptionArray();
34
  $types = array();
35
  foreach($product_type_array as $type) {
36
  $types[] = $type['value'];
43
  * @return mixed Lengow connector object
44
  */
45
  public function getConnector($id_client, $api_key) {
46
+ $connector = Mage::getSingleton('lensync/connector');
47
  $connector->init((integer) $id_client, $api_key);
48
  return $connector;
49
  }
app/code/community/Lengow/Feed/Model/Feed.php CHANGED
@@ -6,68 +6,68 @@
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Model_Feed extends Varien_Object {
13
 
14
  protected $_id;
15
-
16
  /**
17
  *
18
  * @var boolean Export only selected product
19
  */
20
  protected $_selected_products;
21
-
22
  /**
23
  *
24
  * @var boolean Export product out of stock
25
  */
26
  protected $_product_out_stock;
27
-
28
  /**
29
  *
30
  * @var string Product type to export
31
  */
32
  protected $_product_type;
33
-
34
  /**
35
  *
36
  * @var string Status of product to export
37
  */
38
  protected $_product_status;
39
-
40
  /**
41
  *
42
- * @var boolean Export product child
43
  */
44
  protected $_product_child;
45
-
46
  /**
47
  *
48
- * @var string Export Format
49
  */
50
  protected $_format;
51
-
52
  /**
53
- *
54
  * @var string Url feed
55
  */
56
  protected $_url;
57
-
58
  /**
59
- *
60
  * @var integer ID store
61
  */
62
  protected $_id_store;
63
-
64
  protected $_idClient;
65
  protected $_idGroup;
66
  protected $_api_key;
67
-
68
  /**
69
  * Buid feed object
70
- *
71
  * @param integer $id
72
  * @param boolean $selected_products
73
  * @param boolean $product_out_stock
@@ -84,17 +84,17 @@ class Lengow_Feed_Model_Feed extends Varien_Object {
84
  $this->_product_status = $args['product_status'];
85
  //$this->_product_child = $args['product_child'];
86
  $this->_format = $args['format'];
87
-
88
- $this->_config_model = Mage::getSingleton('feed/config');
89
-
90
- $this->_idClient = $this->_config_model->get('tracker/general/login');
91
  $this->_idGroup = $args['group_id'];
92
  $this->_id_store = $args['store_id'];
93
  //$this->_config_model->get('tracker/general/group');
94
- $this->_api_key = $this->_config_model->get('tracker/general/api_key');
95
  parent::__construct();
96
  }
97
-
98
  /**
99
  * Build url before update
100
  */
@@ -111,20 +111,20 @@ class Lengow_Feed_Model_Feed extends Varien_Object {
111
  $new_flow = Mage::getUrl('lengow/feed/index') . $params;
112
  $this->_url = $new_flow;
113
  }
114
-
115
  /**
116
  * Update feed on Lengow
117
  */
118
  public function update() {
119
  $this->_buildUrl();
120
- $connector = Mage::helper('feed/data')->getConnector($this->_idClient, $this->_api_key);
121
  $args = array(
122
  'idClient' => $this->_idClient,
123
  'idGroup' => $this->_idGroup,
124
  'urlFlux' => $this->_url,
125
  'idFlux' => $this->_id
126
  );
127
- Mage::helper('sync/data')->log('Test udate group ' . $this->_idGroup . ' : ' . $this->_url);
128
  return true;
129
  return $connector->api('updateRootFeed', $args);
130
  }
6
  * @category Lengow
7
  * @package Lengow_Feed
8
  * @author Romain Le Polh <romain@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Feed_Model_Feed extends Varien_Object {
13
 
14
  protected $_id;
15
+
16
  /**
17
  *
18
  * @var boolean Export only selected product
19
  */
20
  protected $_selected_products;
21
+
22
  /**
23
  *
24
  * @var boolean Export product out of stock
25
  */
26
  protected $_product_out_stock;
27
+
28
  /**
29
  *
30
  * @var string Product type to export
31
  */
32
  protected $_product_type;
33
+
34
  /**
35
  *
36
  * @var string Status of product to export
37
  */
38
  protected $_product_status;
39
+
40
  /**
41
  *
42
+ * @var boolean Export product child
43
  */
44
  protected $_product_child;
45
+
46
  /**
47
  *
48
+ * @var string Export Format
49
  */
50
  protected $_format;
51
+
52
  /**
53
+ *
54
  * @var string Url feed
55
  */
56
  protected $_url;
57
+
58
  /**
59
+ *
60
  * @var integer ID store
61
  */
62
  protected $_id_store;
63
+
64
  protected $_idClient;
65
  protected $_idGroup;
66
  protected $_api_key;
67
+
68
  /**
69
  * Buid feed object
70
+ *
71
  * @param integer $id
72
  * @param boolean $selected_products
73
  * @param boolean $product_out_stock
84
  $this->_product_status = $args['product_status'];
85
  //$this->_product_child = $args['product_child'];
86
  $this->_format = $args['format'];
87
+
88
+ $this->_config_model = Mage::getSingleton('lenfeed/config');
89
+
90
+ $this->_idClient = $this->_config_model->get('lentracker/general/login');
91
  $this->_idGroup = $args['group_id'];
92
  $this->_id_store = $args['store_id'];
93
  //$this->_config_model->get('tracker/general/group');
94
+ $this->_api_key = $this->_config_model->get('lentracker/general/api_key');
95
  parent::__construct();
96
  }
97
+
98
  /**
99
  * Build url before update
100
  */
111
  $new_flow = Mage::getUrl('lengow/feed/index') . $params;
112
  $this->_url = $new_flow;
113
  }
114
+
115
  /**
116
  * Update feed on Lengow
117
  */
118
  public function update() {
119
  $this->_buildUrl();
120
+ $connector = Mage::helper('lenfeed/data')->getConnector($this->_idClient, $this->_api_key);
121
  $args = array(
122
  'idClient' => $this->_idClient,
123
  'idGroup' => $this->_idGroup,
124
  'urlFlux' => $this->_url,
125
  'idFlux' => $this->_id
126
  );
127
+ Mage::helper('lensync/data')->log('Test udate group ' . $this->_idGroup . ' : ' . $this->_url);
128
  return true;
129
  return $connector->api('updateRootFeed', $args);
130
  }
app/code/community/Lengow/Feed/controllers/Adminhtml/Lengow/FeedController.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Lengow
6
  * @package Lengow_Feed
7
  * @author Romain Le Polh <romain@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Controller_Action {
@@ -22,7 +22,7 @@ class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Control
22
  public function gridAction() {
23
  $this->loadLayout();
24
  $this->getResponse()->setBody(
25
- $this->getLayout()->createBlock('feed/adminhtml_feed')->toHtml()
26
  );
27
  }
28
 
@@ -34,7 +34,7 @@ class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Control
34
  * Migrate feed
35
  */
36
  public function migrateAction() {
37
-
38
  $feed_ids = $this->getRequest()->getParam('feed_id');
39
  $selected_products = $this->getRequest()->getParam('selected_products');
40
  $product_out_stock = $this->getRequest()->getParam('product_out_stock');
@@ -44,21 +44,21 @@ class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Control
44
  $format = $this->getRequest()->getParam('format');
45
  $_lengow_ids_group = array();
46
  $_store_id = $this->getRequest()->getParam('store');
47
- Mage::helper('sync/data')->log('Test store : ' . $_store_id);
48
- $_group = Mage::getModel('sync/config')->setStore($_store_id)->getConfig('tracker/general/group');
49
-
50
  if($this->getRequest()->getParam('submit')) {
51
  $feed_ids = array($this->getRequest()->getParam('submit'));
52
  }
53
-
54
  $error = false;
55
  $message = '';
56
- $data_feeds = json_decode(Mage::getSingleton('feed/config')->get('feed/general/json_feed'));
57
  if(empty($data_feeds))
58
  $data_feeds = new stdClass;
59
  if(!empty($feed_ids)) {
60
  foreach($feed_ids as $feed_id) {
61
-
62
  $args = array(
63
  'feed_id' => $feed_id,
64
  'group_id' => $_group,
@@ -69,25 +69,25 @@ class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Control
69
  'product_status' => $product_status[$feed_id],
70
  //'product_child' => $product_child[$feed_id],
71
  'format' => $format[$feed_id]);
72
-
73
- $feed = Mage::getModel('feed/feed', $args);
74
  if(!$feed->update()) {
75
  $error = true;
76
- $message .= Mage::helper('feed')->__('Error update feed %s', '#' . $feed_id . '<br />');
77
  } else {
78
  $data_feeds->{$feed_id} = $args;
79
  }
80
  }
81
- Mage::getConfig()->saveConfig('feed/general/json_feed', json_encode($data_feeds));
82
  } else {
83
  $error = 'true';
84
- $message = Mage::helper('feed')->__('');
85
  }
86
-
87
  if($error)
88
  Mage::getSingleton('core/session')->addError($message);
89
  else
90
- Mage::getSingleton('core/session')->addSuccess(Mage::helper('feed')->__('Update success'));
91
  if(!empty($_store_id))
92
  $this->_redirect('*/*/index/', array('store' => $_store_id));
93
  else
5
  * @category Lengow
6
  * @package Lengow_Feed
7
  * @author Romain Le Polh <romain@lengow.com>
8
+ * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Feed_Adminhtml_Lengow_FeedController extends Mage_Adminhtml_Controller_Action {
22
  public function gridAction() {
23
  $this->loadLayout();
24
  $this->getResponse()->setBody(
25
+ $this->getLayout()->createBlock('lenfeed/adminhtml_feed')->toHtml()
26
  );
27
  }
28
 
34
  * Migrate feed
35
  */
36
  public function migrateAction() {
37
+
38
  $feed_ids = $this->getRequest()->getParam('feed_id');
39
  $selected_products = $this->getRequest()->getParam('selected_products');
40
  $product_out_stock = $this->getRequest()->getParam('product_out_stock');
44
  $format = $this->getRequest()->getParam('format');
45
  $_lengow_ids_group = array();
46
  $_store_id = $this->getRequest()->getParam('store');
47
+ Mage::helper('lensync/data')->log('Test store : ' . $_store_id);
48
+ $_group = Mage::getModel('lensync/config')->setStore($_store_id)->getConfig('lentracker/general/group');
49
+
50
  if($this->getRequest()->getParam('submit')) {
51
  $feed_ids = array($this->getRequest()->getParam('submit'));
52
  }
53
+
54
  $error = false;
55
  $message = '';
56
+ $data_feeds = json_decode(Mage::getSingleton('lenfeed/config')->get('lenfeed/general/json_feed'));
57
  if(empty($data_feeds))
58
  $data_feeds = new stdClass;
59
  if(!empty($feed_ids)) {
60
  foreach($feed_ids as $feed_id) {
61
+
62
  $args = array(
63
  'feed_id' => $feed_id,
64
  'group_id' => $_group,
69
  'product_status' => $product_status[$feed_id],
70
  //'product_child' => $product_child[$feed_id],
71
  'format' => $format[$feed_id]);
72
+
73
+ $feed = Mage::getModel('lenfeed/feed', $args);
74
  if(!$feed->update()) {
75
  $error = true;
76
+ $message .= Mage::helper('lenfeed')->__('Error update feed %s', '#' . $feed_id . '<br />');
77
  } else {
78
  $data_feeds->{$feed_id} = $args;
79
  }
80
  }
81
+ Mage::getConfig()->saveConfig('lenfeed/general/json_feed', json_encode($data_feeds));
82
  } else {
83
  $error = 'true';
84
+ $message = Mage::helper('lenfeed')->__('');
85
  }
86
+
87
  if($error)
88
  Mage::getSingleton('core/session')->addError($message);
89
  else
90
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('lenfeed')->__('Update success'));
91
  if(!empty($_store_id))
92
  $this->_redirect('*/*/index/', array('store' => $_store_id));
93
  else
app/code/community/Lengow/Feed/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Lengow_Feed>
5
- <version>2.0.1.5</version>
6
  </Lengow_Feed>
7
  </modules>
8
  <admin>
@@ -10,7 +10,7 @@
10
  <adminhtml>
11
  <args>
12
  <modules>
13
- <feed before="Mage_Adminhtml">Lengow_Feed_Adminhtml</feed>
14
  </modules>
15
  </args>
16
  </adminhtml>
@@ -18,10 +18,10 @@
18
  </admin>
19
  <global>
20
  <models>
21
- <feed>
22
  <class>Lengow_Feed_Model</class>
23
  <resourceModel>feed_mysql4</resourceModel>
24
- </feed>
25
  <feed_mysql4>
26
  <class>Lengow_Feed_Model_Mysql4</class>
27
  <entities>
@@ -32,31 +32,31 @@
32
  </feed_mysql4>
33
  </models>
34
  <resources>
35
- <feed_setup>
36
  <connection>
37
  <use>core_setup</use>
38
  </connection>
39
- </feed_setup>
40
- <feed_write>
41
  <connection>
42
  <use>core_write</use>
43
  </connection>
44
- </feed_write>
45
- <feed_read>
46
  <connection>
47
  <use>core_read</use>
48
  </connection>
49
- </feed_read>
50
  </resources>
51
  <blocks>
52
- <feed>
53
  <class>Lengow_Feed_Block</class>
54
- </feed>
55
  </blocks>
56
  <helpers>
57
- <feed>
58
  <class>Lengow_Feed_Helper</class>
59
- </feed>
60
  </helpers>
61
  </global>
62
  <adminhtml>
@@ -74,7 +74,7 @@
74
  <title>Lengow</title>
75
  <sort_order>20</sort_order>
76
  <children>
77
- <feed translate="title" module="feed">
78
  <title>Manage Feeds</title>
79
  <action>adminhtml/lengow_feed</action>
80
  <sort_order>300</sort_order>
@@ -90,18 +90,18 @@
90
  <children>
91
  <config>
92
  <children>
93
- <feed translate="title" module="feed">
94
  <title>Products</title>
95
- </feed>
96
  </children>
97
  </config>
98
  </children>
99
  </system>
100
- <lengow translate="title" module="feed">
101
  <children>
102
- <feed translate="title" module="feed">
103
  <title>Manage Feeds</title>
104
- </feed>
105
  </children>
106
  </lengow>
107
  </children>
2
  <config>
3
  <modules>
4
  <Lengow_Feed>
5
+ <version>2.1.0</version>
6
  </Lengow_Feed>
7
  </modules>
8
  <admin>
10
  <adminhtml>
11
  <args>
12
  <modules>
13
+ <lenfeed before="Mage_Adminhtml">Lengow_Feed_Adminhtml</lenfeed>
14
  </modules>
15
  </args>
16
  </adminhtml>
18
  </admin>
19
  <global>
20
  <models>
21
+ <lenfeed>
22
  <class>Lengow_Feed_Model</class>
23
  <resourceModel>feed_mysql4</resourceModel>
24
+ </lenfeed>
25
  <feed_mysql4>
26
  <class>Lengow_Feed_Model_Mysql4</class>
27
  <entities>
32
  </feed_mysql4>
33
  </models>
34
  <resources>
35
+ <lenfeed_setup>
36
  <connection>
37
  <use>core_setup</use>
38
  </connection>
39
+ </lenfeed_setup>
40
+ <lenfeed_write>
41
  <connection>
42
  <use>core_write</use>
43
  </connection>
44
+ </lenfeed_write>
45
+ <lenfeed_read>
46
  <connection>
47
  <use>core_read</use>
48
  </connection>
49
+ </lenfeed_read>
50
  </resources>
51
  <blocks>
52
+ <lenfeed>
53
  <class>Lengow_Feed_Block</class>
54
+ </lenfeed>
55
  </blocks>
56
  <helpers>
57
+ <lenfeed>
58
  <class>Lengow_Feed_Helper</class>
59
+ </lenfeed>
60
  </helpers>
61
  </global>
62
  <adminhtml>
74
  <title>Lengow</title>
75
  <sort_order>20</sort_order>
76
  <children>
77
+ <feed translate="title" module="lenfeed">
78
  <title>Manage Feeds</title>
79
  <action>adminhtml/lengow_feed</action>
80
  <sort_order>300</sort_order>
90
  <children>
91
  <config>
92
  <children>
93
+ <lenfeed translate="title" module="lenfeed">
94
  <title>Products</title>
95
+ </lenfeed>
96
  </children>
97
  </config>
98
  </children>
99
  </system>
100
+ <lengow translate="title" module="lenfeed">
101
  <children>
102
+ <lenfeed translate="title" module="lenfeed">
103
  <title>Manage Feeds</title>
104
+ </lenfeed>
105
  </children>
106
  </lengow>
107
  </children>
app/code/community/Lengow/Feed/etc/system.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
- <lengow translate="label" module="feed">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
- <feed translate="label" module="feed">
11
  <label>Feed configuration</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
@@ -35,6 +35,6 @@
35
  </fields>
36
  </general>
37
  </groups>
38
- </feed>
39
  </sections>
40
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
+ <lengow translate="label" module="lenfeed">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
+ <lenfeed translate="label" module="lenfeed">
11
  <label>Feed configuration</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
35
  </fields>
36
  </general>
37
  </groups>
38
+ </lenfeed>
39
  </sections>
40
  </config>
app/code/community/Lengow/Sync/Block/Adminhtml/Log.php CHANGED
@@ -13,11 +13,11 @@ class Lengow_Sync_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_C
13
  public function __construct() {
14
  parent::__construct();
15
  $this->_controller = 'adminhtml_log';
16
- $this->_blockGroup = 'sync';
17
  $this->_headerText = $this->__('Lengow logs');
18
  $this->_removeButton('add');
19
  $this->_addButton('deleteAll', array(
20
- 'label' => Mage::helper('sync')->__('Flush logs'),
21
  'onclick' => 'setLocation(\'' . $this->getUrl('*/*/delete') . '\')',
22
  'class' => 'delete'
23
  ));
13
  public function __construct() {
14
  parent::__construct();
15
  $this->_controller = 'adminhtml_log';
16
+ $this->_blockGroup = 'lensync';
17
  $this->_headerText = $this->__('Lengow logs');
18
  $this->_removeButton('add');
19
  $this->_addButton('deleteAll', array(
20
+ 'label' => Mage::helper('lensync')->__('Flush logs'),
21
  'onclick' => 'setLocation(\'' . $this->getUrl('*/*/delete') . '\')',
22
  'class' => 'delete'
23
  ));
app/code/community/Lengow/Sync/Block/Adminhtml/Log/Grid.php CHANGED
@@ -20,26 +20,26 @@ class Lengow_Sync_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_G
20
  }
21
 
22
  protected function _prepareCollection() {
23
- $collection = Mage::getModel('sync/log')->getCollection();
24
  $this->setCollection($collection);
25
  return parent::_prepareCollection();
26
  }
27
 
28
  protected function _prepareColumns() {
29
  $this->addColumn('id', array(
30
- 'header'=> Mage::helper('sync')->__('ID'),
31
  'width' => '80px',
32
  'type' => 'text',
33
  'index' => 'id',
34
  ));
35
  $this->addColumn('date', array(
36
- 'header' => Mage::helper('sync')->__('Created at'),
37
  'index' => 'date',
38
  'type' => 'datetime',
39
  'width' => '100px',
40
  ));
41
  $this->addColumn('message', array(
42
- 'header' => Mage::helper('sync')->__('Message'),
43
  'index' => 'message',
44
  ));
45
  return parent::_prepareColumns();
20
  }
21
 
22
  protected function _prepareCollection() {
23
+ $collection = Mage::getModel('lensync/log')->getCollection();
24
  $this->setCollection($collection);
25
  return parent::_prepareCollection();
26
  }
27
 
28
  protected function _prepareColumns() {
29
  $this->addColumn('id', array(
30
+ 'header'=> Mage::helper('lensync')->__('ID'),
31
  'width' => '80px',
32
  'type' => 'text',
33
  'index' => 'id',
34
  ));
35
  $this->addColumn('date', array(
36
+ 'header' => Mage::helper('lensync')->__('Created at'),
37
  'index' => 'date',
38
  'type' => 'datetime',
39
  'width' => '100px',
40
  ));
41
  $this->addColumn('message', array(
42
+ 'header' => Mage::helper('lensync')->__('Message'),
43
  'index' => 'message',
44
  ));
45
  return parent::_prepareColumns();
app/code/community/Lengow/Sync/Block/Adminhtml/Order.php CHANGED
@@ -13,7 +13,7 @@ class Lengow_Sync_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid
13
  public function __construct() {
14
  parent::__construct();
15
  $this->_controller = 'adminhtml_order';
16
- $this->_blockGroup = 'sync';
17
  $this->_headerText = $this->__('Lengow orders');
18
  }
19
 
13
  public function __construct() {
14
  parent::__construct();
15
  $this->_controller = 'adminhtml_order';
16
+ $this->_blockGroup = 'lensync';
17
  $this->_headerText = $this->__('Lengow orders');
18
  }
19
 
app/code/community/Lengow/Sync/Block/Adminhtml/Order/Grid.php CHANGED
@@ -98,17 +98,17 @@ class Lengow_Sync_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget
98
  ));
99
  // Add datas from Lengow
100
  $this->addColumn('order_id_lengow', array(
101
- 'header' => Mage::helper('sync')->__('Id lengow'),
102
  'index' => 'order_id_lengow',
103
  ));
104
 
105
  $this->addColumn('marketplace_lengow', array(
106
- 'header' => Mage::helper('sync')->__('Marketplace'),
107
  'index' => 'marketplace_lengow',
108
  ));
109
 
110
  $this->addColumn('fees_lengow', array(
111
- 'header'=> Mage::helper('sync')->__('Fees'),
112
  'type' => 'currency',
113
  'index' => 'fees_lengow',
114
  'currency' => 'base_currency_code',
98
  ));
99
  // Add datas from Lengow
100
  $this->addColumn('order_id_lengow', array(
101
+ 'header' => Mage::helper('lensync')->__('Id lengow'),
102
  'index' => 'order_id_lengow',
103
  ));
104
 
105
  $this->addColumn('marketplace_lengow', array(
106
+ 'header' => Mage::helper('lensync')->__('Marketplace'),
107
  'index' => 'marketplace_lengow',
108
  ));
109
 
110
  $this->addColumn('fees_lengow', array(
111
+ 'header'=> Mage::helper('lensync')->__('Fees'),
112
  'type' => 'currency',
113
  'index' => 'fees_lengow',
114
  'currency' => 'base_currency_code',
app/code/community/Lengow/Sync/Block/Adminhtml/Order/Tab.php CHANGED
@@ -5,12 +5,12 @@
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Romain Le Pohl <romain@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Block_Adminhtml_Order_Tab extends Mage_Adminhtml_Block_Sales_Order_Abstract
12
  implements Mage_Adminhtml_Block_Widget_Tab_Interface {
13
-
14
  protected function _construct() {
15
  $this->setTemplate('lengow/sales/order/tab/info.phtml');
16
  }
@@ -49,55 +49,63 @@ class Lengow_Sync_Block_Adminhtml_Order_Tab extends Mage_Adminhtml_Block_Sales_O
49
  public function isHidden() {
50
  return false;
51
  }
52
-
53
  /**
54
  * Get fields array
55
- *
56
  * @return Array
57
  */
58
  public function getFields() {
59
  $fields = array();
60
  $order = $this->getOrder();
61
-
62
  $fields[] = array(
63
- 'label' => Mage::helper('sync')->__('Lengow order ID'),
64
  'value' => $order->getData('order_id_lengow'),
65
  );
66
  $fields[] = array(
67
- 'label' => Mage::helper('sync')->__('Feed ID'),
68
  'value' => $order->getData('feed_id_lengow'),
69
  );
70
  $fields[] = array(
71
- 'label' => Mage::helper('sync')->__('Marketplace'),
72
  'value' => $order->getData('marketplace_lengow'),
73
  );
74
  $fields[] = array(
75
- 'label' => Mage::helper('sync')->__('Total paid'),
76
  'value' => $order->getData('total_paid_lengow'),
77
  );
78
  $fields[] = array(
79
- 'label' => Mage::helper('sync')->__('Carrier'),
80
  'value' => $order->getData('carrier_lengow'),
81
  );
82
  $fields[] = array(
83
- 'label' => Mage::helper('sync')->__('Carrier method'),
84
  'value' => $order->getData('carrier_method_lengow'),
85
  );
86
  $fields[] = array(
87
- 'label' => Mage::helper('sync')->__('Message'),
 
 
 
 
 
 
 
 
88
  'value' => $order->getData('message_lengow'),
89
  );
90
  $fields[] = array(
91
- 'label' => Mage::helper('sync')->__('Json Node'),
92
  'value' => '<textarea disabled="disabled">' . $order->getData('xml_node_lengow') . '</textarea>',
93
  );
94
-
95
  return $fields;
96
  }
97
-
98
  /**
99
  * Check if is a Lengow order
100
- *
101
  * @return boolean
102
  */
103
  public function isLengowOrder() {
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Romain Le Pohl <romain@lengow.com>
8
+ * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Block_Adminhtml_Order_Tab extends Mage_Adminhtml_Block_Sales_Order_Abstract
12
  implements Mage_Adminhtml_Block_Widget_Tab_Interface {
13
+
14
  protected function _construct() {
15
  $this->setTemplate('lengow/sales/order/tab/info.phtml');
16
  }
49
  public function isHidden() {
50
  return false;
51
  }
52
+
53
  /**
54
  * Get fields array
55
+ *
56
  * @return Array
57
  */
58
  public function getFields() {
59
  $fields = array();
60
  $order = $this->getOrder();
61
+
62
  $fields[] = array(
63
+ 'label' => Mage::helper('lensync')->__('Lengow order ID'),
64
  'value' => $order->getData('order_id_lengow'),
65
  );
66
  $fields[] = array(
67
+ 'label' => Mage::helper('lensync')->__('Feed ID'),
68
  'value' => $order->getData('feed_id_lengow'),
69
  );
70
  $fields[] = array(
71
+ 'label' => Mage::helper('lensync')->__('Marketplace'),
72
  'value' => $order->getData('marketplace_lengow'),
73
  );
74
  $fields[] = array(
75
+ 'label' => Mage::helper('lensync')->__('Total paid'),
76
  'value' => $order->getData('total_paid_lengow'),
77
  );
78
  $fields[] = array(
79
+ 'label' => Mage::helper('lensync')->__('Carrier'),
80
  'value' => $order->getData('carrier_lengow'),
81
  );
82
  $fields[] = array(
83
+ 'label' => Mage::helper('lensync')->__('Carrier method'),
84
  'value' => $order->getData('carrier_method_lengow'),
85
  );
86
  $fields[] = array(
87
+ 'label' => Mage::helper('lensync')->__('Carrier tracking'),
88
+ 'value' => $order->getData('carrier_tracking_lengow'),
89
+ );
90
+ $fields[] = array(
91
+ 'label' => Mage::helper('lensync')->__('Carrier id relay'),
92
+ 'value' => $order->getData('carrier_id_relay_lengow'),
93
+ );
94
+ $fields[] = array(
95
+ 'label' => Mage::helper('lensync')->__('Message'),
96
  'value' => $order->getData('message_lengow'),
97
  );
98
  $fields[] = array(
99
+ 'label' => Mage::helper('lensync')->__('Json Node'),
100
  'value' => '<textarea disabled="disabled">' . $order->getData('xml_node_lengow') . '</textarea>',
101
  );
102
+
103
  return $fields;
104
  }
105
+
106
  /**
107
  * Check if is a Lengow order
108
+ *
109
  * @return boolean
110
  */
111
  public function isLengowOrder() {
app/code/community/Lengow/Sync/Block/Payment/Info/Purchaseorder.php CHANGED
@@ -5,11 +5,11 @@
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Block_Payment_Info_Purchaseorder extends Mage_Payment_Block_Info {
12
-
13
  protected function _construct() {
14
  parent::_construct();
15
  $this->setTemplate('lengow/sales/payment/info/purchaseorder.phtml');
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
+ * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Block_Payment_Info_Purchaseorder extends Mage_Payment_Block_Info {
12
+
13
  protected function _construct() {
14
  parent::_construct();
15
  $this->setTemplate('lengow/sales/payment/info/purchaseorder.phtml');
app/code/community/Lengow/Sync/Helper/Data.php CHANGED
@@ -4,8 +4,8 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
@@ -17,11 +17,12 @@ class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
17
  * @param SimpleXMLElement $xml
18
  * @return array
19
  */
20
- public function xmlToAssoc(SimpleXMLElement $xml) {
 
21
  $array = array();
22
  foreach ($xml as $key => $value) {
23
  $array[$key] = trim((string)$value);
24
- if (empty($array[$key]) && !empty($value))
25
  $array[$key] = self::xmlToAssoc($value);
26
  else
27
  $array[$key] = (string)$value;
@@ -36,7 +37,8 @@ class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
36
  * @param bool $isCanonical - whether to ignore attributes
37
  * @return array|string
38
  */
39
- public function asArray(SimpleXMLElement $xml,$isCanonical = true) {
 
40
  $result = array();
41
  if (!$isCanonical) {
42
  // add attributes
@@ -52,7 +54,7 @@ class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
52
  if(!$child->hasChildren())
53
  $result[$childName] = $this->asArray($child,$isCanonical);
54
  else
55
- $result[$childName][] = $this->asArray($child,$isCanonical);
56
  }
57
  } else {
58
  if (empty($result)) {
@@ -65,20 +67,42 @@ class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
65
  }
66
  return $result;
67
  }
68
-
69
- public function log($message, $id_order = null) {
70
- $log_model = Mage::getModel('sync/log');
 
 
 
 
 
 
 
 
 
71
  $log_model->log($message, $id_order);
72
  return $this;
73
  }
74
-
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Clean None utf-8 characters
77
  * @param string $value
78
  * @return string $value
79
  */
80
- public function cleanNotUtf8($value) {
81
- $value = Mage::helper('core/string')->cleanString($value);
 
82
  //reject overly long 2 byte sequences, as well as characters above U+10000 and replace with blank
83
  $value = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'.
84
  '|[\x00-\x7F][\x80-\xBF]+'.
@@ -88,16 +112,31 @@ class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
88
  '', $value );
89
  //reject overly long 3 byte sequences and UTF-16 surrogates and replace with blank
90
  $value = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
91
- '|\xED[\xA0-\xBF][\x80-\xBF]/S','', $value );
92
  /*$value = preg_replace("/([\x80-\xFF])/e",
93
  "chr(0xC0|ord('\\1')>>6).chr(0x80|ord('\\1')&0x3F)",
94
- $value);*/
95
  $value = str_replace(chr(31),"", $value);
96
  $value = str_replace(chr(30),"", $value);
97
  $value = str_replace(chr(29),"", $value);
98
- $value = str_replace(chr(28),"", $value);
99
- //$value = iconv("UTF-8","UTF-8//IGNORE",$value);
100
  return $value;
101
  }
102
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Helper_Data extends Mage_Core_Helper_Abstract {
17
  * @param SimpleXMLElement $xml
18
  * @return array
19
  */
20
+ public function xmlToAssoc(SimpleXMLElement $xml)
21
+ {
22
  $array = array();
23
  foreach ($xml as $key => $value) {
24
  $array[$key] = trim((string)$value);
25
+ if (empty($array[$key]) && !empty($value))
26
  $array[$key] = self::xmlToAssoc($value);
27
  else
28
  $array[$key] = (string)$value;
37
  * @param bool $isCanonical - whether to ignore attributes
38
  * @return array|string
39
  */
40
+ public function asArray(SimpleXMLElement $xml,$isCanonical = true)
41
+ {
42
  $result = array();
43
  if (!$isCanonical) {
44
  // add attributes
54
  if(!$child->hasChildren())
55
  $result[$childName] = $this->asArray($child,$isCanonical);
56
  else
57
+ $result[$childName][] = $this->asArray($child,$isCanonical);
58
  }
59
  } else {
60
  if (empty($result)) {
67
  }
68
  return $result;
69
  }
70
+
71
+ /**
72
+ * Writes log
73
+ *
74
+ * @param string $message log message
75
+ * @param string $id_order lengow order id
76
+ *
77
+ * @return Lengow_Sync_Helper_Data
78
+ */
79
+ public function log($message, $id_order = null)
80
+ {
81
+ $log_model = Mage::getModel('lensync/log');
82
  $log_model->log($message, $id_order);
83
  return $this;
84
  }
85
+
86
+ /**
87
+ * Suppress log files when too old.
88
+ */
89
+ public function cleanLog()
90
+ {
91
+ $resource = Mage::getSingleton('core/resource');
92
+ $writeConnection = $resource->getConnection('core_write');
93
+ $table = $resource->getTableName('lensync/log');
94
+ $query = "DELETE FROM ".$table." WHERE date < DATE_SUB(NOW(),INTERVAL 20 DAY)";
95
+ $writeConnection->query($query);
96
+ }
97
+
98
  /**
99
  * Clean None utf-8 characters
100
  * @param string $value
101
  * @return string $value
102
  */
103
+ public function cleanNotUtf8($value)
104
+ {
105
+ $value = Mage::helper('core/string')->cleanString($value);
106
  //reject overly long 2 byte sequences, as well as characters above U+10000 and replace with blank
107
  $value = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'.
108
  '|[\x00-\x7F][\x80-\xBF]+'.
112
  '', $value );
113
  //reject overly long 3 byte sequences and UTF-16 surrogates and replace with blank
114
  $value = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
115
+ '|\xED[\xA0-\xBF][\x80-\xBF]/S','', $value );
116
  /*$value = preg_replace("/([\x80-\xFF])/e",
117
  "chr(0xC0|ord('\\1')>>6).chr(0x80|ord('\\1')&0x3F)",
118
+ $value);*/
119
  $value = str_replace(chr(31),"", $value);
120
  $value = str_replace(chr(30),"", $value);
121
  $value = str_replace(chr(29),"", $value);
122
+ $value = str_replace(chr(28),"", $value);
123
+ //$value = iconv("UTF-8","UTF-8//IGNORE",$value);
124
  return $value;
125
  }
126
+
127
+ /**
128
+ * Updates marketplace.xml
129
+ */
130
+ public function updateMarketplaceXML()
131
+ {
132
+ $config = Mage::getSingleton('lensync/config');
133
+ $mp_update = $config->get('hidden/last_synchro');
134
+ if (!$mp_update || !$mp_update == '0000-00-00' ||$mp_update != date('Y-m-d'))
135
+ $config->updateMarketPlaceConfiguration();
136
+ }
137
+
138
+ public function cleanMethod($method)
139
+ {
140
+ return str_replace(array(' ', '-', '\''), '_', $method);
141
+ }
142
  }
app/code/community/Lengow/Sync/Model/Config.php CHANGED
@@ -4,20 +4,20 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Config extends Varien_Object {
12
-
13
  /**
14
  * Config key "Debug mode"
15
  */
16
- const DEBUG_MODE = 'orders/debug';
17
-
18
  const MP_CONF_LENGOW = 'http://kml.lengow.com/mp.xml';
19
-
20
- protected $_id_store;
21
 
22
  protected $_file;
23
 
@@ -39,53 +39,75 @@ class Lengow_Sync_Model_Config extends Varien_Object {
39
  'vat_id' => 'na',
40
  );
41
 
42
- public function setStore($id_store) {
43
- $this->_id_store = $id_store;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  return $this;
45
  }
46
 
47
- public function getConfig($key) {
48
- return Mage::getStoreConfig($key, $this->_id_store);
 
 
 
 
 
 
49
  }
50
 
51
- public function get($key) {
52
- return Mage::getStoreConfig('sync/' . $key, $this->_id_store);
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
56
  * Map Magento address attribute codes with Neteven ones
57
  *
58
- * @param string $attributeCode
 
59
  * @return mixed
60
  */
61
- public function getMappedAddressAttributeCode($attribute_code) {
 
62
  return self::$ADDRESS_ATTRIBUTES[$attribute_code];
63
  }
64
 
65
- public function getOrderState($lengow) {
66
- switch ($lengow) {
67
- case 'new':
68
- return Mage_Sales_Model_Order::STATE_NEW;
69
- break;
70
- case 'processing':
71
- return Mage_Sales_Model_Order::STATE_PROCESSING;
72
- break;
73
- case 'shipped':
74
- return Mage_Sales_Model_Order::STATE_COMPLETE;
75
- break;
76
- case 'canceled':
77
- return Mage_Sales_Model_Order::STATE_CANCELED;
78
- break;
79
- }
80
- }
81
-
82
  /**
83
  * Is debug mode
84
  *
85
  * @return boolean
86
  */
87
- public function isDebugMode() {
88
- return $this->get(self::DEBUG_MODE);
 
89
  }
90
 
91
  /**
@@ -93,13 +115,14 @@ class Lengow_Sync_Model_Config extends Varien_Object {
93
  *
94
  * @return boolean.
95
  */
96
- public function updateMarketPlaceConfiguration() {
 
97
  if ($xml = fopen(self::MP_CONF_LENGOW, 'r')) {
98
- $markeplace = Mage::getModel('sync/marketplace');
99
  $handle = fopen(Mage::getModuleDir('etc', 'Lengow_Sync') . DS . $markeplace::$XML_MARKETPLACES . '', 'w');
100
  stream_copy_to_stream($xml, $handle);
101
  fclose($handle);
102
- Mage::getModel('core/config')->saveConfig('sync/hidden/last_synchro', date('Y-m-d'));
103
  }
104
  }
105
 
@@ -108,32 +131,67 @@ class Lengow_Sync_Model_Config extends Varien_Object {
108
  *
109
  * @return boolean.
110
  */
111
- public function importCanStart() {
112
- $timestamp = $this->readFlagFile();
113
- if($timestamp !== false) {
114
- $this->createFlagFile();
115
- return true;
116
- }
117
- if((time() - (integer) $timestamp) < (60*25)) {
 
 
 
118
  return false;
119
- } else {
120
- $this->createFlagFile();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  return true;
122
  }
 
 
123
  }
124
 
125
  /**
126
- * Create file flag.
127
  *
128
- * @return boolean.
129
  */
130
- public function readFlagFile() {
 
131
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS;
132
  if(is_file($file_path . 'import.flag')) {
133
- $this->_file = Mage::getModel('sync/file');
134
- $this->_file->checkAndCreateFolder($file_path);
135
  $this->_file->cd($file_path);
136
- $this->_file->streamOpen('import.flag', 'r+');
137
  $this->_file->streamLock();
138
  return $this->_file->streamRead(4096);
139
  } else {
@@ -142,35 +200,17 @@ class Lengow_Sync_Model_Config extends Varien_Object {
142
  }
143
 
144
  /**
145
- * Create file flag.
146
  *
147
- * @return boolean.
148
  */
149
- public function createFlagFile($clean = false) {
150
- if($clean)
151
- $_time = 0;
152
- else
153
- $_time = time();
154
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS;
155
- $this->_file->streamUnlock();
156
- $this->_file->streamClose();
157
  $this->_file->streamOpen('import.flag', 'w+');
158
- $this->_file->streamLock();
159
- $this->_file->streamWrite($_time);
160
- Mage::helper('sync/data')->log('Write on file log : ' . $_time);
161
  }
162
-
163
- /**
164
- * Clean file flag.
165
- *
166
- * @return boolean.
167
- */
168
- public function cleanFlagFile() {
169
- $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS;
170
- if(is_file($file_path . 'import.flag'))
171
- $this->createFlagFile(true);
172
- $this->_file->streamUnlock();
173
- $this->_file->streamClose();
174
- }
175
-
176
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Config extends Varien_Object {
12
+
13
  /**
14
  * Config key "Debug mode"
15
  */
16
+ const DEBUG_MODE = 'performances/debug';
17
+
18
  const MP_CONF_LENGOW = 'http://kml.lengow.com/mp.xml';
19
+
20
+ protected $store;
21
 
22
  protected $_file;
23
 
39
  'vat_id' => 'na',
40
  );
41
 
42
+ /**
43
+ * Constructor
44
+ */
45
+ public function __construct($args = null)
46
+ {
47
+ parent::__construct();
48
+ if (isset($args['store']))
49
+ $this->setStore($args['store']);
50
+ }
51
+
52
+ /**
53
+ * Set store
54
+ *
55
+ * @param $store
56
+ *
57
+ * @return Lengow_Sync_Model_Config
58
+ */
59
+ public function setStore($store)
60
+ {
61
+ $this->store = $store;
62
  return $this;
63
  }
64
 
65
+ /**
66
+ * Get store from config
67
+ *
68
+ * @return
69
+ */
70
+ public function getStore()
71
+ {
72
+ return $this->store;
73
  }
74
 
75
+ /**
76
+ * Get data from config
77
+ *
78
+ * @param string $key
79
+ *
80
+ * @return mixed
81
+ */
82
+ public function get($key)
83
+ {
84
+ if (is_null($this->store))
85
+ $id_store = null;
86
+ else
87
+ $id_store = $this->store->getId();
88
+ return Mage::getStoreConfig('lensync/' . $key, $id_store);
89
  }
90
 
91
  /**
92
  * Map Magento address attribute codes with Neteven ones
93
  *
94
+ * @param string $attribute_code
95
+ *
96
  * @return mixed
97
  */
98
+ public function getMappedAddressAttributeCode($attribute_code)
99
+ {
100
  return self::$ADDRESS_ATTRIBUTES[$attribute_code];
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  /**
104
  * Is debug mode
105
  *
106
  * @return boolean
107
  */
108
+ public function isDebugMode()
109
+ {
110
+ return $this->get(self::DEBUG_MODE) == 1 ? true : false;
111
  }
112
 
113
  /**
115
  *
116
  * @return boolean.
117
  */
118
+ public function updateMarketPlaceConfiguration()
119
+ {
120
  if ($xml = fopen(self::MP_CONF_LENGOW, 'r')) {
121
+ $markeplace = Mage::getModel('lensync/marketplace');
122
  $handle = fopen(Mage::getModuleDir('etc', 'Lengow_Sync') . DS . $markeplace::$XML_MARKETPLACES . '', 'w');
123
  stream_copy_to_stream($xml, $handle);
124
  fclose($handle);
125
+ Mage::getModel('core/config')->saveConfig('lensync/hidden/last_synchro', date('Y-m-d'));
126
  }
127
  }
128
 
131
  *
132
  * @return boolean.
133
  */
134
+ public function importCanStart()
135
+ {
136
+ if (is_null($this->_file))
137
+ $this->getFlagFile();
138
+ if (!$this->addFlagToFile()) {
139
+ $timestamp = $this->readFlagFile();
140
+ if ($timestamp !== false && (time() - (integer) $timestamp) > (60*25)) {
141
+ $this->addFlagToFile();
142
+ return true;
143
+ }
144
  return false;
145
+ }
146
+ return true;
147
+ }
148
+
149
+ /**
150
+ * Finish import
151
+ *
152
+ */
153
+ public function importSetEnd()
154
+ {
155
+ $this->getFlagFile();
156
+ $this->_file->streamUnlock();
157
+ $this->addFlagToFile(true);
158
+ $this->_file->streamClose();
159
+ }
160
+
161
+ /**
162
+ * Add flag to file
163
+ *
164
+ * @param boolean $reset
165
+ *
166
+ * @return boolean
167
+ */
168
+ public function addFlagToFile($reset = false)
169
+ {
170
+
171
+ if ($this->_file->streamLock()) {
172
+ if ($reset) {
173
+ if ($this->_file->streamErase())
174
+ $this->_file->streamWrite('0');
175
+ }
176
+ else {
177
+ $this->_file->streamWrite(time());
178
+ }
179
  return true;
180
  }
181
+ else
182
+ return false;
183
  }
184
 
185
  /**
186
+ * Read file flag
187
  *
188
+ * @return boolean
189
  */
190
+ public function readFlagFile()
191
+ {
192
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS;
193
  if(is_file($file_path . 'import.flag')) {
 
 
194
  $this->_file->cd($file_path);
 
195
  $this->_file->streamLock();
196
  return $this->_file->streamRead(4096);
197
  } else {
200
  }
201
 
202
  /**
203
+ * Create file flag
204
  *
205
+ * @return boolean
206
  */
207
+ public function getFlagFile()
208
+ {
209
+ $this->_file = new Lengow_Sync_Model_File();
 
 
210
  $file_path = Mage::getBaseDir('media') . DS . 'lengow' . DS;
211
+ $this->_file->checkAndCreateFolder($file_path);
212
+ $this->_file->cd($file_path);
213
  $this->_file->streamOpen('import.flag', 'w+');
214
+ Mage::helper('lensync/data')->log('Write on file log');
 
 
215
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
app/code/community/Lengow/Sync/Model/Connector.php CHANGED
@@ -33,12 +33,12 @@ if (!function_exists('simplexml_load_string')) {
33
  * @copyright 2013 Lengow SAS
34
  */
35
  class Lengow_Sync_Model_Connector {
36
-
37
  /**
38
  * Version.
39
  */
40
  const VERSION = '1.0.1';
41
-
42
  /**
43
  * Error.
44
  */
@@ -128,7 +128,7 @@ class Lengow_Sync_Model_Connector {
128
  }
129
  return true;
130
  }
131
-
132
  /**
133
  * The API method.
134
  *
@@ -148,7 +148,7 @@ class Lengow_Sync_Model_Connector {
148
  }
149
  return $data;
150
  }
151
-
152
  /**
153
  * Call the Lengow service with accepted method.
154
  *
@@ -173,7 +173,7 @@ class Lengow_Sync_Model_Connector {
173
  $result = $this->_makeRequest($url);
174
  return $this->_format($result, self::$DOMAIN_LENGOW[$service]['format']);
175
  }
176
-
177
  /**
178
  * Makes the Service API Url.
179
  *
@@ -216,7 +216,7 @@ class Lengow_Sync_Model_Connector {
216
  . (isset($array['state']) && !empty($array['state']) ? $array['state'] . '/' : '');
217
  return $url;
218
  }
219
-
220
  /**
221
  * Makes the Statisctics API Url.
222
  *
@@ -232,7 +232,7 @@ class Lengow_Sync_Model_Connector {
232
  . $array['dateFrom'] . '/'
233
  . $array['dateTo'] . '/'
234
  . $this->id_customer .'/'
235
- . $array['id']
236
  . '/total-All/';
237
  return $url;
238
  }
@@ -268,7 +268,7 @@ class Lengow_Sync_Model_Connector {
268
  }
269
  return null;
270
  }
271
-
272
  /**
273
  * Makes an HTTP request.
274
  *
@@ -277,7 +277,7 @@ class Lengow_Sync_Model_Connector {
277
  * @return string The response text
278
  */
279
  protected function _makeRequest($url) {
280
- Mage::helper('sync/data')->log('Connector ' . $url);
281
  $ch = curl_init();
282
  // Options
283
  $opts = self::$CURL_OPTS;
@@ -286,7 +286,7 @@ class Lengow_Sync_Model_Connector {
286
  curl_setopt_array($ch, $opts);
287
  $result = curl_exec($ch);
288
  if ($result === false) {
289
- Mage::helper('sync/data')->log('Connector Error (' . curl_error($ch) . ')' . $result);
290
  throw new Lengow_Sync_Model_Connector_Exception(
291
  array('message' => curl_error($ch),
292
  'type' => 'CurlException',
33
  * @copyright 2013 Lengow SAS
34
  */
35
  class Lengow_Sync_Model_Connector {
36
+
37
  /**
38
  * Version.
39
  */
40
  const VERSION = '1.0.1';
41
+
42
  /**
43
  * Error.
44
  */
128
  }
129
  return true;
130
  }
131
+
132
  /**
133
  * The API method.
134
  *
148
  }
149
  return $data;
150
  }
151
+
152
  /**
153
  * Call the Lengow service with accepted method.
154
  *
173
  $result = $this->_makeRequest($url);
174
  return $this->_format($result, self::$DOMAIN_LENGOW[$service]['format']);
175
  }
176
+
177
  /**
178
  * Makes the Service API Url.
179
  *
216
  . (isset($array['state']) && !empty($array['state']) ? $array['state'] . '/' : '');
217
  return $url;
218
  }
219
+
220
  /**
221
  * Makes the Statisctics API Url.
222
  *
232
  . $array['dateFrom'] . '/'
233
  . $array['dateTo'] . '/'
234
  . $this->id_customer .'/'
235
+ . $array['id']
236
  . '/total-All/';
237
  return $url;
238
  }
268
  }
269
  return null;
270
  }
271
+
272
  /**
273
  * Makes an HTTP request.
274
  *
277
  * @return string The response text
278
  */
279
  protected function _makeRequest($url) {
280
+ Mage::helper('lensync/data')->log('Connector ' . $url);
281
  $ch = curl_init();
282
  // Options
283
  $opts = self::$CURL_OPTS;
286
  curl_setopt_array($ch, $opts);
287
  $result = curl_exec($ch);
288
  if ($result === false) {
289
+ Mage::helper('lensync/data')->log('Connector Error (' . curl_error($ch) . ')' . $result);
290
  throw new Lengow_Sync_Model_Connector_Exception(
291
  array('message' => curl_error($ch),
292
  'type' => 'CurlException',
app/code/community/Lengow/Sync/Model/Customer/Customer.php CHANGED
@@ -4,54 +4,81 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Customer_Customer extends Mage_Customer_Model_Customer {
12
-
13
  /**
14
  * Convert xml node to customer model
15
  *
16
  * @param $xml_node SimpleXMLElement
17
  */
18
- public function setFromNode(SimpleXMLElement $xml_node, $id_store) {
19
- $id_store = Mage::getModel('core/store')->load($id_store)->getWebsiteId();
20
- $array = Mage::helper('sync')->xmlToAssoc($xml_node);
21
- if(empty($array['billing_address']['billing_email']))
22
- $array['billing_address']['billing_email'] = 'no-mail-' . $array['order_id'] . '@' . $array['marketplace'] . '.com';
23
- if(empty($array['billing_address']['billing_firstname']))
24
- $array['billing_address']['billing_firstname'] = '__';
25
- if(empty($array['delivery_address']['delivery_firstname']))
26
- $array['delivery_address']['delivery_firstname'] = '__';
27
- $this->setWebsiteId($id_store)
28
- ->loadByEmail($array['billing_address']['billing_email']);
 
29
  if(!$this->getId()) {
30
- $this->setImportMode(true);
31
- $this->setWebsiteId($id_store);
32
  $this->setConfirmation(null);
33
  $this->setForceConfirmed(true);
34
  $this->setPasswordHash($this->hashPassword($this->generatePassword(8)));
35
  $this->setFromLengow(1);
36
  }
 
37
  // Billing address
38
- $billing_address = $this->convertAddress($array['billing_address']);
 
 
 
 
 
 
 
39
  $this->addAddress($billing_address);
 
40
  // Shipping address
 
 
 
 
 
 
 
 
 
 
41
  $shipping_address = $this->convertAddress($array['delivery_address'], 'shipping');
42
  $this->addAddress($shipping_address);
43
  Mage::helper('core')->copyFieldset('lengow_convert_billing_address', 'to_customer', $array['billing_address'], $this);
 
 
 
 
44
  $this->save();
45
  return $this;
46
  }
47
-
48
  /**
49
  * Convert xml node to customer address model
50
  *
51
- * @param array $data
 
 
52
  * @return Mage_Customer_Model_Address
53
  */
54
- public function convertAddress(array $data, $type = 'billing') {
 
55
  $address = Mage::getModel('customer/address');
56
  $address->setId(null);
57
  $address->setIsDefaultBilling(true);
@@ -60,7 +87,7 @@ class Lengow_Sync_Model_Customer_Customer extends Mage_Customer_Model_Customer {
60
  $address->setIsDefaultBilling(false);
61
  $address->setIsDefaultShipping(true);
62
  }
63
- Mage::helper('core')->copyFieldset('lengow_convert_' . $type . '_address', 'to_' . $type . '_address', $data, $address);
64
  if($type == 'shipping')
65
  $type = 'delivery';
66
  $address_1 = $data[$type . '_address'];
@@ -70,27 +97,92 @@ class Lengow_Sync_Model_Customer_Customer extends Mage_Customer_Model_Customer {
70
  $address_1 = $address_2;
71
  $address_2 = null;
72
  }
73
- // Fix address 2
74
  if(!empty($address_2))
75
  $address_1 = $address_1 . "\n" . $address_2;
76
  $address_3 = $data[$type . '_address_complement'];
77
  if(!empty($address_3))
78
  $address_1 = $address_1 . "\n" . $address_3;
 
 
 
79
  $address->setStreet($address_1);
80
  $tel_1 = $data[$type . '_phone_office'];
81
  $tel_2 = $data[$type . '_phone_mobile'];
82
  // Fix tel
 
 
 
 
83
  if(!empty($tel_1))
84
  $address->setFax($tel_1);
85
  else if(!empty($tel_2))
86
  $address->setFax($tel_2);
87
- $codeRegion = substr(str_pad($address->getPostcode(), 5, '0', STR_PAD_LEFT), 0, 2);
88
  $id_region = Mage::getModel('directory/region')->getCollection()
89
  ->addRegionCodeFilter($codeRegion)
90
  ->addCountryFilter($address->getCountry())
91
  ->getFirstItem()
92
- ->getId();
93
  $address->setRegionId($id_region);
 
94
  return $address;
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Customer_Customer extends Mage_Customer_Model_Customer {
12
+
13
  /**
14
  * Convert xml node to customer model
15
  *
16
  * @param $xml_node SimpleXMLElement
17
  */
18
+ public function setFromNode(SimpleXMLElement $xml_node, $config)
19
+ {
20
+ $id_store = $config->getStore()->getStoreId();
21
+ $id_website = Mage::getModel('core/store')->load($id_store)->getWebsiteId();
22
+ $array = Mage::helper('lensync')->xmlToAssoc($xml_node);
23
+ if(empty($array['billing_address']['billing_email']) || $config->isDebugMode() || $config->get('orders/fake_email'))
24
+ $array['billing_address']['billing_email'] = $array['order_id'] . '-' . $array['marketplace'] . '@lengow.com';
25
+
26
+ // first get by email
27
+ $this->setWebsiteId($id_website)
28
+ ->loadByEmail($array['billing_address']['billing_email']);
29
+
30
  if(!$this->getId()) {
31
+ $this->setImportMode(true);
32
+ $this->setWebsiteId($id_website);
33
  $this->setConfirmation(null);
34
  $this->setForceConfirmed(true);
35
  $this->setPasswordHash($this->hashPassword($this->generatePassword(8)));
36
  $this->setFromLengow(1);
37
  }
38
+
39
  // Billing address
40
+ $temp_names = array(
41
+ 'firstname' => $array['billing_address']['billing_firstname'],
42
+ 'lastname' => $array['billing_address']['billing_lastname'],
43
+ );
44
+ $billing_names = self::getNames($temp_names, $config->get('orders/split_name'));
45
+ $array['billing_address']['billing_firstname'] = $billing_names['firstname'];
46
+ $array['billing_address']['billing_lastname'] = $billing_names['lastname'];
47
+ $billing_address = $this->convertAddress($array['billing_address']);
48
  $this->addAddress($billing_address);
49
+
50
  // Shipping address
51
+ $temp_names = array(
52
+ 'firstname' => $array['delivery_address']['delivery_firstname'],
53
+ 'lastname' => $array['delivery_address']['delivery_lastname'],
54
+ );
55
+ $billing_names = self::getNames($temp_names, $config->get('orders/split_name'));
56
+ $array['delivery_address']['delivery_firstname'] = $billing_names['firstname'];
57
+ $array['delivery_address']['delivery_lastname'] = $billing_names['lastname'];
58
+
59
+ if ($array['tracking_informations']['tracking_relay'] != '')
60
+ $array['delivery_address']['tracking_relay'] = $array['tracking_informations']['tracking_relay'];
61
  $shipping_address = $this->convertAddress($array['delivery_address'], 'shipping');
62
  $this->addAddress($shipping_address);
63
  Mage::helper('core')->copyFieldset('lengow_convert_billing_address', 'to_customer', $array['billing_address'], $this);
64
+
65
+ // set group
66
+ $this->setGroupId($config->get('orders/customer_group'));
67
+
68
  $this->save();
69
  return $this;
70
  }
71
+
72
  /**
73
  * Convert xml node to customer address model
74
  *
75
+ * @param array $data
76
+ * @param string $type
77
+ *
78
  * @return Mage_Customer_Model_Address
79
  */
80
+ public function convertAddress(array $data, $type = 'billing')
81
+ {
82
  $address = Mage::getModel('customer/address');
83
  $address->setId(null);
84
  $address->setIsDefaultBilling(true);
87
  $address->setIsDefaultBilling(false);
88
  $address->setIsDefaultShipping(true);
89
  }
90
+ Mage::helper('core')->copyFieldset('lengow_convert_' . $type . '_address', 'to_' . $type . '_address', $data, $address);
91
  if($type == 'shipping')
92
  $type = 'delivery';
93
  $address_1 = $data[$type . '_address'];
97
  $address_1 = $address_2;
98
  $address_2 = null;
99
  }
100
+ // Fix address 2
101
  if(!empty($address_2))
102
  $address_1 = $address_1 . "\n" . $address_2;
103
  $address_3 = $data[$type . '_address_complement'];
104
  if(!empty($address_3))
105
  $address_1 = $address_1 . "\n" . $address_3;
106
+ // adding relay to address
107
+ if (isset($data['tracking_relay']))
108
+ $address_1 .= ' - Relay : ' . $data['tracking_relay'];
109
  $address->setStreet($address_1);
110
  $tel_1 = $data[$type . '_phone_office'];
111
  $tel_2 = $data[$type . '_phone_mobile'];
112
  // Fix tel
113
+ $tel_1 = empty($tel_1) ? $tel_2 : $tel_1;
114
+
115
+ if (!empty($tel_1))
116
+ $this->setTelephone($tel_1);
117
  if(!empty($tel_1))
118
  $address->setFax($tel_1);
119
  else if(!empty($tel_2))
120
  $address->setFax($tel_2);
121
+ $codeRegion = (integer) substr(str_pad($address->getPostcode(), 5, '0', STR_PAD_LEFT), 0, 2);
122
  $id_region = Mage::getModel('directory/region')->getCollection()
123
  ->addRegionCodeFilter($codeRegion)
124
  ->addCountryFilter($address->getCountry())
125
  ->getFirstItem()
126
+ ->getId();
127
  $address->setRegionId($id_region);
128
+ $address->setCustomer($this);
129
  return $address;
130
  }
131
+
132
+ /**
133
+ * Check if firstname or lastname are empty
134
+ *
135
+ * @param array $array
136
+ * @param boolean $split
137
+ *
138
+ * @return array
139
+ */
140
+ protected static function getNames($array, $split)
141
+ {
142
+ if(empty($array['firstname'])) {
143
+ if (!empty($array['lastname'])) {
144
+ if ($split)
145
+ $array = self::splitNames($array['lastname']);
146
+ }
147
+ }
148
+ if (empty($array['lastname'])) {
149
+ if (!empty($array['firstname'])) {
150
+ if ($split)
151
+ $array = self::splitNames($array['firstname']);
152
+ }
153
+ }
154
+ if (empty($array['lastname']))
155
+ $array['lastname'] = '__';
156
+ if (empty($array['firstname'])) {
157
+ $array['firstname'] = '__';
158
+ }
159
+ return $array;
160
+ }
161
+
162
+ /**
163
+ * Split fullname
164
+ *
165
+ * @param string $fullname
166
+ *
167
+ * @return array
168
+ */
169
+ protected static function splitNames($fullname)
170
+ {
171
+ $split = explode(' ', $fullname);
172
+ if($split && count($split)) {
173
+ $names['firstname'] = $split[0];
174
+ $names['lastname'] = '';
175
+ for ($i=1; $i<count($split); $i++) {
176
+ if(!empty($names['lastname']))
177
+ $names['lastname'] .= ' ';
178
+
179
+ $names['lastname'] .= $split[$i];
180
+ }
181
+ } else {
182
+ $names['firstname'] = '__';
183
+ $names['lastname'] = empty($fullname) ? '__' : $fullname;
184
+ }
185
+ return $names;
186
+ }
187
+
188
  }
app/code/community/Lengow/Sync/Model/File.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Lengow_Sync_Model_File extends Varien_Io_File
4
+ {
5
+ /**
6
+ * Override adding the LOCK_NB option
7
+ * @param bool $exclusive
8
+ * @return bool
9
+ */
10
+ public function streamLock($exclusive = true)
11
+ {
12
+ if (!$this->_streamHandler) {
13
+ return false;
14
+ }
15
+ $this->_streamLocked = true;
16
+ $lock = $exclusive ? LOCK_EX : LOCK_SH;
17
+ return flock($this->_streamHandler, $lock | LOCK_NB);
18
+ }
19
+
20
+ public function streamErase()
21
+ {
22
+ if (!$this->_streamHandler) {
23
+ return false;
24
+ }
25
+ return ftruncate($this->_streamHandler, 0);
26
+ }
27
+ }
app/code/community/Lengow/Sync/Model/Import.php CHANGED
@@ -1,11 +1,12 @@
1
  <?php
 
2
  /**
3
  * Lengow sync model import
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Import extends Varien_Object {
@@ -14,239 +15,491 @@ class Lengow_Sync_Model_Import extends Varien_Object {
14
  * @var Mage_Sales_Model_Quote
15
  */
16
  protected $_quote = null;
17
-
18
  /**
19
  * @var Mage_Customer_Model_Customer
20
  */
21
  protected $_customer = null;
22
-
23
- /**
24
- * Config Data of Module Manageorders
25
- * @var Profileolabs_Lengow_Model_Manageorders_Config
26
- */
27
- protected $_config = null;
28
-
29
  protected $_ordersIdsImported = array();
30
-
31
  protected $_orderIdsAlreadyImported = array();
32
-
33
  protected $_result;
34
-
35
  protected $_resultSendOrder = "";
36
-
37
  protected $_isUnderVersion14 = null;
38
- /**
 
39
  * Product model
40
  *
41
  * @var Mage_Catalog_Model_Product
42
  */
43
  protected $_productModel;
44
 
45
- protected $store_id = 0;
46
 
47
- protected $_helper;
48
 
49
  public static $import_start = false;
50
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  /**
53
- * Construct the import manager
54
- *
55
- * @param $command varchar The command of import
56
- * @param mixed
57
  */
58
- public function exec($command = 'orders', $args = array()) {
59
- switch ($command) {
60
- case 'orders':
61
- return $this->_importOrders($args);
62
- default:
63
- return $this->_importOrders($args);
 
 
 
 
 
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
67
  /**
68
  * Makes the Orders API Url and imports all orders
69
  *
70
- * @param array $args The arguments to request at the API
 
 
71
  */
72
- protected function _importOrders($args = array()) {
73
- if(Mage::app()->getStore()->getCode() != 'admin')
74
- Mage::app()->setCurrentStore('admin');
75
- $this->_helper = Mage::helper('sync/data');
76
- $this->_config = Mage::getSingleton('sync/config')
77
- ->setStore($args['id_store']);
78
- $this->_checkVersionMarketplaceXML();
79
- $connector = Mage::getSingleton('sync/connector');
80
- self::$import_start = true;
81
  $count_orders_updated = 0;
82
  $count_orders_added = 0;
83
- $connector->init((integer) $this->_config->getConfig('tracker/general/login'),
84
- $this->_config->getConfig('tracker/general/api_key'));
85
- $orders = $connector->api('commands', array('dateFrom' => $args['dateFrom'],
86
- 'dateTo' => $args['dateTo'],
87
- 'id_group' => $this->_config->getConfig('tracker/general/group'),
88
- 'state' => 'plugin'));
89
- if(!is_object($orders)) {
90
- $error = $this->_helper->__('Error on lengow webservice');
91
- $this->_helper->log($error);
92
- return array('new' => 0,
93
- 'update' => 0,
94
- 'error' => $error);
95
- } else {
96
- $find_count_orders = count($orders->orders->order);
97
- $this->_helper->log('Find ' . $find_count_orders . ' order' . ($find_count_orders > 1 ? 's' : ''));
98
- }
99
- //LengowCore::debug($orders);
100
- $count_orders = (integer) $orders->orders_count->count_total;
101
- if(isset($orders->error) && (string) $orders->error == 'No Way') {
102
- $error = $this->_helper->__('API\'s connection refused with IP %s', (string) $orders->ip);
103
- $this->_helper->log($error);
104
- return array('new' => 0,
105
- 'update' => 0,
106
- 'error' => $error);
107
- }
108
- if($count_orders == 0) {
109
- $this->_helper->log('No orders to import between ' . $args['dateFrom'] . ' and ' . $args['dateTo'], $this->force_log_output);
110
- return false;
111
- }
112
- $model_order = Mage::getModel('sync/order', $args['id_store']);
113
- foreach($orders->orders->order as $key => $data) {
114
- $lengow_order = $data;
115
- $lengow_order_id = (string) $lengow_order->order_id;
116
- if($this->_config->isDebugMode() && !$this->getForceUpdate()) {
117
- $lengow_order_id = $lengow_order_id . time();
118
- }
119
- $marketplace = Mage::getModel('sync/marketplace');
120
- $marketplace->set((string) $lengow_order->marketplace);
121
- $id_flux = (integer) $lengow_order->idFlux;
122
- if((string) $lengow_order->order_status->marketplace == '') {
123
- $this->_helper->log('Order ' . $lengow_order_id . ' : no order\'s status');
124
  continue;
125
  }
126
- if((integer) $lengow_order->tracking_informations->tracking_deliveringByMarketPlace == 1) {
127
- $this->_helper->log('Order ' . $lengow_order_id . ' : delivry by the marketplace (' . $lengow_order->marketplace . ')');
 
 
128
  continue;
129
  }
130
- if($model_order->isAlreadyImported($lengow_order_id, $id_flux)) {
131
- $this->_helper->log('Order ' . $lengow_order_id . ' : already imported');
132
- $order_imported = $model_order->getOrderByIdLengow($lengow_order_id, $id_flux);
133
- $lengow_status = (string) $lengow_order->order_status->lengow;
134
- $this->_config->getOrderState($lengow_status);
135
- // Update status' order only if in process or shipped
136
- if($order_imported->getState() != $this->_config->getOrderState($lengow_status)) {
137
- if($order_imported->getState() == $this->_config->getOrderState('new') // Change state process to processing
138
- && $lengow_order->order_status->lengow == 'shipped') {
139
- $model_order->toInvoice($order_imported);
140
- $this->_helper->log('Order ' . $lengow_order_id . ' : update state to processing');
141
- $count_orders_updated++;
142
- } else if($order_imported->getState() == $this->_config->getOrderState('processing') // Change state process to shipped
143
- && $lengow_order->order_status->lengow == 'shipped') {
144
- $model_order->toShip($order_imported,
145
- (string) $lengow_order->tracking_informations->tracking_carrier,
146
- (string) $lengow_order->tracking_informations->tracking_method,
147
- (string) $lengow_order->tracking_informations->tracking_number);
148
- $this->_helper->log('Order ' . $lengow_order_id . ' : update state to shipped');
149
- $count_orders_updated++;
150
- } else if(($order_imported->current_state == $this->_config->getOrderState('process') // Change state process or shipped to cancel
151
- || $order_imported->current_state == $this->_config->getOrderState('shipped'))
152
- && $lengow_order->order_status->lengow == 'canceled') {
153
- $model_order->toCancel($order_imported);
154
- $this->_helper->log('Order ' . $lengow_order_id . ' : update state to cancel');
155
- $count_orders_updated++;
156
- }
157
- }
158
  } else {
159
  // Import only process order or shipped order and not imported with previous module
160
- $lengow_order_state = (string) $lengow_order->order_status->marketplace;
161
- $id_order_magento = (string) $lengow_order->order_external_id;
162
- if(($marketplace->getStateLengow($lengow_order_state) == 'processing'
163
- || $marketplace->getStateLengow($lengow_order_state) == 'shipped'
164
- || ($marketplace->getStateLengow($lengow_order_state) == 'new' && $this->_config->get('orders/pending'))) && !$id_order_magento) {
165
- // Check payment status
166
- $lengow_order_payment_status = (string) $lengow_order->order_payment->payment_status;
167
- // Break new order if not in pending payment
168
- $_to_order = true;
169
- if($marketplace->getStateLengow($lengow_order_state) == 'new' && $this->_config->get('orders/pending')) {
170
- $_to_order = false;
171
- if(empty($lengow_order_payment_status) || !$marketplace->getStatePaymentLengow($lengow_order_payment_status) == 'pending') {
172
- $this->_helper->log('Order ' . $lengow_order_id . ' : order\'s status ( ' . $lengow_order_state . ' - ' . $lengow_order_payment_status . ') not available to import');
173
- continue;
174
- }
175
- }
176
- $order = Mage::getModel('sync/order', $args['id_store']);
177
- // Create or Update customer with addresses
178
- $customer = Mage::getModel('sync/customer_customer');
179
- $customer->setFromNode($data, $args['id_store']);
180
- // Create order
181
- $payment_status = '';
182
- if(!$this->_config->get('orders/processing_fee')) {
183
- $data->order_amount = new SimpleXMLElement('<order_amount><![CDATA[' . ((float) $data->order_amount - (float) $data->order_processing_fee) . ']]></order_amount>');
184
- $data->order_processing_fee = new SimpleXMLElement('<order_processing_fee><![CDATA[ ]]></order_processing_fee>');
185
- $this->_helper->log('Order ' . $lengow_order_id . ' : rewrite amount without processing fee');
186
- }
187
- // Create quote
188
- if(!$quote = $order->createQuote($data, $customer)) {
189
- $this->_helper->log('Order ' . $lengow_order_id . ' : create order fail');
190
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  }
192
- $order = $order->makeOrder($data, $quote, $_to_order);
193
- if($order) {
194
- // Change order date
195
- if($this->_config->get('orders/date_import')) {
196
- $date = (string) $lengow_order->order_purchase_date . ' ' . (string) $lengow_order->order_purchase_heure;
197
- $order->setCreatedAt($date);
198
- $order->setUpdatedAt($date);
199
- $order->save();
200
- }
201
- // Sync to lengow
202
- if(!$this->_config->isDebugMode()) {
203
- $orders = $connector->api('getInternalOrderId', array(
204
- 'idClient' => (integer) $this->_config->getConfig('tracker/general/login'),
205
- 'idFlux' => $this->_config->getConfig('tracker/general/api_key'),
206
- 'Marketplace' => (string) $lengow_order->marketplace,
207
- 'idCommandeMP' => $lengow_order_id,
208
- 'idCommandeMage' => $order->getId(),
209
- 'statutCommandeMP' => (string) $lengow_order->order_status->lengow,
210
- 'statutCommandeMage' => $order->getState(),
211
- 'idQuoteMage' => $quote->getId(),
212
- 'Message' => 'Import depuis: ' . (string) $lengow_order->marketplace . '<br/>idOrder: '.$lengow_order_id,
213
- 'type' => 'Magento'
214
- ));
215
- $this->_helper->log('Order ' . $lengow_order_id . ' : sync with Lengow (Order ' . $order->getId() . ')');
216
- }
217
- $count_orders_added++;
218
- $this->_helper->log('Order ' . $lengow_order_id . ' : import success (' . $order->getId() . ')');
219
- if($lengow_order->order_status->lengow == 'shipped') {
220
- $id_flux = (integer) $lengow_order->idFlux;
221
- $model_order = Mage::getModel('sync/order', $args['id_store']);
222
- $order_imported = $model_order->getOrderByIdLengow($lengow_order_id, $id_flux);
223
- $model_order->toShip($order,
224
- (string) $lengow_order->tracking_informations->tracking_carrier,
225
- (string) $lengow_order->tracking_informations->tracking_method,
226
- (string) $lengow_order->tracking_informations->tracking_number);
227
- $this->_helper->log('Order ' . $lengow_order_id . ' : update state to shipped');
228
- }
229
- // Clear session
230
- Mage::getSingleton('checkout/session')->clear();
231
  }
232
- } else {
233
- if($id_order_magento) {
234
- $this->_helper->log('Order ' . $lengow_order_id . ' : already imported in Magento with order ID ' . $id_order_magento);
235
- } else {
236
- $this->_helper->log('Order ' . $lengow_order_id . ' : order\'s status ( ' . $lengow_order_state . ') not available to import');
237
  }
 
 
 
 
 
238
  }
 
239
  }
240
  }
241
  self::$import_start = false;
242
- return array('new' => $count_orders_added,
243
- 'update' => $count_orders_updated);
 
244
  }
245
 
246
- private function _checkVersionMarketplaceXML() {
247
- $mp_update = $this->_config->get('hidden/last_synchro');
248
- if (!$mp_update || !$mp_update == '0000-00-00' ||$mp_update != date('Y-m-d'))
249
- $this->_config->updateMarketPlaceConfiguration();
250
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
1
  <?php
2
+
3
  /**
4
  * Lengow sync model import
5
  *
6
  * @category Lengow
7
  * @package Lengow_Sync
8
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
9
+ * @copyright 2015 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Sync_Model_Import extends Varien_Object {
15
  * @var Mage_Sales_Model_Quote
16
  */
17
  protected $_quote = null;
18
+
19
  /**
20
  * @var Mage_Customer_Model_Customer
21
  */
22
  protected $_customer = null;
23
+
 
 
 
 
 
 
24
  protected $_ordersIdsImported = array();
25
+
26
  protected $_orderIdsAlreadyImported = array();
27
+
28
  protected $_result;
29
+
30
  protected $_resultSendOrder = "";
31
+
32
  protected $_isUnderVersion14 = null;
33
+
34
+ /**
35
  * Product model
36
  *
37
  * @var Mage_Catalog_Model_Product
38
  */
39
  protected $_productModel;
40
 
41
+ protected $_connector;
42
 
43
+ protected $_helper;
44
 
45
  public static $import_start = false;
46
 
47
+ protected $_dateFrom;
48
+
49
+ protected $_dateTo;
50
+
51
+ protected $_config;
52
+
53
+ protected $_idCustomer;
54
+
55
+ protected $_idGroup;
56
+
57
+ protected $_apiToken;
58
 
59
  /**
60
+ * Constructor
 
 
 
61
  */
62
+ public function __construct($args)
63
+ {
64
+ parent::__construct();
65
+ if(Mage::app()->getStore()->getCode() != 'admin')
66
+ Mage::app()->setCurrentStore('admin');
67
+
68
+ if (!is_array($args))
69
+ return;
70
+
71
+ foreach ($args as $key => $value) {
72
+ $this->{'_'.$key} = $value;
73
  }
74
+ $this->_helper = Mage::helper('lensync/data');
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * Execute import process
80
+ */
81
+ public function exec()
82
+ {
83
+ self::$import_start = true;
84
+ Mage::getSingleton('core/session')->setIsFromlengow('true');
85
+ $orders = $this->getLengowOrders();
86
+ if(!is_object($orders) || isset($orders->error)) {
87
+ $error = (string) $orders->error;
88
+ if (strtolower($error) == 'no way')
89
+ $message = $this->_helper->__('API\'s connection refused with IP %s', (string) $orders->ip);
90
+ $error = $this->_helper->__('Error on lengow webservice'.isset($message) ? ': ' . $message : json_encode($orders));
91
+ $this->_helper->log($error);
92
+ return array('new' => 0, 'update' => 0, 'error' => $error);
93
+ } else {
94
+ $count_orders = count($orders->orders->order);
95
+ if ($count_orders === 0) {
96
+ $this->_helper->log(
97
+ 'No orders to import between ' . $this->_dateFrom . ' and ' . $this->_dateTo,
98
+ $this->force_log_output
99
+ );
100
+ return false;
101
+ }
102
+ $this->_helper->log($count_orders . ' order' . ($count_orders > 1 ? 's ' : ' ') . 'found');
103
+ }
104
+ return $this->importOrders($orders);
105
+ }
106
+
107
+ /**
108
+ * Retrieve Lengow orders
109
+ *
110
+ * @return SimpleXmlElement list of orders to be imported
111
+ */
112
+ protected function getLengowOrders()
113
+ {
114
+ $this->_connector = Mage::getSingleton('lensync/connector');
115
+ $this->_connector->init((integer) $this->_idCustomer, $this->_apiToken);
116
+
117
+ if ($this->_connector->error)
118
+ return $connector;
119
+
120
+ return $this->_connector->api(
121
+ 'commands',
122
+ array(
123
+ 'dateFrom' => $this->_dateFrom,
124
+ 'dateTo' => $this->_dateTo,
125
+ 'id_group' => $this->_idGroup,
126
+ 'state' => 'plugin',
127
+ )
128
+ );
129
  }
130
 
131
  /**
132
  * Makes the Orders API Url and imports all orders
133
  *
134
+ * @param SimpleXmlElement $orders List of orders to be imported
135
+ *
136
+ * @return array Number of new and update orders
137
  */
138
+ protected function importOrders($orders)
139
+ {
 
 
 
 
 
 
 
140
  $count_orders_updated = 0;
141
  $count_orders_added = 0;
142
+
143
+ foreach($orders->orders->order as $key => $order_data) {
144
+ $model_order = Mage::getModel('lensync/order');
145
+ $model_order->setConfig($this->_config);
146
+
147
+ $id_lengow_order = (string) $order_data->order_id;
148
+
149
+ if($this->_config->isDebugMode())
150
+ $id_lengow_order .= '--'.time();
151
+
152
+ // check if order has a status
153
+ $marketplace_status = (string) $order_data->order_status->marketplace;
154
+ if (empty($marketplace_status)) {
155
+ $this->_helper->log('no order\'s status', $id_lengow_order);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  continue;
157
  }
158
+
159
+ // first check if not shipped by marketplace
160
+ if ((integer) $order_data->tracking_informations->tracking_deliveringByMarketPlace == 1) {
161
+ $this->_helper->log('delivery by marketplace (' . (string) $order_data->marketplace . ')', $id_lengow_order);
162
  continue;
163
  }
164
+
165
+ // convert marketplace status to Lengow equivalent
166
+ $marketplace = Mage::getModel('lensync/marketplace');
167
+ $marketplace->set((string) $order_data->marketplace);
168
+ $lengow_status = $marketplace->getStateLengow($marketplace_status);
169
+
170
+ // check if order has already been imported
171
+ $id_order = $model_order->isAlreadyImported($id_lengow_order, (integer) $order_data->idFlux);
172
+ if ($id_order) {
173
+ $order_imported = Mage::getModel('sales/order')->load($id_order);
174
+ $this->_helper->log('already imported in Magento with order ID ' . $order_imported->getIncrementId(), $id_lengow_order);
175
+ if ($model_order->updateState($order_imported, $lengow_status, $order_data))
176
+ $count_orders_updated++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  } else {
178
  // Import only process order or shipped order and not imported with previous module
179
+ $id_order_magento = $this->_config->isDebugMode() ? null : (string) $order_data->order_external_id;
180
+ if ($lengow_status == 'processing' || $lengow_status == 'shipped' && !$id_order_magento) {
181
+
182
+ // Create or Update customer with addresses
183
+ $customer = Mage::getModel('lensync/customer_customer');
184
+ $customer->setFromNode($order_data, $this->_config);
185
+
186
+ // rewrite order if processing fees not included
187
+ if(!$this->_config->get('orders/processing_fee')) {
188
+ $total_wt_proc_fees = (float) $order_data->order_amount - (float) $order_data->order_processing_fee;
189
+ $order_data->order_amount = new SimpleXMLElement('<order_amount><![CDATA[' . ($total_wt_proc_fees) . ']]></order_amount>');
190
+ $order_data->order_processing_fee = new SimpleXMLElement('<order_processing_fee><![CDATA[ ]]></order_processing_fee>');
191
+ $this->_helper->log('rewrite amount without processing fee', $id_lengow_order);
192
+ unset($total_wt_proc_fees);
193
+ }
194
+
195
+ try {
196
+ $quote = $this->_createQuote($id_lengow_order, $order_data, $customer, $marketplace);
197
+ } catch (Lengow_Sync_Model_Quote_Exception $e) {
198
+ $this->_helper->log('create quote fail : ' . $e->getMessage(), $id_lengow_order);
199
+ continue;
200
+ }
201
+ try {
202
+ $order = $this->makeOrder($id_lengow_order, $order_data, $quote, $model_order, true);
203
+ } catch (Exception $e) {
204
+ $this->_helper->log('create order fail : ' . $e->getMessage(), $id_lengow_order);
205
+ }
206
+
207
+ if($order) {
208
+ // Sync to lengow
209
+ if(!$this->_config->isDebugMode()) {
210
+ $orders = $this->_connector->api('getInternalOrderId', array(
211
+ 'idClient' => (integer) $this->_idCustomer,
212
+ 'idFlux' => (integer) $order_data->idFlux,
213
+ 'Marketplace' => (string) $order_data->marketplace,
214
+ 'idCommandeMP' => $id_lengow_order,
215
+ 'idCommandeMage' => $order->getId(),
216
+ 'statutCommandeMP' => (string) $order_data->order_status->lengow,
217
+ 'statutCommandeMage' => $order->getState(),
218
+ 'idQuoteMage' => $quote->getId(),
219
+ 'Message' => 'Import depuis: ' . (string) $order_data->marketplace . '<br/>idOrder: '.$id_lengow_order,
220
+ 'type' => 'Magento'
221
+ ));
222
+ $this->_helper->log('order successfully synchronised with Lengow webservice (Order ' . $order->getIncrementId() . ')', $id_lengow_order);
223
  }
224
+ $count_orders_added++;
225
+ $this->_helper->log('order successfully imported (Order ' . $order->getIncrementId() . ')', $id_lengow_order);
226
+ if($lengow_status == 'shipped') {
227
+ $model_order->toShip($order,
228
+ (string) $order_data->tracking_informations->tracking_carrier,
229
+ (string) $order_data->tracking_informations->tracking_method,
230
+ (string) $order_data->tracking_informations->tracking_number
231
+ );
232
+ $this->_helper->log('update state to "shipped" (Order ' . $order->getIncrementId() . ')', $id_lengow_order);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  }
234
+ unset($customer);
235
+ unset($quote);
236
+ unset($order);
 
 
237
  }
238
+ } else {
239
+ if($id_order_magento)
240
+ $this->_helper->log('already imported in Magento with order ID ' . $id_order_magento, $id_lengow_order);
241
+ else
242
+ $this->_helper->log('order\'s status (' . $lengow_status . ') not available to import', $id_lengow_order);
243
  }
244
+ unset($model_order);
245
  }
246
  }
247
  self::$import_start = false;
248
+ // Clear session
249
+ Mage::getSingleton('core/session')->clear();
250
+ return array('new' => $count_orders_added, 'update' => $count_orders_updated);
251
  }
252
 
253
+ /**
254
+ * Create quote
255
+ *
256
+ * @param string $id_lengow_order
257
+ * @param SimpleXMLelement $order_data
258
+ * @param Lengow_Sync_Model_Customer_Customer $customer
259
+ * @param Lengow_Sync_Model_Marketplace $marketplace
260
+ *
261
+ * @return Lengow_Sync_Model_Quote
262
+ */
263
+ protected function _createQuote($id_lengow_order, SimpleXMLelement $order_data, Lengow_Sync_Model_Customer_Customer $customer, Lengow_Sync_Model_Marketplace $marketplace)
264
+ {
265
+ $quote = Mage::getModel('lensync/quote')
266
+ ->setIsMultiShipping(false)
267
+ ->setStore($this->_config->getStore())
268
+ ->setIsSuperMode(true);
269
+
270
+ // import customer addresses into quote
271
+ // Set billing Address
272
+ $customer_billing_address = Mage::getModel('customer/address')
273
+ ->load($customer->getDefaultBilling());
274
+ $billing_address = Mage::getModel('sales/quote_address')
275
+ ->setShouldIgnoreValidation(true)
276
+ ->importCustomerAddress($customer_billing_address)
277
+ ->setSaveInAddressBook(0);
278
+
279
+ // Set shipping Address
280
+ $customer_shipping_address = Mage::getModel('customer/address')
281
+ ->load($customer->getDefaultShipping());
282
+ $shipping_address = Mage::getModel('sales/quote_address')
283
+ ->setShouldIgnoreValidation(true)
284
+ ->importCustomerAddress($customer_shipping_address)
285
+ ->setSaveInAddressBook(0)
286
+ ->setSameAsBilling(0);
287
+ $quote->assignCustomerWithAddressChange($customer, $billing_address, $shipping_address);
288
+
289
+ // check if store include tax (Product and shipping cost)
290
+ $priceIncludeTax = Mage::helper('tax')->priceIncludesTax($quote->getStore());
291
+ $shippingIncludeTax = Mage::helper('tax')->shippingPriceIncludesTax($quote->getStore());
292
+
293
+ // add product in quote
294
+ $quote->addLengowProducts($order_data->cart->products->product, $marketplace, $id_lengow_order, $priceIncludeTax);
295
+
296
+ // get shipping cost with tax
297
+ $shipping_cost = (float) $order_data->order_processing_fee + (float) $order_data->order_shipping;
298
+
299
+ // if shipping cost not include tax -> get shipping cost without tax
300
+ if(!$shippingIncludeTax) {
301
+ $basedOn = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $quote->getStore());
302
+ $country_id = ($basedOn == 'shipping') ? $shipping_address->getCountryId() : $billing_address->getCountryId();
303
+ $shippingTaxClass = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $quote->getStore());
304
+ $taxCalculator = Mage::getModel('tax/calculation');
305
+ $taxRequest = new Varien_Object();
306
+ $taxRequest->setCountryId($country_id)
307
+ ->setCustomerClassId($customer->getTaxClassId())
308
+ ->setProductClassId($shippingTaxClass);
309
+ $tax_rate = (float) $taxCalculator->getRate($taxRequest);
310
+ $tax_shipping_cost = (float) $taxCalculator->calcTaxAmount($shipping_cost, $tax_rate, true);
311
+ $shipping_cost = $shipping_cost - $tax_shipping_cost;
312
+ }
313
+
314
+ // get and update shipping rates for current order
315
+ $rates = $quote->getShippingAddress()
316
+ ->setCollectShippingRates(true)
317
+ ->collectShippingRates()
318
+ ->getShippingRatesCollection();
319
+ $shipping_method = $this->updateRates($rates, $id_lengow_order, $shipping_cost);
320
+
321
+ // set shipping price and shipping method for current order
322
+ $quote->getShippingAddress()
323
+ ->setShippingPrice($shipping_cost)
324
+ ->setShippingMethod($shipping_method);
325
+
326
+ // collect totals
327
+ $quote->collectTotals();
328
+
329
+ // Re-ajuste cents for item quote
330
+ // Conversion Tax Include > Tax Exclude > Tax Include maybe make 0.01 amount error
331
+ if (!$priceIncludeTax) {
332
+ if($quote->getGrandTotal() != (float) $order_data->order_amount) {
333
+ $quote_items = $quote->getAllItems();
334
+ foreach ($quote_items as $item) {
335
+ $row_total_lengow = (float) $quote->getRowTotalLengow((string) $item->getProduct()->getId());
336
+ if ($row_total_lengow != $item->getRowTotalInclTax()) {
337
+ $diff = $row_total_lengow - $item->getRowTotalInclTax();
338
+ $item->setPriceInclTax($item->getPriceInclTax() + ($diff / $item->getQty()));
339
+ $item->setBasePriceInclTax($item->getPriceInclTax());
340
+ $item->setPrice($item->getPrice() + ($diff / $item->getQty()));
341
+ $item->setOriginalPrice($item->getPrice());
342
+ $item->setRowTotal($item->getRowTotal() + $diff);
343
+ $item->setBaseRowTotal($item->getRowTotal());
344
+ $item->setRowTotalInclTax((float) $row_total_lengow);
345
+ $item->setBaseRowTotalInclTax($item->getRowTotalInclTax());
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ // set payment method lengow
352
+ $quote->getPayment()
353
+ ->importData(
354
+ array(
355
+ 'method' => 'lengow',
356
+ 'marketplace' => (string) $order_data->marketplace . ' - ' . (string) $order_data->order_payment->payment_type,
357
+ )
358
+ );
359
+
360
+ $quote->save();
361
+ return $quote;
362
+ }
363
 
364
+ /**
365
+ * Create order
366
+ *
367
+ * @param string $id_lengow_order
368
+ * @param SimpleXMLelement $order_data
369
+ * @param Lengow_Sync_Model_Quote $quote
370
+ * @param Lengow_Sync_Model_Order $model_order
371
+ * @param boolean $invoice
372
+ *
373
+ * @return Mage_Sales_Model_Order
374
+ */
375
+ protected function makeOrder($id_lengow_order, SimpleXMLelement $order_data, Lengow_Sync_Model_Quote $quote, Mage_Sales_Model_Order $model_order, $invoice = true)
376
+ {
377
+ try {
378
+ $additional_data = array('from_lengow' => true ,
379
+ 'marketplace_lengow' => (string) $order_data->marketplace ,
380
+ 'fees_lengow' => (float) $order_data->order_commission ,
381
+ 'order_id_lengow' => $id_lengow_order ,
382
+ 'feed_id_lengow' => (integer) $order_data->idFlux ,
383
+ 'xml_node_lengow' => Mage::helper('Core')->jsonEncode($order_data) ,
384
+ 'message_lengow' => (string) $order_data->order_comments ,
385
+ 'total_paid_lengow' => (float) $order_data->order_amount ,
386
+ 'carrier_lengow' => (string) $order_data->tracking_informations->tracking_carrier ,
387
+ 'carrier_method_lengow' => (string) $order_data->tracking_informations->tracking_method ,
388
+ 'carrier_tracking_lengow' => (string) $order_data->tracking_informations->tracking_number ,
389
+ 'carrier_id_relay_lengow' => (string) $order_data->tracking_informations->tracking_relay ,
390
+ 'global_currency_code' => (string) $order_data->order_currency ,
391
+ 'base_currency_code' => (string) $order_data->order_currency ,
392
+ 'store_currency_code' => (string) $order_data->order_currency ,
393
+ 'order_currency_code' => (string) $order_data->order_currency ,
394
+ );
395
+
396
+ $service = Mage::getModel('sales/service_quote', $quote);
397
+ $service->setOrderData($additional_data);
398
+ $order = false;
399
+ if(method_exists($service, 'submitAll')) {
400
+ $service->submitAll();
401
+ $order = $service->getOrder();
402
+ } else {
403
+ $order = $service->submit();
404
+ }
405
+ if (!$order)
406
+ throw new Exception('service unable to create order based on given quote');
407
+
408
+ $order->setIsFromLengow(true);
409
+ // modify order dates to use actual dates
410
+ if ($this->_config->get('orders/date_import')) {
411
+ $date_mp = (string) $order_data->order_purchase_date . ' ' . (string) $order_data->order_purchase_heure;
412
+ $server_timezone = date_default_timezone_get();
413
+ date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));
414
+ $date_UTC = gmdate('Y-m-d H:i:s', strtotime($date_mp));
415
+ date_default_timezone_set($server_timezone);
416
+ $order->setCreatedAt($date_UTC);
417
+ $order->setUpdatedAt($date_UTC);
418
+ }
419
+ $order->save();
420
+
421
+ // Re-ajuste cents for total and shipping cost
422
+ // Conversion Tax Include > Tax Exclude > Tax Include maybe make 0.01 amount error
423
+ $priceIncludeTax = Mage::helper('tax')->priceIncludesTax($quote->getStore());
424
+ $shippingIncludeTax = Mage::helper('tax')->shippingPriceIncludesTax($quote->getStore());
425
+ if (!$priceIncludeTax || !$shippingIncludeTax) {
426
+ if($order->getGrandTotal() != (float) $order_data->order_amount) {
427
+ // check Grand Total
428
+ $diff = (((float) $order_data->order_amount) - $order->getGrandTotal());
429
+ $order->setGrandTotal((float) $order_data->order_amount);
430
+ $order->setBaseGrandTotal($order->getGrandTotal());
431
+ // if the difference is only on the grand total, removing the difference of shipping cost
432
+ if (($order->getSubtotalInclTax() + $order->getShippingInclTax()) == (float) $order_data->order_amount) {
433
+ $order->setShippingAmount($order->getShippingAmount() + $diff);
434
+ $order->setBaseShippingAmount($order->getShippingAmount());
435
+ } else {
436
+ // check Shipping Cost
437
+ $diff_shipping = 0;
438
+ $shipping_cost = (float) $order_data->order_processing_fee + (float) $order_data->order_shipping;
439
+ if($order->getShippingInclTax() != (float) $shipping_cost) {
440
+ $diff_shipping = ($shipping_cost - $order->getShippingInclTax());
441
+ $order->setShippingAmount($order->getShippingAmount() + $diff_shipping);
442
+ $order->setBaseShippingAmount($order->getShippingAmount());
443
+ $order->setShippingInclTax($shipping_cost);
444
+ $order->setBaseShippingInclTax($order->getShippingInclTax());
445
+ }
446
+ // update Subtotal without shipping cost
447
+ $order->setSubtotalInclTax($order->getSubtotalInclTax() + ($diff - $diff_shipping));
448
+ $order->setBaseSubtotalInclTax($order->getSubtotalInclTax());
449
+ $order->setSubtotal($order->getSubtotal() + ($diff - $diff_shipping));
450
+ $order->setBaseSubtotal($order->getSubtotal());
451
+ }
452
+ }
453
+ $order->save();
454
+ }
455
+
456
+ // generate invoice for order
457
+ if ($invoice && $order->canInvoice()) {
458
+ $model_order->toInvoice($order);
459
+ }
460
+
461
+ $carrier_name = (string) $order_data->tracking_informations->tracking_carrier;
462
+ if ((string) $carrier_name === 'None' || $carrier_name == '')
463
+ $carrier_name = (string) $order_data->tracking_informations->tracking_method;
464
+ $order->setShippingDescription($order->getShippingDescription() . ' [marketplace shipping method : ' . $carrier_name . ']');
465
+
466
+ $order->save();
467
+ } catch (Exception $e){
468
+ Mage::helper('lensync')->log('error create order : ' . $e->getMessage(), $id_lengow_order);
469
+ }
470
+ return $order;
471
+ }
472
+
473
+ /**
474
+ * Update Rates with shipping cost
475
+ *
476
+ * @param $rates
477
+ * @param string $id_lengow_order
478
+ * @param float $shipping_cost
479
+ * @param string $shipping_method
480
+ * @param boolean $first stop recursive effect
481
+ *
482
+ * @return boolean
483
+ */
484
+ protected function updateRates($rates, $id_lengow_order, $shipping_cost, $shipping_method = null, $first = true)
485
+ {
486
+ if (!$shipping_method)
487
+ $shipping_method = $this->_config->get('orders/default_shipping');
488
+ foreach ($rates as &$rate) {
489
+ // make sure the chosen shipping method is correct
490
+ if ($rate->getCode() == $shipping_method) {
491
+ if ($rate->getPrice() != $shipping_cost) {
492
+ $rate->setPrice($shipping_cost);
493
+ $rate->setCost($shipping_cost);
494
+ }
495
+ return $rate->getCode();
496
+ }
497
+ }
498
+ // stop recursive effect
499
+ if (!$first)
500
+ return 'lengow_lengow';
501
+ // get lengow shipping method if selected shipping method is unavailable
502
+ $this->_helper->log('the selected shipping method is unavailable for current order. Lengow shipping method assigned.', $id_lengow_order);
503
+ return $this->updateRates($rates, $id_lengow_order, $shipping_cost, 'lengow_lengow', false);
504
+ }
505
  }
app/code/community/Lengow/Sync/Model/Log.php CHANGED
@@ -10,8 +10,9 @@
10
  */
11
  class Lengow_Sync_Model_Log extends Mage_Core_Model_Abstract {
12
 
13
- protected function _construct() {
14
- $this->_init('sync/log');
 
15
  }
16
 
17
  /**
@@ -19,10 +20,11 @@ class Lengow_Sync_Model_Log extends Mage_Core_Model_Abstract {
19
  * @param $message string
20
  * @param $id_order int
21
  */
22
- public function log($message, $id_order = null) {
 
23
  $order_message = '';
24
  if(!is_null($id_order)) {
25
- $order_message = Mage::helper('sync')->__('ID Order') . ' Lengow #' . $id_order . ' ';
26
  }
27
  $message = $order_message . $message;
28
  $this->setMessage($message);
10
  */
11
  class Lengow_Sync_Model_Log extends Mage_Core_Model_Abstract {
12
 
13
+ protected function _construct()
14
+ {
15
+ $this->_init('lensync/log');
16
  }
17
 
18
  /**
20
  * @param $message string
21
  * @param $id_order int
22
  */
23
+ public function log($message, $id_order = null)
24
+ {
25
  $order_message = '';
26
  if(!is_null($id_order)) {
27
+ $order_message = Mage::helper('lensync')->__('ID Order') . ' Lengow #' . $id_order . ' ';
28
  }
29
  $message = $order_message . $message;
30
  $this->setMessage($message);
app/code/community/Lengow/Sync/Model/Marketplace.php CHANGED
@@ -52,8 +52,8 @@ class Lengow_Sync_Model_Marketplace {
52
  *
53
  * @param string $name The name of the marketplace
54
  */
55
- public function set($name) {
56
- $this->_helper = Mage::helper('sync/data');
57
  $this->_loadXml();
58
  $this->name = strtolower($name);
59
  $object = self::$DOM->xpath('/marketplaces/marketplace[@name=\'' . $this->name . '\']');
@@ -104,7 +104,7 @@ class Lengow_Sync_Model_Marketplace {
104
  }
105
 
106
  /**
107
- * Get the real lengow's state
108
  *
109
  * @param string $name The marketplace state
110
  *
@@ -115,7 +115,7 @@ class Lengow_Sync_Model_Marketplace {
115
  }
116
 
117
  /**
118
- * Get the marketplace's state
119
  *
120
  * @param string $name The lengow state
121
  *
@@ -126,7 +126,7 @@ class Lengow_Sync_Model_Marketplace {
126
  }
127
 
128
  /**
129
- * Get the real lengow's payment
130
  *
131
  * @param string $name The payment state
132
  *
@@ -137,7 +137,7 @@ class Lengow_Sync_Model_Marketplace {
137
  }
138
 
139
  /**
140
- * Get the marketplace's payment
141
  *
142
  * @param string $name The lengow payment
143
  *
@@ -170,7 +170,7 @@ class Lengow_Sync_Model_Marketplace {
170
  }
171
 
172
  /**
173
- * Call the Lengow WSDL for current marketplace
174
  *
175
  * @param string $action The name of the action
176
  * @param string $id_feed The flux ID
@@ -245,7 +245,7 @@ class Lengow_Sync_Model_Marketplace {
245
  }
246
  $call_url .= '?' . implode('&', $url);
247
  }
248
- break;
249
  case 'refuse' :
250
  $call_url = $this->api_url;
251
  $call_url = str_replace('#ID_FLUX#', $id_feed, $call_url);
@@ -264,7 +264,7 @@ class Lengow_Sync_Model_Marketplace {
264
  if(count($gets) > 0)
265
  $call_url .= '?' . implode('&', $gets);
266
  }
267
- break;
268
  case 'link' :
269
  $call_url = self::$WSDL_LINK_ORDER;
270
  $call_url = str_replace('#MP#', $this->name, $call_url);
@@ -272,18 +272,17 @@ class Lengow_Sync_Model_Marketplace {
272
  $call_url = str_replace('#ID_FLUX#', $id_feed, $call_url);
273
  $call_url = str_replace('#ORDER_ID#', $order->getData('order_id_lengow'), $call_url);
274
  $call_url = str_replace('#INTERNAL_ORDER_ID#', $order->getData('entity_id'), $call_url);
275
-
276
  }
277
  try {
278
  if($call_url) {
279
- if(!Mage::getSingleton('sync/config')->isDebugMode()) {
280
  $this->_makeRequest($call_url);
281
  }
282
- Mage::helper('sync')->log('Order ' . $order->getData('order_id_lengow') . ' : call Lengow WSDL ' . $call_url);
283
  }
284
  } catch(Lengow_Sync_Model_Marketplace_Exception $e) {
285
- Mage::helper('sync')->log('Order ' . $order->getData('order_id_lengow') . ' : call error WSDL ' . $call_url);
286
- Mage::helper('sync')->log('Order ' . $order->getData('order_id_lengow') . ' : exception ' . $e->getMessage());
287
  }
288
  }
289
 
@@ -306,12 +305,32 @@ class Lengow_Sync_Model_Marketplace {
306
  return $value;
307
 
308
  }
 
309
  // Approximately match
310
  foreach($param['accepted_values'] as $value) {
311
  $value = (string) $value;
312
- if(preg_match('`.*?(' . $name . ').*?`i', $name))
 
 
 
 
 
 
 
 
 
 
 
313
  return $value;
314
 
 
 
 
 
 
 
 
 
315
  }
316
  return $param['accepted_values_default'];
317
  }
@@ -323,7 +342,7 @@ class Lengow_Sync_Model_Marketplace {
323
  if(!self::$DOM) {
324
  self::$DOM = simplexml_load_file(Mage::getModuleDir('etc', 'Lengow_Sync') . DS . self::$XML_MARKETPLACES);
325
  }
326
- }
327
 
328
  /**
329
  * Makes an HTTP request.
@@ -335,7 +354,7 @@ class Lengow_Sync_Model_Marketplace {
335
  protected function _makeRequest($url) {
336
  $ch = curl_init();
337
  // Options
338
- $connector = Mage::getSingleton('sync/connector');
339
  $opts = $connector::$CURL_OPTS;
340
  $opts[CURLOPT_URL] = $url;
341
  // Exectute url request
52
  *
53
  * @param string $name The name of the marketplace
54
  */
55
+ public function set($name) {
56
+ $this->_helper = Mage::helper('lensync/data');
57
  $this->_loadXml();
58
  $this->name = strtolower($name);
59
  $object = self::$DOM->xpath('/marketplaces/marketplace[@name=\'' . $this->name . '\']');
104
  }
105
 
106
  /**
107
+ * Get the real lengow's state
108
  *
109
  * @param string $name The marketplace state
110
  *
115
  }
116
 
117
  /**
118
+ * Get the marketplace's state
119
  *
120
  * @param string $name The lengow state
121
  *
126
  }
127
 
128
  /**
129
+ * Get the real lengow's payment
130
  *
131
  * @param string $name The payment state
132
  *
137
  }
138
 
139
  /**
140
+ * Get the marketplace's payment
141
  *
142
  * @param string $name The lengow payment
143
  *
170
  }
171
 
172
  /**
173
+ * Call the Lengow WSDL for current marketplace
174
  *
175
  * @param string $action The name of the action
176
  * @param string $id_feed The flux ID
245
  }
246
  $call_url .= '?' . implode('&', $url);
247
  }
248
+ break;
249
  case 'refuse' :
250
  $call_url = $this->api_url;
251
  $call_url = str_replace('#ID_FLUX#', $id_feed, $call_url);
264
  if(count($gets) > 0)
265
  $call_url .= '?' . implode('&', $gets);
266
  }
267
+ break;
268
  case 'link' :
269
  $call_url = self::$WSDL_LINK_ORDER;
270
  $call_url = str_replace('#MP#', $this->name, $call_url);
272
  $call_url = str_replace('#ID_FLUX#', $id_feed, $call_url);
273
  $call_url = str_replace('#ORDER_ID#', $order->getData('order_id_lengow'), $call_url);
274
  $call_url = str_replace('#INTERNAL_ORDER_ID#', $order->getData('entity_id'), $call_url);
 
275
  }
276
  try {
277
  if($call_url) {
278
+ if(!Mage::getSingleton('lensync/config')->isDebugMode()) {
279
  $this->_makeRequest($call_url);
280
  }
281
+ Mage::helper('lensync')->log('WSDL call Lengow : ' . $call_url, $order->getData('order_id_lengow'));
282
  }
283
  } catch(Lengow_Sync_Model_Marketplace_Exception $e) {
284
+ Mage::helper('lensync')->log('call error WSDL ' . $call_url, $order->getData('order_id_lengow'));
285
+ Mage::helper('lensync')->log('exception ' . $e->getMessage(), $order->getData('order_id_lengow'));
286
  }
287
  }
288
 
305
  return $value;
306
 
307
  }
308
+
309
  // Approximately match
310
  foreach($param['accepted_values'] as $value) {
311
  $value = (string) $value;
312
+ if(preg_match('`.*?' . $value . '.*?`i', $name))
313
+ return $value;
314
+
315
+ }
316
+
317
+ // search by title
318
+ if (strtoupper($title) == 'GLS S')
319
+ $title = 'GLS';
320
+ // Exact match
321
+ foreach($param['accepted_values'] as $value) {
322
+ $value = (string) $value;
323
+ if(preg_match('`' . $value . '`i', trim($title)))
324
  return $value;
325
 
326
+ }
327
+
328
+ // Approximately match
329
+ foreach($param['accepted_values'] as $value) {
330
+ $value = (string) $value;
331
+ if(preg_match('`.*?' . $value . '.*?`i', $title))
332
+ return $value;
333
+
334
  }
335
  return $param['accepted_values_default'];
336
  }
342
  if(!self::$DOM) {
343
  self::$DOM = simplexml_load_file(Mage::getModuleDir('etc', 'Lengow_Sync') . DS . self::$XML_MARKETPLACES);
344
  }
345
+ }
346
 
347
  /**
348
  * Makes an HTTP request.
354
  protected function _makeRequest($url) {
355
  $ch = curl_init();
356
  // Options
357
+ $connector = Mage::getSingleton('lensync/connector');
358
  $opts = $connector::$CURL_OPTS;
359
  $opts[CURLOPT_URL] = $url;
360
  // Exectute url request
app/code/community/Lengow/Sync/Model/Mysql4/Log.php CHANGED
@@ -11,6 +11,6 @@
11
  class Lengow_Sync_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract {
12
 
13
  protected function _construct() {
14
- $this->_init('sync/log', 'id');
15
  }
16
  }
11
  class Lengow_Sync_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract {
12
 
13
  protected function _construct() {
14
+ $this->_init('lensync/log', 'id');
15
  }
16
  }
app/code/community/Lengow/Sync/Model/Mysql4/Log/Collection.php CHANGED
@@ -11,6 +11,6 @@
11
  class Lengow_Sync_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
12
 
13
  protected function _construct() {
14
- $this->_init('sync/log');
15
  }
16
  }
11
  class Lengow_Sync_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
12
 
13
  protected function _construct() {
14
+ $this->_init('lensync/log');
15
  }
16
  }
app/code/community/Lengow/Sync/Model/Observer.php CHANGED
@@ -4,118 +4,179 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Observer {
12
 
13
- public function import($observer) {
14
- //if(!Mage::getSingelton('sync/config')->importCanStart()) {
15
- // Mage::helper('sync/data')->log('##Error cron import : import is already started##');
16
- //} else {
17
- Mage::helper('sync/data')->log('##Start cron import##');
18
- $_default_store = Mage::getModel('core/store')->load(Mage::app()
19
- ->getWebsite(true)
20
- ->getDefaultGroup()
21
- ->getDefaultStoreId());
22
- $_current_id_store = $_default_store->getId();
23
- $_lengow_id_user_global = Mage::getModel('sync/config')->setStore($_current_id_store)->getConfig('tracker/general/login');
24
- $_lengow_id_group_global = $this->_cleanGroup(Mage::getModel('sync/config')->setStore($_current_id_store)->getConfig('tracker/general/group'));
25
- $result_new = 0;
26
- $result_update = 0;
27
- $result_new = 0;
28
- $_default_is_imported = false;
29
- $import = Mage::getModel('sync/import');
30
- // Import default shop if configured
31
- if($_lengow_id_user_global && $_lengow_id_group_global) {
32
- try {
33
- $_default_is_imported = true;
34
- Mage::helper('sync/data')->log('Start cron import in store ' . $_default_store->getName() . '(' . $_default_store->getId() . ')');
35
- $days = Mage::getModel('sync/config')->setStore($_default_store->getId())
36
- ->getConfig('sync/orders/period');
37
- $date_from = date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days'));
38
- $date_to = date('Y-m-d');
39
- $result = $import->exec('orders', array('dateFrom' => $date_from,
40
- 'dateTo' => $date_to,
41
- 'id_store' => $_current_id_store));
42
- $result_new = $result['new'];
43
- $result_update = $result['update'];
44
- } catch(Exception $e) {
45
- Mage::helper('sync/data')->log('Error : ' . $e->getMessage());
46
- }
47
- }
48
- $store_collection = Mage::getResourceModel('core/store_collection')
49
- ->addFieldToFilter('is_active', 1);
50
- // Import different view if is different
51
- foreach($store_collection as $store) {
52
- try {
53
- $_lengow_id_user_current = Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/login');
54
- $_lengow_id_group_current = $this->_cleanGroup(Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/group'));
55
- if(($_lengow_id_user_current != $_lengow_id_user_global || $_lengow_id_group_current != $_lengow_id_group_global)
56
- && $_lengow_id_user_current && $_lengow_id_group_current) {
57
- if($store->getId() != $_current_id_store || !$_default_is_imported) {
58
- Mage::helper('sync/data')->log('Start cron import in store ' . $store->getName() . '(' . $store->getId() . ')');
59
- $days = Mage::getModel('sync/config')->setStore($store->getId())
60
- ->getConfig('sync/orders/period');
61
- $date_from = date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days'));
62
- $date_to = date('Y-m-d');
63
- $import = Mage::getModel('sync/import');
64
- $result = $import->exec('orders', array('dateFrom' => $date_from,
65
- 'dateTo' => $date_to,
66
- 'id_store' => $store->getId()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  $result_new += $result['new'];
68
  $result_update += $result['update'];
69
  }
 
 
70
  }
71
- } catch(Exception $e) {
72
- Mage::helper('sync/data')->log('Error : ' . $e->getMessage());
73
- }
74
- }
75
- Mage::helper('sync/data')->log('##End cron import##');
76
- //}
77
- }
 
 
 
 
 
78
 
79
- public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer) {
 
 
 
 
80
  $shipment = $observer->getEvent()->getShipment();
81
  $order = $shipment->getOrder();
82
- if($order->getData('from_lengow') == 1) {
83
- $marketplace = Mage::getModel('sync/marketplace');
84
  $marketplace->set($order->getMarketplaceLengow());
85
- if ($order->getState() == Mage::getSingleton('sync/config')->getOrderState('processing')) {
86
- Mage::helper('sync')->log('WDSL : send tracking to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow') . ' - ' . $order->getData('order_id_lengow'));
87
  $marketplace->wsdl('shipped', $order->getData('feed_id_lengow'), $order, $shipment);
88
  }
89
  }
90
  return $this;
91
  }
92
 
93
- public function salesOrderPaymentCancel(Varien_Event_Observer $observer) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  $payment = $observer->getEvent()->getPayment();
95
  $order = $payment->getOrder();
96
- if($order->getData('from_lengow') == 1) {
97
- $marketplace = Mage::getModel('sync/marketplace');
98
  $marketplace->set($order->getMarketplaceLengow());
99
- if ($order->getState() == Mage::getSingleton('sync/config')->getOrderState('processing')) {
100
- Mage::helper('sync')->log('WDSL : send cancel to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow') . ' - ' . $order->getData('order_id_lengow'));
101
  $marketplace->wsdl('refuse', $order->getData('feed_id_lengow'), $order);
102
  }
103
  }
 
104
  }
105
 
106
- public function salesOrderSaveCommitAfter(Varien_Event_Observer $observer) {
 
107
  $order = $observer->getEvent();
108
- if($order->getData('from_lengow') == 1) {
109
  $marketplace = Mage::getModel('sync/marketplace');
110
  $marketplace->set($order->getMarketplaceLengow());
111
- if ($order->getState() == self::STATE_COMPLETE && $order->getState() == Mage::getSingleton('sync/config')->getOrderState('processing')) {
112
- Mage::helper('sync')->log('WDSL : send cancel to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow') . ' - ' . $order->getData('order_id_lengow'));
113
  $marketplace->wsdl('shipped', $order->getData('feed_id_lengow'), $order);
114
  }
115
  }
 
116
  }
117
 
118
- private function _cleanGroup($data) {
 
 
 
 
 
 
119
  return trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ',');
120
  }
121
 
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Observer {
12
 
13
+ /**
14
+ * Imports orders for each store with cron job
15
+ */
16
+ public function import($observer)
17
+ {
18
+ if(Mage::getStoreConfig('lensync/performances/active_cron')) {
19
+ // update marketplace file
20
+ Mage::helper('lensync/data')->updateMarketplaceXML();
21
+ // clean old log (20 days)
22
+ Mage::helper('lensync/data')->cleanLog();
23
+ // check if import is not already in process
24
+ if (!Mage::getSingleton('lensync/config')->importCanStart()) {
25
+ Mage::helper('lensync/data')->log('## Error cron import : import is already started ##');
26
+ } else {
27
+ Mage::helper('lensync/data')->log('## Start cron import ##');
28
+
29
+ if(Mage::getStoreConfig('lensync/performances/debug'))
30
+ Mage::helper('lensync/data')->log('WARNING ! Debug mode is activated');
31
+
32
+ $result_new = 0;
33
+ $result_update = 0;
34
+ $lengow_groups = array();
35
+
36
+ $store_collection = Mage::getResourceModel('core/store_collection')
37
+ ->addFieldToFilter('is_active', 1);
38
+ // Import different view if is different
39
+ foreach($store_collection as $store) {
40
+ try {
41
+ if(!$store->getId())
42
+ continue;
43
+
44
+ Mage::helper('lensync/data')->log('Start cron import in store ' . $store->getName() . ' (' . $store->getId() . ')');
45
+
46
+ $lensync_config = Mage::getModel('lensync/config', array('store' => $store));
47
+ // if store is enabled -> stop import
48
+ if(!$lensync_config->get('orders/active_store')) {
49
+ Mage::helper('lensync/data')->log('Stop cron import - Store ' . $store->getName() . '(' . $store->getId() . ') is disabled');
50
+ continue;
51
+ }
52
+ // get login informations
53
+ $error_import = false;
54
+ $lentracker_config = Mage::getModel('lentracker/config', array('store' => $store));
55
+ $id_lengow_customer = $lentracker_config->get('general/login');
56
+ $id_lengow_group = $this->_cleanGroup($lentracker_config->get('general/group'));
57
+ $api_token_lengow = $lentracker_config->get('general/api_key');
58
+ // if ID Customer or group are empty -> stop import for this store
59
+ if (empty($id_lengow_customer) || !is_numeric($id_lengow_customer) || empty($id_lengow_group)) {
60
+ $message = 'id customer or id group is empty. Please make sure it is saved in your plugin configuration';
61
+ Mage::helper('lensync/data')->log('Stop cron import in store ' . $store->getName() . '(' . $store->getId() . ') : ' . $message);
62
+ $error_import = true;
63
+ }
64
+ // check if group was already imported
65
+ $new_id_lengow_group = false;
66
+ $id_groups = explode(';', $id_lengow_group);
67
+ foreach ($id_groups as $id_group) {
68
+ if (is_numeric($id_group) && !in_array($id_group, $lengow_groups)) {
69
+ $lengow_groups[] = $id_group;
70
+ $new_id_lengow_group .= !$new_id_lengow_group ? $id_group : ';'.$id_group;
71
+ }
72
+ }
73
+
74
+ if (!$error_import && $new_id_lengow_group) {
75
+ $days = $lensync_config->get('orders/period');
76
+ $args = array(
77
+ 'dateFrom' => date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days')),
78
+ 'dateTo' => date('Y-m-d'),
79
+ 'config' => $lensync_config,
80
+ 'idCustomer' => $id_lengow_customer,
81
+ 'idGroup' => $new_id_lengow_group,
82
+ 'apiToken' => $api_token_lengow,
83
+ );
84
+ $import = Mage::getModel('lensync/import', $args);
85
+ $result = $import->exec();
86
  $result_new += $result['new'];
87
  $result_update += $result['update'];
88
  }
89
+ } catch(Exception $e) {
90
+ Mage::helper('lensync/data')->log('Error ' . $e->getMessage() . '');
91
  }
92
+ }
93
+ if($result_new > 0)
94
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('%d orders are imported', $result_new));
95
+ if($result_update > 0)
96
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('%d orders are updated', $result_update));
97
+ if($result_new == 0 && $result_update == 0)
98
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('No order available to import'));
99
+ Mage::helper('lensync/data')->log('## End cron import ##');
100
+ Mage::getSingleton('lensync/config')->importSetEnd();
101
+ }
102
+ }
103
+ }
104
 
105
+ /**
106
+ * Sending a call WSDL for a new order shipment
107
+ */
108
+ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
109
+ {
110
  $shipment = $observer->getEvent()->getShipment();
111
  $order = $shipment->getOrder();
112
+ if($order->getData('from_lengow') == 1) {
113
+ $marketplace = Mage::getModel('lensync/marketplace');
114
  $marketplace->set($order->getMarketplaceLengow());
115
+ if ($order->getState() == Mage::getSingleton('lensync/order')->getOrderState('processing')) {
116
+ Mage::helper('lensync')->log('WSDL : send tracking to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow'), $order->getData('order_id_lengow'));
117
  $marketplace->wsdl('shipped', $order->getData('feed_id_lengow'), $order, $shipment);
118
  }
119
  }
120
  return $this;
121
  }
122
 
123
+ // /**
124
+ // * Sending a call WSDL for a new tracking
125
+ // */
126
+ // public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer) {
127
+ // $track = $observer->getEvent()->getTrack();
128
+ // $shipment = $track->getShipment();
129
+ // $order = $shipment->getOrder();
130
+ // if($order->getData('from_lengow') == 1) {
131
+ // $marketplace = Mage::getModel('lensync/marketplace');
132
+ // $marketplace->set($order->getMarketplaceLengow());
133
+ // if ($order->getState() == Mage::getSingleton('lensync/order')->getOrderState('shipped')) {
134
+ // Mage::helper('lensync')->log('WSDL : send tracking to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow'), $order->getData('order_id_lengow'));
135
+ // $marketplace->wsdl('shipped', $order->getData('feed_id_lengow'), $order, $shipment);
136
+ // }
137
+ // }
138
+ // return $this;
139
+ // }
140
+
141
+ /**
142
+ * Sending a call for a cancellation of order
143
+ */
144
+ public function salesOrderPaymentCancel(Varien_Event_Observer $observer)
145
+ {
146
  $payment = $observer->getEvent()->getPayment();
147
  $order = $payment->getOrder();
148
+ if($order->getData('from_lengow') == 1) {
149
+ $marketplace = Mage::getModel('lensync/marketplace');
150
  $marketplace->set($order->getMarketplaceLengow());
151
+ if ($order->getState() == Mage::getSingleton('lensync/order')->getOrderState('processing')) {
152
+ Mage::helper('lensync')->log('WSDL : send cancel to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow'), $order->getData('order_id_lengow'));
153
  $marketplace->wsdl('refuse', $order->getData('feed_id_lengow'), $order);
154
  }
155
  }
156
+ return $this;
157
  }
158
 
159
+ public function salesOrderSaveCommitAfter(Varien_Event_Observer $observer)
160
+ {
161
  $order = $observer->getEvent();
162
+ if($order->getData('from_lengow') == 1) {
163
  $marketplace = Mage::getModel('sync/marketplace');
164
  $marketplace->set($order->getMarketplaceLengow());
165
+ if ($order->getState() == self::STATE_COMPLETE && $order->getState() == Mage::getSingleton('lensync/order')->getOrderState('processing')) {
166
+ Mage::helper('lensync')->log('WSDL : send cancel to ' . $order->getData('marketplace_lengow') . ' - ' . $order->getData('feed_id_lengow'), $order->getData('order_id_lengow'));
167
  $marketplace->wsdl('shipped', $order->getData('feed_id_lengow'), $order);
168
  }
169
  }
170
+ return $this;
171
  }
172
 
173
+ /**
174
+ * Clean group id
175
+ *
176
+ * @param string $data
177
+ */
178
+ private function _cleanGroup($data)
179
+ {
180
  return trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ',');
181
  }
182
 
app/code/community/Lengow/Sync/Model/Order.php CHANGED
@@ -1,55 +1,52 @@
1
  <?php
 
2
  /**
3
  * Lengow sync model order
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
12
 
13
  protected $_countryCollection;
 
14
  protected $_config;
15
 
16
  protected $_canInvoice = false;
 
17
  protected $_canShip = false;
 
18
  protected $_canCancel = false;
 
19
  protected $_canRefund = false;
20
 
21
  protected $_hasInvoices = false;
22
- protected $_hasShipments = false;
23
- protected $_isCanceled = false;
24
- protected $_isRefunded = false;
25
 
26
- private $_store;
27
 
28
- public function __construct($id_store) {
29
- $this->_store = Mage::getModel('core/store')->load($id_store);
30
- parent::__construct();
31
- }
32
 
33
- public function isAlreadyImported($id_lengow, $id_flux) {
34
- $order = Mage::getModel('sales/order')->getCollection()
35
- ->addAttributeToFilter('order_id_lengow', $id_lengow)
36
- ->addAttributeToFilter('feed_id_lengow', $id_flux)
37
- ->addAttributeToSelect('order_id_lengow')
38
- ->getData();;
39
- if(count($order) > 0)
40
- return true;
41
- else
42
- return false;
43
- }
44
 
45
- public function getOrderByIdLengow($id_lengow, $id_flux) {
46
- $order = Mage::getModel('sales/order')->getCollection()
47
- ->addAttributeToFilter('order_id_lengow', $id_lengow)
48
- ->addAttributeToFilter('feed_id_lengow', $id_flux)
49
- ->addAttributeToSelect('entity_id')
50
- ->getData();
51
- if(isset($order[0]['entity_id']))
52
- return Mage::getModel('sales/order')->load($order[0]['entity_id']);
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
@@ -57,271 +54,58 @@ class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
57
  *
58
  * @return Lengow_Sync_Model_Config
59
  */
60
- public function getConfig() {
 
61
  if(is_null($this->_config)) {
62
- $this->_config = Mage::getSingleton('sync/config');
63
  }
64
  return $this->_config;
65
  }
66
 
67
  /**
68
- * Create quote
69
  *
70
- * @param Varien_Object $lengowItem
71
- */
72
- public function createQuote(SimpleXMLelement $data, Lengow_Sync_Model_Customer_Customer $customer) {
73
- $quote = Mage::getModel('sales/quote');
74
- $quote->setIsMultiShipping(false)
75
- ->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER)
76
- ->setCustomerId($customer->getId())
77
- ->setCustomerEmail($customer->getEmail())
78
- ->setCustomerIsGuest(false)
79
- ->setCustomerGroupId($this->getConfig()->get('orders/customer_group'))
80
- ->setCustomerFirstname($customer->getFirstname())
81
- ->setCustomerLastname($customer->getLastname())
82
- ->setStore($this->_store);
83
- // Add products to quote with data from Lengow
84
- foreach($data->cart->products->product as $lengow_product) {
85
- if(!$quote = $this->addItemToQuote($lengow_product, $quote, (string) $data->order_id)) {
86
- return false;
87
- }
88
- }
89
- // Set billing Address
90
- $billing_address = $quote->getBillingAddress();
91
- $billing_address->setShouldIgnoreValidation(true);
92
- $customer_billing_address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
93
- $billing_address->importCustomerAddress($customer_billing_address)->setSaveInAddressBook(0);
94
- // Set shipping Address
95
- $shipping_address = $quote->getShippingAddress();
96
- $shipping_address->setShouldIgnoreValidation(true);
97
- $customerAddressShipping = Mage::getModel('customer/address')->load($customer->getDefaultShipping());
98
- $shipping_address->importCustomerAddress($customerAddressShipping)->setSaveInAddressBook(0);
99
- $shipping_address->setSameAsBilling(0);
100
- // Create Shipment
101
- $shipping_cost = (float) $data->order_processing_fee + (float) $data->order_shipping;
102
- if(!Mage::getSingleton('tax/config')->shippingPriceIncludesTax($quote->getStore())) {
103
- $pseudo_product = new Varien_Object();
104
- $pseudo_product->setTaxClassId(Mage::getSingleton('tax/config')->getShippingTaxClass($quote->getStore()));
105
- $shipping_cost = Mage::helper('tax')->getPrice(
106
- $pseudo_product,
107
- $shipping_cost,
108
- false,
109
- $shipping_address,
110
- $billing_address,
111
- null,
112
- $quote->getStore(),
113
- true
114
- );
115
- }
116
- Mage::getSingleton('checkout/session')
117
- ->setShippingPrice($shipping_cost)
118
- ->setIsFromlengow(true);
119
- $quote->getShippingAddress()
120
- ->setShippingMethod('lengow_lengow')
121
- ->setCollectShippingRates(true)
122
- ->collectShippingRates();
123
- // Create Payment
124
- $quote->getShippingAddress()
125
- ->setPaymentMethod('lengow');
126
- $payment = $quote->getPayment();
127
- $payment->importData(array('method' => 'lengow' ,
128
- 'marketplace' => (string) $data->marketplace . ' - ' . (string) $data->order_payment->payment_type ));
129
- // Create quote
130
- $quote->collectTotals();
131
- $quote->save();
132
- return $quote;
133
- }
134
-
135
- /**
136
- * Add item to quote
137
- *
138
- * @param Varien_Object $lengowItem
139
- * @param Mage_Sales_Mode_Quote
140
- * @return Mage_Sales_Mode_Quote
141
- */
142
- public function addItemToQuote(SimpleXMLelement $lengow_product, $quote, $order_id) {
143
- // TODO add while
144
- $quote->setIsSuperMode(true);
145
- $product_model = Mage::getModel('catalog/product');
146
- $sku = (string) $lengow_product->sku;
147
- $sku = str_replace('\_', '_', $sku);
148
- $product_field = strtolower((string) $lengow_product->sku['field'][0]);
149
- $product = $product_model;
150
- /*if($product_model->hasData($product_field))
151
- $product = $product_model->loadByAttribute($product_field, $sku);*/
152
- $attributeModel = Mage::getSingleton('eav/config')
153
- ->getAttribute('catalog_product', $product_field);
154
- if($attributeModel->getAttributeId()) {
155
- $collection = Mage::getResourceModel('catalog/product_collection')
156
- ->setStoreId($quote->getStore()->getStoreId())
157
- ->addAttributeToSelect('*')
158
- ->addAttributeToFilter($product_field, $sku)
159
- ->setPage(1,1)
160
- ->getData();
161
- if(is_array($collection) && count($collection) > 0) {
162
- $product->load($collection[0]['entity_id']);
163
- }
164
- }
165
- if(!empty($sku) && !$product->getId()) {
166
- $product = $product_model->load($product_model->getIdBySku($sku));
167
- if(!empty($sku) && !$product->getId()) {
168
- $sku = (string) $lengow_product->idMP;
169
- $sku = str_replace('\_', '_', $sku);
170
- $product = $product_model->load($product_model->getIdBySku($sku));
171
- if(!empty($sku) && !$product->getId()) {
172
- $sku = (string) $lengow_product->idLengow;
173
- $sku = str_replace('\_', '_', $sku);
174
- $product = $product_model->load($product_model->getIdBySku($sku));
175
- if(!empty($sku) && !$product->getId()) {
176
- $sku = (string) $lengow_product->sku;
177
- $sku = str_replace('\_', '_', $sku);
178
- $product = $product_model->load($sku);
179
- if(!empty($sku) && !$product->getId()) {
180
- $sku = (string) $lengow_product->idMP;
181
- $sku = str_replace('\_', '_', $sku);
182
- $product = $product_model->load($sku);
183
- if(!empty($sku) && !$product->getId()) {
184
- $sku = (string) $lengow_product->idLengow;
185
- $sku = str_replace('\_', '_', $sku);
186
- $product = $product_model->load($sku);
187
- if(!empty($sku) && !$product->getId()) {
188
- Mage::helper('sync')->log('Order ' . $order_id . ' : Product ' . (string) $lengow_product->sku . ' doesn\'t exist');
189
- return false;
190
- }
191
- }
192
- }
193
- }
194
- }
195
- }
196
- }
197
- $quote_item = Mage::getModel('sync/quote_item');
198
- $quote_item
199
- ->setProduct($product)
200
- ->setPrice((float) $lengow_product->price_unit)
201
- ->setCustomPrice((float) $lengow_product->price_unit)
202
- ->setOriginalCustomPrice((float) $lengow_product->price_unit)
203
- ->setQuote($quote)
204
- ->setQty((integer) $lengow_product->quantity)
205
- ->initPrice((float) $lengow_product->price_unit);
206
- $title_from_lengow = $this->getConfig()->setStore($quote->getStore()->getStoreId())->get('orders/title');
207
- if($title_from_lengow)
208
- $quote_item->setName((string) $lengow_product->title);
209
- $quote->addItem($quote_item);
210
- return $quote;
211
- }
212
-
213
- /**
214
- * Create order
215
  *
216
- * @param Mage_Sales_Model_Quote
217
- * @return Mage_Sales_Model_Order
218
  */
219
- public function makeOrder(SimpleXMLelement $data, Mage_Sales_Model_Quote $quote, $invoice = true) {
220
- try {
221
- $order = false;
222
- $store = $quote->getStore();
223
- $grand_total = 0;
224
- if (!Mage::helper('tax')->priceIncludesTax($store)) {
225
- $grand_total = $quote->getGrandTotal();
226
- }
227
- $quote->setGrandTotal((float) $data->order_amount);
228
- $quote->setBaseGrandTotal((float) $data->order_amount);
229
- $additional_data = array('from_lengow' => true ,
230
- 'marketplace_lengow' => (string) $data->marketplace ,
231
- 'fees_lengow' => (float) $data->order_commission ,
232
- 'order_id_lengow' => (string) $data->order_id ,
233
- 'feed_id_lengow' => (integer) $data->idFlux ,
234
- 'xml_node_lengow' => Mage::helper('Core')->jsonEncode($data) ,
235
- 'message_lengow' => (string) $data->order_comments ,
236
- 'total_paid_lengow' => (float) $data->order_amount ,
237
- 'carrier_lengow' => (string) $data->tracking_informations->tracking_carrier ,
238
- 'carrier_method_lengow' => (string) $data->tracking_informations->tracking_method ,
239
- 'global_currency_code' => (string) $data->order_currency ,
240
- 'base_currency_code' => (string) $data->order_currency ,
241
- 'store_currency_code' => (string) $data->order_currency ,
242
- 'order_currency_code' => (string) $data->order_currency ,
243
- );
244
- $service = Mage::getModel('sales/service_quote', $quote);
245
- $service->setOrderData($additional_data);
246
- $order = false;
247
- if(method_exists($service, 'submitAll')) {
248
- $service->submitAll();
249
- $order = $service->getOrder();
250
- } else {
251
- $order = $service->submit();
252
- }
253
- $order->setIsFromLengow(true)
254
- ->save();
255
- // Re-ajuste cents
256
- // Conversion Tax Include > Tax Exclude > Tax Include maybe make 0.01 amount error
257
- if (!Mage::helper('tax')->priceIncludesTax($store)) {
258
-
259
- if($order->getBaseShippingInclTax() != (float) $data->order_shipping) {
260
- $order->setBaseShippingInclTax((float) $data->order_shipping);
261
- }
262
- if($grand_total != (float) $data->order_amount) {
263
- $order->setGrandTotal((float) $data->order_amount);
264
- $order->setBaseGrandTotal((float) $data->order_amount);
265
- $diff = (((float) $data->order_amount) - $grand_total);
266
- $order->setTaxAmount($order->getTaxAmount() + $diff);
267
- }
268
- $order->save();
269
- }
270
- if($invoice)
271
- $order = $this->toInvoice($order);
272
- // FIX fields amount & taxes
273
- $products = Mage::getResourceModel('sales/order_item_collection')
274
- ->setOrderFilter($order->getId());
275
- foreach($products as $product) {
276
- $product->setBaseOriginalPrice($product->getOriginalPrice());
277
- $product->setBaseTaxAmount($product->getTaxAmount());
278
- $product->setBaseTaxInvoiced($product->getTaxAmount());
279
- $product->setBasePriceInclTax($product->getPriceInclTax());
280
- $product->setBaseRowTotalInclTax($product->getRowTotalInclTax());
281
- $product->save();
282
- }
283
- $order->setBaseTaxAmount($order->getTaxAmount());
284
- $order->setBaseTaxInvoiced($order->getTaxAmount());
285
- $order->setBaseTotalInvoiced($order->getTotalPaid());
286
- $order->setBaseTotalPaid($order->getTotalPaid());
287
- $order->setBaseGrandTotal($order->getTotalPaid());
288
- $order->setBaseSubtotalInclTax($order->getSubtotalInclTax());
289
- $order->save();
290
- } catch (Exception $e){
291
- Mage::helper('sync')->log('Error create order : ' . $e->getMessage());
292
- }
293
- return $order;
294
  }
295
 
296
  /**
297
  * Create invoice
298
  *
299
- * @param Mage_Sales_Model_Order
300
- * @return Lengow_Sync_Model_Order
301
  */
302
- public function toInvoice(Mage_Sales_Model_Order $order) {
303
- if($order->canInvoice()) {
304
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
305
- if($invoice) {
306
- $invoice->register();
307
- $invoice->getOrder()->setIsInProcess(true);
308
- $transactionSave = Mage::getModel('core/resource_transaction')
309
- ->addObject($invoice)
310
- ->addObject($invoice->getOrder());
311
- $transactionSave->save();
312
- $this->_hasInvoices = true;
313
- }
314
  }
315
- return $order;
316
  }
317
 
318
  /**
319
  * Ship order
320
  *
321
- * @param Mage_Sales_Model_Order
322
- * @return Lengow_Sync_Model_Order
 
 
 
323
  */
324
- public function toShip($order, $carrier = null, $title = '', $tracking = '') {
 
325
  if($order->canShip()) {
326
  $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment();
327
  if($shipment) {
@@ -343,42 +127,38 @@ class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
343
  }
344
  try {
345
  $shipment->save();
346
- $track->save();
 
347
  } catch (Mage_Core_Exception $e) {
348
- Mage::helper('sync')->log('Error create shipment : ' . $e->getMessage());
349
  }
350
- /*$ship = Mage::getModel('sales/order_shipment_api')
351
- ->addTrack($shipment->getIncrementId() ,
352
- $carrier ,
353
- $title ,
354
- $tracking); */
355
  }
356
  }
357
- return $this;
358
  }
359
 
360
  /**
361
  * Cancel order
362
  *
363
- * @param Mage_Sales_Model_Order
364
- * @return Lengow_Sync_Model_Order
365
  */
366
- public function toCancel(Lengow_Sync_Model_Order $order) {
367
- if($this->_canCancel) {
 
368
  $order->cancel();
369
  $this->_isCanceled = true;
370
  }
371
-
372
- return $this;
373
  }
374
 
375
  /**
376
  * Refund order
377
  *
378
  * @param Mage_Sales_Model_Order
 
379
  * @return Lengow_Sync_Model_Order
380
  */
381
- public function toRefund(Lengow_Sync_Model_Order $order) {
 
382
  if($this->_canRefund && $order->canCreditmemo()) {
383
  $invoice_id = $order->getInvoiceCollection()->getFirstItem()->getId();
384
  if(!$invoice_id) {
@@ -418,9 +198,11 @@ class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
418
  * Retrieve country id based on country name
419
  *
420
  * @param string $country_name
 
421
  * @return string
422
  */
423
- protected function _getCountryId($country_name) {
 
424
  if(is_null($this->_countryCollection)) {
425
  $this->_countryCollection = Mage::getResourceModel('directory/country_collection')->toOptionArray();
426
  }
@@ -431,4 +213,74 @@ class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
431
  }
432
  return $country_name;
433
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  }
1
  <?php
2
+
3
  /**
4
  * Lengow sync model order
5
  *
6
  * @category Lengow
7
  * @package Lengow_Sync
8
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
9
+ * @copyright 2015 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Sync_Model_Order extends Mage_Sales_Model_Order {
13
 
14
  protected $_countryCollection;
15
+
16
  protected $_config;
17
 
18
  protected $_canInvoice = false;
19
+
20
  protected $_canShip = false;
21
+
22
  protected $_canCancel = false;
23
+
24
  protected $_canRefund = false;
25
 
26
  protected $_hasInvoices = false;
 
 
 
27
 
28
+ protected $_hasShipments = false;
29
 
30
+ protected $_isCanceled = false;
 
 
 
31
 
32
+ protected $_isRefunded = false;
 
 
 
 
 
 
 
 
 
 
33
 
34
+ /**
35
+ * is Already Imported
36
+ *
37
+ * @param integer $idLengow Lengow order id
38
+ * @param integer $idFlux Id flux Lengow
39
+ *
40
+ * @return mixed
41
+ */
42
+ public function isAlreadyImported($idLengow, $idFlux)
43
+ {
44
+ $order_collection = $this->getCollection()
45
+ ->addAttributeToFilter('order_id_lengow', $idLengow)
46
+ ->addAttributeToFilter('feed_id_lengow', $idFlux)
47
+ ->addAttributeToSelect('entity_id')
48
+ ->getData();
49
+ return isset($order_collection[0]['entity_id']) ? $order_collection[0]['entity_id'] : false;
50
  }
51
 
52
  /**
54
  *
55
  * @return Lengow_Sync_Model_Config
56
  */
57
+ public function getConfig()
58
+ {
59
  if(is_null($this->_config)) {
60
+ $this->_config = Mage::getSingleton('lensync/config');
61
  }
62
  return $this->_config;
63
  }
64
 
65
  /**
66
+ * Set config
67
  *
68
+ * @param Lengow_Sync_Model_Config $config
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  *
70
+ * @return Lengow_Sync_Model_Order
 
71
  */
72
+ public function setConfig($config)
73
+ {
74
+ $this->_config = $config;
75
+ return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
  /**
79
  * Create invoice
80
  *
81
+ * @param Mage_Sales_Model_Order $order
82
+ *
83
  */
84
+ public function toInvoice($order)
85
+ {
86
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
87
+ if($invoice) {
88
+ $invoice->register();
89
+ $invoice->getOrder()->setIsInProcess(true);
90
+ $transactionSave = Mage::getModel('core/resource_transaction')
91
+ ->addObject($invoice)
92
+ ->addObject($invoice->getOrder());
93
+ $transactionSave->save();
94
+ $order->_hasInvoices = true;
 
95
  }
 
96
  }
97
 
98
  /**
99
  * Ship order
100
  *
101
+ * @param Mage_Sales_Model_Order $order
102
+ * @param string $carrier
103
+ * @param string $title
104
+ * @param string $tracking
105
+ *
106
  */
107
+ public function toShip($order, $carrier = null, $title = '', $tracking = '')
108
+ {
109
  if($order->canShip()) {
110
  $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment();
111
  if($shipment) {
127
  }
128
  try {
129
  $shipment->save();
130
+ if(isset($track))
131
+ $track->save();
132
  } catch (Mage_Core_Exception $e) {
133
+ Mage::helper('lensync/data')->log('ERROR create shipment : ' . $e->getMessage(), $order->getOrderIdLengow());
134
  }
 
 
 
 
 
135
  }
136
  }
 
137
  }
138
 
139
  /**
140
  * Cancel order
141
  *
142
+ * @param Mage_Sales_Model_Order $order
143
+ *
144
  */
145
+ public function toCancel($order)
146
+ {
147
+ if($this->_canCancel && $order->canCancel()) {
148
  $order->cancel();
149
  $this->_isCanceled = true;
150
  }
 
 
151
  }
152
 
153
  /**
154
  * Refund order
155
  *
156
  * @param Mage_Sales_Model_Order
157
+ *
158
  * @return Lengow_Sync_Model_Order
159
  */
160
+ public function toRefund(Lengow_Sync_Model_Order $order)
161
+ {
162
  if($this->_canRefund && $order->canCreditmemo()) {
163
  $invoice_id = $order->getInvoiceCollection()->getFirstItem()->getId();
164
  if(!$invoice_id) {
198
  * Retrieve country id based on country name
199
  *
200
  * @param string $country_name
201
+ *
202
  * @return string
203
  */
204
+ protected function _getCountryId($country_name)
205
+ {
206
  if(is_null($this->_countryCollection)) {
207
  $this->_countryCollection = Mage::getResourceModel('directory/country_collection')->toOptionArray();
208
  }
213
  }
214
  return $country_name;
215
  }
216
+
217
+ /**
218
+ * Get Magento equivalent to lengow order state
219
+ *
220
+ * @param string $lengow_status lengow state
221
+ *
222
+ * @return string
223
+ */
224
+ public function getOrderState($lengow_status)
225
+ {
226
+ switch ($lengow_status) {
227
+ case 'new':
228
+ return Mage_Sales_Model_Order::STATE_NEW;
229
+ break;
230
+ case 'processing':
231
+ return Mage_Sales_Model_Order::STATE_PROCESSING;
232
+ break;
233
+ case 'shipped':
234
+ return Mage_Sales_Model_Order::STATE_COMPLETE;
235
+ break;
236
+ case 'canceled':
237
+ return Mage_Sales_Model_Order::STATE_CANCELED;
238
+ break;
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Update order state to marketplace state
244
+ *
245
+ * @param Mage_Sales_Model_Order $order Magento Order
246
+ * @param string $lengow_status marketplace status
247
+ * @param string $order_data order data
248
+ *
249
+ * @return bool true if order has been updated
250
+ */
251
+ public function updateState($order, $lengow_status, SimpleXMLelement $order_data)
252
+ {
253
+ $helper = Mage::helper('lensync/data');
254
+ // Update order's status only if in process, shipped, or canceled
255
+ if ($order->getState() != self::getOrderState($lengow_status) && $order->getData('from_lengow') == 1) {
256
+ if ($order->getState() == self::getOrderState('new') && $lengow_status == 'processing') {
257
+ // generate invoice
258
+ $this->toInvoice($order);
259
+ $helper->log('state updated to "processing" (Order ' . $order->getIncrementId() . ')', $order->getOrderIdLengow());
260
+ return true;
261
+ } elseif (($order->getState() == self::getOrderState('processing') || $order->getState() == self::getOrderState('new'))
262
+ && $lengow_status == 'shipped') {
263
+ // if order is new -> generate invoice
264
+ if ($order->getState() == self::getOrderState('new'))
265
+ $this->toInvoice($order);
266
+ $this->toShip(
267
+ $order,
268
+ (string) $order_data->tracking_informations->tracking_carrier,
269
+ (string) $order_data->tracking_informations->tracking_method,
270
+ (string) $order_data->tracking_informations->tracking_number
271
+ );
272
+ $helper->log('state updated to "shipped" (Order ' . $order->getIncrementId() . ')', $order->getOrderIdLengow());
273
+ return true;
274
+ } else if (($order->getState() == self::getOrderState('processing') || $order->getState() == self::getOrderState('shipped'))
275
+ && $lengow_status == 'canceled') {
276
+ $this->toCancel($order);
277
+ if ($this->_isCanceled) {
278
+ $helper->log('state update to "canceled" (Order ' . $order->getIncrementId() . ')', $order->getOrderIdLengow());
279
+ return true;
280
+ }
281
+ return false;
282
+ }
283
+ }
284
+ return false;
285
+ }
286
  }
app/code/community/Lengow/Sync/Model/Payment/Method/Lengow.php CHANGED
@@ -10,8 +10,8 @@
10
  */
11
  class Lengow_Sync_Model_Payment_Method_Lengow extends Mage_Payment_Model_Method_Abstract {
12
 
13
- protected $_code = 'lengow';
14
- protected $_infoBlockType = 'sync/payment_info_purchaseorder';
15
 
16
  /**
17
  * Assign data to info model instance
@@ -27,14 +27,12 @@ class Lengow_Sync_Model_Payment_Method_Lengow extends Mage_Payment_Model_Method_
27
  return $this;
28
  }
29
 
30
- /**
31
  * Check whether payment method can be used
32
  * @param Mage_Sales_Model_Quote
33
  * @return bool
34
  */
35
  public function isAvailable($quote = null) {
36
- if(Mage::getSingleton('checkout/session')->getIsFromlengow())
37
- return true;
38
- return false;
39
- }
40
  }
10
  */
11
  class Lengow_Sync_Model_Payment_Method_Lengow extends Mage_Payment_Model_Method_Abstract {
12
 
13
+ protected $_code = 'lengow';
14
+ protected $_infoBlockType = 'lensync/payment_info_purchaseorder';
15
 
16
  /**
17
  * Assign data to info model instance
27
  return $this;
28
  }
29
 
30
+ /**
31
  * Check whether payment method can be used
32
  * @param Mage_Sales_Model_Quote
33
  * @return bool
34
  */
35
  public function isAvailable($quote = null) {
36
+ return Mage::getSingleton('core/session')->getIsFromlengow();
37
+ }
 
 
38
  }
app/code/community/Lengow/Sync/Model/Quote.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Lengow sync model quote
5
+ *
6
+ * @category Lengow
7
+ * @package Lengow_Sync
8
+ * @author Benjamin Le Nevé <benjamin.le-neve@lengow.com>
9
+ * @copyright 2015 Lengow SAS
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class Lengow_Sync_Model_Quote extends Mage_Sales_Model_Quote {
13
+
14
+ protected $_rowTotalLengow = array();
15
+
16
+ /**
17
+ * Add products from API to current quote
18
+ *
19
+ * @param SimpleXMLelement $products product list to be added
20
+ * @param Lengow_Sync_Model_Marketplace $marketplace
21
+ * @param String $id_lengow_order
22
+ * @param boolean $priceIncludeTax
23
+ *
24
+ * @return Lengow_Sync_Model_Quote
25
+ */
26
+ public function addLengowProducts(SimpleXMLelement $products, Lengow_Sync_Model_Marketplace $marketplace, $id_lengow_order, $priceIncludeTax = true)
27
+ {
28
+ $order_lineid = '';
29
+ $first = true;
30
+ foreach ($products as $product_line) {
31
+ if ($first || empty($order_lineid) || $order_lineid != (string) $product_line->order_lineid) {
32
+ $first = false;
33
+ $order_lineid = (string) $product_line->order_lineid;
34
+ // check whether the product is canceled
35
+ if (!empty($product_line->status)) {
36
+ if ($marketplace->getStateLengow((string) $product_line->status) == 'canceled') {
37
+ Mage::helper('lensync')->log('product ' . $product_line->sku . ' could not be added to cart - status: ' . $marketplace->getStateLengow((string) $product_line->status), $id_lengow_order);
38
+ continue;
39
+ }
40
+ }
41
+ $product = $this->_findProduct($product_line);
42
+ if ($product) {
43
+ // get unit price with tax
44
+ $price = (float) $product_line->price_unit;
45
+ // save total row Lengow for each product
46
+ $this->_rowTotalLengow[(string) $product->getId()] = $price * $product_line->quantity;
47
+ // if price not include tax -> get shipping cost without tax
48
+ if (!$priceIncludeTax) {
49
+ $basedOn = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $this->getStore());
50
+ $country_id = ($basedOn == 'shipping') ? $this->getShippingAddress()->getCountryId() : $this->getBillingAddress()->getCountryId();
51
+ $taxCalculator = Mage::getModel('tax/calculation');
52
+ $taxRequest = new Varien_Object();
53
+ $taxRequest->setCountryId($country_id)
54
+ ->setCustomerClassId($this->getCustomer()->getTaxClassId())
55
+ ->setProductClassId($product->getTaxClassId());
56
+ $tax_rate = $taxCalculator->getRate($taxRequest);
57
+ $tax = (float) $taxCalculator->calcTaxAmount($price, $tax_rate, true);
58
+ $price = $price - $tax;
59
+ }
60
+ $product->setPrice($price);
61
+ $product->setFinalPrice($price);
62
+ //option "import with product's title from Lengow"
63
+ if (Mage::getStoreConfig('lensync/orders/title', $this->getStore()))
64
+ $product->setName((string) $product_line->title);
65
+ // add item to quote
66
+ $quote_item = Mage::getModel('sales/quote_item')
67
+ ->setProduct($product)
68
+ ->setQty((int) $product_line->quantity);
69
+ $this->addItem($quote_item);
70
+ }
71
+ }
72
+ }
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Find product in Magento based on API data
78
+ *
79
+ * @param SimpleXMLelement $lengow_product product data
80
+ *
81
+ * @return Mage_Catalog_Model_Product product found to be added
82
+ */
83
+ protected function _findProduct(SimpleXMLelement $lengow_product)
84
+ {
85
+ $api_fields = array(
86
+ 'sku',
87
+ 'idLengow',
88
+ 'idMP',
89
+ 'ean',
90
+ );
91
+ $product_field = strtolower((string) $lengow_product->sku['field'][0]);
92
+ $product_model = Mage::getModel('catalog/product');
93
+ // search product foreach sku
94
+ $i = 0;
95
+ $found = false;
96
+ $count = count($api_fields);
97
+ while(!$found && $i < $count) {
98
+ // search with sku type field first
99
+ $sku = (string) $lengow_product->{$api_fields[$i]};
100
+ $i++;
101
+ if (empty($sku))
102
+ continue;
103
+ // search by field if exists
104
+ $attributeModel = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $product_field);
105
+ if ($attributeModel->getAttributeId()) {
106
+ $collection = Mage::getResourceModel('catalog/product_collection')
107
+ ->setStoreId($this->getStore()->getStoreId())
108
+ ->addAttributeToSelect($product_field)
109
+ ->addAttributeToFilter($product_field, $sku)
110
+ ->setPage(1,1)
111
+ ->getData();
112
+ if(is_array($collection) && count($collection) > 0) {
113
+ $product = $product_model->load($collection[0]['entity_id']);
114
+ }
115
+ }
116
+ // search by id or sku
117
+ if (!$product || !$product->getId()) {
118
+ if (is_integer($sku) && $sku != 0) {
119
+ $product = $product_model->load((integer) $sku);
120
+ } else {
121
+ $sku = str_replace('\_', '_', $sku);
122
+ $product = $product_model->load($product_model->getIdBySku($sku));
123
+ }
124
+ }
125
+ if ($product && $product->getId())
126
+ $found = true;
127
+ }
128
+ if (!$found)
129
+ throw new Lengow_Sync_Model_Quote_Exception('product ' . (string) $lengow_product->sku . ' could not be found.');
130
+ elseif ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
131
+ throw new Lengow_Sync_Model_Quote_Exception('product ' . (string) $lengow_product->sku . ' is a parent product.');
132
+ return $product;
133
+ }
134
+
135
+ /**
136
+ * Get row Total from Lengow
137
+ *
138
+ * @param string $product_id product id
139
+ *
140
+ * @return string
141
+ */
142
+ public function getRowTotalLengow($product_id)
143
+ {
144
+ return $this->_rowTotalLengow[$product_id];
145
+ }
146
+
147
+ }
app/code/community/Lengow/Sync/Model/Quote/Exception.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Lengow_Sync_Model_Quote_Exception extends Exception
4
+ {
5
+ /**
6
+ * The result from the WSDL server that represents the exception information.
7
+ */
8
+ protected $result;
9
+
10
+ /**
11
+ * Make a new WSDL Exception with the given result.
12
+ *
13
+ * @param array $result The error result
14
+ */
15
+ public function __construct($result, $noerror) {
16
+ $this->result = $result;
17
+ if(is_array($result))
18
+ $msg = $result['message'];
19
+ else
20
+ $msg = $result;
21
+ parent::__construct($msg, $noerror);
22
+ }
23
+
24
+ /**
25
+ * Return the associated result object returned by the WSDL server.
26
+ *
27
+ * @return array The result from the WSDL server
28
+ */
29
+ public function getResult() {
30
+ return $this->result;
31
+ }
32
+
33
+ /**
34
+ * Returns the associated type for the error.
35
+ *
36
+ * @return string
37
+ */
38
+ public function getType() {
39
+ if(isset($this->result['type']))
40
+ return $this->result['type'];
41
+ return 'Lengow_Sync_Model_Quote_Exception';
42
+ }
43
+
44
+ /**
45
+ * To make debugging easier.
46
+ *
47
+ * @return string The string representation of the error
48
+ */
49
+ public function __toString() {
50
+ if(isset($this->result['message']))
51
+ return $this->result['message'];
52
+ return $this->message;
53
+ }
54
+ }
app/code/community/Lengow/Sync/Model/Shipping/Carrier/Lengow.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Shipping_Carrier_Lengow extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
@@ -30,11 +30,11 @@ class Lengow_Sync_Model_Shipping_Carrier_Lengow extends Mage_Shipping_Model_Carr
30
  $method->setMethod('lengow');
31
  $method->setMethodTitle($this->getConfigData('name'));
32
  $method->setPrice($this->getSession()->getShippingPrice());
33
- $method->setCost($this->getSession()->getShippingPrice());
34
- $result->append($method);
35
  return $result;
36
  }
37
-
38
  /**
39
  * Processing additional validation to check is carrier applicable.
40
  *
@@ -43,18 +43,16 @@ class Lengow_Sync_Model_Shipping_Carrier_Lengow extends Mage_Shipping_Model_Carr
43
  */
44
  public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request) {
45
  if(Mage::getVersion() == '1.4.1.0')
46
- return $this->isActive();
47
  return parent::proccessAdditionalValidation($request);
48
  }
49
-
50
  public function getSession() {
51
  return Mage::getSingleton('checkout/session');
52
  }
53
-
54
  public function isActive() {
55
- if($this->getSession()->getIsFromlengow())
56
- return true;
57
- return false;
58
  }
59
 
60
  public function getAllowedMethods() {
5
  * @category Lengow
6
  * @package Lengow_Sync
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
+ * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Model_Shipping_Carrier_Lengow extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
30
  $method->setMethod('lengow');
31
  $method->setMethodTitle($this->getConfigData('name'));
32
  $method->setPrice($this->getSession()->getShippingPrice());
33
+ $method->setCost($this->getSession()->getShippingPrice());
34
+ $result->append($method);
35
  return $result;
36
  }
37
+
38
  /**
39
  * Processing additional validation to check is carrier applicable.
40
  *
43
  */
44
  public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request) {
45
  if(Mage::getVersion() == '1.4.1.0')
46
+ return $this->isActive();
47
  return parent::proccessAdditionalValidation($request);
48
  }
49
+
50
  public function getSession() {
51
  return Mage::getSingleton('checkout/session');
52
  }
53
+
54
  public function isActive() {
55
+ return Mage::getSingleton('core/session')->getIsFromlengow();
 
 
56
  }
57
 
58
  public function getAllowedMethods() {
app/code/community/Lengow/Sync/Model/System/Config/Source/Shipping/Carrier.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Lengow_Sync_Model_System_Config_Source_Shipping_Carrier extends Mage_Core_Model_Config_Data
5
+ {
6
+ public function toOptionArray() {
7
+ $carriers = Mage::getModel('shipping/config')->getActiveCarriers();
8
+ $select = array();
9
+ foreach ($carriers as $code => $model) {
10
+ $title = Mage::getStoreConfig('carriers/'.$code.'/title');
11
+ $select[$code] = empty($title) ? $code : $title;
12
+ }
13
+ return $select;
14
+ }
15
+
16
+ public function toSelectArray() {
17
+ $carriers = Mage::getModel('shipping/config')->getActiveCarriers();
18
+ $select = array();
19
+ foreach ($carriers as $code => $model) {
20
+ $select[$code] = Mage::getStoreConfig('carriers/'.$code.'/title');;
21
+ }
22
+ return $select;
23
+ }
24
+ }
app/code/community/Lengow/Sync/Model/System/Config/Source/Shipping/Method.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Lengow_Sync_Model_System_Config_Source_Shipping_Method extends Mage_Core_Model_Config_Data
5
+ {
6
+ public function toOptionArray() {
7
+ $store = Mage::getModel('core/store')
8
+ ->load(Mage::getSingleton('adminhtml/config_data')->getStore());
9
+
10
+ $carrier_code = Mage::getSingleton('lensync/config')
11
+ ->setStore($store)
12
+ ->get('orders/default_carrier');
13
+ if (!$carrier_code)
14
+ return array();
15
+ $carrier = Mage::getModel('shipping/shipping')
16
+ ->getCarrierByCode($carrier_code, $store->getId());
17
+ $methods = $carrier->getAllowedMethods();
18
+ if (count($methods) == 0 )
19
+ return array();
20
+
21
+ $select = array();
22
+ $index = 0;
23
+ foreach ($methods as $method) {
24
+
25
+ $select[$carrier_code.'--'.Mage::helper('lensync/data')->cleanMethod($method)] = $method;
26
+ }
27
+ return $select;
28
+ }
29
+
30
+ public function toSelectArray() {
31
+ $store = Mage::getModel('core/store')
32
+ ->load(Mage::getSingleton('adminhtml/config_data')->getStore());
33
+
34
+ $carrier_code = Mage::getSingleton('lensync/config')
35
+ ->setStore($store)
36
+ ->get('orders/default_carrier');
37
+ if (!$carrier_code)
38
+ return array();
39
+ $carrier = Mage::getModel('shipping/shipping')
40
+ ->getCarrierByCode($carrier_code, $store->getId());
41
+ $methods = $carrier->getAllowedMethods();
42
+ if (count($methods) == 0 )
43
+ return array();
44
+
45
+ $select = array();
46
+ $index = 0;
47
+ foreach ($methods as $method) {
48
+ $select[$index] = $method;
49
+ }
50
+ return $select;
51
+ }
52
+ }
app/code/community/Lengow/Sync/controllers/Adminhtml/Lengow/LogController.php CHANGED
@@ -13,7 +13,7 @@ class Lengow_Sync_Adminhtml_Lengow_LogController extends Mage_Adminhtml_Controll
13
  protected function _initAction() {
14
  $this->loadLayout()
15
  ->_setActiveMenu('lengow/log')
16
- ->_addBreadcrumb(Mage::helper('sync')->__('Lengow orders'), Mage::helper('sync')->__('Lengow orders'));
17
  return $this;
18
  }
19
 
@@ -24,16 +24,16 @@ class Lengow_Sync_Adminhtml_Lengow_LogController extends Mage_Adminhtml_Controll
24
  }
25
 
26
  public function deleteAction() {
27
- $collection = Mage::getModel('sync/log')->getCollection();
28
  foreach($collection as $log)
29
  $log->delete();
30
- $this->_getSession()->addSuccess(Mage::helper('sync')->__('Log is empty'));
31
  $this->_redirect('*/*/index');
32
 
33
  }
34
 
35
  public function gridAction() {
36
- $this->getResponse()->setBody($this->getLayout()->createBlock('sync/adminhtml_log_grid')->toHtml());
37
  return $this;
38
  }
39
 
13
  protected function _initAction() {
14
  $this->loadLayout()
15
  ->_setActiveMenu('lengow/log')
16
+ ->_addBreadcrumb(Mage::helper('lensync')->__('Lengow orders'), Mage::helper('lensync')->__('Lengow orders'));
17
  return $this;
18
  }
19
 
24
  }
25
 
26
  public function deleteAction() {
27
+ $collection = Mage::getModel('lensync/log')->getCollection();
28
  foreach($collection as $log)
29
  $log->delete();
30
+ $this->_getSession()->addSuccess(Mage::helper('lensync')->__('Log is empty'));
31
  $this->_redirect('*/*/index');
32
 
33
  }
34
 
35
  public function gridAction() {
36
+ $this->getResponse()->setBody($this->getLayout()->createBlock('lensync/adminhtml_log_grid')->toHtml());
37
  return $this;
38
  }
39
 
app/code/community/Lengow/Sync/controllers/Adminhtml/Lengow/OrderController.php CHANGED
@@ -4,133 +4,185 @@
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
- * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2013 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Adminhtml_Lengow_OrderController extends Mage_Adminhtml_Controller_Action {
12
 
13
- protected function _initAction() {
 
 
 
 
14
  $this->loadLayout()
15
  ->_setActiveMenu('lengow/order')
16
- ->_addBreadcrumb(Mage::helper('sync')->__('Lengow manage orders'), Mage::helper('sync')->__('Lengow orders'));
17
  return $this;
18
  }
19
-
20
-
 
 
21
  public function indexAction() {
22
  $this->_initAction()
23
- ->renderLayout();
24
  return $this;
25
  }
26
-
 
 
 
27
  public function gridAction() {
28
  $this->getResponse()->setBody(
29
- $this->getLayout()->createBlock('sync/adminhtml_order_grid')->toHtml()
30
  );
31
  return $this;
32
  }
33
-
34
  /**
35
  * Export order grid to CSV format
36
  */
37
- public function exportCsvAction() {
 
38
  $filename = 'orders_lengow.csv';
39
- $grid = $this->getLayout()->createBlock('sync/adminhtml_order_grid');
40
  $this->_prepareDownloadResponse($filename, $grid->getCsvFile());
41
  }
42
 
43
  /**
44
  * Export order grid to Excel XML format
45
  */
46
- public function exportExcelAction() {
 
47
  $filename = 'orders_lengow.xml';
48
- $grid = $this->getLayout()->createBlock('sync/adminhtml_order_grid');
49
  $this->_prepareDownloadResponse($filename, $grid->getExcelFile($filename));
50
  }
51
-
52
- public function importAction() {
53
- //if(!Mage::getSingleton('sync/config')->importCanStart()) {
54
- // Mage::helper('sync/data')->log('##Error manuel import : import is already started##');
55
- // $this->_getSession()->addError(Mage::helper('sync')->__('Import is already started'));
56
- // $this->_redirect('*/*/index');
57
- //} else {
58
- Mage::helper('sync/data')->log('##Start manual import##');
59
- $_force_update = $this->getRequest()->getParam('update');
60
- $_default_store = Mage::getModel('core/store')->load(Mage::app()
61
- ->getWebsite(true)
62
- ->getDefaultGroup()
63
- ->getDefaultStoreId());
64
- $_current_id_store = $_default_store->getId();
65
- $_lengow_id_user_global = Mage::getModel('sync/config')->setStore($_current_id_store)->getConfig('tracker/general/login');
66
- $_lengow_id_group_global = $this->_cleanGroup(Mage::getModel('sync/config')->setStore($_current_id_store)->getConfig('tracker/general/group'));
 
 
 
 
 
 
 
67
  $result_new = 0;
68
  $result_update = 0;
69
- $result_new = 0;
70
- $_default_is_imported = false;
71
- $import = Mage::getModel('sync/import');
72
- $import->setForceUpdate($_force_update);
73
- // Import default shop if configured
74
- if($_lengow_id_user_global && $_lengow_id_group_global) {
75
- try {
76
- $_default_is_imported = true;
77
- Mage::helper('sync/data')->log('Start manual import in store ' . $_default_store->getName() . '(' . $_default_store->getId() . ')');
78
- $days = Mage::getModel('sync/config')->setStore($_default_store->getId())
79
- ->getConfig('sync/orders/period');
80
- $date_from = date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days'));
81
- $date_to = date('Y-m-d');
82
- $result = $import->exec('orders', array('dateFrom' => $date_from,
83
- 'dateTo' => $date_to,
84
- 'id_store' => $_current_id_store));
85
- $result_new = $result['new'];
86
- $result_update = $result['update'];
87
- } catch(Exception $e) {
88
- $this->_getSession()->addError($e->getMessage());
89
- Mage::helper('sync/data')->log('Error ' . $e->getMessage() . '');
90
- }
91
- }
92
  $store_collection = Mage::getResourceModel('core/store_collection')
93
  ->addFieldToFilter('is_active', 1);
94
- // Import different view if is different
95
  foreach($store_collection as $store) {
96
  try {
97
- $_lengow_id_user_current = Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/login');
98
- $_lengow_id_group_current = $this->_cleanGroup(Mage::getModel('sync/config')->setStore($store->getId())->getConfig('tracker/general/group'));
99
- if(($_lengow_id_user_current != $_lengow_id_user_global || $_lengow_id_group_current != $_lengow_id_group_global)
100
- && $_lengow_id_user_current && $_lengow_id_group_current) {
101
- if($store->getId() != $_current_id_store || !$_default_is_imported) {
102
- Mage::helper('sync/data')->log('Start manual import in store ' . $store->getName() . '(' . $store->getId() . ')');
103
- $days = Mage::getModel('sync/config')->setStore($store->getId())
104
- ->getConfig('sync/orders/period');
105
- $date_from = date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days'));
106
- $date_to = date('Y-m-d');
107
- $import = Mage::getModel('sync/import');
108
- $import->setForceUpdate($_force_update);
109
- $result = $import->exec('orders', array('dateFrom' => $date_from,
110
- 'dateTo' => $date_to,
111
- 'id_store' => $store->getId()));
112
- $result_new += $result['new'];
113
- $result_update += $result['update'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  } catch(Exception $e) {
117
  $this->_getSession()->addError($e->getMessage());
118
- Mage::helper('sync/data')->log('Error ' . $e->getMessage() . '');
119
- }
120
- }
121
- if($result_new > 0)
122
- $this->_getSession()->addSuccess(Mage::helper('sync')->__('%d orders are imported', $result['new']));
123
- if($result_update > 0)
124
- $this->_getSession()->addSuccess(Mage::helper('sync')->__('%d orders are updated', $result['update']));
125
- if($result_new == 0 && $result_update == 0)
126
- $this->_getSession()->addSuccess(Mage::helper('sync')->__('No order available to import'));
127
- Mage::helper('sync/data')->log('##End manual import##');
 
 
 
 
 
 
 
 
 
 
 
128
  $this->_redirect('*/*/index');
129
- //}
130
  }
131
 
132
- private function _cleanGroup($data) {
133
- return trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ',');
 
 
 
 
 
 
134
  }
135
-
136
  }
4
  *
5
  * @category Lengow
6
  * @package Lengow_Sync
7
+ * @author Ludovic Drin <ludovic@lengow.com> & Benjamin Le Nevé <benjamin.le-neve@lengow.com>
8
+ * @copyright 2015 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Sync_Adminhtml_Lengow_OrderController extends Mage_Adminhtml_Controller_Action {
12
 
13
+ /**
14
+ * Init Lengow orders menu
15
+ */
16
+ protected function _initAction()
17
+ {
18
  $this->loadLayout()
19
  ->_setActiveMenu('lengow/order')
20
+ ->_addBreadcrumb(Mage::helper('lensync')->__('Lengow manage orders'), Mage::helper('lensync')->__('Lengow orders'));
21
  return $this;
22
  }
23
+
24
+ /**
25
+ * Render the layout
26
+ */
27
  public function indexAction() {
28
  $this->_initAction()
29
+ ->renderLayout();
30
  return $this;
31
  }
32
+
33
+ /**
34
+ * Create the order grid
35
+ */
36
  public function gridAction() {
37
  $this->getResponse()->setBody(
38
+ $this->getLayout()->createBlock('lensync/adminhtml_order_grid')->toHtml()
39
  );
40
  return $this;
41
  }
42
+
43
  /**
44
  * Export order grid to CSV format
45
  */
46
+ public function exportCsvAction()
47
+ {
48
  $filename = 'orders_lengow.csv';
49
+ $grid = $this->getLayout()->createBlock('lensync/adminhtml_order_grid');
50
  $this->_prepareDownloadResponse($filename, $grid->getCsvFile());
51
  }
52
 
53
  /**
54
  * Export order grid to Excel XML format
55
  */
56
+ public function exportExcelAction()
57
+ {
58
  $filename = 'orders_lengow.xml';
59
+ $grid = $this->getLayout()->createBlock('lensync/adminhtml_order_grid');
60
  $this->_prepareDownloadResponse($filename, $grid->getExcelFile($filename));
61
  }
62
+
63
+ /**
64
+ * Imports orders for each store
65
+ */
66
+ public function importAction()
67
+ {
68
+ // update marketplace.xml file
69
+ Mage::helper('lensync/data')->updateMarketplaceXML();
70
+ // clean old log (20 days)
71
+ Mage::helper('lensync/data')->cleanLog();
72
+ // check if import is not already in process
73
+ if (!Mage::getSingleton('lensync/config')->importCanStart()) {
74
+ Mage::helper('lensync/data')->log('## Error manuel import : import is already started ##');
75
+ $this->_getSession()->addError(Mage::helper('lensync')->__('Import is already started'));
76
+ $this->_redirect('*/*/index');
77
+ } else {
78
+ Mage::helper('lensync/data')->log('## Start manual import ##');
79
+
80
+ if(Mage::getStoreConfig('lensync/performances/debug'))
81
+ Mage::helper('lensync/data')->log('WARNING ! Debug mode is activated');
82
+
83
+ $store_count = 0;
84
+ $store_disabled = 0;
85
  $result_new = 0;
86
  $result_update = 0;
87
+ $lengow_groups = array();
88
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  $store_collection = Mage::getResourceModel('core/store_collection')
90
  ->addFieldToFilter('is_active', 1);
91
+
92
  foreach($store_collection as $store) {
93
  try {
94
+ if(!$store->getId())
95
+ continue;
96
+
97
+ $store_count++;
98
+ Mage::helper('lensync/data')->log('Start manual import in store ' . $store->getName() . ' (' . $store->getId() . ')');
99
+
100
+ $lensync_config = Mage::getModel('lensync/config', array('store' => $store));
101
+ // if store is enabled -> stop import
102
+ if(!$lensync_config->get('orders/active_store')) {
103
+ Mage::helper('lensync/data')->log('Stop manual import - Store ' . $store->getName() . '(' . $store->getId() . ') is disabled');
104
+ $store_disabled++;
105
+ continue;
106
+ }
107
+ // get login informations
108
+ $error_import = false;
109
+ $lentracker_config = Mage::getModel('lentracker/config', array('store' => $store));
110
+ $id_lengow_customer = $lentracker_config->get('general/login');
111
+ $id_lengow_group = $this->_cleanGroup($lentracker_config->get('general/group'));
112
+ $api_token_lengow = $lentracker_config->get('general/api_key');
113
+ // if ID Customer or token API are empty -> stop import
114
+ if (empty($id_lengow_customer) || !is_numeric($id_lengow_customer) || empty($api_token_lengow)) {
115
+ $message = 'ID customer or token API is empty. Please make sure it is saved in your plugin configuration';
116
+ $this->_getSession()->addError(Mage::helper('lensync')->__($message));
117
+ Mage::helper('lensync/data')->log($message);
118
+ break;
119
+ }
120
+ // if ID group is empty -> stop import for current store
121
+ if (empty($id_lengow_group)) {
122
+ $message = 'ID group is empty. Please make sure it is saved in your plugin configuration';
123
+ Mage::helper('lensync/data')->log('Stop manual import in store ' . $store->getName() . '(' . $store->getId() . ') : ' . $message);
124
+ $error_import = true;
125
+ }
126
+ // check if group was already imported
127
+ $new_id_lengow_group = false;
128
+ $id_groups = explode(';', $id_lengow_group);
129
+ foreach ($id_groups as $id_group) {
130
+ if (is_numeric($id_group) && !in_array($id_group, $lengow_groups)) {
131
+ $lengow_groups[] = $id_group;
132
+ $new_id_lengow_group .= !$new_id_lengow_group ? $id_group : ';'.$id_group;
133
  }
134
  }
135
+ // start import for current store
136
+ if (!$error_import && $new_id_lengow_group) {
137
+ $days = $lensync_config->get('orders/period');
138
+ $args = array(
139
+ 'dateFrom' => date('Y-m-d', strtotime(date('Y-m-d') . '-' . $days . 'days')),
140
+ 'dateTo' => date('Y-m-d'),
141
+ 'config' => $lensync_config,
142
+ 'idCustomer' => $id_lengow_customer,
143
+ 'idGroup' => $new_id_lengow_group,
144
+ 'apiToken' => $api_token_lengow,
145
+ );
146
+ $import = Mage::getModel('lensync/import', $args);
147
+ $result = $import->exec();
148
+ $result_new += $result['new'];
149
+ $result_update += $result['update'];
150
+ }
151
  } catch(Exception $e) {
152
  $this->_getSession()->addError($e->getMessage());
153
+ Mage::helper('lensync/data')->log('Error ' . $e->getMessage() . '');
154
+ }
155
+ }
156
+ if($result_new > 0) {
157
+ $this->_getSession()->addSuccess(Mage::helper('lensync')->__('%d orders are imported', $result_new));
158
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('%d orders are imported', $result_new));
159
+ }
160
+ if($result_update > 0) {
161
+ $this->_getSession()->addSuccess(Mage::helper('lensync')->__('%d orders are updated', $result_update));
162
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('%d orders are updated', $result_update));
163
+ }
164
+ if($result_new == 0 && $result_update == 0) {
165
+ $this->_getSession()->addSuccess(Mage::helper('lensync')->__('No order available to import'));
166
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('No order available to import'));
167
+ }
168
+ if ($store_count == $store_disabled) {
169
+ $this->_getSession()->addError(Mage::helper('lensync')->__('No store enabled to import. Please check lengow import configuration'));
170
+ Mage::helper('lensync/data')->log(Mage::helper('lensync')->__('No store enabled to import. Please check lengow import configuration'));
171
+ }
172
+ Mage::helper('lensync/data')->log('## End manual import ##');
173
+ Mage::getSingleton('lensync/config')->importSetEnd();
174
  $this->_redirect('*/*/index');
175
+ }
176
  }
177
 
178
+ /**
179
+ * Clean group id
180
+ *
181
+ * @param string $data
182
+ */
183
+ private function _cleanGroup($data)
184
+ {
185
+ return trim(str_replace(array("\r\n", ';', '-', '|', ' '), ';', $data), ';');
186
  }
187
+
188
  }
app/code/community/Lengow/Sync/controllers/ApiController.php CHANGED
@@ -15,8 +15,8 @@ class Lengow_Sync_ApiController extends Mage_Core_Controller_Front_Action {
15
  }
16
 
17
  public function checkAction() {
18
- $_helper_export = Mage::helper('export/security');
19
- $_helper_api = Mage::helper('sync/api');
20
  if($_helper_export->checkIp()) {
21
  $return = array('magento_version' => Mage::getVersion(),
22
  'lengow_version' => $_helper_api->getVersion());
15
  }
16
 
17
  public function checkAction() {
18
+ $_helper_export = Mage::helper('lenexport/security');
19
+ $_helper_api = Mage::helper('lensync/api');
20
  if($_helper_export->checkIp()) {
21
  $return = array('magento_version' => Mage::getVersion(),
22
  'lengow_version' => $_helper_api->getVersion());
app/code/community/Lengow/Sync/etc/config.xml CHANGED
@@ -2,18 +2,18 @@
2
  <config>
3
  <modules>
4
  <Lengow_Sync>
5
- <version>2.0.1.5</version>
6
  </Lengow_Sync>
7
  </modules>
8
  <admin>
9
  <routers>
10
- <sync>
11
  <use>admin</use>
12
  <args>
13
  <module>Lengow_Sync</module>
14
- <frontName>lengow</frontName>
15
  </args>
16
- </sync>
17
  <adminhtml>
18
  <args>
19
  <modules>
@@ -25,10 +25,10 @@
25
  </admin>
26
  <global>
27
  <models>
28
- <sync>
29
  <class>Lengow_Sync_Model</class>
30
  <resourceModel>sync_mysql4</resourceModel>
31
- </sync>
32
  <sync_mysql4>
33
  <class>Lengow_Sync_Model_Mysql4</class>
34
  <entities>
@@ -48,26 +48,26 @@
48
  <use>core_setup</use>
49
  </connection>
50
  </lengow_setup>
51
- <sync_write>
52
  <connection>
53
  <use>core_write</use>
54
  </connection>
55
- </sync_write>
56
- <sync_read>
57
  <connection>
58
  <use>core_read</use>
59
  </connection>
60
- </sync_read>
61
  </resources>
62
  <blocks>
63
- <sync>
64
  <class>Lengow_Sync_Block</class>
65
- </sync>
66
  </blocks>
67
  <helpers>
68
- <sync>
69
  <class>Lengow_Sync_Helper</class>
70
- </sync>
71
  </helpers>
72
  <events>
73
  <sales_order_shipment_save_after>
@@ -78,6 +78,14 @@
78
  </lengow_shipment_save_after>
79
  </observers>
80
  </sales_order_shipment_save_after>
 
 
 
 
 
 
 
 
81
  <sales_order_payment_cancel>
82
  <observers>
83
  <lengow_payment_cancel>
@@ -175,12 +183,12 @@
175
  <title>Lengow</title>
176
  <sort_order>20</sort_order>
177
  <children>
178
- <sync translate="title" module="sync">
179
  <title>Manage Orders</title>
180
  <action>adminhtml/lengow_order</action>
181
  <sort_order>200</sort_order>
182
  </sync>
183
- <log translate="title" module="sync">
184
  <title>Logs</title>
185
  <action>adminhtml/lengow_log</action>
186
  <sort_order>400</sort_order>
@@ -196,20 +204,20 @@
196
  <children>
197
  <config>
198
  <children>
199
- <sync translate="title" module="sync">
200
  <title>Manage orders</title>
201
- </sync>
202
  </children>
203
  </config>
204
  </children>
205
  </system>
206
- <lengow translate="title" module="sync">
207
  <title>Lengow</title>
208
  <children>
209
- <sync translate="title" module="sync">
210
  <title>Manage Orders</title>
211
- </sync>
212
- <log translate="title" module="sync">
213
  <title>Manage Logs</title>
214
  </log>
215
  </children>
@@ -226,27 +234,37 @@
226
  <cron_expr>*/30 * * * *</cron_expr>
227
  </schedule>
228
  <run>
229
- <model>sync/observer::import</model>
230
  </run>
231
  </sync_orders_lengow>
232
  </jobs>
233
  </crontab>
234
  <default>
235
- <sync>
236
  <orders>
 
237
  <period>3</period>
238
- <customer_group>0</customer_group>
239
- <pending>0</pending>
240
  <processing_fee>1</processing_fee>
 
 
 
 
 
 
241
  </orders>
 
 
 
 
242
  <hidden>
243
  <last_synchro>0000-00-00</last_synchro>
244
  </hidden>
245
- </sync>
246
  <payment>
247
  <lengow>
248
  <active>1</active>
249
- <model>sync/payment_method_lengow</model>
250
  <order_status>pending</order_status>
251
  <title>Lengow Payment</title>
252
  <allowspecific>0</allowspecific>
@@ -254,7 +272,7 @@
254
  </lengow>
255
  <lengow_purchaseorder>
256
  <active>1</active>
257
- <model>sync/payment_method_lengow</model>
258
  <order_status>new</order_status>
259
  <title>Lengow Payment (version 1.x)</title>
260
  <allowspecific>0</allowspecific>
@@ -262,10 +280,10 @@
262
  </lengow_purchaseorder>
263
  </payment>
264
  <carriers>
265
- <lengow translate="name title" module="sync">
266
  <active>1</active>
267
  <sallowspecific>0</sallowspecific>
268
- <model>sync/shipping_carrier_lengow</model>
269
  <name>Shipping from marketplace</name>
270
  <title>Lengow</title>
271
  </lengow>
2
  <config>
3
  <modules>
4
  <Lengow_Sync>
5
+ <version>2.1.0</version>
6
  </Lengow_Sync>
7
  </modules>
8
  <admin>
9
  <routers>
10
+ <lensync> <!-- module name -->
11
  <use>admin</use>
12
  <args>
13
  <module>Lengow_Sync</module>
14
+ <frontName>lengow</frontName> <!-- URL call of controller -->
15
  </args>
16
+ </lensync>
17
  <adminhtml>
18
  <args>
19
  <modules>
25
  </admin>
26
  <global>
27
  <models>
28
+ <lensync>
29
  <class>Lengow_Sync_Model</class>
30
  <resourceModel>sync_mysql4</resourceModel>
31
+ </lensync>
32
  <sync_mysql4>
33
  <class>Lengow_Sync_Model_Mysql4</class>
34
  <entities>
48
  <use>core_setup</use>
49
  </connection>
50
  </lengow_setup>
51
+ <lensync_write>
52
  <connection>
53
  <use>core_write</use>
54
  </connection>
55
+ </lensync_write>
56
+ <lensync_read>
57
  <connection>
58
  <use>core_read</use>
59
  </connection>
60
+ </lensync_read>
61
  </resources>
62
  <blocks>
63
+ <lensync>
64
  <class>Lengow_Sync_Block</class>
65
+ </lensync>
66
  </blocks>
67
  <helpers>
68
+ <lensync>
69
  <class>Lengow_Sync_Helper</class>
70
+ </lensync>
71
  </helpers>
72
  <events>
73
  <sales_order_shipment_save_after>
78
  </lengow_shipment_save_after>
79
  </observers>
80
  </sales_order_shipment_save_after>
81
+ <!-- <sales_order_shipment_track_save_after>
82
+ <observers>
83
+ <lengow_shipment_track_save_after>
84
+ <class>Lengow_Sync_Model_Observer</class>
85
+ <method>salesOrderShipmentTrackSaveAfter</method>
86
+ </lengow_shipment_track_save_after>
87
+ </observers>
88
+ </sales_order_shipment_track_save_after> -->
89
  <sales_order_payment_cancel>
90
  <observers>
91
  <lengow_payment_cancel>
183
  <title>Lengow</title>
184
  <sort_order>20</sort_order>
185
  <children>
186
+ <sync translate="title" module="lensync">
187
  <title>Manage Orders</title>
188
  <action>adminhtml/lengow_order</action>
189
  <sort_order>200</sort_order>
190
  </sync>
191
+ <log translate="title" module="lensync">
192
  <title>Logs</title>
193
  <action>adminhtml/lengow_log</action>
194
  <sort_order>400</sort_order>
204
  <children>
205
  <config>
206
  <children>
207
+ <lensync translate="title" module="lensync">
208
  <title>Manage orders</title>
209
+ </lensync>
210
  </children>
211
  </config>
212
  </children>
213
  </system>
214
+ <lengow translate="title" module="lensync">
215
  <title>Lengow</title>
216
  <children>
217
+ <lensync translate="title" module="lensync">
218
  <title>Manage Orders</title>
219
+ </lensync>
220
+ <log translate="title" module="lensync">
221
  <title>Manage Logs</title>
222
  </log>
223
  </children>
234
  <cron_expr>*/30 * * * *</cron_expr>
235
  </schedule>
236
  <run>
237
+ <model>lensync/observer::import</model>
238
  </run>
239
  </sync_orders_lengow>
240
  </jobs>
241
  </crontab>
242
  <default>
243
+ <lensync>
244
  <orders>
245
+ <active_store>0</active_store>
246
  <period>3</period>
247
+ <date_import>0</date_import>
 
248
  <processing_fee>1</processing_fee>
249
+ <customer_group>0</customer_group>
250
+ <title>0</title>
251
+ <!-- <pending>0</pending> -->
252
+ <split_name>0</split_name>
253
+ <default_shipping>lengow_lengow</default_shipping>
254
+ <fake_email>0</fake_email>
255
  </orders>
256
+ <performances>
257
+ <active_cron>0</active_cron>
258
+ <debug>0</debug>
259
+ </performances>
260
  <hidden>
261
  <last_synchro>0000-00-00</last_synchro>
262
  </hidden>
263
+ </lensync>
264
  <payment>
265
  <lengow>
266
  <active>1</active>
267
+ <model>lensync/payment_method_lengow</model>
268
  <order_status>pending</order_status>
269
  <title>Lengow Payment</title>
270
  <allowspecific>0</allowspecific>
272
  </lengow>
273
  <lengow_purchaseorder>
274
  <active>1</active>
275
+ <model>lensync/payment_method_lengow</model>
276
  <order_status>new</order_status>
277
  <title>Lengow Payment (version 1.x)</title>
278
  <allowspecific>0</allowspecific>
280
  </lengow_purchaseorder>
281
  </payment>
282
  <carriers>
283
+ <lengow translate="name title" module="lensync">
284
  <active>1</active>
285
  <sallowspecific>0</sallowspecific>
286
+ <model>lensync/shipping_carrier_lengow</model>
287
  <name>Shipping from marketplace</name>
288
  <title>Lengow</title>
289
  </lengow>
app/code/community/Lengow/Sync/etc/marketplaces.xml CHANGED
@@ -74,7 +74,6 @@
74
  <state name="ToShip">
75
  <actions>
76
  <action type="shipped">Shipped</action>
77
- <action type="refuse">refuseOrder</action>
78
  </actions>
79
  <lengow>processing</lengow>
80
  </state>
@@ -131,7 +130,10 @@
131
  <state name="refusesale">
132
  <lengow>canceled</lengow>
133
  </state>
134
- <state name="CLOSED">
 
 
 
135
  <lengow>shipped</lengow>
136
  </state>
137
  <state name="CANCELLED">
@@ -240,28 +242,28 @@
240
  <lengow>canceled</lengow>
241
  </state>
242
  </states>
243
- <payments>
244
  <payment name="NoPaymentFailure">
245
  <lengow>complete</lengow>
246
  </payment>
247
- <payment name="PayPalPaymentInProcess">
248
  <lengow>pending</lengow>
249
  </payment>
250
- <payment name="PayPalPaymentInProcess">
251
  <lengow>pending</lengow>
252
  </payment>
253
  <payment name="MoneyXferAcceptedInCheckout">
254
  <lengow>pending</lengow>
255
  </payment>
256
- <payment name="Complete">
257
  <lengow>complete</lengow>
258
  </payment>
259
- <payment name="Incomplete">
260
  <lengow>pending</lengow>
261
  </payment>
262
- <payment name="PaymentInProcess">
263
  <lengow>pending</lengow>
264
- </payment>
265
  </payments>
266
  <additional_params>
267
  <param usedby="shipped">
@@ -270,412 +272,391 @@
270
  </param>
271
  </additional_params>
272
  </marketplace>
273
- <marketplace name="cdiscount">
274
- <api>https://wsdl.lengow.com/wsdl/cdiscount/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
275
  <states>
276
- <state name="WaitingForSellerAcceptation">
277
- <actions>
278
- <action type="accept">acceptOrder</action>
279
- <action type="refuse">refuseOrder</action>
280
- </actions>
281
- <lengow>new</lengow>
282
- </state>
283
- <state name="AcceptedBySeller">
284
- <lengow>new</lengow>
285
- </state>
286
- <state name="PaymentinProgress">
287
- <lengow>new</lengow>
288
- </state>
289
- <state name="ValidatedFianet">
290
  <lengow>new</lengow>
291
  </state>
292
- <state name="WaitingForShipmentAcceptation">
293
  <actions>
294
  <action type="shipped">shippedOrder</action>
295
- <action type="refuse">refuseShipment</action>
296
  </actions>
297
  <lengow>processing</lengow>
298
  </state>
299
- <state name="Shipped">
300
  <lengow>shipped</lengow>
301
  </state>
302
- <state name="">
303
- <lengow>canceled</lengow>
304
- </state>
305
- <state name="ShipmentRefusedBySeller">
306
- <lengow>canceled</lengow>
307
- </state>
308
- <state name="PaymentRefused">
309
- <lengow>canceled</lengow>
310
- </state>
311
- <state name="CancelledByCustomer">
312
- <lengow>canceled</lengow>
313
- </state>
314
- <state name="RefusedNotShipment">
315
- <lengow>canceled</lengow>
316
- </state>
317
- <state name="AutomaticCancellation">
318
- <lengow>canceled</lengow>
319
- </state>
320
- <state name="CancelledBeforePaymentByCustomer">
321
- <lengow>canceled</lengow>
322
- </state>
323
- <state name="CancelledBeforeNotificationByCustomer">
324
- <lengow>canceled</lengow>
325
- </state>
326
- <state name="CancellationRequestPending">
327
- <lengow>canceled</lengow>
328
- </state>
329
- <state name="RefusedBySeller">
330
  <lengow>canceled</lengow>
331
  </state>
332
- <state name="PickedUp">
333
- <lengow>shipped</lengow>
334
- </state>
335
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  <additional_params>
337
- <param usedby="shipped" require="carrier">
338
  <type>tracking</type>
339
  <name>TrackingColis</name>
340
  </param>
341
- <param usedby="shipped" require="tracking">
342
- <type>carrier</type>
343
- <name>Transporteur</name>
344
- <accepted_values>
345
- <value label="La Poste" default="true">LAPOSTE</value>
346
- <value label="DHL">DHL</value>
347
- <value label="Fedex">FEDEX</value>
348
- <value label="GLS">GLS</value>
349
- <value label="UPS">UPS</value>
350
- <value label="TAT Express">TAT</value>
351
- <value label="TNT">TNT</value>
352
- <value label="Mondial Relay">MONDIALRELAY</value>
353
- <value label="SERNAM">SERNAM</value>
354
- <value label="Geodis Calberson">GEODISCALBERSON</value>
355
- <value label="France Express">FRANCEEXPRESS</value>
356
- <value label="SDEN">FRANCSDENEEXPRESS</value>
357
- <value label="CHRONOPOST">Chronopost</value>
358
- <value label="TATEX">TATEX</value>
359
- <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
360
- <value label="Relais colis">Relais_colis</value>
361
- <value label="Gefco">Gefco</value>
362
- <value label="MORY">MORY</value>
363
- <value label="Heppner">Heppner</value>
364
- <value label="Exapaq">Exapaq</value>
365
- <value label="Mazet">Mazet</value>
366
- <value label="SIC EXPRESS">SICEXPRESS</value>
367
- <value label="TMB">TMB</value>
368
- </accepted_values>
369
- </param>
370
- <param usedby="shipped">
371
- <type>tracking_url</type>
372
- <name>TrackingUrl</name>
373
- </param>
374
  </additional_params>
375
  </marketplace>
376
- <marketplace name="laredoute">
377
- <api>https://wsdl.lengow.com/wsdl/laredoute/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
378
- <apibyline>https://wsdl.lengow.com/wsdl/laredoute/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QTY_TO_REFUND#/#FDP#/#ACTION#.xml</apibyline>
379
  <states>
380
- <state name="ToCancel">
381
- <actions>
382
- <action type="cancel">cancelOrder</action>
383
- </actions>
384
- <lengow>new</lengow>
385
- </state>
386
- <state name="Created">
387
- <actions>
388
- <action type="accept">acceptOrder</action>
389
- <action type="refuse">refuseOrder</action>
390
- </actions>
391
- <lengow>new</lengow>
392
- </state>
393
- <state name="Accepted">
394
  <lengow>new</lengow>
395
  </state>
396
  <state name="ToShip">
397
  <actions>
398
  <action type="shipped">shippedOrder</action>
399
- <action type="refund">refundOrder</action>
400
- <action type="refundLine" usedbyline="true">refundOrder</action>
401
  </actions>
402
  <lengow>processing</lengow>
403
  </state>
404
- <state name="ToCancel">
405
- <lengow>processing</lengow>
406
- </state>
407
- <state name="Shipped">
408
- <actions>
409
- <action type="refund">refundOrder</action>
410
- <action type="refundLine" usedbyline="true">refundOrder</action>
411
- </actions>
412
  <lengow>shipped</lengow>
413
  </state>
414
- <state name="Refunded">
415
- <lengow>canceled</lengow>
416
- </state>
417
  <state name="Cancelled">
418
  <lengow>canceled</lengow>
419
  </state>
420
- <state name="Refused">
421
- <lengow>canceled</lengow>
422
- </state>
423
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  <additional_params>
425
  <param usedby="shipped">
426
  <type>tracking</type>
427
  <name>TrackingColis</name>
428
  </param>
429
- <param usedby="shipped">
430
- <type>carrier</type>
431
- <name>Transporteur</name>
432
- </param>
433
- <param usedby="shipped">
434
- <type>tracking_url</type>
435
- <name>url</name>
436
- </param>
437
- <param usedby="shipped" usedbyline="true">
438
- <type>shipping_price</type>
439
- <name>fdp</name>
440
- </param>
441
- <param usedby="shipped" usedbyline="true">
442
- <type>order_line</type>
443
- <name>orderlineid</name>
444
- </param>
445
- <param usedby="shipped" usedbyline="true">
446
- <type>quantity</type>
447
- <name>qty</name>
448
- </param>
449
  </additional_params>
450
  </marketplace>
451
- <marketplace name="frenchplace">
452
- <api>https://wsdl.lengow.com/wsdl/frenchplace/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
453
  <states>
454
- <state name="new">
455
- <actions>
456
- <action type="accept">acceptOrder</action>
457
- <action type="refuse">refuseOrder</action>
458
- </actions>
459
  <lengow>new</lengow>
460
  </state>
461
- <state name="Accepted">
 
 
 
462
  <lengow>processing</lengow>
463
  </state>
464
- <state name="shipped">
465
  <lengow>shipped</lengow>
466
  </state>
467
- <state name="Accepted">
468
  <lengow>canceled</lengow>
469
  </state>
470
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  <additional_params>
472
  <param usedby="shipped">
473
  <type>tracking</type>
474
  <name>TrackingColis</name>
475
  </param>
476
- <param usedby="shipped">
477
- <type>carrier</type>
478
- <name>Transporteur</name>
479
- </param>
480
  </additional_params>
481
  </marketplace>
482
- <marketplace name="greenrepublic">
483
- <api>https://wsdl.lengow.com/wsdl/greenrepublic/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
484
  <states>
485
- <state name="new">
486
- <actions>
487
- <action type="refuse">refuseOrder</action>
488
- </actions>
489
  <lengow>new</lengow>
490
  </state>
491
- <state name="pending_payment">
492
- <lengow>processing</lengow>
493
- </state>
494
- <state name="processing">
495
  <actions>
496
  <action type="shipped">shippedOrder</action>
497
  </actions>
498
  <lengow>processing</lengow>
499
  </state>
500
- <state name="holded">
501
- <lengow>processing</lengow>
502
- </state>
503
- <state name="in">
504
- <lengow>processing</lengow>
505
- </state>
506
- <state name="payment_review">
507
- <lengow>processing</lengow>
508
- </state>
509
- <state name="complete">
510
  <lengow>shipped</lengow>
511
  </state>
512
- <state name="canceled">
513
  <lengow>canceled</lengow>
514
  </state>
515
  </states>
516
- <additional_params>
517
- <param usedby="shipped">
518
- <type>tracking</type>
519
- <name>TrackingColis</name>
520
- </param>
521
- <param usedby="shipped">
522
- <type>carrier</type>
523
- <name>Transporteur</name>
524
- <accepted_values>
525
- <value>sc_calberson</value>
526
- <value>sc_fedex</value>
527
- <value>sc_relaypoint</value>
528
- <value>sc_gls</value>
529
- <value>sc_chronopost</value>
530
- <value>sc_tnt</value>
531
- <value>sc_dhl</value>
532
- <value default="true">sc_colissimo</value>
533
- <value>sc_export3j</value>
534
- </accepted_values>
 
 
 
 
 
 
 
 
535
  </param>
536
  </additional_params>
537
  </marketplace>
538
- <marketplace name="babyssima">
539
- <api>https://wsdl.lengow.com/wsdl/babyssima/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
540
  <states>
541
- <state name="new">
542
- <actions>
543
- <action type="refuse">refuseOrder</action>
544
- </actions>
545
  <lengow>new</lengow>
546
  </state>
547
- <state name="processing">
548
  <actions>
549
  <action type="shipped">shippedOrder</action>
550
  </actions>
551
  <lengow>processing</lengow>
552
  </state>
553
- <state name="complete">
554
  <lengow>shipped</lengow>
555
  </state>
556
- <state name="canceled">
557
  <lengow>canceled</lengow>
558
  </state>
559
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  <additional_params>
561
  <param usedby="shipped">
562
  <type>tracking</type>
563
  <name>TrackingColis</name>
564
  </param>
565
- <param usedby="shipped">
566
- <type>carrier</type>
567
- <name>Transporteur</name>
568
- </param>
569
  </additional_params>
570
  </marketplace>
571
- <marketplace name="monechelle">
572
- <api>https://wsdl.lengow.com/wsdl/monechelle/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
573
  <states>
574
- <state name="new">
575
  <lengow>new</lengow>
576
  </state>
577
- <state name="processing">
578
  <actions>
579
- <action type="refuse">refuseOrder</action>
580
- <action type="accept">acceptOrder</action>
581
  </actions>
582
  <lengow>processing</lengow>
583
  </state>
584
- <state name="accepted">
585
  <lengow>shipped</lengow>
586
  </state>
587
- <state name="refused">
588
  <lengow>canceled</lengow>
589
  </state>
590
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  <additional_params>
592
  <param usedby="shipped">
593
  <type>tracking</type>
594
  <name>TrackingColis</name>
595
  </param>
596
- <param usedby="shipped">
597
- <type>carrier</type>
598
- <name>Transporteur</name>
599
- </param>
600
  </additional_params>
601
  </marketplace>
602
- <marketplace name="brandalley">
603
- <api>https://wsdl.lengow.com/wsdl/brandalley/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
604
  <states>
605
- <state name="new">
 
 
 
606
  <actions>
607
- <action type="refuse">refuseOrder</action>
608
- <action type="accept">acceptOrder</action>
609
  </actions>
610
  <lengow>processing</lengow>
611
  </state>
612
- <state name="accepted">
613
  <lengow>shipped</lengow>
614
  </state>
615
- <state name="cancel">
616
- <lengow>canceled</lengow>
617
- </state>
618
- </states>
619
- </marketplace>
620
- <marketplace name="pixplace">
621
- <states>
622
- <state name="accepted">
623
- <lengow>processing</lengow>
624
- </state>
625
- <state name="processing">
626
- <lengow>processing</lengow>
627
- </state>
628
- <state name="NotReceived">
629
- <lengow>processing</lengow>
630
- </state>
631
  <state name="Cancelled">
632
  <lengow>canceled</lengow>
633
  </state>
634
- <state name="Refused">
635
- <lengow>canceled</lengow>
636
- </state>
637
- <state name="Refunded">
638
- <lengow>canceled</lengow>
639
- </state>
640
- </states>
641
- </marketplace>
642
- <marketplace name="leoo">
643
- <states>
644
- <state name="Confirmé">
645
- <lengow>processing</lengow>
646
- </state>
647
- <state name="Expédié">
648
- <lengow>shipped</lengow>
649
- </state>
650
- <state name="Annulation">
651
- <lengow>canceled</lengow>
652
- </state>
653
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  </marketplace>
655
- <marketplace name="lechouchou">
656
- <api>https://wsdl.lengow.com/wsdl/lechouchou/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
657
  <states>
658
- <state name="new">
659
  <lengow>new</lengow>
660
- <actions>
661
- <action type="accept">accepted</action>
662
- <action type="refuse">refused</action>
663
- </actions>
664
  </state>
665
- <state name="processing">
666
  <actions>
667
- <action type="shipped">shipped</action>
668
- <action type="refuse">refused</action>
669
  </actions>
670
  <lengow>processing</lengow>
671
  </state>
672
- <state name="accept">
673
  <lengow>shipped</lengow>
674
  </state>
675
- <state name="refused">
676
  <lengow>canceled</lengow>
677
  </state>
678
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
  <additional_params>
680
  <param usedby="shipped">
681
  <type>tracking</type>
@@ -683,296 +664,3261 @@
683
  </param>
684
  </additional_params>
685
  </marketplace>
686
- <marketplace name="leoo">
687
- <states>
688
- <state name="Confirmé">
689
- <lengow>processing</lengow>
690
- </state>
691
- <state name="Expédié">
692
- <lengow>shipped</lengow>
693
- </state>
694
- <state name="Annulation">
695
- <lengow>canceled</lengow>
696
- </state>
697
- </states>
698
- </marketplace>
699
- <marketplace name="discounteo">
700
- <api>https://wsdl.lengow.com/wsdl/discounteo/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
701
  <states>
702
- <state name="new">
703
  <lengow>new</lengow>
704
  </state>
705
- <state name="processing">
706
  <actions>
707
- <action type="shipped">shipped</action>
708
- <action type="refuse">refused</action>
709
  </actions>
710
  <lengow>processing</lengow>
711
  </state>
712
- <state name="shipped">
713
  <lengow>shipped</lengow>
714
  </state>
715
- <state name="refused">
716
  <lengow>canceled</lengow>
717
  </state>
718
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  <additional_params>
720
  <param usedby="shipped">
721
  <type>tracking</type>
722
  <name>TrackingColis</name>
723
  </param>
724
- <param usedby="shipped">
725
- <type>carrier</type>
726
- <name>Transporteur</name>
727
- </param>
728
  </additional_params>
729
  </marketplace>
730
- <marketplace name="ecopresto">
731
- <api>https://wsdl.lengow.com/wsdl/ecopresto/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
732
  <states>
733
- <state name="new">
734
  <lengow>new</lengow>
735
  </state>
736
- <state name="processing">
737
  <actions>
738
- <action type="shipped">setTracking</action>
739
  </actions>
740
  <lengow>processing</lengow>
741
  </state>
742
- <state name="shipped">
743
  <lengow>shipped</lengow>
744
  </state>
745
- <state name="refused">
746
  <lengow>canceled</lengow>
747
  </state>
748
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  <additional_params>
750
  <param usedby="shipped">
751
  <type>tracking</type>
752
  <name>TrackingColis</name>
753
  </param>
754
- <param usedby="shipped">
755
- <type>carrier</type>
756
- <name>TrackingCarrier</name>
757
- <accepted_values>
758
- <value label="Divers" default="true">1</value>
759
- <value label="Colissimo">2</value>
760
- <value label="Lettre Max">3</value>
761
- </accepted_values>
762
- </param>
763
  </additional_params>
764
  </marketplace>
765
- <marketplace name="ecitizen">
 
766
  <states>
767
- <state name="processing">
 
 
 
 
 
 
768
  <lengow>processing</lengow>
769
  </state>
770
- <state name="shipped">
771
  <lengow>shipped</lengow>
772
  </state>
 
 
 
773
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  </marketplace>
775
- <marketplace name="godsavethekids">
 
776
  <states>
777
- <state name="RECEIVED">
778
- <lengow>new</lengow>
779
- </state>
780
- <state name="STAGING">
781
- <lengow>new</lengow>
782
- </state>
783
- <state name="WAITING_ACCEPTANCE">
784
- <lengow>new</lengow>
785
- </state>
786
- <state name="WAITING_DEBIT">
787
- <lengow>new</lengow>
788
- </state>
789
- <state name="WAITING_DEBIT_PAYMENT">
790
  <lengow>new</lengow>
791
  </state>
792
- <state name="CANCELED">
793
- <lengow>canceled</lengow>
794
- </state>
795
- <state name="CLOSED">
796
- <lengow>processing</lengow>
797
- </state>
798
- <state name="REFUSED">
799
- <lengow>canceled</lengow>
800
- </state>
801
- <state name="SHIPPING">
802
- <lengow>shipped</lengow>
803
- </state>
804
- <state name="INCIDENT_OPEN">
805
  <lengow>processing</lengow>
806
  </state>
807
- <state name="SHIPPED">
808
  <lengow>shipped</lengow>
809
  </state>
810
- <state name="REFUNDED">
811
  <lengow>canceled</lengow>
812
  </state>
813
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
814
  </marketplace>
815
- <marketplace name="mistergooddeal">
816
- <api>https://wsdl.lengow.com/wsdl/mistergooddeal/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
817
  <states>
818
- <state name="RECEIVED">
819
- <lengow>new</lengow>
820
- </state>
821
- <state name="STAGING">
822
  <lengow>new</lengow>
823
  </state>
824
- <state name="WAITING_ACCEPTANCE">
825
- <lengow>new</lengow>
826
  <actions>
827
- <action type="accept">accept</action>
828
- <action type="refuse">canceled</action>
829
  </actions>
830
- </state>
831
- <state name="WAITING_DEBIT">
832
- <lengow>new</lengow>
833
- </state>
834
- <state name="WAITING_DEBIT_PAYMENT">
835
- <lengow>new</lengow>
836
- </state>
837
- <state name="SHIPPING">
838
  <lengow>processing</lengow>
839
- <actions>
840
- <action type="shipped">shipped</action>
841
- </actions>
842
- </state>
843
- <state name="RECEIVED">
844
- <lengow>shipped</lengow>
845
- </state>
846
- <state name="SHIPPED">
847
- <lengow>shipped</lengow>
848
- </state>
849
- <state name="CANCELED">
850
- <lengow>canceled</lengow>
851
  </state>
852
- <state name="CLOSED">
853
  <lengow>shipped</lengow>
854
  </state>
855
- <state name="REFUSED">
856
  <lengow>canceled</lengow>
857
  </state>
858
- <state name="INCIDENT_OPEN">
859
- <lengow>processing</lengow>
860
- </state>
861
- <state name="INCIDENT_CLOSED">
862
- <lengow>processing</lengow>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
  </state>
864
- <state name="WAITING_REFUND">
 
 
 
865
  <lengow>processing</lengow>
866
  </state>
867
- <state name="WAITING_REFUND_PAYMENT">
868
- <lengow>processing</lengow>
869
  </state>
870
- <state name="REFUNDED">
871
  <lengow>canceled</lengow>
872
  </state>
873
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
  </marketplace>
875
- <marketplace name="rakuten_de">
876
- <api>https://wsdl.lengow.com/wsdl/rakutende/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
877
  <states>
878
- <state name="pending">
879
  <lengow>new</lengow>
880
  </state>
881
- <state name="editable">
882
- <lengow>processing</lengow>
883
  <actions>
884
- <action type="shipped">shipped</action>
885
  </actions>
 
886
  </state>
887
- <state name="shipped">
888
- <lengow>shipped</lengow>
889
- </state>
890
- <state name="payout">
891
  <lengow>shipped</lengow>
892
  </state>
893
- <state name="cancelled">
894
  <lengow>canceled</lengow>
895
  </state>
896
  </states>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
897
  </marketplace>
898
- <marketplace name="spartoo">
899
- <api>https://wsdl.lengow.com/wsdl/spartoo/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
 
900
  <states>
901
- <state name="0">
902
  <lengow>new</lengow>
 
 
 
 
903
  </state>
904
- <state name="1">
 
905
  <actions>
906
- <action type="accept">processing</action>
907
- <action type="cancel">canceled</action>
908
- <action type="refund">refund</action>
909
  </actions>
910
- <lengow>new</lengow>
911
  </state>
912
- <state name="11">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
913
  <lengow>new</lengow>
914
  <actions>
915
- <action type="accept">processing</action>
916
- <action type="cancel">canceled</action>
917
- <action type="refund">refund</action>
918
  </actions>
919
  </state>
920
- <state name="2">
 
921
  <actions>
922
  <action type="shipped" method="post">shipped</action>
923
- <action type="cancel">canceled</action>
924
- <action type="refund">refund</action>
925
  </actions>
926
- <lengow>processing</lengow>
927
  </state>
928
- <state name="3">
929
  <lengow>shipped</lengow>
930
  </state>
931
- <state name="4">
932
  <lengow>canceled</lengow>
933
  </state>
934
- <state name="41">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
  <lengow>canceled</lengow>
936
  </state>
937
  </states>
938
  <additional_params>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  <param usedby="shipped">
940
  <type>tracking</type>
941
  <name>tracking_number</name>
942
  </param>
 
 
 
 
943
  </additional_params>
944
  </marketplace>
945
- <marketplace name="zalando">
946
- <api>http://wsdl.lengow.com/wsdl/zalando/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
 
947
  <states>
948
- <state name="New">
949
  <lengow>new</lengow>
950
- </state>
951
- <state name="Approved">
952
  <actions>
953
- <action type="shipped" method="post">SHIPPED</action>
954
- <action type="cancel" method="post">ZALANDO_CANCELED</action>
955
- <action type="refund" method="post">NO_INVENTORY_CANCELED</action>
956
  </actions>
957
- <lengow>processing</lengow>
958
  </state>
959
- <state name="Shipped">
 
960
  <actions>
961
- <action type="returned" method="post">RETURNED</action>
 
962
  </actions>
 
 
963
  <lengow>shipped</lengow>
964
  </state>
965
- <state name="Returned">
966
  <lengow>canceled</lengow>
967
  </state>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
968
  <state name="canceled">
969
  <lengow>canceled</lengow>
970
  </state>
971
  </states>
972
  <additional_params>
973
- <param usedby="shipped cancel refund returned">
974
- <type>client_token</type>
975
- <name>token</name>
 
 
 
 
976
  </param>
977
  <param usedby="shipped cancel refund returned">
978
  <type>action</type>
@@ -992,32 +3938,92 @@
992
  </param>
993
  <param usedby="shipped">
994
  <type>tracking</type>
995
- <name>trackingNumber</name>
996
  </param>
997
  <param usedby="shipped">
998
- <type>return_tracking</type>
999
- <name>returnTrackingNumber</name>
1000
- </param>
1001
- <param usedby="returned">
1002
- <type>return_code</type>
1003
- <name>returnReasonCode</name>
1004
  </param>
1005
  </additional_params>
1006
  </marketplace>
1007
- <marketplace name="placedumariage">
 
 
1008
  <states>
1009
- <state name="partielle">
1010
  <lengow>new</lengow>
 
 
 
 
1011
  </state>
1012
- <state name="complète">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013
  <lengow>new</lengow>
1014
  </state>
1015
- <state name="expédiée">
 
 
 
 
 
 
1016
  <lengow>shipped</lengow>
1017
  </state>
1018
- <state name="annulée">
1019
  <lengow>canceled</lengow>
1020
  </state>
1021
- </states>
1022
  </marketplace>
1023
  </marketplaces>
74
  <state name="ToShip">
75
  <actions>
76
  <action type="shipped">Shipped</action>
 
77
  </actions>
78
  <lengow>processing</lengow>
79
  </state>
130
  <state name="refusesale">
131
  <lengow>canceled</lengow>
132
  </state>
133
+ <state name="closed">
134
+ <lengow>shipped</lengow>
135
+ </state>
136
+ <state name="CLOSED">
137
  <lengow>shipped</lengow>
138
  </state>
139
  <state name="CANCELLED">
242
  <lengow>canceled</lengow>
243
  </state>
244
  </states>
245
+ <payments>
246
  <payment name="NoPaymentFailure">
247
  <lengow>complete</lengow>
248
  </payment>
249
+ <payment name="PayPalPaymentInProcess">
250
  <lengow>pending</lengow>
251
  </payment>
252
+ <payment name="PayPalPaymentInProcess">
253
  <lengow>pending</lengow>
254
  </payment>
255
  <payment name="MoneyXferAcceptedInCheckout">
256
  <lengow>pending</lengow>
257
  </payment>
258
+ <payment name="Complete">
259
  <lengow>complete</lengow>
260
  </payment>
261
+ <payment name="Incomplete">
262
  <lengow>pending</lengow>
263
  </payment>
264
+ <payment name="PaymentInProcess">
265
  <lengow>pending</lengow>
266
+ </payment>
267
  </payments>
268
  <additional_params>
269
  <param usedby="shipped">
272
  </param>
273
  </additional_params>
274
  </marketplace>
275
+ <marketplace name="ebay_fr">
276
+ <api>https://wsdl.lengow.com/wsdl/ebay_fr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
277
  <states>
278
+ <state name="New">
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  <lengow>new</lengow>
280
  </state>
281
+ <state name="ToShip">
282
  <actions>
283
  <action type="shipped">shippedOrder</action>
 
284
  </actions>
285
  <lengow>processing</lengow>
286
  </state>
287
+ <state name="Completed">
288
  <lengow>shipped</lengow>
289
  </state>
290
+ <state name="Cancelled">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  <lengow>canceled</lengow>
292
  </state>
 
 
 
293
  </states>
294
+ <payments>
295
+ <payment name="NoPaymentFailure">
296
+ <lengow>complete</lengow>
297
+ </payment>
298
+ <payment name="PayPalPaymentInProcess">
299
+ <lengow>pending</lengow>
300
+ </payment>
301
+ <payment name="PayPalPaymentInProcess">
302
+ <lengow>pending</lengow>
303
+ </payment>
304
+ <payment name="MoneyXferAcceptedInCheckout">
305
+ <lengow>pending</lengow>
306
+ </payment>
307
+ <payment name="Complete">
308
+ <lengow>complete</lengow>
309
+ </payment>
310
+ <payment name="Incomplete">
311
+ <lengow>pending</lengow>
312
+ </payment>
313
+ <payment name="PaymentInProcess">
314
+ <lengow>pending</lengow>
315
+ </payment>
316
+ </payments>
317
  <additional_params>
318
+ <param usedby="shipped">
319
  <type>tracking</type>
320
  <name>TrackingColis</name>
321
  </param>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  </additional_params>
323
  </marketplace>
324
+ <marketplace name="ebay_us">
325
+ <api>https://wsdl.lengow.com/wsdl/ebay_us/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
 
326
  <states>
327
+ <state name="New">
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  <lengow>new</lengow>
329
  </state>
330
  <state name="ToShip">
331
  <actions>
332
  <action type="shipped">shippedOrder</action>
 
 
333
  </actions>
334
  <lengow>processing</lengow>
335
  </state>
336
+ <state name="Completed">
 
 
 
 
 
 
 
337
  <lengow>shipped</lengow>
338
  </state>
 
 
 
339
  <state name="Cancelled">
340
  <lengow>canceled</lengow>
341
  </state>
 
 
 
342
  </states>
343
+ <payments>
344
+ <payment name="NoPaymentFailure">
345
+ <lengow>complete</lengow>
346
+ </payment>
347
+ <payment name="PayPalPaymentInProcess">
348
+ <lengow>pending</lengow>
349
+ </payment>
350
+ <payment name="PayPalPaymentInProcess">
351
+ <lengow>pending</lengow>
352
+ </payment>
353
+ <payment name="MoneyXferAcceptedInCheckout">
354
+ <lengow>pending</lengow>
355
+ </payment>
356
+ <payment name="Complete">
357
+ <lengow>complete</lengow>
358
+ </payment>
359
+ <payment name="Incomplete">
360
+ <lengow>pending</lengow>
361
+ </payment>
362
+ <payment name="PaymentInProcess">
363
+ <lengow>pending</lengow>
364
+ </payment>
365
+ </payments>
366
  <additional_params>
367
  <param usedby="shipped">
368
  <type>tracking</type>
369
  <name>TrackingColis</name>
370
  </param>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  </additional_params>
372
  </marketplace>
373
+ <marketplace name="ebay_at">
374
+ <api>https://wsdl.lengow.com/wsdl/ebay_at/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
375
  <states>
376
+ <state name="New">
 
 
 
 
377
  <lengow>new</lengow>
378
  </state>
379
+ <state name="ToShip">
380
+ <actions>
381
+ <action type="shipped">shippedOrder</action>
382
+ </actions>
383
  <lengow>processing</lengow>
384
  </state>
385
+ <state name="Completed">
386
  <lengow>shipped</lengow>
387
  </state>
388
+ <state name="Cancelled">
389
  <lengow>canceled</lengow>
390
  </state>
391
  </states>
392
+ <payments>
393
+ <payment name="NoPaymentFailure">
394
+ <lengow>complete</lengow>
395
+ </payment>
396
+ <payment name="PayPalPaymentInProcess">
397
+ <lengow>pending</lengow>
398
+ </payment>
399
+ <payment name="PayPalPaymentInProcess">
400
+ <lengow>pending</lengow>
401
+ </payment>
402
+ <payment name="MoneyXferAcceptedInCheckout">
403
+ <lengow>pending</lengow>
404
+ </payment>
405
+ <payment name="Complete">
406
+ <lengow>complete</lengow>
407
+ </payment>
408
+ <payment name="Incomplete">
409
+ <lengow>pending</lengow>
410
+ </payment>
411
+ <payment name="PaymentInProcess">
412
+ <lengow>pending</lengow>
413
+ </payment>
414
+ </payments>
415
  <additional_params>
416
  <param usedby="shipped">
417
  <type>tracking</type>
418
  <name>TrackingColis</name>
419
  </param>
 
 
 
 
420
  </additional_params>
421
  </marketplace>
422
+ <marketplace name="ebay_au">
423
+ <api>https://wsdl.lengow.com/wsdl/ebay_au/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
424
  <states>
425
+ <state name="New">
 
 
 
426
  <lengow>new</lengow>
427
  </state>
428
+ <state name="ToShip">
 
 
 
429
  <actions>
430
  <action type="shipped">shippedOrder</action>
431
  </actions>
432
  <lengow>processing</lengow>
433
  </state>
434
+ <state name="Completed">
 
 
 
 
 
 
 
 
 
435
  <lengow>shipped</lengow>
436
  </state>
437
+ <state name="Cancelled">
438
  <lengow>canceled</lengow>
439
  </state>
440
  </states>
441
+ <payments>
442
+ <payment name="NoPaymentFailure">
443
+ <lengow>complete</lengow>
444
+ </payment>
445
+ <payment name="PayPalPaymentInProcess">
446
+ <lengow>pending</lengow>
447
+ </payment>
448
+ <payment name="PayPalPaymentInProcess">
449
+ <lengow>pending</lengow>
450
+ </payment>
451
+ <payment name="MoneyXferAcceptedInCheckout">
452
+ <lengow>pending</lengow>
453
+ </payment>
454
+ <payment name="Complete">
455
+ <lengow>complete</lengow>
456
+ </payment>
457
+ <payment name="Incomplete">
458
+ <lengow>pending</lengow>
459
+ </payment>
460
+ <payment name="PaymentInProcess">
461
+ <lengow>pending</lengow>
462
+ </payment>
463
+ </payments>
464
+ <additional_params>
465
+ <param usedby="shipped">
466
+ <type>tracking</type>
467
+ <name>TrackingColis</name>
468
  </param>
469
  </additional_params>
470
  </marketplace>
471
+ <marketplace name="ebay_befr">
472
+ <api>https://wsdl.lengow.com/wsdl/ebay_befr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
473
  <states>
474
+ <state name="New">
 
 
 
475
  <lengow>new</lengow>
476
  </state>
477
+ <state name="ToShip">
478
  <actions>
479
  <action type="shipped">shippedOrder</action>
480
  </actions>
481
  <lengow>processing</lengow>
482
  </state>
483
+ <state name="Completed">
484
  <lengow>shipped</lengow>
485
  </state>
486
+ <state name="Cancelled">
487
  <lengow>canceled</lengow>
488
  </state>
489
  </states>
490
+ <payments>
491
+ <payment name="NoPaymentFailure">
492
+ <lengow>complete</lengow>
493
+ </payment>
494
+ <payment name="PayPalPaymentInProcess">
495
+ <lengow>pending</lengow>
496
+ </payment>
497
+ <payment name="PayPalPaymentInProcess">
498
+ <lengow>pending</lengow>
499
+ </payment>
500
+ <payment name="MoneyXferAcceptedInCheckout">
501
+ <lengow>pending</lengow>
502
+ </payment>
503
+ <payment name="Complete">
504
+ <lengow>complete</lengow>
505
+ </payment>
506
+ <payment name="Incomplete">
507
+ <lengow>pending</lengow>
508
+ </payment>
509
+ <payment name="PaymentInProcess">
510
+ <lengow>pending</lengow>
511
+ </payment>
512
+ </payments>
513
  <additional_params>
514
  <param usedby="shipped">
515
  <type>tracking</type>
516
  <name>TrackingColis</name>
517
  </param>
 
 
 
 
518
  </additional_params>
519
  </marketplace>
520
+ <marketplace name="ebay_benl">
521
+ <api>https://wsdl.lengow.com/wsdl/ebay_benl/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
522
  <states>
523
+ <state name="New">
524
  <lengow>new</lengow>
525
  </state>
526
+ <state name="ToShip">
527
  <actions>
528
+ <action type="shipped">shippedOrder</action>
 
529
  </actions>
530
  <lengow>processing</lengow>
531
  </state>
532
+ <state name="Completed">
533
  <lengow>shipped</lengow>
534
  </state>
535
+ <state name="Cancelled">
536
  <lengow>canceled</lengow>
537
  </state>
538
  </states>
539
+ <payments>
540
+ <payment name="NoPaymentFailure">
541
+ <lengow>complete</lengow>
542
+ </payment>
543
+ <payment name="PayPalPaymentInProcess">
544
+ <lengow>pending</lengow>
545
+ </payment>
546
+ <payment name="PayPalPaymentInProcess">
547
+ <lengow>pending</lengow>
548
+ </payment>
549
+ <payment name="MoneyXferAcceptedInCheckout">
550
+ <lengow>pending</lengow>
551
+ </payment>
552
+ <payment name="Complete">
553
+ <lengow>complete</lengow>
554
+ </payment>
555
+ <payment name="Incomplete">
556
+ <lengow>pending</lengow>
557
+ </payment>
558
+ <payment name="PaymentInProcess">
559
+ <lengow>pending</lengow>
560
+ </payment>
561
+ </payments>
562
  <additional_params>
563
  <param usedby="shipped">
564
  <type>tracking</type>
565
  <name>TrackingColis</name>
566
  </param>
 
 
 
 
567
  </additional_params>
568
  </marketplace>
569
+ <marketplace name="ebay_ca">
570
+ <api>https://wsdl.lengow.com/wsdl/ebay_ca/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
571
  <states>
572
+ <state name="New">
573
+ <lengow>new</lengow>
574
+ </state>
575
+ <state name="ToShip">
576
  <actions>
577
+ <action type="shipped">shippedOrder</action>
 
578
  </actions>
579
  <lengow>processing</lengow>
580
  </state>
581
+ <state name="Completed">
582
  <lengow>shipped</lengow>
583
  </state>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  <state name="Cancelled">
585
  <lengow>canceled</lengow>
586
  </state>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587
  </states>
588
+ <payments>
589
+ <payment name="NoPaymentFailure">
590
+ <lengow>complete</lengow>
591
+ </payment>
592
+ <payment name="PayPalPaymentInProcess">
593
+ <lengow>pending</lengow>
594
+ </payment>
595
+ <payment name="PayPalPaymentInProcess">
596
+ <lengow>pending</lengow>
597
+ </payment>
598
+ <payment name="MoneyXferAcceptedInCheckout">
599
+ <lengow>pending</lengow>
600
+ </payment>
601
+ <payment name="Complete">
602
+ <lengow>complete</lengow>
603
+ </payment>
604
+ <payment name="Incomplete">
605
+ <lengow>pending</lengow>
606
+ </payment>
607
+ <payment name="PaymentInProcess">
608
+ <lengow>pending</lengow>
609
+ </payment>
610
+ </payments>
611
+ <additional_params>
612
+ <param usedby="shipped">
613
+ <type>tracking</type>
614
+ <name>TrackingColis</name>
615
+ </param>
616
+ </additional_params>
617
  </marketplace>
618
+ <marketplace name="ebay_cafr">
619
+ <api>https://wsdl.lengow.com/wsdl/ebay_cafr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
620
  <states>
621
+ <state name="New">
622
  <lengow>new</lengow>
 
 
 
 
623
  </state>
624
+ <state name="ToShip">
625
  <actions>
626
+ <action type="shipped">shippedOrder</action>
 
627
  </actions>
628
  <lengow>processing</lengow>
629
  </state>
630
+ <state name="Completed">
631
  <lengow>shipped</lengow>
632
  </state>
633
+ <state name="Cancelled">
634
  <lengow>canceled</lengow>
635
  </state>
636
  </states>
637
+ <payments>
638
+ <payment name="NoPaymentFailure">
639
+ <lengow>complete</lengow>
640
+ </payment>
641
+ <payment name="PayPalPaymentInProcess">
642
+ <lengow>pending</lengow>
643
+ </payment>
644
+ <payment name="PayPalPaymentInProcess">
645
+ <lengow>pending</lengow>
646
+ </payment>
647
+ <payment name="MoneyXferAcceptedInCheckout">
648
+ <lengow>pending</lengow>
649
+ </payment>
650
+ <payment name="Complete">
651
+ <lengow>complete</lengow>
652
+ </payment>
653
+ <payment name="Incomplete">
654
+ <lengow>pending</lengow>
655
+ </payment>
656
+ <payment name="PaymentInProcess">
657
+ <lengow>pending</lengow>
658
+ </payment>
659
+ </payments>
660
  <additional_params>
661
  <param usedby="shipped">
662
  <type>tracking</type>
664
  </param>
665
  </additional_params>
666
  </marketplace>
667
+ <marketplace name="ebay_ch">
668
+ <api>https://wsdl.lengow.com/wsdl/ebay_ch/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
 
 
 
 
 
 
 
 
 
 
 
 
 
669
  <states>
670
+ <state name="New">
671
  <lengow>new</lengow>
672
  </state>
673
+ <state name="ToShip">
674
  <actions>
675
+ <action type="shipped">shippedOrder</action>
 
676
  </actions>
677
  <lengow>processing</lengow>
678
  </state>
679
+ <state name="Completed">
680
  <lengow>shipped</lengow>
681
  </state>
682
+ <state name="Cancelled">
683
  <lengow>canceled</lengow>
684
  </state>
685
  </states>
686
+ <payments>
687
+ <payment name="NoPaymentFailure">
688
+ <lengow>complete</lengow>
689
+ </payment>
690
+ <payment name="PayPalPaymentInProcess">
691
+ <lengow>pending</lengow>
692
+ </payment>
693
+ <payment name="PayPalPaymentInProcess">
694
+ <lengow>pending</lengow>
695
+ </payment>
696
+ <payment name="MoneyXferAcceptedInCheckout">
697
+ <lengow>pending</lengow>
698
+ </payment>
699
+ <payment name="Complete">
700
+ <lengow>complete</lengow>
701
+ </payment>
702
+ <payment name="Incomplete">
703
+ <lengow>pending</lengow>
704
+ </payment>
705
+ <payment name="PaymentInProcess">
706
+ <lengow>pending</lengow>
707
+ </payment>
708
+ </payments>
709
  <additional_params>
710
  <param usedby="shipped">
711
  <type>tracking</type>
712
  <name>TrackingColis</name>
713
  </param>
 
 
 
 
714
  </additional_params>
715
  </marketplace>
716
+ <marketplace name="ebay_de">
717
+ <api>https://wsdl.lengow.com/wsdl/ebay_de/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
718
  <states>
719
+ <state name="New">
720
  <lengow>new</lengow>
721
  </state>
722
+ <state name="ToShip">
723
  <actions>
724
+ <action type="shipped">shippedOrder</action>
725
  </actions>
726
  <lengow>processing</lengow>
727
  </state>
728
+ <state name="Completed">
729
  <lengow>shipped</lengow>
730
  </state>
731
+ <state name="Cancelled">
732
  <lengow>canceled</lengow>
733
  </state>
734
  </states>
735
+ <payments>
736
+ <payment name="NoPaymentFailure">
737
+ <lengow>complete</lengow>
738
+ </payment>
739
+ <payment name="PayPalPaymentInProcess">
740
+ <lengow>pending</lengow>
741
+ </payment>
742
+ <payment name="PayPalPaymentInProcess">
743
+ <lengow>pending</lengow>
744
+ </payment>
745
+ <payment name="MoneyXferAcceptedInCheckout">
746
+ <lengow>pending</lengow>
747
+ </payment>
748
+ <payment name="Complete">
749
+ <lengow>complete</lengow>
750
+ </payment>
751
+ <payment name="Incomplete">
752
+ <lengow>pending</lengow>
753
+ </payment>
754
+ <payment name="PaymentInProcess">
755
+ <lengow>pending</lengow>
756
+ </payment>
757
+ </payments>
758
  <additional_params>
759
  <param usedby="shipped">
760
  <type>tracking</type>
761
  <name>TrackingColis</name>
762
  </param>
 
 
 
 
 
 
 
 
 
763
  </additional_params>
764
  </marketplace>
765
+ <marketplace name="ebay_es">
766
+ <api>https://wsdl.lengow.com/wsdl/ebay_es/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
767
  <states>
768
+ <state name="New">
769
+ <lengow>new</lengow>
770
+ </state>
771
+ <state name="ToShip">
772
+ <actions>
773
+ <action type="shipped">shippedOrder</action>
774
+ </actions>
775
  <lengow>processing</lengow>
776
  </state>
777
+ <state name="Completed">
778
  <lengow>shipped</lengow>
779
  </state>
780
+ <state name="Cancelled">
781
+ <lengow>canceled</lengow>
782
+ </state>
783
  </states>
784
+ <payments>
785
+ <payment name="NoPaymentFailure">
786
+ <lengow>complete</lengow>
787
+ </payment>
788
+ <payment name="PayPalPaymentInProcess">
789
+ <lengow>pending</lengow>
790
+ </payment>
791
+ <payment name="PayPalPaymentInProcess">
792
+ <lengow>pending</lengow>
793
+ </payment>
794
+ <payment name="MoneyXferAcceptedInCheckout">
795
+ <lengow>pending</lengow>
796
+ </payment>
797
+ <payment name="Complete">
798
+ <lengow>complete</lengow>
799
+ </payment>
800
+ <payment name="Incomplete">
801
+ <lengow>pending</lengow>
802
+ </payment>
803
+ <payment name="PaymentInProcess">
804
+ <lengow>pending</lengow>
805
+ </payment>
806
+ </payments>
807
+ <additional_params>
808
+ <param usedby="shipped">
809
+ <type>tracking</type>
810
+ <name>TrackingColis</name>
811
+ </param>
812
+ </additional_params>
813
  </marketplace>
814
+ <marketplace name="ebay_hk">
815
+ <api>https://wsdl.lengow.com/wsdl/ebay_hk/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
816
  <states>
817
+ <state name="New">
 
 
 
 
 
 
 
 
 
 
 
 
818
  <lengow>new</lengow>
819
  </state>
820
+ <state name="ToShip">
821
+ <actions>
822
+ <action type="shipped">shippedOrder</action>
823
+ </actions>
 
 
 
 
 
 
 
 
 
824
  <lengow>processing</lengow>
825
  </state>
826
+ <state name="Completed">
827
  <lengow>shipped</lengow>
828
  </state>
829
+ <state name="Cancelled">
830
  <lengow>canceled</lengow>
831
  </state>
832
  </states>
833
+ <payments>
834
+ <payment name="NoPaymentFailure">
835
+ <lengow>complete</lengow>
836
+ </payment>
837
+ <payment name="PayPalPaymentInProcess">
838
+ <lengow>pending</lengow>
839
+ </payment>
840
+ <payment name="PayPalPaymentInProcess">
841
+ <lengow>pending</lengow>
842
+ </payment>
843
+ <payment name="MoneyXferAcceptedInCheckout">
844
+ <lengow>pending</lengow>
845
+ </payment>
846
+ <payment name="Complete">
847
+ <lengow>complete</lengow>
848
+ </payment>
849
+ <payment name="Incomplete">
850
+ <lengow>pending</lengow>
851
+ </payment>
852
+ <payment name="PaymentInProcess">
853
+ <lengow>pending</lengow>
854
+ </payment>
855
+ </payments>
856
+ <additional_params>
857
+ <param usedby="shipped">
858
+ <type>tracking</type>
859
+ <name>TrackingColis</name>
860
+ </param>
861
+ </additional_params>
862
  </marketplace>
863
+ <marketplace name="ebay_ie">
864
+ <api>https://wsdl.lengow.com/wsdl/ebay_ie/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
865
  <states>
866
+ <state name="New">
 
 
 
867
  <lengow>new</lengow>
868
  </state>
869
+ <state name="ToShip">
 
870
  <actions>
871
+ <action type="shipped">shippedOrder</action>
 
872
  </actions>
 
 
 
 
 
 
 
 
873
  <lengow>processing</lengow>
 
 
 
 
 
 
 
 
 
 
 
 
874
  </state>
875
+ <state name="Completed">
876
  <lengow>shipped</lengow>
877
  </state>
878
+ <state name="Cancelled">
879
  <lengow>canceled</lengow>
880
  </state>
881
+ </states>
882
+ <payments>
883
+ <payment name="NoPaymentFailure">
884
+ <lengow>complete</lengow>
885
+ </payment>
886
+ <payment name="PayPalPaymentInProcess">
887
+ <lengow>pending</lengow>
888
+ </payment>
889
+ <payment name="PayPalPaymentInProcess">
890
+ <lengow>pending</lengow>
891
+ </payment>
892
+ <payment name="MoneyXferAcceptedInCheckout">
893
+ <lengow>pending</lengow>
894
+ </payment>
895
+ <payment name="Complete">
896
+ <lengow>complete</lengow>
897
+ </payment>
898
+ <payment name="Incomplete">
899
+ <lengow>pending</lengow>
900
+ </payment>
901
+ <payment name="PaymentInProcess">
902
+ <lengow>pending</lengow>
903
+ </payment>
904
+ </payments>
905
+ <additional_params>
906
+ <param usedby="shipped">
907
+ <type>tracking</type>
908
+ <name>TrackingColis</name>
909
+ </param>
910
+ </additional_params>
911
+ </marketplace>
912
+ <marketplace name="ebay_in">
913
+ <api>https://wsdl.lengow.com/wsdl/ebay_in/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
914
+ <states>
915
+ <state name="New">
916
+ <lengow>new</lengow>
917
  </state>
918
+ <state name="ToShip">
919
+ <actions>
920
+ <action type="shipped">shippedOrder</action>
921
+ </actions>
922
  <lengow>processing</lengow>
923
  </state>
924
+ <state name="Completed">
925
+ <lengow>shipped</lengow>
926
  </state>
927
+ <state name="Cancelled">
928
  <lengow>canceled</lengow>
929
  </state>
930
  </states>
931
+ <payments>
932
+ <payment name="NoPaymentFailure">
933
+ <lengow>complete</lengow>
934
+ </payment>
935
+ <payment name="PayPalPaymentInProcess">
936
+ <lengow>pending</lengow>
937
+ </payment>
938
+ <payment name="PayPalPaymentInProcess">
939
+ <lengow>pending</lengow>
940
+ </payment>
941
+ <payment name="MoneyXferAcceptedInCheckout">
942
+ <lengow>pending</lengow>
943
+ </payment>
944
+ <payment name="Complete">
945
+ <lengow>complete</lengow>
946
+ </payment>
947
+ <payment name="Incomplete">
948
+ <lengow>pending</lengow>
949
+ </payment>
950
+ <payment name="PaymentInProcess">
951
+ <lengow>pending</lengow>
952
+ </payment>
953
+ </payments>
954
+ <additional_params>
955
+ <param usedby="shipped">
956
+ <type>tracking</type>
957
+ <name>TrackingColis</name>
958
+ </param>
959
+ </additional_params>
960
  </marketplace>
961
+ <marketplace name="ebay_it">
962
+ <api>https://wsdl.lengow.com/wsdl/ebay_it/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
963
  <states>
964
+ <state name="New">
965
  <lengow>new</lengow>
966
  </state>
967
+ <state name="ToShip">
 
968
  <actions>
969
+ <action type="shipped">shippedOrder</action>
970
  </actions>
971
+ <lengow>processing</lengow>
972
  </state>
973
+ <state name="Completed">
 
 
 
974
  <lengow>shipped</lengow>
975
  </state>
976
+ <state name="Cancelled">
977
  <lengow>canceled</lengow>
978
  </state>
979
  </states>
980
+ <payments>
981
+ <payment name="NoPaymentFailure">
982
+ <lengow>complete</lengow>
983
+ </payment>
984
+ <payment name="PayPalPaymentInProcess">
985
+ <lengow>pending</lengow>
986
+ </payment>
987
+ <payment name="PayPalPaymentInProcess">
988
+ <lengow>pending</lengow>
989
+ </payment>
990
+ <payment name="MoneyXferAcceptedInCheckout">
991
+ <lengow>pending</lengow>
992
+ </payment>
993
+ <payment name="Complete">
994
+ <lengow>complete</lengow>
995
+ </payment>
996
+ <payment name="Incomplete">
997
+ <lengow>pending</lengow>
998
+ </payment>
999
+ <payment name="PaymentInProcess">
1000
+ <lengow>pending</lengow>
1001
+ </payment>
1002
+ </payments>
1003
+ <additional_params>
1004
+ <param usedby="shipped">
1005
+ <type>tracking</type>
1006
+ <name>TrackingColis</name>
1007
+ </param>
1008
+ </additional_params>
1009
+ </marketplace>
1010
+ <marketplace name="ebay_my">
1011
+ <api>https://wsdl.lengow.com/wsdl/ebay_my/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1012
+ <states>
1013
+ <state name="New">
1014
+ <lengow>new</lengow>
1015
+ </state>
1016
+ <state name="ToShip">
1017
+ <actions>
1018
+ <action type="shipped">shippedOrder</action>
1019
+ </actions>
1020
+ <lengow>processing</lengow>
1021
+ </state>
1022
+ <state name="Completed">
1023
+ <lengow>shipped</lengow>
1024
+ </state>
1025
+ <state name="Cancelled">
1026
+ <lengow>canceled</lengow>
1027
+ </state>
1028
+ </states>
1029
+ <payments>
1030
+ <payment name="NoPaymentFailure">
1031
+ <lengow>complete</lengow>
1032
+ </payment>
1033
+ <payment name="PayPalPaymentInProcess">
1034
+ <lengow>pending</lengow>
1035
+ </payment>
1036
+ <payment name="PayPalPaymentInProcess">
1037
+ <lengow>pending</lengow>
1038
+ </payment>
1039
+ <payment name="MoneyXferAcceptedInCheckout">
1040
+ <lengow>pending</lengow>
1041
+ </payment>
1042
+ <payment name="Complete">
1043
+ <lengow>complete</lengow>
1044
+ </payment>
1045
+ <payment name="Incomplete">
1046
+ <lengow>pending</lengow>
1047
+ </payment>
1048
+ <payment name="PaymentInProcess">
1049
+ <lengow>pending</lengow>
1050
+ </payment>
1051
+ </payments>
1052
+ <additional_params>
1053
+ <param usedby="shipped">
1054
+ <type>tracking</type>
1055
+ <name>TrackingColis</name>
1056
+ </param>
1057
+ </additional_params>
1058
+ </marketplace>
1059
+ <marketplace name="ebay_nl">
1060
+ <api>https://wsdl.lengow.com/wsdl/ebay_nl/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1061
+ <states>
1062
+ <state name="New">
1063
+ <lengow>new</lengow>
1064
+ </state>
1065
+ <state name="ToShip">
1066
+ <actions>
1067
+ <action type="shipped">shippedOrder</action>
1068
+ </actions>
1069
+ <lengow>processing</lengow>
1070
+ </state>
1071
+ <state name="Completed">
1072
+ <lengow>shipped</lengow>
1073
+ </state>
1074
+ <state name="Cancelled">
1075
+ <lengow>canceled</lengow>
1076
+ </state>
1077
+ </states>
1078
+ <payments>
1079
+ <payment name="NoPaymentFailure">
1080
+ <lengow>complete</lengow>
1081
+ </payment>
1082
+ <payment name="PayPalPaymentInProcess">
1083
+ <lengow>pending</lengow>
1084
+ </payment>
1085
+ <payment name="PayPalPaymentInProcess">
1086
+ <lengow>pending</lengow>
1087
+ </payment>
1088
+ <payment name="MoneyXferAcceptedInCheckout">
1089
+ <lengow>pending</lengow>
1090
+ </payment>
1091
+ <payment name="Complete">
1092
+ <lengow>complete</lengow>
1093
+ </payment>
1094
+ <payment name="Incomplete">
1095
+ <lengow>pending</lengow>
1096
+ </payment>
1097
+ <payment name="PaymentInProcess">
1098
+ <lengow>pending</lengow>
1099
+ </payment>
1100
+ </payments>
1101
+ <additional_params>
1102
+ <param usedby="shipped">
1103
+ <type>tracking</type>
1104
+ <name>TrackingColis</name>
1105
+ </param>
1106
+ </additional_params>
1107
+ </marketplace>
1108
+ <marketplace name="ebay_ph">
1109
+ <api>https://wsdl.lengow.com/wsdl/ebay_ph/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1110
+ <states>
1111
+ <state name="New">
1112
+ <lengow>new</lengow>
1113
+ </state>
1114
+ <state name="ToShip">
1115
+ <actions>
1116
+ <action type="shipped">shippedOrder</action>
1117
+ </actions>
1118
+ <lengow>processing</lengow>
1119
+ </state>
1120
+ <state name="Completed">
1121
+ <lengow>shipped</lengow>
1122
+ </state>
1123
+ <state name="Cancelled">
1124
+ <lengow>canceled</lengow>
1125
+ </state>
1126
+ </states>
1127
+ <payments>
1128
+ <payment name="NoPaymentFailure">
1129
+ <lengow>complete</lengow>
1130
+ </payment>
1131
+ <payment name="PayPalPaymentInProcess">
1132
+ <lengow>pending</lengow>
1133
+ </payment>
1134
+ <payment name="PayPalPaymentInProcess">
1135
+ <lengow>pending</lengow>
1136
+ </payment>
1137
+ <payment name="MoneyXferAcceptedInCheckout">
1138
+ <lengow>pending</lengow>
1139
+ </payment>
1140
+ <payment name="Complete">
1141
+ <lengow>complete</lengow>
1142
+ </payment>
1143
+ <payment name="Incomplete">
1144
+ <lengow>pending</lengow>
1145
+ </payment>
1146
+ <payment name="PaymentInProcess">
1147
+ <lengow>pending</lengow>
1148
+ </payment>
1149
+ </payments>
1150
+ <additional_params>
1151
+ <param usedby="shipped">
1152
+ <type>tracking</type>
1153
+ <name>TrackingColis</name>
1154
+ </param>
1155
+ </additional_params>
1156
+ </marketplace>
1157
+ <marketplace name="ebay_pl">
1158
+ <api>https://wsdl.lengow.com/wsdl/ebay_pl/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1159
+ <states>
1160
+ <state name="New">
1161
+ <lengow>new</lengow>
1162
+ </state>
1163
+ <state name="ToShip">
1164
+ <actions>
1165
+ <action type="shipped">shippedOrder</action>
1166
+ </actions>
1167
+ <lengow>processing</lengow>
1168
+ </state>
1169
+ <state name="Completed">
1170
+ <lengow>shipped</lengow>
1171
+ </state>
1172
+ <state name="Cancelled">
1173
+ <lengow>canceled</lengow>
1174
+ </state>
1175
+ </states>
1176
+ <payments>
1177
+ <payment name="NoPaymentFailure">
1178
+ <lengow>complete</lengow>
1179
+ </payment>
1180
+ <payment name="PayPalPaymentInProcess">
1181
+ <lengow>pending</lengow>
1182
+ </payment>
1183
+ <payment name="PayPalPaymentInProcess">
1184
+ <lengow>pending</lengow>
1185
+ </payment>
1186
+ <payment name="MoneyXferAcceptedInCheckout">
1187
+ <lengow>pending</lengow>
1188
+ </payment>
1189
+ <payment name="Complete">
1190
+ <lengow>complete</lengow>
1191
+ </payment>
1192
+ <payment name="Incomplete">
1193
+ <lengow>pending</lengow>
1194
+ </payment>
1195
+ <payment name="PaymentInProcess">
1196
+ <lengow>pending</lengow>
1197
+ </payment>
1198
+ </payments>
1199
+ <additional_params>
1200
+ <param usedby="shipped">
1201
+ <type>tracking</type>
1202
+ <name>TrackingColis</name>
1203
+ </param>
1204
+ </additional_params>
1205
+ </marketplace>
1206
+ <marketplace name="ebay_sg">
1207
+ <api>https://wsdl.lengow.com/wsdl/ebay_sg/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1208
+ <states>
1209
+ <state name="New">
1210
+ <lengow>new</lengow>
1211
+ </state>
1212
+ <state name="ToShip">
1213
+ <actions>
1214
+ <action type="shipped">shippedOrder</action>
1215
+ </actions>
1216
+ <lengow>processing</lengow>
1217
+ </state>
1218
+ <state name="Completed">
1219
+ <lengow>shipped</lengow>
1220
+ </state>
1221
+ <state name="Cancelled">
1222
+ <lengow>canceled</lengow>
1223
+ </state>
1224
+ </states>
1225
+ <payments>
1226
+ <payment name="NoPaymentFailure">
1227
+ <lengow>complete</lengow>
1228
+ </payment>
1229
+ <payment name="PayPalPaymentInProcess">
1230
+ <lengow>pending</lengow>
1231
+ </payment>
1232
+ <payment name="PayPalPaymentInProcess">
1233
+ <lengow>pending</lengow>
1234
+ </payment>
1235
+ <payment name="MoneyXferAcceptedInCheckout">
1236
+ <lengow>pending</lengow>
1237
+ </payment>
1238
+ <payment name="Complete">
1239
+ <lengow>complete</lengow>
1240
+ </payment>
1241
+ <payment name="Incomplete">
1242
+ <lengow>pending</lengow>
1243
+ </payment>
1244
+ <payment name="PaymentInProcess">
1245
+ <lengow>pending</lengow>
1246
+ </payment>
1247
+ </payments>
1248
+ <additional_params>
1249
+ <param usedby="shipped">
1250
+ <type>tracking</type>
1251
+ <name>TrackingColis</name>
1252
+ </param>
1253
+ </additional_params>
1254
+ </marketplace>
1255
+ <marketplace name="ebay_uk">
1256
+ <api>https://wsdl.lengow.com/wsdl/ebay_uk/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1257
+ <states>
1258
+ <state name="New">
1259
+ <lengow>new</lengow>
1260
+ </state>
1261
+ <state name="ToShip">
1262
+ <actions>
1263
+ <action type="shipped">shippedOrder</action>
1264
+ </actions>
1265
+ <lengow>processing</lengow>
1266
+ </state>
1267
+ <state name="Completed">
1268
+ <lengow>shipped</lengow>
1269
+ </state>
1270
+ <state name="Cancelled">
1271
+ <lengow>canceled</lengow>
1272
+ </state>
1273
+ </states>
1274
+ <payments>
1275
+ <payment name="NoPaymentFailure">
1276
+ <lengow>complete</lengow>
1277
+ </payment>
1278
+ <payment name="PayPalPaymentInProcess">
1279
+ <lengow>pending</lengow>
1280
+ </payment>
1281
+ <payment name="PayPalPaymentInProcess">
1282
+ <lengow>pending</lengow>
1283
+ </payment>
1284
+ <payment name="MoneyXferAcceptedInCheckout">
1285
+ <lengow>pending</lengow>
1286
+ </payment>
1287
+ <payment name="Complete">
1288
+ <lengow>complete</lengow>
1289
+ </payment>
1290
+ <payment name="Incomplete">
1291
+ <lengow>pending</lengow>
1292
+ </payment>
1293
+ <payment name="PaymentInProcess">
1294
+ <lengow>pending</lengow>
1295
+ </payment>
1296
+ </payments>
1297
+ <additional_params>
1298
+ <param usedby="shipped">
1299
+ <type>tracking</type>
1300
+ <name>TrackingColis</name>
1301
+ </param>
1302
+ </additional_params>
1303
+ </marketplace>
1304
+ <marketplace name="cdiscount">
1305
+ <api>https://wsdl.lengow.com/wsdl/cdiscount/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1306
+ <states>
1307
+ <state name="WaitingForSellerAcceptation">
1308
+ <actions>
1309
+ <action type="accept">acceptOrder</action>
1310
+ <action type="refuse">refuseOrder</action>
1311
+ </actions>
1312
+ <lengow>new</lengow>
1313
+ </state>
1314
+ <state name="AcceptedBySeller">
1315
+ <lengow>new</lengow>
1316
+ </state>
1317
+ <state name="PaymentInProgress">
1318
+ <lengow>new</lengow>
1319
+ </state>
1320
+ <state name="ValidatedFianet">
1321
+ <lengow>new</lengow>
1322
+ </state>
1323
+ <state name="WaitingForShipmentAcceptation">
1324
+ <actions>
1325
+ <action type="shipped">shippedOrder</action>
1326
+ <action type="refuse">refuseShipment</action>
1327
+ </actions>
1328
+ <lengow>processing</lengow>
1329
+ </state>
1330
+ <state name="Shipped">
1331
+ <lengow>shipped</lengow>
1332
+ </state>
1333
+ <state name="">
1334
+ <lengow>canceled</lengow>
1335
+ </state>
1336
+ <state name="ShipmentRefusedBySeller">
1337
+ <lengow>canceled</lengow>
1338
+ </state>
1339
+ <state name="PaymentRefused">
1340
+ <lengow>canceled</lengow>
1341
+ </state>
1342
+ <state name="CancelledByCustomer">
1343
+ <lengow>canceled</lengow>
1344
+ </state>
1345
+ <state name="RefusedNotShipment">
1346
+ <lengow>canceled</lengow>
1347
+ </state>
1348
+ <state name="AutomaticCancellation">
1349
+ <lengow>canceled</lengow>
1350
+ </state>
1351
+ <state name="CancelledBeforePaymentByCustomer">
1352
+ <lengow>canceled</lengow>
1353
+ </state>
1354
+ <state name="CancelledBeforeNotificationByCustomer">
1355
+ <lengow>canceled</lengow>
1356
+ </state>
1357
+ <state name="CancellationRequestPending">
1358
+ <lengow>canceled</lengow>
1359
+ </state>
1360
+ <state name="NonPickedUpByCustomer">
1361
+ <lengow>canceled</lengow>
1362
+ </state>
1363
+ <state name="RefusedBySeller">
1364
+ <lengow>canceled</lengow>
1365
+ </state>
1366
+ <state name="PickedUp">
1367
+ <lengow>shipped</lengow>
1368
+ </state>
1369
+ <state name="ShippedBySeller">
1370
+ <lengow>shipped</lengow>
1371
+ </state>
1372
+ </states>
1373
+ <additional_params>
1374
+ <param usedby="shipped" require="carrier">
1375
+ <type>tracking</type>
1376
+ <name>TrackingColis</name>
1377
+ </param>
1378
+ <param usedby="shipped" require="tracking">
1379
+ <type>carrier</type>
1380
+ <name>Transporteur</name>
1381
+ <accepted_values>
1382
+ <value label="La Poste" default="true">LAPOSTE</value>
1383
+ <value label="DHL">DHL</value>
1384
+ <value label="Fedex">FEDEX</value>
1385
+ <value label="GLS">GLS</value>
1386
+ <value label="UPS">UPS</value>
1387
+ <value label="TAT Express">TAT</value>
1388
+ <value label="TNT">TNT</value>
1389
+ <value label="Mondial Relay">MONDIALRELAY</value>
1390
+ <value label="SERNAM">SERNAM</value>
1391
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1392
+ <value label="France Express">FRANCEEXPRESS</value>
1393
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1394
+ <value label="CHRONOPOST">Chronopost</value>
1395
+ <value label="TATEX">TATEX</value>
1396
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1397
+ <value label="Relais colis">Relais_colis</value>
1398
+ <value label="Gefco">Gefco</value>
1399
+ <value label="MORY">MORY</value>
1400
+ <value label="Heppner">Heppner</value>
1401
+ <value label="Exapaq">Exapaq</value>
1402
+ <value label="Mazet">Mazet</value>
1403
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1404
+ <value label="TMB">TMB</value>
1405
+ <value label="DPD">DPD</value>
1406
+ </accepted_values>
1407
+ </param>
1408
+ <param usedby="shipped">
1409
+ <type>tracking_url</type>
1410
+ <name>TrackingUrl</name>
1411
+ </param>
1412
+ </additional_params>
1413
+ <carriers>
1414
+ <carrier code='SO1'>socolissimo</carrier>
1415
+ <carrier code='STD'>standard</carrier>
1416
+ <carrier code='TRK'>suivi</carrier>
1417
+ <carrier code='REG'>recommande</carrier>
1418
+ <carrier code='COL'>colissimo</carrier>
1419
+ <carrier code='RCO'>relaiscolis</carrier>
1420
+ <carrier code='REL'>mondialrelay</carrier>
1421
+ <carrier code='MAG'>inshop</carrier>
1422
+ </carriers>
1423
+ </marketplace>
1424
+ <marketplace name="moncornerdeco">
1425
+ <api>https://wsdl.lengow.com/wsdl/moncornerdeco/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1426
+ <states>
1427
+ <state name="WaitingForSellerAcceptation">
1428
+ <actions>
1429
+ <action type="accept">acceptOrder</action>
1430
+ <action type="refuse">refuseOrder</action>
1431
+ </actions>
1432
+ <lengow>new</lengow>
1433
+ </state>
1434
+ <state name="AcceptedBySeller">
1435
+ <lengow>new</lengow>
1436
+ </state>
1437
+ <state name="PaymentInProgress">
1438
+ <lengow>new</lengow>
1439
+ </state>
1440
+ <state name="ValidatedFianet">
1441
+ <lengow>new</lengow>
1442
+ </state>
1443
+ <state name="WaitingForShipmentAcceptation">
1444
+ <actions>
1445
+ <action type="shipped">shippedOrder</action>
1446
+ <action type="refuse">refuseShipment</action>
1447
+ </actions>
1448
+ <lengow>processing</lengow>
1449
+ </state>
1450
+ <state name="Shipped">
1451
+ <lengow>shipped</lengow>
1452
+ </state>
1453
+ <state name="">
1454
+ <lengow>canceled</lengow>
1455
+ </state>
1456
+ <state name="ShipmentRefusedBySeller">
1457
+ <lengow>canceled</lengow>
1458
+ </state>
1459
+ <state name="PaymentRefused">
1460
+ <lengow>canceled</lengow>
1461
+ </state>
1462
+ <state name="CancelledByCustomer">
1463
+ <lengow>canceled</lengow>
1464
+ </state>
1465
+ <state name="RefusedNotShipment">
1466
+ <lengow>canceled</lengow>
1467
+ </state>
1468
+ <state name="AutomaticCancellation">
1469
+ <lengow>canceled</lengow>
1470
+ </state>
1471
+ <state name="CancelledBeforePaymentByCustomer">
1472
+ <lengow>canceled</lengow>
1473
+ </state>
1474
+ <state name="CancelledBeforeNotificationByCustomer">
1475
+ <lengow>canceled</lengow>
1476
+ </state>
1477
+ <state name="CancellationRequestPending">
1478
+ <lengow>canceled</lengow>
1479
+ </state>
1480
+ <state name="RefusedBySeller">
1481
+ <lengow>canceled</lengow>
1482
+ </state>
1483
+ <state name="PickedUp">
1484
+ <lengow>shipped</lengow>
1485
+ </state>
1486
+ </states>
1487
+ <additional_params>
1488
+ <param usedby="shipped" require="carrier">
1489
+ <type>tracking</type>
1490
+ <name>TrackingColis</name>
1491
+ </param>
1492
+ <param usedby="shipped" require="tracking">
1493
+ <type>carrier</type>
1494
+ <name>Transporteur</name>
1495
+ <accepted_values>
1496
+ <value label="La Poste" default="true">LAPOSTE</value>
1497
+ <value label="DHL">DHL</value>
1498
+ <value label="Fedex">FEDEX</value>
1499
+ <value label="GLS">GLS</value>
1500
+ <value label="UPS">UPS</value>
1501
+ <value label="TAT Express">TAT</value>
1502
+ <value label="TNT">TNT</value>
1503
+ <value label="Mondial Relay">MONDIALRELAY</value>
1504
+ <value label="SERNAM">SERNAM</value>
1505
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1506
+ <value label="France Express">FRANCEEXPRESS</value>
1507
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1508
+ <value label="CHRONOPOST">Chronopost</value>
1509
+ <value label="TATEX">TATEX</value>
1510
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1511
+ <value label="Relais colis">Relais_colis</value>
1512
+ <value label="Gefco">Gefco</value>
1513
+ <value label="MORY">MORY</value>
1514
+ <value label="Heppner">Heppner</value>
1515
+ <value label="Exapaq">Exapaq</value>
1516
+ <value label="Mazet">Mazet</value>
1517
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1518
+ <value label="TMB">TMB</value>
1519
+ <value label="DPD">DPD</value>
1520
+ </accepted_values>
1521
+ </param>
1522
+ <param usedby="shipped">
1523
+ <type>tracking_url</type>
1524
+ <name>TrackingUrl</name>
1525
+ </param>
1526
+ </additional_params>
1527
+ </marketplace>
1528
+ <marketplace name="moncornerbaby">
1529
+ <api>https://wsdl.lengow.com/wsdl/moncornerbaby/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1530
+ <states>
1531
+ <state name="WaitingForSellerAcceptation">
1532
+ <actions>
1533
+ <action type="accept">acceptOrder</action>
1534
+ <action type="refuse">refuseOrder</action>
1535
+ </actions>
1536
+ <lengow>new</lengow>
1537
+ </state>
1538
+ <state name="AcceptedBySeller">
1539
+ <lengow>new</lengow>
1540
+ </state>
1541
+ <state name="PaymentInProgress">
1542
+ <lengow>new</lengow>
1543
+ </state>
1544
+ <state name="ValidatedFianet">
1545
+ <lengow>new</lengow>
1546
+ </state>
1547
+ <state name="WaitingForShipmentAcceptation">
1548
+ <actions>
1549
+ <action type="shipped">shippedOrder</action>
1550
+ <action type="refuse">refuseShipment</action>
1551
+ </actions>
1552
+ <lengow>processing</lengow>
1553
+ </state>
1554
+ <state name="Shipped">
1555
+ <lengow>shipped</lengow>
1556
+ </state>
1557
+ <state name="">
1558
+ <lengow>canceled</lengow>
1559
+ </state>
1560
+ <state name="ShipmentRefusedBySeller">
1561
+ <lengow>canceled</lengow>
1562
+ </state>
1563
+ <state name="PaymentRefused">
1564
+ <lengow>canceled</lengow>
1565
+ </state>
1566
+ <state name="CancelledByCustomer">
1567
+ <lengow>canceled</lengow>
1568
+ </state>
1569
+ <state name="RefusedNotShipment">
1570
+ <lengow>canceled</lengow>
1571
+ </state>
1572
+ <state name="AutomaticCancellation">
1573
+ <lengow>canceled</lengow>
1574
+ </state>
1575
+ <state name="CancelledBeforePaymentByCustomer">
1576
+ <lengow>canceled</lengow>
1577
+ </state>
1578
+ <state name="CancelledBeforeNotificationByCustomer">
1579
+ <lengow>canceled</lengow>
1580
+ </state>
1581
+ <state name="CancellationRequestPending">
1582
+ <lengow>canceled</lengow>
1583
+ </state>
1584
+ <state name="RefusedBySeller">
1585
+ <lengow>canceled</lengow>
1586
+ </state>
1587
+ <state name="PickedUp">
1588
+ <lengow>shipped</lengow>
1589
+ </state>
1590
+ </states>
1591
+ <additional_params>
1592
+ <param usedby="shipped" require="carrier">
1593
+ <type>tracking</type>
1594
+ <name>TrackingColis</name>
1595
+ </param>
1596
+ <param usedby="shipped" require="tracking">
1597
+ <type>carrier</type>
1598
+ <name>Transporteur</name>
1599
+ <accepted_values>
1600
+ <value label="La Poste" default="true">LAPOSTE</value>
1601
+ <value label="DHL">DHL</value>
1602
+ <value label="Fedex">FEDEX</value>
1603
+ <value label="GLS">GLS</value>
1604
+ <value label="UPS">UPS</value>
1605
+ <value label="TAT Express">TAT</value>
1606
+ <value label="TNT">TNT</value>
1607
+ <value label="Mondial Relay">MONDIALRELAY</value>
1608
+ <value label="SERNAM">SERNAM</value>
1609
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1610
+ <value label="France Express">FRANCEEXPRESS</value>
1611
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1612
+ <value label="CHRONOPOST">Chronopost</value>
1613
+ <value label="TATEX">TATEX</value>
1614
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1615
+ <value label="Relais colis">Relais_colis</value>
1616
+ <value label="Gefco">Gefco</value>
1617
+ <value label="MORY">MORY</value>
1618
+ <value label="Heppner">Heppner</value>
1619
+ <value label="Exapaq">Exapaq</value>
1620
+ <value label="Mazet">Mazet</value>
1621
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1622
+ <value label="TMB">TMB</value>
1623
+ <value label="DPD">DPD</value>
1624
+ </accepted_values>
1625
+ </param>
1626
+ <param usedby="shipped">
1627
+ <type>tracking_url</type>
1628
+ <name>TrackingUrl</name>
1629
+ </param>
1630
+ </additional_params>
1631
+ </marketplace>
1632
+ <marketplace name="moncornerjardin">
1633
+ <api>https://wsdl.lengow.com/wsdl/moncornerjardin/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1634
+ <states>
1635
+ <state name="WaitingForSellerAcceptation">
1636
+ <actions>
1637
+ <action type="accept">acceptOrder</action>
1638
+ <action type="refuse">refuseOrder</action>
1639
+ </actions>
1640
+ <lengow>new</lengow>
1641
+ </state>
1642
+ <state name="AcceptedBySeller">
1643
+ <lengow>new</lengow>
1644
+ </state>
1645
+ <state name="PaymentInProgress">
1646
+ <lengow>new</lengow>
1647
+ </state>
1648
+ <state name="ValidatedFianet">
1649
+ <lengow>new</lengow>
1650
+ </state>
1651
+ <state name="WaitingForShipmentAcceptation">
1652
+ <actions>
1653
+ <action type="shipped">shippedOrder</action>
1654
+ <action type="refuse">refuseShipment</action>
1655
+ </actions>
1656
+ <lengow>processing</lengow>
1657
+ </state>
1658
+ <state name="Shipped">
1659
+ <lengow>shipped</lengow>
1660
+ </state>
1661
+ <state name="">
1662
+ <lengow>canceled</lengow>
1663
+ </state>
1664
+ <state name="ShipmentRefusedBySeller">
1665
+ <lengow>canceled</lengow>
1666
+ </state>
1667
+ <state name="PaymentRefused">
1668
+ <lengow>canceled</lengow>
1669
+ </state>
1670
+ <state name="CancelledByCustomer">
1671
+ <lengow>canceled</lengow>
1672
+ </state>
1673
+ <state name="RefusedNotShipment">
1674
+ <lengow>canceled</lengow>
1675
+ </state>
1676
+ <state name="AutomaticCancellation">
1677
+ <lengow>canceled</lengow>
1678
+ </state>
1679
+ <state name="CancelledBeforePaymentByCustomer">
1680
+ <lengow>canceled</lengow>
1681
+ </state>
1682
+ <state name="CancelledBeforeNotificationByCustomer">
1683
+ <lengow>canceled</lengow>
1684
+ </state>
1685
+ <state name="CancellationRequestPending">
1686
+ <lengow>canceled</lengow>
1687
+ </state>
1688
+ <state name="RefusedBySeller">
1689
+ <lengow>canceled</lengow>
1690
+ </state>
1691
+ <state name="PickedUp">
1692
+ <lengow>shipped</lengow>
1693
+ </state>
1694
+ </states>
1695
+ <additional_params>
1696
+ <param usedby="shipped" require="carrier">
1697
+ <type>tracking</type>
1698
+ <name>TrackingColis</name>
1699
+ </param>
1700
+ <param usedby="shipped" require="tracking">
1701
+ <type>carrier</type>
1702
+ <name>Transporteur</name>
1703
+ <accepted_values>
1704
+ <value label="La Poste" default="true">LAPOSTE</value>
1705
+ <value label="DHL">DHL</value>
1706
+ <value label="Fedex">FEDEX</value>
1707
+ <value label="GLS">GLS</value>
1708
+ <value label="UPS">UPS</value>
1709
+ <value label="TAT Express">TAT</value>
1710
+ <value label="TNT">TNT</value>
1711
+ <value label="Mondial Relay">MONDIALRELAY</value>
1712
+ <value label="SERNAM">SERNAM</value>
1713
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1714
+ <value label="France Express">FRANCEEXPRESS</value>
1715
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1716
+ <value label="CHRONOPOST">Chronopost</value>
1717
+ <value label="TATEX">TATEX</value>
1718
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1719
+ <value label="Relais colis">Relais_colis</value>
1720
+ <value label="Gefco">Gefco</value>
1721
+ <value label="MORY">MORY</value>
1722
+ <value label="Heppner">Heppner</value>
1723
+ <value label="Exapaq">Exapaq</value>
1724
+ <value label="Mazet">Mazet</value>
1725
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1726
+ <value label="TMB">TMB</value>
1727
+ <value label="DPD">DPD</value>
1728
+ </accepted_values>
1729
+ </param>
1730
+ <param usedby="shipped">
1731
+ <type>tracking_url</type>
1732
+ <name>TrackingUrl</name>
1733
+ </param>
1734
+ </additional_params>
1735
+ </marketplace>
1736
+ <marketplace name="moncornerbrico">
1737
+ <api>https://wsdl.lengow.com/wsdl/moncornerbrico/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1738
+ <states>
1739
+ <state name="WaitingForSellerAcceptation">
1740
+ <actions>
1741
+ <action type="accept">acceptOrder</action>
1742
+ <action type="refuse">refuseOrder</action>
1743
+ </actions>
1744
+ <lengow>new</lengow>
1745
+ </state>
1746
+ <state name="AcceptedBySeller">
1747
+ <lengow>new</lengow>
1748
+ </state>
1749
+ <state name="PaymentInProgress">
1750
+ <lengow>new</lengow>
1751
+ </state>
1752
+ <state name="ValidatedFianet">
1753
+ <lengow>new</lengow>
1754
+ </state>
1755
+ <state name="WaitingForShipmentAcceptation">
1756
+ <actions>
1757
+ <action type="shipped">shippedOrder</action>
1758
+ <action type="refuse">refuseShipment</action>
1759
+ </actions>
1760
+ <lengow>processing</lengow>
1761
+ </state>
1762
+ <state name="Shipped">
1763
+ <lengow>shipped</lengow>
1764
+ </state>
1765
+ <state name="">
1766
+ <lengow>canceled</lengow>
1767
+ </state>
1768
+ <state name="ShipmentRefusedBySeller">
1769
+ <lengow>canceled</lengow>
1770
+ </state>
1771
+ <state name="PaymentRefused">
1772
+ <lengow>canceled</lengow>
1773
+ </state>
1774
+ <state name="CancelledByCustomer">
1775
+ <lengow>canceled</lengow>
1776
+ </state>
1777
+ <state name="RefusedNotShipment">
1778
+ <lengow>canceled</lengow>
1779
+ </state>
1780
+ <state name="AutomaticCancellation">
1781
+ <lengow>canceled</lengow>
1782
+ </state>
1783
+ <state name="CancelledBeforePaymentByCustomer">
1784
+ <lengow>canceled</lengow>
1785
+ </state>
1786
+ <state name="CancelledBeforeNotificationByCustomer">
1787
+ <lengow>canceled</lengow>
1788
+ </state>
1789
+ <state name="CancellationRequestPending">
1790
+ <lengow>canceled</lengow>
1791
+ </state>
1792
+ <state name="RefusedBySeller">
1793
+ <lengow>canceled</lengow>
1794
+ </state>
1795
+ <state name="PickedUp">
1796
+ <lengow>shipped</lengow>
1797
+ </state>
1798
+ </states>
1799
+ <additional_params>
1800
+ <param usedby="shipped" require="carrier">
1801
+ <type>tracking</type>
1802
+ <name>TrackingColis</name>
1803
+ </param>
1804
+ <param usedby="shipped" require="tracking">
1805
+ <type>carrier</type>
1806
+ <name>Transporteur</name>
1807
+ <accepted_values>
1808
+ <value label="La Poste" default="true">LAPOSTE</value>
1809
+ <value label="DHL">DHL</value>
1810
+ <value label="Fedex">FEDEX</value>
1811
+ <value label="GLS">GLS</value>
1812
+ <value label="UPS">UPS</value>
1813
+ <value label="TAT Express">TAT</value>
1814
+ <value label="TNT">TNT</value>
1815
+ <value label="Mondial Relay">MONDIALRELAY</value>
1816
+ <value label="SERNAM">SERNAM</value>
1817
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1818
+ <value label="France Express">FRANCEEXPRESS</value>
1819
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1820
+ <value label="CHRONOPOST">Chronopost</value>
1821
+ <value label="TATEX">TATEX</value>
1822
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1823
+ <value label="Relais colis">Relais_colis</value>
1824
+ <value label="Gefco">Gefco</value>
1825
+ <value label="MORY">MORY</value>
1826
+ <value label="Heppner">Heppner</value>
1827
+ <value label="Exapaq">Exapaq</value>
1828
+ <value label="Mazet">Mazet</value>
1829
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1830
+ <value label="TMB">TMB</value>
1831
+ <value label="DPD">DPD</value>
1832
+ </accepted_values>
1833
+ </param>
1834
+ <param usedby="shipped">
1835
+ <type>tracking_url</type>
1836
+ <name>TrackingUrl</name>
1837
+ </param>
1838
+ </additional_params>
1839
+ </marketplace>
1840
+ <marketplace name="moncornerhomme">
1841
+ <api>https://wsdl.lengow.com/wsdl/moncornerhomme/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1842
+ <states>
1843
+ <state name="WaitingForSellerAcceptation">
1844
+ <actions>
1845
+ <action type="accept">acceptOrder</action>
1846
+ <action type="refuse">refuseOrder</action>
1847
+ </actions>
1848
+ <lengow>new</lengow>
1849
+ </state>
1850
+ <state name="AcceptedBySeller">
1851
+ <lengow>new</lengow>
1852
+ </state>
1853
+ <state name="PaymentInProgress">
1854
+ <lengow>new</lengow>
1855
+ </state>
1856
+ <state name="ValidatedFianet">
1857
+ <lengow>new</lengow>
1858
+ </state>
1859
+ <state name="WaitingForShipmentAcceptation">
1860
+ <actions>
1861
+ <action type="shipped">shippedOrder</action>
1862
+ <action type="refuse">refuseShipment</action>
1863
+ </actions>
1864
+ <lengow>processing</lengow>
1865
+ </state>
1866
+ <state name="Shipped">
1867
+ <lengow>shipped</lengow>
1868
+ </state>
1869
+ <state name="">
1870
+ <lengow>canceled</lengow>
1871
+ </state>
1872
+ <state name="ShipmentRefusedBySeller">
1873
+ <lengow>canceled</lengow>
1874
+ </state>
1875
+ <state name="PaymentRefused">
1876
+ <lengow>canceled</lengow>
1877
+ </state>
1878
+ <state name="CancelledByCustomer">
1879
+ <lengow>canceled</lengow>
1880
+ </state>
1881
+ <state name="RefusedNotShipment">
1882
+ <lengow>canceled</lengow>
1883
+ </state>
1884
+ <state name="AutomaticCancellation">
1885
+ <lengow>canceled</lengow>
1886
+ </state>
1887
+ <state name="CancelledBeforePaymentByCustomer">
1888
+ <lengow>canceled</lengow>
1889
+ </state>
1890
+ <state name="CancelledBeforeNotificationByCustomer">
1891
+ <lengow>canceled</lengow>
1892
+ </state>
1893
+ <state name="CancellationRequestPending">
1894
+ <lengow>canceled</lengow>
1895
+ </state>
1896
+ <state name="RefusedBySeller">
1897
+ <lengow>canceled</lengow>
1898
+ </state>
1899
+ <state name="PickedUp">
1900
+ <lengow>shipped</lengow>
1901
+ </state>
1902
+ </states>
1903
+ <additional_params>
1904
+ <param usedby="shipped" require="carrier">
1905
+ <type>tracking</type>
1906
+ <name>TrackingColis</name>
1907
+ </param>
1908
+ <param usedby="shipped" require="tracking">
1909
+ <type>carrier</type>
1910
+ <name>Transporteur</name>
1911
+ <accepted_values>
1912
+ <value label="La Poste" default="true">LAPOSTE</value>
1913
+ <value label="DHL">DHL</value>
1914
+ <value label="Fedex">FEDEX</value>
1915
+ <value label="GLS">GLS</value>
1916
+ <value label="UPS">UPS</value>
1917
+ <value label="TAT Express">TAT</value>
1918
+ <value label="TNT">TNT</value>
1919
+ <value label="Mondial Relay">MONDIALRELAY</value>
1920
+ <value label="SERNAM">SERNAM</value>
1921
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
1922
+ <value label="France Express">FRANCEEXPRESS</value>
1923
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
1924
+ <value label="CHRONOPOST">Chronopost</value>
1925
+ <value label="TATEX">TATEX</value>
1926
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
1927
+ <value label="Relais colis">Relais_colis</value>
1928
+ <value label="Gefco">Gefco</value>
1929
+ <value label="MORY">MORY</value>
1930
+ <value label="Heppner">Heppner</value>
1931
+ <value label="Exapaq">Exapaq</value>
1932
+ <value label="Mazet">Mazet</value>
1933
+ <value label="SIC EXPRESS">SICEXPRESS</value>
1934
+ <value label="TMB">TMB</value>
1935
+ <value label="DPD">DPD</value>
1936
+ </accepted_values>
1937
+ </param>
1938
+ <param usedby="shipped">
1939
+ <type>tracking_url</type>
1940
+ <name>TrackingUrl</name>
1941
+ </param>
1942
+ </additional_params>
1943
+ </marketplace>
1944
+ <marketplace name="gosport">
1945
+ <api>https://wsdl.lengow.com/wsdl/gosport/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
1946
+ <states>
1947
+ <state name="WaitingForSellerAcceptation">
1948
+ <actions>
1949
+ <action type="accept">acceptOrder</action>
1950
+ <action type="refuse">refuseOrder</action>
1951
+ </actions>
1952
+ <lengow>new</lengow>
1953
+ </state>
1954
+ <state name="AcceptedBySeller">
1955
+ <lengow>new</lengow>
1956
+ </state>
1957
+ <state name="PaymentInProgress">
1958
+ <lengow>new</lengow>
1959
+ </state>
1960
+ <state name="ValidatedFianet">
1961
+ <lengow>new</lengow>
1962
+ </state>
1963
+ <state name="WaitingForShipmentAcceptation">
1964
+ <actions>
1965
+ <action type="shipped">shippedOrder</action>
1966
+ <action type="refuse">refuseShipment</action>
1967
+ </actions>
1968
+ <lengow>processing</lengow>
1969
+ </state>
1970
+ <state name="Shipped">
1971
+ <lengow>shipped</lengow>
1972
+ </state>
1973
+ <state name="">
1974
+ <lengow>canceled</lengow>
1975
+ </state>
1976
+ <state name="ShipmentRefusedBySeller">
1977
+ <lengow>canceled</lengow>
1978
+ </state>
1979
+ <state name="PaymentRefused">
1980
+ <lengow>canceled</lengow>
1981
+ </state>
1982
+ <state name="CancelledByCustomer">
1983
+ <lengow>canceled</lengow>
1984
+ </state>
1985
+ <state name="RefusedNotShipment">
1986
+ <lengow>canceled</lengow>
1987
+ </state>
1988
+ <state name="AutomaticCancellation">
1989
+ <lengow>canceled</lengow>
1990
+ </state>
1991
+ <state name="CancelledBeforePaymentByCustomer">
1992
+ <lengow>canceled</lengow>
1993
+ </state>
1994
+ <state name="CancelledBeforeNotificationByCustomer">
1995
+ <lengow>canceled</lengow>
1996
+ </state>
1997
+ <state name="CancellationRequestPending">
1998
+ <lengow>canceled</lengow>
1999
+ </state>
2000
+ <state name="RefusedBySeller">
2001
+ <lengow>canceled</lengow>
2002
+ </state>
2003
+ <state name="PickedUp">
2004
+ <lengow>shipped</lengow>
2005
+ </state>
2006
+ </states>
2007
+ <additional_params>
2008
+ <param usedby="shipped" require="carrier">
2009
+ <type>tracking</type>
2010
+ <name>TrackingColis</name>
2011
+ </param>
2012
+ <param usedby="shipped" require="tracking">
2013
+ <type>carrier</type>
2014
+ <name>Transporteur</name>
2015
+ <accepted_values>
2016
+ <value label="La Poste" default="true">LAPOSTE</value>
2017
+ <value label="DHL">DHL</value>
2018
+ <value label="Fedex">FEDEX</value>
2019
+ <value label="GLS">GLS</value>
2020
+ <value label="UPS">UPS</value>
2021
+ <value label="TAT Express">TAT</value>
2022
+ <value label="TNT">TNT</value>
2023
+ <value label="Mondial Relay">MONDIALRELAY</value>
2024
+ <value label="SERNAM">SERNAM</value>
2025
+ <value label="Geodis Calberson">GEODISCALBERSON</value>
2026
+ <value label="France Express">FRANCEEXPRESS</value>
2027
+ <value label="SDEN">FRANCSDENEEXPRESS</value>
2028
+ <value label="CHRONOPOST">Chronopost</value>
2029
+ <value label="TATEX">TATEX</value>
2030
+ <value label="SCHENKER JOYAU">SCHENKER_JOYAU</value>
2031
+ <value label="Relais colis">Relais_colis</value>
2032
+ <value label="Gefco">Gefco</value>
2033
+ <value label="MORY">MORY</value>
2034
+ <value label="Heppner">Heppner</value>
2035
+ <value label="Exapaq">Exapaq</value>
2036
+ <value label="Mazet">Mazet</value>
2037
+ <value label="SIC EXPRESS">SICEXPRESS</value>
2038
+ <value label="TMB">TMB</value>
2039
+ <value label="DPD">DPD</value>
2040
+ </accepted_values>
2041
+ </param>
2042
+ <param usedby="shipped">
2043
+ <type>tracking_url</type>
2044
+ <name>TrackingUrl</name>
2045
+ </param>
2046
+ </additional_params>
2047
+ </marketplace>
2048
+ <marketplace name="laredoute">
2049
+ <api>https://wsdl.lengow.com/wsdl/laredoute/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2050
+ <apibyline>https://wsdl.lengow.com/wsdl/laredoute/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QTY_TO_REFUND#/#FDP#/#ACTION#.xml</apibyline>
2051
+ <states>
2052
+ <state name="Created">
2053
+ <actions>
2054
+ <action type="accept">acceptOrder</action>
2055
+ <action type="refuse">refuseOrder</action>
2056
+ <action type="refuseLine" usedbyline="true">refuseOrder</action>
2057
+ </actions>
2058
+ <lengow>new</lengow>
2059
+ </state>
2060
+ <state name="Accepted">
2061
+ <lengow>new</lengow>
2062
+ </state>
2063
+ <state name="ToShip">
2064
+ <actions>
2065
+ <action type="shipped">shippedOrder</action>
2066
+ <action type="refund">refundOrder</action>
2067
+ <action type="refundLine" usedbyline="true">refundOrder</action>
2068
+ </actions>
2069
+ <lengow>processing</lengow>
2070
+ </state>
2071
+ <state name="ToCancel">
2072
+ <lengow>canceled</lengow>
2073
+ </state>
2074
+ <state name="Shipped">
2075
+ <actions>
2076
+ <action type="refund">refundOrder</action>
2077
+ <action type="refundLine" usedbyline="true">refundOrder</action>
2078
+ </actions>
2079
+ <lengow>shipped</lengow>
2080
+ </state>
2081
+ <state name="Refunded">
2082
+ <lengow>canceled</lengow>
2083
+ </state>
2084
+ <state name="Cancelled">
2085
+ <lengow>canceled</lengow>
2086
+ </state>
2087
+ <state name="Refused">
2088
+ <lengow>canceled</lengow>
2089
+ </state>
2090
+ </states>
2091
+ <additional_params>
2092
+ <param usedby="shipped">
2093
+ <type>tracking</type>
2094
+ <name>TrackingColis</name>
2095
+ </param>
2096
+ <param usedby="shipped">
2097
+ <type>carrier</type>
2098
+ <name>Transporteur</name>
2099
+ </param>
2100
+ <param usedby="shipped">
2101
+ <type>tracking_url</type>
2102
+ <name>url</name>
2103
+ </param>
2104
+ <param usedby="shipped" usedbyline="true">
2105
+ <type>shipping_price</type>
2106
+ <name>fdp</name>
2107
+ </param>
2108
+ <param usedby="shipped" usedbyline="true">
2109
+ <type>order_line</type>
2110
+ <name>orderlineid</name>
2111
+ </param>
2112
+ <param usedby="shipped" usedbyline="true">
2113
+ <type>quantity</type>
2114
+ <name>qty</name>
2115
+ </param>
2116
+ </additional_params>
2117
+ </marketplace>
2118
+ <marketplace name="frenchplace">
2119
+ <api>https://wsdl.lengow.com/wsdl/frenchplace/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2120
+ <states>
2121
+ <state name="new">
2122
+ <actions>
2123
+ <action type="accept">acceptOrder</action>
2124
+ <action type="refuse">refuseOrder</action>
2125
+ </actions>
2126
+ <lengow>new</lengow>
2127
+ </state>
2128
+ <state name="Accepted">
2129
+ <lengow>processing</lengow>
2130
+ </state>
2131
+ <state name="shipped">
2132
+ <lengow>shipped</lengow>
2133
+ </state>
2134
+ <state name="Accepted">
2135
+ <lengow>canceled</lengow>
2136
+ </state>
2137
+ </states>
2138
+ <additional_params>
2139
+ <param usedby="shipped">
2140
+ <type>tracking</type>
2141
+ <name>TrackingColis</name>
2142
+ </param>
2143
+ <param usedby="shipped">
2144
+ <type>carrier</type>
2145
+ <name>Transporteur</name>
2146
+ </param>
2147
+ </additional_params>
2148
+ </marketplace>
2149
+ <marketplace name="greenrepublic">
2150
+ <api>https://wsdl.lengow.com/wsdl/greenrepublic/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2151
+ <states>
2152
+ <state name="new">
2153
+ <actions>
2154
+ <action type="refuse">refuseOrder</action>
2155
+ </actions>
2156
+ <lengow>new</lengow>
2157
+ </state>
2158
+ <state name="pending_payment">
2159
+ <lengow>processing</lengow>
2160
+ </state>
2161
+ <state name="processing">
2162
+ <actions>
2163
+ <action type="shipped">shippedOrder</action>
2164
+ </actions>
2165
+ <lengow>processing</lengow>
2166
+ </state>
2167
+ <state name="holded">
2168
+ <lengow>processing</lengow>
2169
+ </state>
2170
+ <state name="in">
2171
+ <lengow>processing</lengow>
2172
+ </state>
2173
+ <state name="payment_review">
2174
+ <lengow>processing</lengow>
2175
+ </state>
2176
+ <state name="complete">
2177
+ <lengow>shipped</lengow>
2178
+ </state>
2179
+ <state name="canceled">
2180
+ <lengow>canceled</lengow>
2181
+ </state>
2182
+ </states>
2183
+ <additional_params>
2184
+ <param usedby="shipped">
2185
+ <type>tracking</type>
2186
+ <name>TrackingColis</name>
2187
+ </param>
2188
+ <param usedby="shipped">
2189
+ <type>carrier</type>
2190
+ <name>Transporteur</name>
2191
+ <accepted_values>
2192
+ <value>sc_calberson</value>
2193
+ <value>sc_fedex</value>
2194
+ <value>sc_relaypoint</value>
2195
+ <value>sc_gls</value>
2196
+ <value>sc_chronopost</value>
2197
+ <value>sc_tnt</value>
2198
+ <value>sc_dhl</value>
2199
+ <value default="true">sc_colissimo</value>
2200
+ <value>sc_export3j</value>
2201
+ </accepted_values>
2202
+ </param>
2203
+ </additional_params>
2204
+ </marketplace>
2205
+ <marketplace name="babyssima">
2206
+ <api>https://wsdl.lengow.com/wsdl/babyssima/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2207
+ <states>
2208
+ <state name="new">
2209
+ <actions>
2210
+ <action type="refuse">refuseOrder</action>
2211
+ </actions>
2212
+ <lengow>new</lengow>
2213
+ </state>
2214
+ <state name="processing">
2215
+ <actions>
2216
+ <action type="shipped">shippedOrder</action>
2217
+ </actions>
2218
+ <lengow>processing</lengow>
2219
+ </state>
2220
+ <state name="complete">
2221
+ <lengow>shipped</lengow>
2222
+ </state>
2223
+ <state name="canceled">
2224
+ <lengow>canceled</lengow>
2225
+ </state>
2226
+ </states>
2227
+ <additional_params>
2228
+ <param usedby="shipped">
2229
+ <type>tracking</type>
2230
+ <name>TrackingColis</name>
2231
+ </param>
2232
+ <param usedby="shipped">
2233
+ <type>carrier</type>
2234
+ <name>Transporteur</name>
2235
+ </param>
2236
+ </additional_params>
2237
+ </marketplace>
2238
+ <marketplace name="monechelle">
2239
+ <api>https://wsdl.lengow.com/wsdl/monechelle/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2240
+ <states>
2241
+ <state name="new">
2242
+ <lengow>new</lengow>
2243
+ </state>
2244
+ <state name="processing">
2245
+ <actions>
2246
+ <action type="refuse">refuseOrder</action>
2247
+ <action type="accept">acceptOrder</action>
2248
+ <action type="shipped">shippedOrder</action>
2249
+ </actions>
2250
+ <lengow>processing</lengow>
2251
+ </state>
2252
+ <state name="accepted">
2253
+ <lengow>processing</lengow>
2254
+ </state>
2255
+ <state name="shipped">
2256
+ <lengow>shipped</lengow>
2257
+ </state>
2258
+ <state name="refused">
2259
+ <lengow>canceled</lengow>
2260
+ </state>
2261
+ </states>
2262
+ <additional_params>
2263
+ <param usedby="shipped">
2264
+ <type>tracking</type>
2265
+ <name>TrackingColis</name>
2266
+ </param>
2267
+ <param usedby="shipped">
2268
+ <type>carrier</type>
2269
+ <name>Transporteur</name>
2270
+ </param>
2271
+ </additional_params>
2272
+ </marketplace>
2273
+ <marketplace name="brandalley">
2274
+ <api>https://wsdl.lengow.com/wsdl/brandalley/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2275
+ <states>
2276
+ <state name="processing">
2277
+ <actions>
2278
+ <action type="refuse">refuseOrder</action>
2279
+ <action type="accept">acceptOrder</action>
2280
+ <action type="shipped">shippedOrder</action>
2281
+ </actions>
2282
+ <lengow>processing</lengow>
2283
+ </state>
2284
+ <state name="accepted">
2285
+ <lengow>shipped</lengow>
2286
+ </state>
2287
+ <state name="cancel">
2288
+ <lengow>canceled</lengow>
2289
+ </state>
2290
+ </states>
2291
+ <additional_params>
2292
+ <param usedby="shipped">
2293
+ <type>tracking</type>
2294
+ <name>TrackingColis</name>
2295
+ </param>
2296
+ <param usedby="shipped">
2297
+ <type>carrier</type>
2298
+ <name>Transporteur</name>
2299
+ </param>
2300
+ </additional_params>
2301
+ </marketplace>
2302
+ <marketplace name="pixplace">
2303
+ <states>
2304
+ <state name="accepted">
2305
+ <lengow>processing</lengow>
2306
+ </state>
2307
+ <state name="processing">
2308
+ <lengow>processing</lengow>
2309
+ </state>
2310
+ <state name="NotReceived">
2311
+ <lengow>processing</lengow>
2312
+ </state>
2313
+ <state name="Cancelled">
2314
+ <lengow>canceled</lengow>
2315
+ </state>
2316
+ <state name="Refused">
2317
+ <lengow>canceled</lengow>
2318
+ </state>
2319
+ <state name="Refunded">
2320
+ <lengow>canceled</lengow>
2321
+ </state>
2322
+ </states>
2323
+ </marketplace>
2324
+ <marketplace name="leoo">
2325
+ <states>
2326
+ <state name="Confirmé">
2327
+ <lengow>processing</lengow>
2328
+ </state>
2329
+ <state name="Expédié">
2330
+ <lengow>shipped</lengow>
2331
+ </state>
2332
+ <state name="Annulation">
2333
+ <lengow>canceled</lengow>
2334
+ </state>
2335
+ </states>
2336
+ </marketplace>
2337
+ <marketplace name="lechouchou">
2338
+ <api>https://wsdl.lengow.com/wsdl/lechouchou/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2339
+ <states>
2340
+ <state name="new">
2341
+ <lengow>new</lengow>
2342
+ <actions>
2343
+ <action type="accept">accepted</action>
2344
+ <action type="refuse">refused</action>
2345
+ </actions>
2346
+ </state>
2347
+ <state name="processing">
2348
+ <actions>
2349
+ <action type="shipped">shipped</action>
2350
+ <action type="refuse">refused</action>
2351
+ </actions>
2352
+ <lengow>processing</lengow>
2353
+ </state>
2354
+ <state name="accept">
2355
+ <lengow>shipped</lengow>
2356
+ </state>
2357
+ <state name="refused">
2358
+ <lengow>canceled</lengow>
2359
+ </state>
2360
+ </states>
2361
+ <additional_params>
2362
+ <param usedby="shipped">
2363
+ <type>tracking</type>
2364
+ <name>TrackingColis</name>
2365
+ </param>
2366
+ </additional_params>
2367
+ </marketplace>
2368
+ <marketplace name="leoo">
2369
+ <states>
2370
+ <state name="Confirmé">
2371
+ <lengow>processing</lengow>
2372
+ </state>
2373
+ <state name="Expédié">
2374
+ <lengow>shipped</lengow>
2375
+ </state>
2376
+ <state name="Annulation">
2377
+ <lengow>canceled</lengow>
2378
+ </state>
2379
+ </states>
2380
+ </marketplace>
2381
+ <marketplace name="darty">
2382
+ <api>https://wsdl.lengow.com/wsdl/darty/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2383
+ <states>
2384
+ <state name="STAGING">
2385
+ <lengow>new</lengow>
2386
+ </state>
2387
+ <state name="WAITING_ACCEPTANCE">
2388
+ <lengow>new</lengow>
2389
+ <actions>
2390
+ <action type="accept">accept</action>
2391
+ <action type="refuse">canceled</action>
2392
+ </actions>
2393
+ </state>
2394
+ <state name="WAITING_DEBIT">
2395
+ <lengow>new</lengow>
2396
+ </state>
2397
+ <state name="WAITING_DEBIT_PAYMENT">
2398
+ <lengow>new</lengow>
2399
+ </state>
2400
+ <state name="SHIPPING">
2401
+ <lengow>processing</lengow>
2402
+ <actions>
2403
+ <action type="shipped">shipped</action>
2404
+ </actions>
2405
+ </state>
2406
+ <state name="RECEIVED">
2407
+ <lengow>shipped</lengow>
2408
+ </state>
2409
+ <state name="SHIPPED">
2410
+ <lengow>shipped</lengow>
2411
+ </state>
2412
+ <state name="CANCELED">
2413
+ <lengow>canceled</lengow>
2414
+ </state>
2415
+ <state name="CLOSED">
2416
+ <lengow>shipped</lengow>
2417
+ </state>
2418
+ <state name="REFUSED">
2419
+ <lengow>canceled</lengow>
2420
+ </state>
2421
+ <state name="INCIDENT_OPEN">
2422
+ <lengow>processing</lengow>
2423
+ </state>
2424
+ <state name="INCIDENT_CLOSED">
2425
+ <lengow>processing</lengow>
2426
+ </state>
2427
+ <state name="WAITING_REFUND">
2428
+ <lengow>processing</lengow>
2429
+ </state>
2430
+ <state name="WAITING_REFUND_PAYMENT">
2431
+ <lengow>processing</lengow>
2432
+ </state>
2433
+ <state name="REFUNDED">
2434
+ <lengow>canceled</lengow>
2435
+ </state>
2436
+ </states>
2437
+ <additional_params>
2438
+ <param usedby="shipped">
2439
+ <type>tracking</type>
2440
+ <name>tracking_number</name>
2441
+ </param>
2442
+ <param usedby="shipped">
2443
+ <type>carrier</type>
2444
+ <name>carrier_name</name>
2445
+ </param>
2446
+ <param usedby="shipped">
2447
+ <type>tracking_url</type>
2448
+ <name>carrier_url</name>
2449
+ </param>
2450
+ </additional_params>
2451
+ </marketplace>
2452
+ <marketplace name="menlook">
2453
+ <api>https://wsdl.lengow.com/wsdl/menlook/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2454
+ <states>
2455
+ <state name="STAGING">
2456
+ <lengow>new</lengow>
2457
+ </state>
2458
+ <state name="WAITING_ACCEPTANCE">
2459
+ <lengow>new</lengow>
2460
+ <actions>
2461
+ <action type="accept">accept</action>
2462
+ <action type="refuse">canceled</action>
2463
+ </actions>
2464
+ </state>
2465
+ <state name="WAITING_DEBIT">
2466
+ <lengow>new</lengow>
2467
+ </state>
2468
+ <state name="WAITING_DEBIT_PAYMENT">
2469
+ <lengow>new</lengow>
2470
+ </state>
2471
+ <state name="SHIPPING">
2472
+ <lengow>processing</lengow>
2473
+ <actions>
2474
+ <action type="shipped">shipped</action>
2475
+ </actions>
2476
+ </state>
2477
+ <state name="RECEIVED">
2478
+ <lengow>shipped</lengow>
2479
+ </state>
2480
+ <state name="SHIPPED">
2481
+ <lengow>shipped</lengow>
2482
+ </state>
2483
+ <state name="CANCELED">
2484
+ <lengow>canceled</lengow>
2485
+ </state>
2486
+ <state name="CLOSED">
2487
+ <lengow>shipped</lengow>
2488
+ </state>
2489
+ <state name="REFUSED">
2490
+ <lengow>canceled</lengow>
2491
+ </state>
2492
+ <state name="INCIDENT_OPEN">
2493
+ <lengow>processing</lengow>
2494
+ </state>
2495
+ <state name="INCIDENT_CLOSED">
2496
+ <lengow>processing</lengow>
2497
+ </state>
2498
+ <state name="WAITING_REFUND">
2499
+ <lengow>processing</lengow>
2500
+ </state>
2501
+ <state name="WAITING_REFUND_PAYMENT">
2502
+ <lengow>processing</lengow>
2503
+ </state>
2504
+ <state name="REFUNDED">
2505
+ <lengow>canceled</lengow>
2506
+ </state>
2507
+ </states>
2508
+ <additional_params>
2509
+ <param usedby="shipped">
2510
+ <type>tracking</type>
2511
+ <name>tracking_number</name>
2512
+ </param>
2513
+ <param usedby="shipped">
2514
+ <type>carrier</type>
2515
+ <name>carrier_name</name>
2516
+ </param>
2517
+ <param usedby="shipped">
2518
+ <type>tracking_url</type>
2519
+ <name>carrier_url</name>
2520
+ </param>
2521
+ </additional_params>
2522
+ </marketplace>
2523
+ <marketplace name="privalia">
2524
+ <api>https://wsdl.lengow.com/wsdl/privalia/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2525
+ <states>
2526
+ <state name="STAGING">
2527
+ <lengow>new</lengow>
2528
+ </state>
2529
+ <state name="WAITING_ACCEPTANCE">
2530
+ <lengow>new</lengow>
2531
+ <actions>
2532
+ <action type="accept">accept</action>
2533
+ <action type="refuse">canceled</action>
2534
+ </actions>
2535
+ </state>
2536
+ <state name="WAITING_DEBIT">
2537
+ <lengow>new</lengow>
2538
+ </state>
2539
+ <state name="WAITING_DEBIT_PAYMENT">
2540
+ <lengow>new</lengow>
2541
+ </state>
2542
+ <state name="SHIPPING">
2543
+ <lengow>processing</lengow>
2544
+ <actions>
2545
+ <action type="shipped">shipped</action>
2546
+ </actions>
2547
+ </state>
2548
+ <state name="RECEIVED">
2549
+ <lengow>shipped</lengow>
2550
+ </state>
2551
+ <state name="SHIPPED">
2552
+ <lengow>shipped</lengow>
2553
+ </state>
2554
+ <state name="CANCELED">
2555
+ <lengow>canceled</lengow>
2556
+ </state>
2557
+ <state name="CLOSED">
2558
+ <lengow>shipped</lengow>
2559
+ </state>
2560
+ <state name="REFUSED">
2561
+ <lengow>canceled</lengow>
2562
+ </state>
2563
+ <state name="INCIDENT_OPEN">
2564
+ <lengow>processing</lengow>
2565
+ </state>
2566
+ <state name="INCIDENT_CLOSED">
2567
+ <lengow>processing</lengow>
2568
+ </state>
2569
+ <state name="WAITING_REFUND">
2570
+ <lengow>processing</lengow>
2571
+ </state>
2572
+ <state name="WAITING_REFUND_PAYMENT">
2573
+ <lengow>processing</lengow>
2574
+ </state>
2575
+ <state name="REFUNDED">
2576
+ <lengow>canceled</lengow>
2577
+ </state>
2578
+ </states>
2579
+ <additional_params>
2580
+ <param usedby="shipped">
2581
+ <type>tracking</type>
2582
+ <name>tracking_number</name>
2583
+ </param>
2584
+ <param usedby="shipped">
2585
+ <type>carrier</type>
2586
+ <name>carrier_name</name>
2587
+ <accepted_values>
2588
+ <value label="MRW" default="true">MRW</value>
2589
+ <value label="UPS">UPS</value>
2590
+ <value label="ASM">ASM</value>
2591
+ </accepted_values>
2592
+ </param>
2593
+ <param usedby="shipped">
2594
+ <type>tracking_url</type>
2595
+ <name>carrier_url</name>
2596
+ </param>
2597
+ </additional_params>
2598
+ </marketplace>
2599
+ <marketplace name="delamaison">
2600
+ <api>https://wsdl.lengow.com/wsdl/delamaison/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2601
+ <states>
2602
+ <state name="STAGING">
2603
+ <lengow>new</lengow>
2604
+ </state>
2605
+ <state name="WAITING_ACCEPTANCE">
2606
+ <lengow>new</lengow>
2607
+ <actions>
2608
+ <action type="accept">accept</action>
2609
+ <action type="refuse">canceled</action>
2610
+ </actions>
2611
+ </state>
2612
+ <state name="WAITING_DEBIT">
2613
+ <lengow>new</lengow>
2614
+ </state>
2615
+ <state name="WAITING_DEBIT_PAYMENT">
2616
+ <lengow>new</lengow>
2617
+ </state>
2618
+ <state name="SHIPPING">
2619
+ <lengow>processing</lengow>
2620
+ <actions>
2621
+ <action type="shipped">shipped</action>
2622
+ </actions>
2623
+ </state>
2624
+ <state name="RECEIVED">
2625
+ <lengow>shipped</lengow>
2626
+ </state>
2627
+ <state name="SHIPPED">
2628
+ <lengow>shipped</lengow>
2629
+ </state>
2630
+ <state name="CANCELED">
2631
+ <lengow>canceled</lengow>
2632
+ </state>
2633
+ <state name="CLOSED">
2634
+ <lengow>shipped</lengow>
2635
+ </state>
2636
+ <state name="REFUSED">
2637
+ <lengow>canceled</lengow>
2638
+ </state>
2639
+ <state name="INCIDENT_OPEN">
2640
+ <lengow>processing</lengow>
2641
+ </state>
2642
+ <state name="INCIDENT_CLOSED">
2643
+ <lengow>processing</lengow>
2644
+ </state>
2645
+ <state name="WAITING_REFUND">
2646
+ <lengow>processing</lengow>
2647
+ </state>
2648
+ <state name="WAITING_REFUND_PAYMENT">
2649
+ <lengow>processing</lengow>
2650
+ </state>
2651
+ <state name="REFUNDED">
2652
+ <lengow>canceled</lengow>
2653
+ </state>
2654
+ </states>
2655
+ <additional_params>
2656
+ <param usedby="shipped">
2657
+ <type>tracking</type>
2658
+ <name>tracking_number</name>
2659
+ </param>
2660
+ <param usedby="shipped">
2661
+ <type>carrier</type>
2662
+ <name>carrier_name</name>
2663
+ <accepted_values>
2664
+ <value label="Colissimo" default="true">1</value>
2665
+ <value label="La Poste">2</value>
2666
+ <value label="Fedex">3</value>
2667
+ <value label="UPS">4</value>
2668
+ </accepted_values>
2669
+ </param>
2670
+ <param usedby="shipped">
2671
+ <type>tracking_url</type>
2672
+ <name>carrier_url</name>
2673
+ </param>
2674
+ </additional_params>
2675
+ </marketplace>
2676
+ <marketplace name="comptoirsante">
2677
+ <api>https://wsdl.lengow.com/wsdl/comptoirsante/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2678
+ <states>
2679
+ <state name="STAGING">
2680
+ <lengow>new</lengow>
2681
+ </state>
2682
+ <state name="WAITING_ACCEPTANCE">
2683
+ <lengow>new</lengow>
2684
+ <actions>
2685
+ <action type="accept">accept</action>
2686
+ <action type="refuse">canceled</action>
2687
+ </actions>
2688
+ </state>
2689
+ <state name="WAITING_DEBIT">
2690
+ <lengow>new</lengow>
2691
+ </state>
2692
+ <state name="WAITING_DEBIT_PAYMENT">
2693
+ <lengow>new</lengow>
2694
+ </state>
2695
+ <state name="SHIPPING">
2696
+ <lengow>processing</lengow>
2697
+ <actions>
2698
+ <action type="shipped">shipped</action>
2699
+ </actions>
2700
+ </state>
2701
+ <state name="RECEIVED">
2702
+ <lengow>shipped</lengow>
2703
+ </state>
2704
+ <state name="SHIPPED">
2705
+ <lengow>shipped</lengow>
2706
+ </state>
2707
+ <state name="CANCELED">
2708
+ <lengow>canceled</lengow>
2709
+ </state>
2710
+ <state name="CLOSED">
2711
+ <lengow>shipped</lengow>
2712
+ </state>
2713
+ <state name="REFUSED">
2714
+ <lengow>canceled</lengow>
2715
+ </state>
2716
+ <state name="INCIDENT_OPEN">
2717
+ <lengow>processing</lengow>
2718
+ </state>
2719
+ <state name="INCIDENT_CLOSED">
2720
+ <lengow>processing</lengow>
2721
+ </state>
2722
+ <state name="WAITING_REFUND">
2723
+ <lengow>processing</lengow>
2724
+ </state>
2725
+ <state name="WAITING_REFUND_PAYMENT">
2726
+ <lengow>processing</lengow>
2727
+ </state>
2728
+ <state name="REFUNDED">
2729
+ <lengow>canceled</lengow>
2730
+ </state>
2731
+ </states>
2732
+ <additional_params>
2733
+ <param usedby="shipped">
2734
+ <type>tracking</type>
2735
+ <name>tracking_number</name>
2736
+ </param>
2737
+ <param usedby="shipped">
2738
+ <type>carrier</type>
2739
+ <name>carrier_name</name>
2740
+ <accepted_values>
2741
+ <value label="Colissimo" default="true">1</value>
2742
+ <value label="TNT">2</value>
2743
+ <value label="Mondial Relay">3</value>
2744
+ <value label="DHL">4</value>
2745
+ </accepted_values>
2746
+ </param>
2747
+ <param usedby="shipped">
2748
+ <type>tracking_url</type>
2749
+ <name>carrier_url</name>
2750
+ </param>
2751
+ </additional_params>
2752
+ </marketplace>
2753
+ <marketplace name="immochan_v2">
2754
+ <api>https://wsdl.lengow.com/wsdl/immochan_v2/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2755
+ <states>
2756
+ <state name="STAGING">
2757
+ <lengow>new</lengow>
2758
+ </state>
2759
+ <state name="WAITING_ACCEPTANCE">
2760
+ <lengow>new</lengow>
2761
+ <actions>
2762
+ <action type="accept">accept</action>
2763
+ <action type="refuse">canceled</action>
2764
+ </actions>
2765
+ </state>
2766
+ <state name="WAITING_DEBIT">
2767
+ <lengow>new</lengow>
2768
+ </state>
2769
+ <state name="WAITING_DEBIT_PAYMENT">
2770
+ <lengow>new</lengow>
2771
+ </state>
2772
+ <state name="SHIPPING">
2773
+ <lengow>processing</lengow>
2774
+ <actions>
2775
+ <action type="shipped">shipped</action>
2776
+ </actions>
2777
+ </state>
2778
+ <state name="RECEIVED">
2779
+ <lengow>shipped</lengow>
2780
+ </state>
2781
+ <state name="SHIPPED">
2782
+ <lengow>shipped</lengow>
2783
+ </state>
2784
+ <state name="CANCELED">
2785
+ <lengow>canceled</lengow>
2786
+ </state>
2787
+ <state name="CLOSED">
2788
+ <lengow>shipped</lengow>
2789
+ </state>
2790
+ <state name="REFUSED">
2791
+ <lengow>canceled</lengow>
2792
+ </state>
2793
+ <state name="INCIDENT_OPEN">
2794
+ <lengow>processing</lengow>
2795
+ </state>
2796
+ <state name="INCIDENT_CLOSED">
2797
+ <lengow>processing</lengow>
2798
+ </state>
2799
+ <state name="WAITING_REFUND">
2800
+ <lengow>processing</lengow>
2801
+ </state>
2802
+ <state name="WAITING_REFUND_PAYMENT">
2803
+ <lengow>processing</lengow>
2804
+ </state>
2805
+ <state name="REFUNDED">
2806
+ <lengow>canceled</lengow>
2807
+ </state>
2808
+ </states>
2809
+ <additional_params>
2810
+ <param usedby="shipped">
2811
+ <type>tracking</type>
2812
+ <name>tracking_number</name>
2813
+ </param>
2814
+ <param usedby="shipped">
2815
+ <type>carrier</type>
2816
+ <name>carrier_name</name>
2817
+ </param>
2818
+ <param usedby="shipped">
2819
+ <type>tracking_url</type>
2820
+ <name>carrier_url</name>
2821
+ </param>
2822
+ </additional_params>
2823
+ </marketplace>
2824
+ <marketplace name="privalia">
2825
+ <api>https://wsdl.lengow.com/wsdl/privalia/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2826
+ <states>
2827
+ <state name="STAGING">
2828
+ <lengow>new</lengow>
2829
+ </state>
2830
+ <state name="WAITING_ACCEPTANCE">
2831
+ <lengow>new</lengow>
2832
+ <actions>
2833
+ <action type="accept">accept</action>
2834
+ <action type="refuse">canceled</action>
2835
+ </actions>
2836
+ </state>
2837
+ <state name="WAITING_DEBIT">
2838
+ <lengow>new</lengow>
2839
+ </state>
2840
+ <state name="WAITING_DEBIT_PAYMENT">
2841
+ <lengow>new</lengow>
2842
+ </state>
2843
+ <state name="SHIPPING">
2844
+ <lengow>processing</lengow>
2845
+ <actions>
2846
+ <action type="shipped">shipped</action>
2847
+ </actions>
2848
+ </state>
2849
+ <state name="RECEIVED">
2850
+ <lengow>shipped</lengow>
2851
+ </state>
2852
+ <state name="SHIPPED">
2853
+ <lengow>shipped</lengow>
2854
+ </state>
2855
+ <state name="CANCELED">
2856
+ <lengow>canceled</lengow>
2857
+ </state>
2858
+ <state name="CLOSED">
2859
+ <lengow>shipped</lengow>
2860
+ </state>
2861
+ <state name="REFUSED">
2862
+ <lengow>canceled</lengow>
2863
+ </state>
2864
+ <state name="INCIDENT_OPEN">
2865
+ <lengow>processing</lengow>
2866
+ </state>
2867
+ <state name="INCIDENT_CLOSED">
2868
+ <lengow>processing</lengow>
2869
+ </state>
2870
+ <state name="WAITING_REFUND">
2871
+ <lengow>processing</lengow>
2872
+ </state>
2873
+ <state name="WAITING_REFUND_PAYMENT">
2874
+ <lengow>processing</lengow>
2875
+ </state>
2876
+ <state name="REFUNDED">
2877
+ <lengow>canceled</lengow>
2878
+ </state>
2879
+ </states>
2880
+ <additional_params>
2881
+ <param usedby="shipped">
2882
+ <type>tracking</type>
2883
+ <name>tracking_number</name>
2884
+ </param>
2885
+ <param usedby="shipped">
2886
+ <type>carrier</type>
2887
+ <name>carrier_name</name>
2888
+ <accepted_values>
2889
+ <value label="Colissimo" default="true">1</value>
2890
+ <value label="TNT">2</value>
2891
+ <value label="Mondial Relay">3</value>
2892
+ <value label="DHL">4</value>
2893
+ </accepted_values>
2894
+ </param>
2895
+ <param usedby="shipped">
2896
+ <type>tracking_url</type>
2897
+ <name>carrier_url</name>
2898
+ </param>
2899
+ </additional_params>
2900
+ </marketplace>
2901
+ <marketplace name="galeries_lafayette">
2902
+ <api>https://wsdl.lengow.com/wsdl/galeries_lafayette/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2903
+ <states>
2904
+ <state name="STAGING">
2905
+ <lengow>new</lengow>
2906
+ </state>
2907
+ <state name="WAITING_ACCEPTANCE">
2908
+ <lengow>new</lengow>
2909
+ <actions>
2910
+ <action type="accept">accept</action>
2911
+ <action type="refuse">canceled</action>
2912
+ </actions>
2913
+ </state>
2914
+ <state name="WAITING_DEBIT">
2915
+ <lengow>new</lengow>
2916
+ </state>
2917
+ <state name="WAITING_DEBIT_PAYMENT">
2918
+ <lengow>new</lengow>
2919
+ </state>
2920
+ <state name="SHIPPING">
2921
+ <lengow>processing</lengow>
2922
+ <actions>
2923
+ <action type="shipped">shipped</action>
2924
+ </actions>
2925
+ </state>
2926
+ <state name="RECEIVED">
2927
+ <lengow>shipped</lengow>
2928
+ </state>
2929
+ <state name="SHIPPED">
2930
+ <lengow>shipped</lengow>
2931
+ </state>
2932
+ <state name="CANCELED">
2933
+ <lengow>canceled</lengow>
2934
+ </state>
2935
+ <state name="CLOSED">
2936
+ <lengow>shipped</lengow>
2937
+ </state>
2938
+ <state name="REFUSED">
2939
+ <lengow>canceled</lengow>
2940
+ </state>
2941
+ <state name="INCIDENT_OPEN">
2942
+ <lengow>processing</lengow>
2943
+ </state>
2944
+ <state name="INCIDENT_CLOSED">
2945
+ <lengow>processing</lengow>
2946
+ </state>
2947
+ <state name="WAITING_REFUND">
2948
+ <lengow>processing</lengow>
2949
+ </state>
2950
+ <state name="WAITING_REFUND_PAYMENT">
2951
+ <lengow>processing</lengow>
2952
+ </state>
2953
+ <state name="REFUNDED">
2954
+ <lengow>canceled</lengow>
2955
+ </state>
2956
+ </states>
2957
+ <additional_params>
2958
+ <param usedby="shipped">
2959
+ <type>tracking</type>
2960
+ <name>tracking_number</name>
2961
+ </param>
2962
+ <param usedby="shipped">
2963
+ <type>carrier</type>
2964
+ <name>carrier_name</name>
2965
+ </param>
2966
+ <param usedby="shipped">
2967
+ <type>tracking_url</type>
2968
+ <name>carrier_url</name>
2969
+ </param>
2970
+ </additional_params>
2971
+ </marketplace>
2972
+ <marketplace name="natdec">
2973
+ <api>https://wsdl.lengow.com/wsdl/natdec/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
2974
+ <states>
2975
+ <state name="STAGING">
2976
+ <lengow>new</lengow>
2977
+ </state>
2978
+ <state name="WAITING_ACCEPTANCE">
2979
+ <lengow>new</lengow>
2980
+ <actions>
2981
+ <action type="accept">accept</action>
2982
+ <action type="refuse">canceled</action>
2983
+ </actions>
2984
+ </state>
2985
+ <state name="WAITING_DEBIT">
2986
+ <lengow>new</lengow>
2987
+ </state>
2988
+ <state name="WAITING_DEBIT_PAYMENT">
2989
+ <lengow>new</lengow>
2990
+ </state>
2991
+ <state name="SHIPPING">
2992
+ <lengow>processing</lengow>
2993
+ <actions>
2994
+ <action type="shipped">shipped</action>
2995
+ </actions>
2996
+ </state>
2997
+ <state name="RECEIVED">
2998
+ <lengow>shipped</lengow>
2999
+ </state>
3000
+ <state name="SHIPPED">
3001
+ <lengow>shipped</lengow>
3002
+ </state>
3003
+ <state name="CANCELED">
3004
+ <lengow>canceled</lengow>
3005
+ </state>
3006
+ <state name="CLOSED">
3007
+ <lengow>shipped</lengow>
3008
+ </state>
3009
+ <state name="REFUSED">
3010
+ <lengow>canceled</lengow>
3011
+ </state>
3012
+ <state name="INCIDENT_OPEN">
3013
+ <lengow>processing</lengow>
3014
+ </state>
3015
+ <state name="INCIDENT_CLOSED">
3016
+ <lengow>processing</lengow>
3017
+ </state>
3018
+ <state name="WAITING_REFUND">
3019
+ <lengow>processing</lengow>
3020
+ </state>
3021
+ <state name="WAITING_REFUND_PAYMENT">
3022
+ <lengow>processing</lengow>
3023
+ </state>
3024
+ <state name="REFUNDED">
3025
+ <lengow>canceled</lengow>
3026
+ </state>
3027
+ </states>
3028
+ <additional_params>
3029
+ <param usedby="shipped">
3030
+ <type>tracking</type>
3031
+ <name>tracking_number</name>
3032
+ </param>
3033
+ <param usedby="shipped">
3034
+ <type>carrier</type>
3035
+ <name>carrier_name</name>
3036
+ </param>
3037
+ <param usedby="shipped">
3038
+ <type>tracking_url</type>
3039
+ <name>carrier_url</name>
3040
+ </param>
3041
+ </additional_params>
3042
+ </marketplace>
3043
+ <marketplace name="discounteo">
3044
+ <api>https://wsdl.lengow.com/wsdl/discounteo/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3045
+ <states>
3046
+ <state name="new">
3047
+ <lengow>new</lengow>
3048
+ </state>
3049
+ <state name="processing">
3050
+ <actions>
3051
+ <action type="shipped">shipped</action>
3052
+ <action type="refuse">refused</action>
3053
+ </actions>
3054
+ <lengow>processing</lengow>
3055
+ </state>
3056
+ <state name="shipped">
3057
+ <lengow>shipped</lengow>
3058
+ </state>
3059
+ <state name="refused">
3060
+ <lengow>canceled</lengow>
3061
+ </state>
3062
+ </states>
3063
+ <additional_params>
3064
+ <param usedby="shipped">
3065
+ <type>tracking</type>
3066
+ <name>TrackingColis</name>
3067
+ </param>
3068
+ <param usedby="shipped">
3069
+ <type>carrier</type>
3070
+ <name>Transporteur</name>
3071
+ </param>
3072
+ </additional_params>
3073
+ </marketplace>
3074
+ <marketplace name="ecopresto">
3075
+ <api>https://wsdl.lengow.com/wsdl/ecopresto/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3076
+ <states>
3077
+ <state name="new">
3078
+ <lengow>new</lengow>
3079
+ </state>
3080
+ <state name="processing">
3081
+ <actions>
3082
+ <action type="shipped">setTracking</action>
3083
+ </actions>
3084
+ <lengow>processing</lengow>
3085
+ </state>
3086
+ <state name="shipped">
3087
+ <lengow>shipped</lengow>
3088
+ </state>
3089
+ <state name="refused">
3090
+ <lengow>canceled</lengow>
3091
+ </state>
3092
+ </states>
3093
+ <additional_params>
3094
+ <param usedby="shipped">
3095
+ <type>tracking</type>
3096
+ <name>TrackingColis</name>
3097
+ </param>
3098
+ <param usedby="shipped">
3099
+ <type>carrier</type>
3100
+ <name>TrackingCarrier</name>
3101
+ <accepted_values>
3102
+ <value label="Divers" default="true">1</value>
3103
+ <value label="Colissimo">2</value>
3104
+ <value label="Lettre Max">3</value>
3105
+ </accepted_values>
3106
+ </param>
3107
+ </additional_params>
3108
+ </marketplace>
3109
+ <marketplace name="ecitizen">
3110
+ <states>
3111
+ <state name="processing">
3112
+ <lengow>processing</lengow>
3113
+ </state>
3114
+ <state name="shipped">
3115
+ <lengow>shipped</lengow>
3116
+ </state>
3117
+ </states>
3118
+ </marketplace>
3119
+ <marketplace name="godsavethekids">
3120
+ <api>https://wsdl.lengow.com/wsdl/godsavethekids/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3121
+ <states>
3122
+ <state name="RECEIVED">
3123
+ <lengow>new</lengow>
3124
+ </state>
3125
+ <state name="STAGING">
3126
+ <lengow>new</lengow>
3127
+ </state>
3128
+ <state name="WAITING_ACCEPTANCE">
3129
+ <lengow>new</lengow>
3130
+ <actions>
3131
+ <action type="accept">accept</action>
3132
+ <action type="refuse">canceled</action>
3133
+ </actions>
3134
+ </state>
3135
+ <state name="WAITING_DEBIT">
3136
+ <lengow>new</lengow>
3137
+ </state>
3138
+ <state name="WAITING_DEBIT_PAYMENT">
3139
+ <lengow>new</lengow>
3140
+ </state>
3141
+ <state name="CANCELED">
3142
+ <lengow>canceled</lengow>
3143
+ </state>
3144
+ <state name="CLOSED">
3145
+ <lengow>shipped</lengow>
3146
+ </state>
3147
+ <state name="REFUSED">
3148
+ <lengow>canceled</lengow>
3149
+ </state>
3150
+ <state name="SHIPPING">
3151
+ <lengow>processing</lengow>
3152
+ <actions>
3153
+ <action type="shipped">shipped</action>
3154
+ </actions>
3155
+ </state>
3156
+ <state name="INCIDENT_OPEN">
3157
+ <lengow>processing</lengow>
3158
+ </state>
3159
+ <state name="INCIDENT_CLOSED">
3160
+ <lengow>processing</lengow>
3161
+ </state>
3162
+ <state name="SHIPPED">
3163
+ <lengow>shipped</lengow>
3164
+ </state>
3165
+ <state name="REFUNDED">
3166
+ <lengow>canceled</lengow>
3167
+ </state>
3168
+ <state name="RECEIVED">
3169
+ <lengow>shipped</lengow>
3170
+ </state>
3171
+ <state name="WAITING_REFUND">
3172
+ <lengow>processing</lengow>
3173
+ </state>
3174
+ <state name="WAITING_REFUND_PAYMENT">
3175
+ <lengow>processing</lengow>
3176
+ </state>
3177
+ </states>
3178
+ </marketplace>
3179
+ <marketplace name="mistergooddeal">
3180
+ <api>https://wsdl.lengow.com/wsdl/mistergooddeal/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3181
+ <states>
3182
+ <state name="STAGING">
3183
+ <lengow>new</lengow>
3184
+ </state>
3185
+ <state name="WAITING_ACCEPTANCE">
3186
+ <lengow>new</lengow>
3187
+ <actions>
3188
+ <action type="accept">accept</action>
3189
+ <action type="refuse">canceled</action>
3190
+ </actions>
3191
+ </state>
3192
+ <state name="WAITING_DEBIT">
3193
+ <lengow>new</lengow>
3194
+ </state>
3195
+ <state name="WAITING_DEBIT_PAYMENT">
3196
+ <lengow>new</lengow>
3197
+ </state>
3198
+ <state name="SHIPPING">
3199
+ <lengow>processing</lengow>
3200
+ <actions>
3201
+ <action type="shipped">shipped</action>
3202
+ </actions>
3203
+ </state>
3204
+ <state name="RECEIVED">
3205
+ <lengow>shipped</lengow>
3206
+ </state>
3207
+ <state name="SHIPPED">
3208
+ <lengow>shipped</lengow>
3209
+ </state>
3210
+ <state name="CANCELED">
3211
+ <lengow>canceled</lengow>
3212
+ </state>
3213
+ <state name="CLOSED">
3214
+ <lengow>shipped</lengow>
3215
+ </state>
3216
+ <state name="REFUSED">
3217
+ <lengow>canceled</lengow>
3218
+ </state>
3219
+ <state name="INCIDENT_OPEN">
3220
+ <lengow>processing</lengow>
3221
+ </state>
3222
+ <state name="INCIDENT_CLOSED">
3223
+ <lengow>processing</lengow>
3224
+ </state>
3225
+ <state name="WAITING_REFUND">
3226
+ <lengow>processing</lengow>
3227
+ </state>
3228
+ <state name="WAITING_REFUND_PAYMENT">
3229
+ <lengow>processing</lengow>
3230
+ </state>
3231
+ <state name="REFUNDED">
3232
+ <lengow>canceled</lengow>
3233
+ </state>
3234
+ </states>
3235
+ <additional_params>
3236
+ <param usedby="shipped">
3237
+ <type>tracking</type>
3238
+ <name>tracking_number</name>
3239
+ </param>
3240
+ <param usedby="shipped">
3241
+ <type>carrier</type>
3242
+ <name>carrier_name</name>
3243
+ </param>
3244
+ <param usedby="shipped">
3245
+ <type>tracking_url</type>
3246
+ <name>carrier_url</name>
3247
+ </param>
3248
+ </additional_params>
3249
+ </marketplace>
3250
+ <marketplace name="rakuten_de">
3251
+ <api>https://wsdl.lengow.com/wsdl/rakutende/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3252
+ <states>
3253
+ <state name="pending">
3254
+ <lengow>new</lengow>
3255
+ </state>
3256
+ <state name="editable">
3257
+ <lengow>processing</lengow>
3258
+ <actions>
3259
+ <action type="shipped">shipped</action>
3260
+ </actions>
3261
+ </state>
3262
+ <state name="shipped">
3263
+ <lengow>shipped</lengow>
3264
+ </state>
3265
+ <state name="payout">
3266
+ <lengow>shipped</lengow>
3267
+ </state>
3268
+ <state name="cancelled">
3269
+ <lengow>canceled</lengow>
3270
+ </state>
3271
+ </states>
3272
+ </marketplace>
3273
+ <marketplace name="rakuten_es">
3274
+ <api>https://wsdl.lengow.com/wsdl/rakutenes/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3275
+ <states>
3276
+ <state name="Unfixed">
3277
+ <lengow>new</lengow>
3278
+ </state>
3279
+ <state name="AwaitingPayment">
3280
+ <lengow>new</lengow>
3281
+ </state>
3282
+ <state name="ProcessingPayment">
3283
+ <lengow>new</lengow>
3284
+ </state>
3285
+ <state name="NotShipped">
3286
+ <lengow>processing</lengow>
3287
+ <actions>
3288
+ <action type="shipped">shipped</action>
3289
+ </actions>
3290
+ </state>
3291
+
3292
+ <state name="AwaitingCompletion">
3293
+ <lengow>shipped</lengow>
3294
+ </state>
3295
+ <state name="Complete">
3296
+ <lengow>shipped</lengow>
3297
+ </state>
3298
+ <state name="Cancelled">
3299
+ <lengow>canceled</lengow>
3300
+ </state>
3301
+ <state name="CancelledAndRefund">
3302
+ <lengow>canceled</lengow>
3303
+ </state>
3304
+ </states>
3305
+ </marketplace>
3306
+ <marketplace name="rakuten_uk">
3307
+ <api>https://wsdl.lengow.com/wsdl/rakutenuk/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3308
+ <states>
3309
+ <state name="Unfixed">
3310
+ <lengow>new</lengow>
3311
+ </state>
3312
+ <state name="AwaitingPayment">
3313
+ <lengow>new</lengow>
3314
+ </state>
3315
+ <state name="ProcessingPayment">
3316
+ <lengow>new</lengow>
3317
+ </state>
3318
+ <state name="NotShipped">
3319
+ <lengow>processing</lengow>
3320
+ <actions>
3321
+ <action type="shipped">shipped</action>
3322
+ </actions>
3323
+ </state>
3324
+
3325
+ <state name="AwaitingCompletion">
3326
+ <lengow>shipped</lengow>
3327
+ </state>
3328
+ <state name="Complete">
3329
+ <lengow>shipped</lengow>
3330
+ </state>
3331
+ <state name="Cancelled">
3332
+ <lengow>canceled</lengow>
3333
+ </state>
3334
+ <state name="CancelledAndRefund">
3335
+ <lengow>canceled</lengow>
3336
+ </state>
3337
+ </states>
3338
+ </marketplace>
3339
+ <marketplace name="spartoo">
3340
+ <api>https://wsdl.lengow.com/wsdl/spartoo/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3341
+ <states>
3342
+ <state name="0">
3343
+ <lengow>new</lengow>
3344
+ </state>
3345
+ <state name="1">
3346
+ <actions>
3347
+ <action type="accept">processing</action>
3348
+ <action type="cancel">canceled</action>
3349
+ <action type="refund">refund</action>
3350
+ </actions>
3351
+ <lengow>new</lengow>
3352
+ </state>
3353
+ <state name="11">
3354
+ <lengow>new</lengow>
3355
+ <actions>
3356
+ <action type="accept">processing</action>
3357
+ <action type="cancel">canceled</action>
3358
+ <action type="refund">refund</action>
3359
+ </actions>
3360
+ </state>
3361
+ <state name="2">
3362
+ <actions>
3363
+ <action type="shipped" method="post">shipped</action>
3364
+ <action type="cancel">canceled</action>
3365
+ <action type="refund">refund</action>
3366
+ </actions>
3367
+ <lengow>processing</lengow>
3368
+ </state>
3369
+ <state name="3">
3370
+ <lengow>shipped</lengow>
3371
+ </state>
3372
+ <state name="4">
3373
+ <lengow>canceled</lengow>
3374
+ </state>
3375
+ <state name="41">
3376
+ <lengow>canceled</lengow>
3377
+ </state>
3378
+ <state name="48">
3379
+ <lengow>canceled</lengow>
3380
+ </state>
3381
+ </states>
3382
+ <additional_params>
3383
+ <param usedby="shipped">
3384
+ <type>tracking</type>
3385
+ <name>tracking_number</name>
3386
+ </param>
3387
+ </additional_params>
3388
+ </marketplace>
3389
+ <marketplace name="zalando">
3390
+ <api>https://wsdl.lengow.com/wsdl/zalando/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3391
+ <states>
3392
+ <state name="New">
3393
+ <lengow>new</lengow>
3394
+ </state>
3395
+ <state name="Approved">
3396
+ <actions>
3397
+ <action type="shipped" method="post">shipped</action>
3398
+ <action type="cancel" method="post">canceled</action>
3399
+ </actions>
3400
+ <lengow>processing</lengow>
3401
+ </state>
3402
+ <state name="SHIPPED">
3403
+ <actions>
3404
+ <action type="returned" method="post">returned</action>
3405
+ </actions>
3406
+ <lengow>shipped</lengow>
3407
+ </state>
3408
+ <state name="RETURNED">
3409
+ <lengow>canceled</lengow>
3410
+ </state>
3411
+ <state name="ZALANDO_CANCELED">
3412
+ <lengow>canceled</lengow>
3413
+ </state>
3414
+ <state name="NO_INVENTORY_CANCELED">
3415
+ <lengow>canceled</lengow>
3416
+ </state>
3417
+ </states>
3418
+ <additional_params>
3419
+ <param usedby="shipped cancel refund returned">
3420
+ <type>client_token</type>
3421
+ <name>token</name>
3422
+ </param>
3423
+ <param usedby="shipped cancel refund returned">
3424
+ <type>action</type>
3425
+ <name>action</name>
3426
+ </param>
3427
+ <param usedby="shipped cancel refund returned">
3428
+ <type>sku</type>
3429
+ <name>sku</name>
3430
+ </param>
3431
+ <param usedby="shipped cancel refund returned">
3432
+ <type>quantity</type>
3433
+ <name>quantity</name>
3434
+ </param>
3435
+ <param usedby="shipped cancel refund returned">
3436
+ <type>line</type>
3437
+ <name>line</name>
3438
+ </param>
3439
+ <param usedby="shipped">
3440
+ <type>tracking</type>
3441
+ <name>trackingNumber</name>
3442
+ </param>
3443
+ <param usedby="shipped">
3444
+ <type>return_tracking</type>
3445
+ <name>returnTrackingNumber</name>
3446
+ </param>
3447
+ <param usedby="returned">
3448
+ <type>return_code</type>
3449
+ <name>returnReasonCode</name>
3450
+ </param>
3451
+ </additional_params>
3452
+ </marketplace>
3453
+ <marketplace name="placedumariage">
3454
+ <states>
3455
+ <state name="partielle">
3456
+ <lengow>new</lengow>
3457
+ </state>
3458
+ <state name="complète">
3459
+ <lengow>new</lengow>
3460
+ </state>
3461
+ <state name="expédiée">
3462
+ <lengow>shipped</lengow>
3463
+ </state>
3464
+ <state name="annulée">
3465
+ <lengow>canceled</lengow>
3466
+ </state>
3467
+ </states>
3468
+ </marketplace>
3469
+ <marketplace name="home24_de">
3470
+ <api>https://wsdl.lengow.com/wsdl/home24_de/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3471
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_de/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3472
+ <states>
3473
+ <state name="new">
3474
+ <lengow>new</lengow>
3475
+ <actions>
3476
+ <action type="accept" method="post">processing</action>
3477
+ <action type="refuse" method="post">canceled</action>
3478
+ </actions>
3479
+ </state>
3480
+ <state name="processing">
3481
+ <lengow>processing</lengow>
3482
+ <actions>
3483
+ <action type="shipped" method="post">shipped</action>
3484
+ <action type="refuse" method="post">canceled</action>
3485
+ </actions>
3486
+ </state>
3487
+ <state name="shipped">
3488
+ <lengow>shipped</lengow>
3489
+ </state>
3490
+ <state name="canceled">
3491
+ <lengow>canceled</lengow>
3492
+ </state>
3493
+ </states>
3494
+ <additional_params>
3495
+ <param usedby="accept">
3496
+ <type>date_shipped</type>
3497
+ <name>date_shipped</name>
3498
+ </param>
3499
+ <param usedby="accept">
3500
+ <type>date_delivered</type>
3501
+ <name>date_delivered</name>
3502
+ </param>
3503
+ <param usedby="shipped cancel refund returned">
3504
+ <type>action</type>
3505
+ <name>action</name>
3506
+ </param>
3507
+ <param usedby="shipped cancel refund returned">
3508
+ <type>sku</type>
3509
+ <name>sku</name>
3510
+ </param>
3511
+ <param usedby="shipped cancel refund returned">
3512
+ <type>quantity</type>
3513
+ <name>quantity</name>
3514
+ </param>
3515
+ <param usedby="shipped cancel refund returned">
3516
+ <type>line</type>
3517
+ <name>line</name>
3518
+ </param>
3519
+ <param usedby="shipped">
3520
+ <type>tracking</type>
3521
+ <name>tracking_number</name>
3522
+ </param>
3523
+ <param usedby="shipped">
3524
+ <type>carrier</type>
3525
+ <name>carrier_name</name>
3526
+ </param>
3527
+ </additional_params>
3528
+ </marketplace>
3529
+ <marketplace name="home24_fr">
3530
+ <api>https://wsdl.lengow.com/wsdl/home24_fr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3531
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_fr/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3532
+ <states>
3533
+ <state name="new">
3534
+ <lengow>new</lengow>
3535
+ <actions>
3536
+ <action type="accept" method="post">processing</action>
3537
+ <action type="refuse" method="post">canceled</action>
3538
+ </actions>
3539
+ </state>
3540
+ <state name="processing">
3541
+ <lengow>processing</lengow>
3542
+ <actions>
3543
+ <action type="shipped" method="post">shipped</action>
3544
+ <action type="refuse" method="post">canceled</action>
3545
+ </actions>
3546
+ </state>
3547
+ <state name="shipped">
3548
+ <lengow>shipped</lengow>
3549
+ </state>
3550
+ <state name="canceled">
3551
+ <lengow>canceled</lengow>
3552
+ </state>
3553
+ </states>
3554
+ <additional_params>
3555
+ <param usedby="accept">
3556
+ <type>date_shipped</type>
3557
+ <name>date_shipped</name>
3558
+ </param>
3559
+ <param usedby="accept">
3560
+ <type>date_delivered</type>
3561
+ <name>date_delivered</name>
3562
+ </param>
3563
+ <param usedby="shipped cancel refund returned">
3564
+ <type>action</type>
3565
+ <name>action</name>
3566
+ </param>
3567
+ <param usedby="shipped cancel refund returned">
3568
+ <type>sku</type>
3569
+ <name>sku</name>
3570
+ </param>
3571
+ <param usedby="shipped cancel refund returned">
3572
+ <type>quantity</type>
3573
+ <name>quantity</name>
3574
+ </param>
3575
+ <param usedby="shipped cancel refund returned">
3576
+ <type>line</type>
3577
+ <name>line</name>
3578
+ </param>
3579
+ <param usedby="shipped">
3580
+ <type>tracking</type>
3581
+ <name>tracking_number</name>
3582
+ </param>
3583
+ <param usedby="shipped">
3584
+ <type>carrier</type>
3585
+ <name>carrier_name</name>
3586
+ </param>
3587
+ </additional_params>
3588
+ </marketplace>
3589
+ <marketplace name="home24_nl">
3590
+ <api>https://wsdl.lengow.com/wsdl/home24_nl/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3591
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_nl/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3592
+ <states>
3593
+ <state name="new">
3594
+ <lengow>new</lengow>
3595
+ <actions>
3596
+ <action type="accept" method="post">processing</action>
3597
+ <action type="refuse" method="post">canceled</action>
3598
+ </actions>
3599
+ </state>
3600
+ <state name="processing">
3601
+ <lengow>processing</lengow>
3602
+ <actions>
3603
+ <action type="shipped" method="post">shipped</action>
3604
+ <action type="refuse" method="post">canceled</action>
3605
+ </actions>
3606
+ </state>
3607
+ <state name="shipped">
3608
+ <lengow>shipped</lengow>
3609
+ </state>
3610
+ <state name="canceled">
3611
+ <lengow>canceled</lengow>
3612
+ </state>
3613
+ </states>
3614
+ <additional_params>
3615
+ <param usedby="accept">
3616
+ <type>date_shipped</type>
3617
+ <name>date_shipped</name>
3618
+ </param>
3619
+ <param usedby="accept">
3620
+ <type>date_delivered</type>
3621
+ <name>date_delivered</name>
3622
+ </param>
3623
+ <param usedby="shipped cancel refund returned">
3624
+ <type>action</type>
3625
+ <name>action</name>
3626
+ </param>
3627
+ <param usedby="shipped cancel refund returned">
3628
+ <type>sku</type>
3629
+ <name>sku</name>
3630
+ </param>
3631
+ <param usedby="shipped cancel refund returned">
3632
+ <type>quantity</type>
3633
+ <name>quantity</name>
3634
+ </param>
3635
+ <param usedby="shipped cancel refund returned">
3636
+ <type>line</type>
3637
+ <name>line</name>
3638
+ </param>
3639
+ <param usedby="shipped">
3640
+ <type>tracking</type>
3641
+ <name>tracking_number</name>
3642
+ </param>
3643
+ <param usedby="shipped">
3644
+ <type>carrier</type>
3645
+ <name>carrier_name</name>
3646
+ </param>
3647
+ </additional_params>
3648
  </marketplace>
3649
+ <marketplace name="home24_at">
3650
+ <api>https://wsdl.lengow.com/wsdl/home24_at/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3651
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_at/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3652
  <states>
3653
+ <state name="new">
3654
  <lengow>new</lengow>
3655
+ <actions>
3656
+ <action type="accept" method="post">processing</action>
3657
+ <action type="refuse" method="post">canceled</action>
3658
+ </actions>
3659
  </state>
3660
+ <state name="processing">
3661
+ <lengow>processing</lengow>
3662
  <actions>
3663
+ <action type="shipped" method="post">shipped</action>
3664
+ <action type="refuse" method="post">canceled</action>
 
3665
  </actions>
 
3666
  </state>
3667
+ <state name="shipped">
3668
+ <lengow>shipped</lengow>
3669
+ </state>
3670
+ <state name="canceled">
3671
+ <lengow>canceled</lengow>
3672
+ </state>
3673
+ </states>
3674
+ <additional_params>
3675
+ <param usedby="accept">
3676
+ <type>date_shipped</type>
3677
+ <name>date_shipped</name>
3678
+ </param>
3679
+ <param usedby="accept">
3680
+ <type>date_delivered</type>
3681
+ <name>date_delivered</name>
3682
+ </param>
3683
+ <param usedby="shipped cancel refund returned">
3684
+ <type>action</type>
3685
+ <name>action</name>
3686
+ </param>
3687
+ <param usedby="shipped cancel refund returned">
3688
+ <type>sku</type>
3689
+ <name>sku</name>
3690
+ </param>
3691
+ <param usedby="shipped cancel refund returned">
3692
+ <type>quantity</type>
3693
+ <name>quantity</name>
3694
+ </param>
3695
+ <param usedby="shipped cancel refund returned">
3696
+ <type>line</type>
3697
+ <name>line</name>
3698
+ </param>
3699
+ <param usedby="shipped">
3700
+ <type>tracking</type>
3701
+ <name>tracking_number</name>
3702
+ </param>
3703
+ <param usedby="shipped">
3704
+ <type>carrier</type>
3705
+ <name>carrier_name</name>
3706
+ </param>
3707
+ </additional_params>
3708
+ </marketplace>
3709
+ <marketplace name="home24_bede">
3710
+ <api>https://wsdl.lengow.com/wsdl/home24_bede/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3711
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_bede/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3712
+ <states>
3713
+ <state name="new">
3714
  <lengow>new</lengow>
3715
  <actions>
3716
+ <action type="accept" method="post">processing</action>
3717
+ <action type="refuse" method="post">canceled</action>
 
3718
  </actions>
3719
  </state>
3720
+ <state name="processing">
3721
+ <lengow>processing</lengow>
3722
  <actions>
3723
  <action type="shipped" method="post">shipped</action>
3724
+ <action type="refuse" method="post">canceled</action>
 
3725
  </actions>
 
3726
  </state>
3727
+ <state name="shipped">
3728
  <lengow>shipped</lengow>
3729
  </state>
3730
+ <state name="canceled">
3731
  <lengow>canceled</lengow>
3732
  </state>
3733
+ </states>
3734
+ <additional_params>
3735
+ <param usedby="accept">
3736
+ <type>date_shipped</type>
3737
+ <name>date_shipped</name>
3738
+ </param>
3739
+ <param usedby="accept">
3740
+ <type>date_delivered</type>
3741
+ <name>date_delivered</name>
3742
+ </param>
3743
+ <param usedby="shipped cancel refund returned">
3744
+ <type>action</type>
3745
+ <name>action</name>
3746
+ </param>
3747
+ <param usedby="shipped cancel refund returned">
3748
+ <type>sku</type>
3749
+ <name>sku</name>
3750
+ </param>
3751
+ <param usedby="shipped cancel refund returned">
3752
+ <type>quantity</type>
3753
+ <name>quantity</name>
3754
+ </param>
3755
+ <param usedby="shipped cancel refund returned">
3756
+ <type>line</type>
3757
+ <name>line</name>
3758
+ </param>
3759
+ <param usedby="shipped">
3760
+ <type>tracking</type>
3761
+ <name>tracking_number</name>
3762
+ </param>
3763
+ <param usedby="shipped">
3764
+ <type>carrier</type>
3765
+ <name>carrier_name</name>
3766
+ </param>
3767
+ </additional_params>
3768
+ </marketplace>
3769
+ <marketplace name="home24_befr">
3770
+ <api>https://wsdl.lengow.com/wsdl/home24_befr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3771
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_befr/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3772
+ <states>
3773
+ <state name="new">
3774
+ <lengow>new</lengow>
3775
+ <actions>
3776
+ <action type="accept" method="post">processing</action>
3777
+ <action type="refuse" method="post">canceled</action>
3778
+ </actions>
3779
+ </state>
3780
+ <state name="processing">
3781
+ <lengow>processing</lengow>
3782
+ <actions>
3783
+ <action type="shipped" method="post">shipped</action>
3784
+ <action type="refuse" method="post">canceled</action>
3785
+ </actions>
3786
+ </state>
3787
+ <state name="shipped">
3788
+ <lengow>shipped</lengow>
3789
+ </state>
3790
+ <state name="canceled">
3791
  <lengow>canceled</lengow>
3792
  </state>
3793
  </states>
3794
  <additional_params>
3795
+ <param usedby="accept">
3796
+ <type>date_shipped</type>
3797
+ <name>date_shipped</name>
3798
+ </param>
3799
+ <param usedby="accept">
3800
+ <type>date_delivered</type>
3801
+ <name>date_delivered</name>
3802
+ </param>
3803
+ <param usedby="shipped cancel refund returned">
3804
+ <type>action</type>
3805
+ <name>action</name>
3806
+ </param>
3807
+ <param usedby="shipped cancel refund returned">
3808
+ <type>sku</type>
3809
+ <name>sku</name>
3810
+ </param>
3811
+ <param usedby="shipped cancel refund returned">
3812
+ <type>quantity</type>
3813
+ <name>quantity</name>
3814
+ </param>
3815
+ <param usedby="shipped cancel refund returned">
3816
+ <type>line</type>
3817
+ <name>line</name>
3818
+ </param>
3819
  <param usedby="shipped">
3820
  <type>tracking</type>
3821
  <name>tracking_number</name>
3822
  </param>
3823
+ <param usedby="shipped">
3824
+ <type>carrier</type>
3825
+ <name>carrier_name</name>
3826
+ </param>
3827
  </additional_params>
3828
  </marketplace>
3829
+ <marketplace name="home24_it">
3830
+ <api>https://wsdl.lengow.com/wsdl/home24_it/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3831
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_it/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3832
  <states>
3833
+ <state name="new">
3834
  <lengow>new</lengow>
 
 
3835
  <actions>
3836
+ <action type="accept" method="post">processing</action>
3837
+ <action type="refuse" method="post">canceled</action>
 
3838
  </actions>
 
3839
  </state>
3840
+ <state name="processing">
3841
+ <lengow>processing</lengow>
3842
  <actions>
3843
+ <action type="shipped" method="post">shipped</action>
3844
+ <action type="refuse" method="post">canceled</action>
3845
  </actions>
3846
+ </state>
3847
+ <state name="shipped">
3848
  <lengow>shipped</lengow>
3849
  </state>
3850
+ <state name="canceled">
3851
  <lengow>canceled</lengow>
3852
  </state>
3853
+ </states>
3854
+ <additional_params>
3855
+ <param usedby="accept">
3856
+ <type>date_shipped</type>
3857
+ <name>date_shipped</name>
3858
+ </param>
3859
+ <param usedby="accept">
3860
+ <type>date_delivered</type>
3861
+ <name>date_delivered</name>
3862
+ </param>
3863
+ <param usedby="shipped cancel refund returned">
3864
+ <type>action</type>
3865
+ <name>action</name>
3866
+ </param>
3867
+ <param usedby="shipped cancel refund returned">
3868
+ <type>sku</type>
3869
+ <name>sku</name>
3870
+ </param>
3871
+ <param usedby="shipped cancel refund returned">
3872
+ <type>quantity</type>
3873
+ <name>quantity</name>
3874
+ </param>
3875
+ <param usedby="shipped cancel refund returned">
3876
+ <type>line</type>
3877
+ <name>line</name>
3878
+ </param>
3879
+ <param usedby="shipped">
3880
+ <type>tracking</type>
3881
+ <name>tracking_number</name>
3882
+ </param>
3883
+ <param usedby="shipped">
3884
+ <type>carrier</type>
3885
+ <name>carrier_name</name>
3886
+ </param>
3887
+ </additional_params>
3888
+ </marketplace>
3889
+ <marketplace name="home24_swde">
3890
+ <api>https://wsdl.lengow.com/wsdl/home24_swde/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3891
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_swde/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3892
+ <states>
3893
+ <state name="new">
3894
+ <lengow>new</lengow>
3895
+ <actions>
3896
+ <action type="accept" method="post">processing</action>
3897
+ <action type="refuse" method="post">canceled</action>
3898
+ </actions>
3899
+ </state>
3900
+ <state name="processing">
3901
+ <lengow>processing</lengow>
3902
+ <actions>
3903
+ <action type="shipped" method="post">shipped</action>
3904
+ <action type="refuse" method="post">canceled</action>
3905
+ </actions>
3906
+ </state>
3907
+ <state name="shipped">
3908
+ <lengow>shipped</lengow>
3909
+ </state>
3910
  <state name="canceled">
3911
  <lengow>canceled</lengow>
3912
  </state>
3913
  </states>
3914
  <additional_params>
3915
+ <param usedby="accept">
3916
+ <type>date_shipped</type>
3917
+ <name>date_shipped</name>
3918
+ </param>
3919
+ <param usedby="accept">
3920
+ <type>date_delivered</type>
3921
+ <name>date_delivered</name>
3922
  </param>
3923
  <param usedby="shipped cancel refund returned">
3924
  <type>action</type>
3938
  </param>
3939
  <param usedby="shipped">
3940
  <type>tracking</type>
3941
+ <name>tracking_number</name>
3942
  </param>
3943
  <param usedby="shipped">
3944
+ <type>carrier</type>
3945
+ <name>carrier_name</name>
 
 
 
 
3946
  </param>
3947
  </additional_params>
3948
  </marketplace>
3949
+ <marketplace name="home24_swfr">
3950
+ <api>https://wsdl.lengow.com/wsdl/home24_swfr/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
3951
+ <apibyline>https://wsdl.lengow.com/wsdl/home24_swfr/#ID_FLUX#/#ORDER_ID#/#ORDER_LINE_ID#/#QUANTITY#/action_lines.xml</apibyline>
3952
  <states>
3953
+ <state name="new">
3954
  <lengow>new</lengow>
3955
+ <actions>
3956
+ <action type="accept" method="post">processing</action>
3957
+ <action type="refuse" method="post">canceled</action>
3958
+ </actions>
3959
  </state>
3960
+ <state name="processing">
3961
+ <lengow>processing</lengow>
3962
+ <actions>
3963
+ <action type="shipped" method="post">shipped</action>
3964
+ <action type="refuse" method="post">canceled</action>
3965
+ </actions>
3966
+ </state>
3967
+ <state name="shipped">
3968
+ <lengow>shipped</lengow>
3969
+ </state>
3970
+ <state name="canceled">
3971
+ <lengow>canceled</lengow>
3972
+ </state>
3973
+ </states>
3974
+ <additional_params>
3975
+ <param usedby="accept">
3976
+ <type>date_shipped</type>
3977
+ <name>date_shipped</name>
3978
+ </param>
3979
+ <param usedby="accept">
3980
+ <type>date_delivered</type>
3981
+ <name>date_delivered</name>
3982
+ </param>
3983
+ <param usedby="shipped cancel refund returned">
3984
+ <type>action</type>
3985
+ <name>action</name>
3986
+ </param>
3987
+ <param usedby="shipped cancel refund returned">
3988
+ <type>sku</type>
3989
+ <name>sku</name>
3990
+ </param>
3991
+ <param usedby="shipped cancel refund returned">
3992
+ <type>quantity</type>
3993
+ <name>quantity</name>
3994
+ </param>
3995
+ <param usedby="shipped cancel refund returned">
3996
+ <type>line</type>
3997
+ <name>line</name>
3998
+ </param>
3999
+ <param usedby="shipped">
4000
+ <type>tracking</type>
4001
+ <name>tracking_number</name>
4002
+ </param>
4003
+ <param usedby="shipped">
4004
+ <type>carrier</type>
4005
+ <name>carrier_name</name>
4006
+ </param>
4007
+ </additional_params>
4008
+ </marketplace>
4009
+ <marketplace name="ricardo">
4010
+ <api>https://wsdl.lengow.com/wsdl/ricardo/#ID_FLUX#/#ORDER_ID#/#ACTION#.xml</api>
4011
+ <states>
4012
+ <state name="new">
4013
  <lengow>new</lengow>
4014
  </state>
4015
+ <state name="processing">
4016
+ <lengow>processing</lengow>
4017
+ <actions>
4018
+ <action type="shipped" method="post">ship</action>
4019
+ </actions>
4020
+ </state>
4021
+ <state name="shipped">
4022
  <lengow>shipped</lengow>
4023
  </state>
4024
+ <state name="canceled">
4025
  <lengow>canceled</lengow>
4026
  </state>
4027
+ </states>
4028
  </marketplace>
4029
  </marketplaces>
app/code/community/Lengow/Sync/etc/system.xml CHANGED
@@ -1,108 +1,157 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
- <lengow translate="label" module="sync">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
- <sync translate="label" module="sync">
11
  <label>Manage Orders</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
14
  <sort_order>110</sort_order>
15
  <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
- <orders translate="label" module="sync">
20
  <label>Manage Orders</label>
21
  <show_in_default>1</show_in_default>
22
- <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
24
  <sort_order>1</sort_order>
25
  <fields>
 
 
 
 
 
 
 
 
 
 
26
  <period>
27
- <label>Import orders from x days</label>
28
  <sort_order>20</sort_order>
29
  <show_in_default>1</show_in_default>
30
  <show_in_website>0</show_in_website>
31
- <show_in_store>0</show_in_store>
32
  <comment>Choose period for Sync order</comment>
33
  </period>
34
- <customer_group>
35
- <label>Customer group</label>
36
- <frontend_type>select</frontend_type>
37
- <sort_order>30</sort_order>
38
- <show_in_default>1</show_in_default>
39
- <show_in_website>0</show_in_website>
40
- <show_in_store>0</show_in_store>
41
- <source_model>sync/system_config_source_customer_group</source_model>
42
- </customer_group>
43
  <date_import>
44
- <label>Use the real date of import's order</label>
45
- <frontend_type>select</frontend_type>
46
  <sort_order>40</sort_order>
47
  <show_in_default>1</show_in_default>
48
  <show_in_website>0</show_in_website>
49
- <show_in_store>0</show_in_store>
50
  <source_model>adminhtml/system_config_source_yesno</source_model>
51
  <comment>To change the date of import's order with the date of marketplace</comment>
52
  </date_import>
53
- <cron>
54
- <label>Auto import</label>
55
- <frontend_type>select</frontend_type>
56
- <sort_order>40</sort_order>
 
 
 
 
 
 
 
 
 
 
57
  <show_in_default>1</show_in_default>
58
  <show_in_website>0</show_in_website>
59
- <show_in_store>0</show_in_store>
60
- <source_model>adminhtml/system_config_source_yesno</source_model>
61
- <comment>Enable import every 30 minutes</comment>
62
- </cron>
63
  <title>
64
  <label>Import with product's title from Lengow</label>
65
  <comment>Import an order with the product's name from marketplace</comment>
66
  <frontend_type>select</frontend_type>
67
- <sort_order>50</sort_order>
68
  <show_in_default>1</show_in_default>
69
  <show_in_website>0</show_in_website>
70
- <show_in_store>0</show_in_store>
71
  <source_model>adminhtml/system_config_source_yesno</source_model>
72
  </title>
73
- <pending>
74
  <label>Import order in pending payment</label>
75
  <comment>Import an order in pendinf payment (like check or money order)</comment>
76
  <frontend_type>select</frontend_type>
77
  <sort_order>50</sort_order>
78
  <show_in_default>1</show_in_default>
79
- <show_in_website>0</show_in_website>
80
- <show_in_store>0</show_in_store>
81
  <source_model>adminhtml/system_config_source_yesno</source_model>
82
- </pending>
83
- <processing_fee>
84
- <label>Import processing fee from Marketplace</label>
85
- <comment>Import the processing fee</comment>
 
 
 
 
 
 
 
 
 
 
86
  <frontend_type>select</frontend_type>
87
- <sort_order>50</sort_order>
88
  <show_in_default>1</show_in_default>
89
  <show_in_website>0</show_in_website>
90
- <show_in_store>0</show_in_store>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  <source_model>adminhtml/system_config_source_yesno</source_model>
92
- </processing_fee>
 
93
  <debug>
94
- <label>Debug mode</label>
95
- <frontend_type>select</frontend_type>
96
- <sort_order>60</sort_order>
97
  <show_in_default>1</show_in_default>
98
  <show_in_website>0</show_in_website>
99
  <show_in_store>0</show_in_store>
100
  <source_model>adminhtml/system_config_source_yesno</source_model>
101
  <comment>Only for preproduction's mode : no sync orders with Lengow, import orders every time</comment>
102
  </debug>
103
- </fields>
104
- </orders>
105
- <hidden translate="label" module="sync">
106
  <label>Hidden fields</label>
107
  <show_in_default>0</show_in_default>
108
  <show_in_website>0</show_in_website>
@@ -110,7 +159,7 @@
110
  <sort_order>1</sort_order>
111
  <fields>
112
  <last_synchro>
113
- <label>Date of marketplace.xml sync</label>
114
  <sort_order>1</sort_order>
115
  <show_in_default>0</show_in_default>
116
  <show_in_website>0</show_in_website>
@@ -120,6 +169,6 @@
120
  </fields>
121
  </hidden>
122
  </groups>
123
- </sync>
124
  </sections>
125
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
+ <lengow translate="label" module="lensync">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
+ <lensync translate="label" module="lensync">
11
  <label>Manage Orders</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
14
  <sort_order>110</sort_order>
15
  <show_in_default>1</show_in_default>
16
+ <show_in_website>0</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
+ <orders translate="label" module="lensync">
20
  <label>Manage Orders</label>
21
  <show_in_default>1</show_in_default>
22
+ <show_in_website>0</show_in_website>
23
  <show_in_store>1</show_in_store>
24
  <sort_order>1</sort_order>
25
  <fields>
26
+ <active_store>
27
+ <label>Enabled store</label>
28
+ <frontend_type>select</frontend_type>
29
+ <sort_order>10</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>0</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <comment>Enable store to import</comment>
35
+ </active_store>
36
  <period>
37
+ <label>Import orders from x days</label>
38
  <sort_order>20</sort_order>
39
  <show_in_default>1</show_in_default>
40
  <show_in_website>0</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
  <comment>Choose period for Sync order</comment>
43
  </period>
 
 
 
 
 
 
 
 
 
44
  <date_import>
45
+ <label>Use the real date of import's order</label>
46
+ <frontend_type>select</frontend_type>
47
  <sort_order>40</sort_order>
48
  <show_in_default>1</show_in_default>
49
  <show_in_website>0</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
  <source_model>adminhtml/system_config_source_yesno</source_model>
52
  <comment>To change the date of import's order with the date of marketplace</comment>
53
  </date_import>
54
+ <processing_fee>
55
+ <label>Import processing fee from Marketplace</label>
56
+ <comment>Import the processing fee</comment>
57
+ <frontend_type>select</frontend_type>
58
+ <sort_order>50</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>0</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ </processing_fee>
64
+ <customer_group>
65
+ <label>Customer group</label>
66
+ <frontend_type>select</frontend_type>
67
+ <sort_order>60</sort_order>
68
  <show_in_default>1</show_in_default>
69
  <show_in_website>0</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <source_model>lensync/system_config_source_customer_group</source_model>
72
+ </customer_group>
 
73
  <title>
74
  <label>Import with product's title from Lengow</label>
75
  <comment>Import an order with the product's name from marketplace</comment>
76
  <frontend_type>select</frontend_type>
77
+ <sort_order>70</sort_order>
78
  <show_in_default>1</show_in_default>
79
  <show_in_website>0</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
  <source_model>adminhtml/system_config_source_yesno</source_model>
82
  </title>
83
+ <!--<pending>
84
  <label>Import order in pending payment</label>
85
  <comment>Import an order in pendinf payment (like check or money order)</comment>
86
  <frontend_type>select</frontend_type>
87
  <sort_order>50</sort_order>
88
  <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
  <source_model>adminhtml/system_config_source_yesno</source_model>
92
+ </pending>-->
93
+ <split_name>
94
+ <label>Split name</label>
95
+ <comment>If one of the name fields is empty, the non-empty field will be split to fill the empty name field</comment>
96
+ <frontend_type>select</frontend_type>
97
+ <sort_order>80</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>0</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ </split_name>
103
+ <default_shipping>
104
+ <label>Choose default shipping</label>
105
+ <comment>Default shipping method</comment>
106
  <frontend_type>select</frontend_type>
107
+ <sort_order>90</sort_order>
108
  <show_in_default>1</show_in_default>
109
  <show_in_website>0</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
112
+ </default_shipping>
113
+ <fake_email>
114
+ <label>Use fake emails</label>
115
+ <comment>Use fake emails for customer creation</comment>
116
+ <frontend_type>select</frontend_type>
117
+ <sort_order>100</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>0</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ </fake_email>
123
+ </fields>
124
+ </orders>
125
+ <performances translate="label comment">
126
+ <label>Performances</label>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>0</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ <sort_order>2</sort_order>
131
+ <fields>
132
+ <active_cron>
133
+ <label>Auto import</label>
134
+ <frontend_type>select</frontend_type>
135
+ <sort_order>10</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>0</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
  <source_model>adminhtml/system_config_source_yesno</source_model>
140
+ <comment>Enable import every 30 minutes</comment>
141
+ </active_cron>
142
  <debug>
143
+ <label>Debug mode</label>
144
+ <frontend_type>select</frontend_type>
145
+ <sort_order>20</sort_order>
146
  <show_in_default>1</show_in_default>
147
  <show_in_website>0</show_in_website>
148
  <show_in_store>0</show_in_store>
149
  <source_model>adminhtml/system_config_source_yesno</source_model>
150
  <comment>Only for preproduction's mode : no sync orders with Lengow, import orders every time</comment>
151
  </debug>
152
+ </fields>
153
+ </performances>
154
+ <hidden translate="label" module="lensync">
155
  <label>Hidden fields</label>
156
  <show_in_default>0</show_in_default>
157
  <show_in_website>0</show_in_website>
159
  <sort_order>1</sort_order>
160
  <fields>
161
  <last_synchro>
162
+ <label>Date of marketplace.xml sync</label>
163
  <sort_order>1</sort_order>
164
  <show_in_default>0</show_in_default>
165
  <show_in_website>0</show_in_website>
169
  </fields>
170
  </hidden>
171
  </groups>
172
+ </lensync>
173
  </sections>
174
  </config>
app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-install-2.0.0.0.php CHANGED
@@ -153,18 +153,19 @@ $installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
153
 
154
  $entity_id = $installer->getEntityTypeId('catalog_product');
155
  $attribute = $installer->getAttribute($entity_id,'lengow_product');
156
- if(!$attribute) {
 
157
  $installer->addAttribute('catalog_product', 'lengow_product', array(
158
  'type' => 'int',
159
  'backend' => '',
160
  'frontend' => '',
161
  'label' => 'Publish on Lengow',
162
  'input' => 'boolean',
163
- 'global' => 0,
164
  'visible' => 1,
165
  'required' => 0,
166
  'user_defined' => 1,
167
- 'default' => 1,
168
  'searchable' => 0,
169
  'filterable' => 0,
170
  'comparable' => 0,
@@ -172,10 +173,11 @@ if(!$attribute) {
172
  'unique' => 0,
173
  'used_in_product_listing' => 1
174
  ));
175
- } else {
176
- // Update attribute
177
- $attribute->setIsGlobal(0)->save();
178
  }
 
179
  // TODO use Mage ORM
180
  $installer->run(
181
  "CREATE TABLE IF NOT EXISTS `{$this->getTable('lengow_log')}` (
153
 
154
  $entity_id = $installer->getEntityTypeId('catalog_product');
155
  $attribute = $installer->getAttribute($entity_id,'lengow_product');
156
+
157
+ if(!$attribute){
158
  $installer->addAttribute('catalog_product', 'lengow_product', array(
159
  'type' => 'int',
160
  'backend' => '',
161
  'frontend' => '',
162
  'label' => 'Publish on Lengow',
163
  'input' => 'boolean',
164
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
165
  'visible' => 1,
166
  'required' => 0,
167
  'user_defined' => 1,
168
+ 'default' => 0,
169
  'searchable' => 0,
170
  'filterable' => 0,
171
  'comparable' => 0,
173
  'unique' => 0,
174
  'used_in_product_listing' => 1
175
  ));
176
+ }else{
177
+ $installer->updateAttribute('catalog_product','lengow_product','default_value', 0);
178
+ $installer->updateAttribute('catalog_product','lengow_product','is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
179
  }
180
+
181
  // TODO use Mage ORM
182
  $installer->run(
183
  "CREATE TABLE IF NOT EXISTS `{$this->getTable('lengow_log')}` (
app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-upgrade-2.0.0.0-2.0.0.1.php CHANGED
@@ -12,7 +12,8 @@ $installer->startSetup();
12
 
13
  /*
14
  * Add order infos
15
- * - carrier - string
 
16
  */
17
  $order_entity_id = $installer->getEntityTypeId('order');
18
 
12
 
13
  /*
14
  * Add order infos
15
+ * - Carrier - text
16
+ * - Carrier method - text
17
  */
18
  $order_entity_id = $installer->getEntityTypeId('order');
19
 
app/code/community/Lengow/Sync/sql/lengow_setup/mysql4-upgrade-2.0.2-2.1.0.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Lengow
5
+ * @package Lengow_Sync
6
+ * @author Benjamin Le Nevé <benjamin.le-neve@lengow.com>
7
+ * @copyright 2015 Lengow SAS
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ /*
14
+ * Add order infos
15
+ * - Carrier tracking - text
16
+ * - Carrier id relay - text
17
+ */
18
+ $order_entity_id = $installer->getEntityTypeId('order');
19
+
20
+ $list_attribute[] = array(
21
+ 'name' => 'carrier_tracking_lengow',
22
+ 'label' => 'Carrier tracking',
23
+ 'type' => 'text',
24
+ 'input' => 'text',
25
+ 'source' => '',
26
+ 'default' => '',
27
+ 'grid' => false,
28
+ );
29
+
30
+ $list_attribute[] = array(
31
+ 'name' => 'carrier_id_relay_lengow',
32
+ 'label' => 'Carrier id relay',
33
+ 'type' => 'text',
34
+ 'input' => 'text',
35
+ 'source' => '',
36
+ 'default' => '',
37
+ 'grid' => false,
38
+ );
39
+
40
+ foreach($list_attribute as $attr) {
41
+ $order_attribute = $installer->getAttribute($order_entity_id, $attr['name']);
42
+ if(!$order_attribute) {
43
+ $installer->addAttribute('order', $attr['name'], array(
44
+ 'name' => $attr['name'],
45
+ 'label' => $attr['label'],
46
+ 'type' => $attr['type'],
47
+ 'visible' => true,
48
+ 'required' => false,
49
+ 'unique' => false,
50
+ 'filterable' => 1,
51
+ 'sort_order' => 700,
52
+ 'default' => $attr['default'],
53
+ 'input' => $attr['input'],
54
+ 'source' => $attr['source'],
55
+ 'grid' => $attr['grid'],
56
+ ));
57
+ }
58
+ $usedInForms = array(
59
+ 'adminhtml_order',
60
+ );
61
+ }
62
+
63
+ /*
64
+ * fix product selection by store
65
+ */
66
+
67
+ $installer->updateAttribute('catalog_product','lengow_product','is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
68
+
69
+ $order_entity_id = $installer->getEntityTypeId('order');
70
+
71
+ $new_attributes = array("lengow_product");
72
+
73
+ // Add new Attribute group
74
+ $groupName = 'Lengow';
75
+
76
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
77
+
78
+ //Add group Lengow in all Attribute Set
79
+ $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->load();
80
+ foreach ($attributeSetCollection as $id => $attributeSet) {
81
+
82
+ // Add group lengow in attribute set
83
+ $installer->addAttributeGroup($entityTypeId, $attributeSet->getId(), $groupName, 100);
84
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId, $attributeSet->getId(), $groupName);
85
+
86
+ // Add new attribute (lengow_product) on Group (Lengow)
87
+ foreach($new_attributes as $attribute_code) {
88
+ $attributeId = $installer->getAttributeId('catalog_product', $attribute_code);
89
+ $entityTypeId = $attributeSet->getEntityTypeId();
90
+ $installer->addAttributeToGroup($entityTypeId, $attributeSet->getId(), $attributeGroupId, $attributeId, null);
91
+ }
92
+ }
93
+
94
+ $installer->endSetup();
app/code/community/Lengow/Tracker/Block/Adminhtml/System/Config/Check.php CHANGED
@@ -43,7 +43,7 @@ class Lengow_Tracker_Block_Adminhtml_System_Config_Check extends Mage_Adminhtml_
43
  * @see Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
44
  */
45
  public function render(Varien_Data_Form_Element_Abstract $element) {
46
- $html = $this->getLayout()->createBlock('tracker/adminhtml_system_config_check_point', 'lengow_checkpoint')
47
  ->toHtml();
48
  $element->setHtmlContent($html);
49
  $this->_element = $element;
43
  * @see Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
44
  */
45
  public function render(Varien_Data_Form_Element_Abstract $element) {
46
+ $html = $this->getLayout()->createBlock('lentracker/adminhtml_system_config_check_point', 'lengow_checkpoint')
47
  ->toHtml();
48
  $element->setHtmlContent($html);
49
  $this->_element = $element;
app/code/community/Lengow/Tracker/Block/Adminhtml/System/Config/Check/Point.php CHANGED
@@ -25,15 +25,15 @@
25
  */
26
 
27
  class Lengow_Tracker_Block_Adminhtml_System_Config_Check_Point extends Mage_Adminhtml_Block_Template {
28
-
29
  protected $_element;
30
 
31
  protected $_helper;
32
 
33
  public function __construct() {
34
  $this->setTemplate('lengow/check/point.phtml');
35
- $this->_helper = Mage::helper('tracker/check');
36
- parent::_construct();
37
  }
38
 
39
  public function getVersion() {
25
  */
26
 
27
  class Lengow_Tracker_Block_Adminhtml_System_Config_Check_Point extends Mage_Adminhtml_Block_Template {
28
+
29
  protected $_element;
30
 
31
  protected $_helper;
32
 
33
  public function __construct() {
34
  $this->setTemplate('lengow/check/point.phtml');
35
+ $this->_helper = Mage::helper('lentracker/check');
36
+ parent::_construct();
37
  }
38
 
39
  public function getVersion() {
app/code/community/Lengow/Tracker/Block/Tag/Capsule.php CHANGED
@@ -28,10 +28,15 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
28
  static private $_ID_CATEGORY = '';
29
 
30
  public function __construct() {
31
- $this->setData('config_model', Mage::getSingleton('tracker/config'));
32
- $this->setData('capsule_model', Mage::getSingleton('tracker/capsule'));
33
  $this->setData('id_client', $this->getData('config_model')->get('general/login'));
34
- $this->setData('id_group', $this->getData('config_model')->get('general/group'));
 
 
 
 
 
35
  $this->setData('current_view', Mage::app()->getRequest()->getActionName());
36
  }
37
 
@@ -42,7 +47,7 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
42
  $current_module = Mage::app()->getFrontController()->getRequest()->getModuleName();
43
  $current_controller = Mage::app()->getFrontController()->getRequest()->getControllerName();
44
  $current_action = '';
45
-
46
  if(Mage::getBlockSingleton('page/html_header')->getIsHomePage()) {
47
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_HOMEPAGE;
48
  } else if ($current_module == 'catalog') {
@@ -51,9 +56,9 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
51
  else if ($current_controller == 'product')
52
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE;
53
  } else if ($current_module == 'checkout') {
54
-
55
  $current_action = Mage::app()->getRequest()->getActionName();
56
-
57
  if ($current_action == 'success')
58
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE_CONFIRMATION;
59
  else if ($current_controller == 'cart')
@@ -61,7 +66,7 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
61
  else if ($current_controller == 'onepage')
62
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE;
63
  }
64
-
65
  // Order total
66
  if (self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_CART ||
67
  self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_PAYMENT ||
@@ -88,7 +93,7 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
88
  self::$_IDS_PRODUCTS = $this->getData('capsule_model')->getIdsProducts($quote);
89
  } else if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_LIST) {
90
  self::$_IDS_PRODUCTS = $this->_getCurrentProductsIds();
91
- } else if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE) {
92
  self::$_IDS_PRODUCTS = $this->_getCurrentProductId();
93
  } else if (self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_CONFIRMATION) {
94
  // Get last order
@@ -113,7 +118,7 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
113
  self::$_ID_CATEGORY = Mage::registry('current_category')->getName();
114
 
115
  // Use SSL
116
- if (isset($_SERVER['HTTPS']) && $_SERVER['https'] == 'on')
117
  self::$_USE_SSL = true;
118
 
119
  // Assign data
@@ -133,14 +138,14 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
133
  }
134
 
135
  protected function _getCurrentProductId() {
136
- $config = Mage::getModel('tracker/config');
137
  if($product = Mage::registry('product'))
138
  return $product->getData($config->get('tag/identifiant'));
139
  return '';
140
  }
141
 
142
  protected function _getCurrentProductsIds($implode = true) {
143
- $config = Mage::getModel('tracker/config');
144
  $ids = array();
145
  $products = $this->_getProductCollection()->getData();
146
  if($products) {
@@ -199,9 +204,9 @@ class Lengow_Tracker_Block_Tag_Capsule extends Mage_Core_Block_Template {
199
 
200
  protected function _beforeToHtml() {
201
  if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_LIST) {
202
- $config = Mage::getModel('tracker/config');
203
  $_list = $this->getLayout()->getBlock('product_list');
204
- $_products = $_list->getLoadedProductCollection();
205
  if($_products) {
206
  foreach ($_products as $product) {
207
  $ids[] = $product[$config->get('tag/identifiant')];
28
  static private $_ID_CATEGORY = '';
29
 
30
  public function __construct() {
31
+ $this->setData('config_model', Mage::getSingleton('lentracker/config'));
32
+ $this->setData('capsule_model', Mage::getSingleton('lentracker/capsule'));
33
  $this->setData('id_client', $this->getData('config_model')->get('general/login'));
34
+
35
+ // explode group id => force 1 group only
36
+ $id_groups = $this->getData('config_model')->get('general/group');
37
+ $id_groups = explode(',', $id_groups);
38
+ $this->setData('id_group', $id_groups[0]);
39
+
40
  $this->setData('current_view', Mage::app()->getRequest()->getActionName());
41
  }
42
 
47
  $current_module = Mage::app()->getFrontController()->getRequest()->getModuleName();
48
  $current_controller = Mage::app()->getFrontController()->getRequest()->getControllerName();
49
  $current_action = '';
50
+
51
  if(Mage::getBlockSingleton('page/html_header')->getIsHomePage()) {
52
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_HOMEPAGE;
53
  } else if ($current_module == 'catalog') {
56
  else if ($current_controller == 'product')
57
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE;
58
  } else if ($current_module == 'checkout') {
59
+
60
  $current_action = Mage::app()->getRequest()->getActionName();
61
+
62
  if ($current_action == 'success')
63
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE_CONFIRMATION;
64
  else if ($current_controller == 'cart')
66
  else if ($current_controller == 'onepage')
67
  self::$_CURRENT_PAGE_TYPE = self::LENGOW_TRACK_PAGE;
68
  }
69
+
70
  // Order total
71
  if (self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_CART ||
72
  self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_PAYMENT ||
93
  self::$_IDS_PRODUCTS = $this->getData('capsule_model')->getIdsProducts($quote);
94
  } else if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_LIST) {
95
  self::$_IDS_PRODUCTS = $this->_getCurrentProductsIds();
96
+ } else if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE) {
97
  self::$_IDS_PRODUCTS = $this->_getCurrentProductId();
98
  } else if (self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_CONFIRMATION) {
99
  // Get last order
118
  self::$_ID_CATEGORY = Mage::registry('current_category')->getName();
119
 
120
  // Use SSL
121
+ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
122
  self::$_USE_SSL = true;
123
 
124
  // Assign data
138
  }
139
 
140
  protected function _getCurrentProductId() {
141
+ $config = Mage::getModel('lentracker/config');
142
  if($product = Mage::registry('product'))
143
  return $product->getData($config->get('tag/identifiant'));
144
  return '';
145
  }
146
 
147
  protected function _getCurrentProductsIds($implode = true) {
148
+ $config = Mage::getModel('lentracker/config');
149
  $ids = array();
150
  $products = $this->_getProductCollection()->getData();
151
  if($products) {
204
 
205
  protected function _beforeToHtml() {
206
  if(self::$_CURRENT_PAGE_TYPE == self::LENGOW_TRACK_PAGE_LIST) {
207
+ $config = Mage::getModel('lentracker/config');
208
  $_list = $this->getLayout()->getBlock('product_list');
209
+ $_products = $_list->getLoadedProductCollection();
210
  if($_products) {
211
  foreach ($_products as $product) {
212
  $ids[] = $product[$config->get('tag/identifiant')];
app/code/community/Lengow/Tracker/Block/Tag/Simple.php CHANGED
@@ -13,14 +13,14 @@ class Lengow_Tracker_Block_Tag_Simple extends Mage_Core_Block_Template {
13
  protected $_config_model;
14
 
15
  public function __construct() {
16
- $this->_config_model = Mage::getSingleton('tracker/config');
17
  $this->setData('id_client', $this->_config_model->get('general/login'));
18
  $this->setData('id_group', $this->_config_model->get('general/group'));
19
  }
20
 
21
  protected function _prepareLayout() {
22
  parent::_prepareLayout();
23
- $tracker_model = Mage::getSingleton('tracker/tracker');
24
  if(Mage::app()->getRequest()->getActionName() == 'success') {
25
  $order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
26
  $order = Mage::getModel('sales/order')->load($order_id);
13
  protected $_config_model;
14
 
15
  public function __construct() {
16
+ $this->_config_model = Mage::getSingleton('lentracker/config');
17
  $this->setData('id_client', $this->_config_model->get('general/login'));
18
  $this->setData('id_group', $this->_config_model->get('general/group'));
19
  }
20
 
21
  protected function _prepareLayout() {
22
  parent::_prepareLayout();
23
+ $tracker_model = Mage::getSingleton('lentracker/tracker');
24
  if(Mage::app()->getRequest()->getActionName() == 'success') {
25
  $order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
26
  $order = Mage::getModel('sales/order')->load($order_id);
app/code/community/Lengow/Tracker/Block/Tracker.php CHANGED
@@ -11,22 +11,22 @@
11
  class Lengow_Tracker_Block_Tracker extends Mage_Core_Block_Template {
12
 
13
  const URI_TAG_CAPSULE = 'https://tracking.lengow.com/tagcapsule.js';
14
- const BLOCK_SIMPLE = 'tracker/tag_simple';
15
- const BLOCK_CAPSULE = 'tracker/tag_capsule';
16
-
17
  protected $_id_client;
18
  protected $_id_group;
19
  protected $_tag;
20
 
21
  protected function _construct() {
22
- $config_model = Mage::getSingleton('tracker/config');
23
-
24
  $this->_id_client = $config_model->get('general/login');
25
  $this->_id_group = $config_model->get('general/group');
26
  $this->_tag = $config_model->get('tag/type');
27
 
28
  }
29
-
30
  protected function _prepareLayout()
31
  {
32
  parent::_prepareLayout();
@@ -34,10 +34,10 @@ class Lengow_Tracker_Block_Tracker extends Mage_Core_Block_Template {
34
  $this->setChild('tracker', $this->getLayout()->createBlock(self::BLOCK_CAPSULE, 'tag_capsule'));
35
  elseif($this->_tag == 'simpletag')
36
  $this->setChild('tracker', $this->getLayout()->createBlock(self::BLOCK_SIMPLE, 'simple_tag'));
37
-
38
  return $this;
39
  }
40
-
41
  /**
42
  * Prepare and return block's html output
43
  *
@@ -46,10 +46,10 @@ class Lengow_Tracker_Block_Tracker extends Mage_Core_Block_Template {
46
  protected function _toHtml() {
47
  return parent::_toHtml();
48
  }
49
-
50
-
51
-
52
-
53
  /**
54
  * Retrieve Page Type
55
  *
@@ -78,7 +78,7 @@ class Lengow_Tracker_Block_Tracker extends Mage_Core_Block_Template {
78
  }
79
 
80
  /**
81
- * Retrieve if SSL is used for display tag capsule
82
  *
83
  * @return string
84
  */
11
  class Lengow_Tracker_Block_Tracker extends Mage_Core_Block_Template {
12
 
13
  const URI_TAG_CAPSULE = 'https://tracking.lengow.com/tagcapsule.js';
14
+ const BLOCK_SIMPLE = 'lentracker/tag_simple';
15
+ const BLOCK_CAPSULE = 'lentracker/tag_capsule';
16
+
17
  protected $_id_client;
18
  protected $_id_group;
19
  protected $_tag;
20
 
21
  protected function _construct() {
22
+ $config_model = Mage::getSingleton('lentracker/config');
23
+
24
  $this->_id_client = $config_model->get('general/login');
25
  $this->_id_group = $config_model->get('general/group');
26
  $this->_tag = $config_model->get('tag/type');
27
 
28
  }
29
+
30
  protected function _prepareLayout()
31
  {
32
  parent::_prepareLayout();
34
  $this->setChild('tracker', $this->getLayout()->createBlock(self::BLOCK_CAPSULE, 'tag_capsule'));
35
  elseif($this->_tag == 'simpletag')
36
  $this->setChild('tracker', $this->getLayout()->createBlock(self::BLOCK_SIMPLE, 'simple_tag'));
37
+
38
  return $this;
39
  }
40
+
41
  /**
42
  * Prepare and return block's html output
43
  *
46
  protected function _toHtml() {
47
  return parent::_toHtml();
48
  }
49
+
50
+
51
+
52
+
53
  /**
54
  * Retrieve Page Type
55
  *
78
  }
79
 
80
  /**
81
+ * Retrieve if SSL is used for display tag capsule
82
  *
83
  * @return string
84
  */
app/code/community/Lengow/Tracker/Helper/Check.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Lengow
6
  * @package Lengow_Tracker
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
- * @copyright 2014 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Tracker_Helper_Check extends Mage_Core_Helper_Abstract {
@@ -27,7 +27,7 @@ class Lengow_Tracker_Helper_Check extends Mage_Core_Helper_Abstract {
27
  $this->_loadDom();
28
  // Compare version
29
  $object = $this->_dom->xpath('/plugins/plugin[@name=\'' . self::PLUGIN_NAME . '\']');
30
- if(!empty($object))
31
  return $object[0]->version;
32
  else
33
  return 'NULL';
@@ -40,14 +40,14 @@ class Lengow_Tracker_Helper_Check extends Mage_Core_Helper_Abstract {
40
  * @return boolean
41
  */
42
  public static function updatePluginsVersion() {
43
- $mp_update = Mage::getModel('tracker/config')->get('hidden/last_synchro');
44
  if (!$mp_update || !$mp_update == '0000-00-00' ||$mp_update != date('Y-m-d')) {
45
  $sep = DS;
46
  if ($xml = fopen(self::LENGOW_PLUGINS_VERSION, 'r')) {
47
  $handle = fopen(Mage::getModuleDir('etc', 'Lengow_Tracker') . DS . self::URI_TAG_CAPSULE . '', 'w');
48
  stream_copy_to_stream($xml, $handle);
49
  fclose($handle);
50
- Mage::getModel('core/config')->saveConfig('tracker/hidden/last_synchro', date('Y-m-d'));
51
  }
52
  }
53
  }
5
  * @category Lengow
6
  * @package Lengow_Tracker
7
  * @author Ludovic Drin <ludovic@lengow.com>
8
+ * @copyright 2014 Lengow SAS
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class Lengow_Tracker_Helper_Check extends Mage_Core_Helper_Abstract {
27
  $this->_loadDom();
28
  // Compare version
29
  $object = $this->_dom->xpath('/plugins/plugin[@name=\'' . self::PLUGIN_NAME . '\']');
30
+ if(!empty($object))
31
  return $object[0]->version;
32
  else
33
  return 'NULL';
40
  * @return boolean
41
  */
42
  public static function updatePluginsVersion() {
43
+ $mp_update = Mage::getModel('lentracker/config')->get('hidden/last_synchro');
44
  if (!$mp_update || !$mp_update == '0000-00-00' ||$mp_update != date('Y-m-d')) {
45
  $sep = DS;
46
  if ($xml = fopen(self::LENGOW_PLUGINS_VERSION, 'r')) {
47
  $handle = fopen(Mage::getModuleDir('etc', 'Lengow_Tracker') . DS . self::URI_TAG_CAPSULE . '', 'w');
48
  stream_copy_to_stream($xml, $handle);
49
  fclose($handle);
50
+ Mage::getModel('core/config')->saveConfig('lentracker/hidden/last_synchro', date('Y-m-d'));
51
  }
52
  }
53
  }
app/code/community/Lengow/Tracker/Model/Config.php CHANGED
@@ -6,17 +6,36 @@
6
  * @category Lengow
7
  * @package Lengow_Tracker
8
  * @author Romain Le Polh <romain@lengow.com>
9
- * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Tracker_Model_Config extends Varien_Object {
13
 
14
- public function setStore($id_store) {
15
- $this->_id_store = $id_store;
 
 
 
 
 
16
  }
17
 
18
- public function get($key) {
19
- return Mage::getStoreConfig('tracker/' . $key, $this->_id_store);
 
 
 
 
 
 
 
20
  }
21
 
 
 
 
 
 
 
 
22
  }
6
  * @category Lengow
7
  * @package Lengow_Tracker
8
  * @author Romain Le Polh <romain@lengow.com>
9
+ * @copyright 2013 Lengow SAS
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  class Lengow_Tracker_Model_Config extends Varien_Object {
13
 
14
+ protected $store;
15
+
16
+ public function __construct($args = null)
17
+ {
18
+ parent::__construct();
19
+ if (isset($args['store']))
20
+ $this->setStore($args['store']);
21
  }
22
 
23
+ public function setStore($store)
24
+ {
25
+ $this->store = $store;
26
+ return $this;
27
+ }
28
+
29
+ public function getStore()
30
+ {
31
+ return $this->store;
32
  }
33
 
34
+ public function get($key) {
35
+ if (is_null($this->store))
36
+ $id_store = null;
37
+ else
38
+ $id_store = $this->store->getId();
39
+ return Mage::getStoreConfig('lentracker/' . $key, $id_store);
40
+ }
41
  }
app/code/community/Lengow/Tracker/Model/Tracker.php CHANGED
@@ -40,7 +40,7 @@ class Lengow_Tracker_Model_Tracker extends Varien_Object {
40
  * @return string
41
  */
42
  protected function _getIdentifier() {
43
- $config = Mage::getModel('tracker/config');
44
  return $config->get('tag/identifiant');
45
  }
46
 
40
  * @return string
41
  */
42
  protected function _getIdentifier() {
43
+ $config = Mage::getModel('lentracker/config');
44
  return $config->get('tag/identifiant');
45
  }
46
 
app/code/community/Lengow/Tracker/etc/config.xml CHANGED
@@ -2,44 +2,44 @@
2
  <config>
3
  <modules>
4
  <Lengow_Tracker>
5
- <version>2.0.1.5</version>
6
  </Lengow_Tracker>
7
  </modules>
8
  <global>
9
  <models>
10
- <tracker>
11
  <class>Lengow_Tracker_Model</class>
12
- </tracker>
13
  </models>
14
  <blocks>
15
- <tracker>
16
  <class>Lengow_Tracker_Block</class>
17
- </tracker>
18
  </blocks>
19
  <helpers>
20
- <tracker>
21
  <class>Lengow_Tracker_Helper</class>
22
- </tracker>
23
  </helpers>
24
  <resources>
25
- <tracker_setup>
26
  <setup>
27
  <module>Lengow_Tracker</module>
28
  </setup>
29
  <connection>
30
  <use>core_setup</use>
31
  </connection>
32
- </tracker_setup>
33
- <tracker_write>
34
  <connection>
35
  <use>core_write</use>
36
  </connection>
37
- </tracker_write>
38
- <tracker_read>
39
  <connection>
40
  <use>core_read</use>
41
  </connection>
42
- </tracker_read>
43
  </resources>
44
  </global>
45
  <admin>
@@ -47,7 +47,7 @@
47
  <adminhtml>
48
  <args>
49
  <modules>
50
- <tracker before="Mage_Adminhtml">Lengow_Tracker_Adminhtml</tracker>
51
  </modules>
52
  </args>
53
  </adminhtml>
@@ -56,9 +56,9 @@
56
  <frontend>
57
  <layout>
58
  <updates>
59
- <tracker>
60
  <file>lengow.xml</file>
61
- </tracker>
62
  </updates>
63
  </layout>
64
  </frontend>
@@ -87,9 +87,9 @@
87
  <children>
88
  <config>
89
  <children>
90
- <tracker translate="title" module="tracker">
91
  <title>Products</title>
92
- </tracker>
93
  </children>
94
  </config>
95
  </children>
@@ -100,10 +100,10 @@
100
  </acl>
101
  </adminhtml>
102
  <default>
103
- <tracker>
104
  <tag>
105
  <identifiant>sku</identifiant>
106
  </tag>
107
- </tracker>
108
  </default>
109
  </config>
2
  <config>
3
  <modules>
4
  <Lengow_Tracker>
5
+ <version>2.1.0</version>
6
  </Lengow_Tracker>
7
  </modules>
8
  <global>
9
  <models>
10
+ <lentracker>
11
  <class>Lengow_Tracker_Model</class>
12
+ </lentracker>
13
  </models>
14
  <blocks>
15
+ <lentracker>
16
  <class>Lengow_Tracker_Block</class>
17
+ </lentracker>
18
  </blocks>
19
  <helpers>
20
+ <lentracker>
21
  <class>Lengow_Tracker_Helper</class>
22
+ </lentracker>
23
  </helpers>
24
  <resources>
25
+ <lentracker_setup>
26
  <setup>
27
  <module>Lengow_Tracker</module>
28
  </setup>
29
  <connection>
30
  <use>core_setup</use>
31
  </connection>
32
+ </lentracker_setup>
33
+ <lentracker_write>
34
  <connection>
35
  <use>core_write</use>
36
  </connection>
37
+ </lentracker_write>
38
+ <lentracker_read>
39
  <connection>
40
  <use>core_read</use>
41
  </connection>
42
+ </lentracker_read>
43
  </resources>
44
  </global>
45
  <admin>
47
  <adminhtml>
48
  <args>
49
  <modules>
50
+ <lentracker before="Mage_Adminhtml">Lengow_Tracker_Adminhtml</lentracker>
51
  </modules>
52
  </args>
53
  </adminhtml>
56
  <frontend>
57
  <layout>
58
  <updates>
59
+ <lentracker>
60
  <file>lengow.xml</file>
61
+ </lentracker>
62
  </updates>
63
  </layout>
64
  </frontend>
87
  <children>
88
  <config>
89
  <children>
90
+ <lentracker translate="title" module="lentracker">
91
  <title>Products</title>
92
+ </lentracker>
93
  </children>
94
  </config>
95
  </children>
100
  </acl>
101
  </adminhtml>
102
  <default>
103
+ <lentracker>
104
  <tag>
105
  <identifiant>sku</identifiant>
106
  </tag>
107
+ </lentracker>
108
  </default>
109
  </config>
app/code/community/Lengow/Tracker/etc/plugins.xml CHANGED
@@ -5,7 +5,7 @@
5
  <release_date>2014-04-08</release_date>
6
  </plugin>
7
  <plugin name="magento">
8
- <version>2.0.1.3</version>
9
  <release_date>2014-04-25</release_date>
10
  </plugin>
11
  <plugin name="woomcommerce">
5
  <release_date>2014-04-08</release_date>
6
  </plugin>
7
  <plugin name="magento">
8
+ <version>2.0.2</version>
9
  <release_date>2014-04-25</release_date>
10
  </plugin>
11
  <plugin name="woomcommerce">
app/code/community/Lengow/Tracker/etc/system.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
- <lengow translate="label" module="tracker">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
- <tracker translate="label" module="tracker">
11
  <label>Customer Account</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
@@ -26,7 +26,7 @@
26
  <show_in_store>0</show_in_store>
27
  </check>
28
  <general translate="label, comment">
29
- <label>Lengow API and TagCapsule</label>
30
  <show_in_default>1</show_in_default>
31
  <show_in_website>1</show_in_website>
32
  <show_in_store>1</show_in_store>
@@ -39,14 +39,14 @@
39
  <sort_order>3</sort_order>
40
  <show_in_default>1</show_in_default>
41
  <show_in_website>0</show_in_website>
42
- <show_in_store>1</show_in_store>
43
  </login>
44
  <group>
45
  <label>Group ID</label>
46
  <comment>Your Group ID of Lengow</comment>
47
  <frontend_type>text</frontend_type>
48
  <sort_order>5</sort_order>
49
- <show_in_default>1</show_in_default>
50
  <show_in_website>0</show_in_website>
51
  <show_in_store>1</show_in_store>
52
  </group>
@@ -56,14 +56,14 @@
56
  <sort_order>20</sort_order>
57
  <show_in_default>1</show_in_default>
58
  <show_in_website>0</show_in_website>
59
- <show_in_store>1</show_in_store>
60
  </api_key>
61
  </fields>
62
  </general>
63
  <tag translate="label, comment">
64
  <label>TagCapsule</label>
65
  <show_in_default>1</show_in_default>
66
- <show_in_website>1</show_in_website>
67
  <show_in_store>1</show_in_store>
68
  <sort_order>2</sort_order>
69
  <fields>
@@ -73,7 +73,7 @@
73
  <source_model>Lengow_Tracker_Model_System_Config_Source_Tracker</source_model>
74
  <sort_order>3</sort_order>
75
  <show_in_default>1</show_in_default>
76
- <show_in_website>1</show_in_website>
77
  <show_in_store>1</show_in_store>
78
  </type>
79
  <identifiant>
@@ -82,7 +82,7 @@
82
  <source_model>Lengow_Tracker_Model_System_Config_Source_Identifiant</source_model>
83
  <sort_order>3</sort_order>
84
  <show_in_default>1</show_in_default>
85
- <show_in_website>1</show_in_website>
86
  <show_in_store>1</show_in_store>
87
  </identifiant>
88
  </fields>
@@ -105,6 +105,6 @@
105
  </fields>
106
  </hidden>
107
  </groups>
108
- </tracker>
109
  </sections>
110
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
+ <lengow translate="label" module="lentracker">
5
  <label>Lengow</label>
6
  <sort_order>210</sort_order>
7
  </lengow>
8
  </tabs>
9
  <sections>
10
+ <lentracker translate="label" module="lentracker">
11
  <label>Customer Account</label>
12
  <tab>lengow</tab>
13
  <frontend_type>text</frontend_type>
26
  <show_in_store>0</show_in_store>
27
  </check>
28
  <general translate="label, comment">
29
+ <label>Lengow API</label>
30
  <show_in_default>1</show_in_default>
31
  <show_in_website>1</show_in_website>
32
  <show_in_store>1</show_in_store>
39
  <sort_order>3</sort_order>
40
  <show_in_default>1</show_in_default>
41
  <show_in_website>0</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
  </login>
44
  <group>
45
  <label>Group ID</label>
46
  <comment>Your Group ID of Lengow</comment>
47
  <frontend_type>text</frontend_type>
48
  <sort_order>5</sort_order>
49
+ <show_in_default>0</show_in_default>
50
  <show_in_website>0</show_in_website>
51
  <show_in_store>1</show_in_store>
52
  </group>
56
  <sort_order>20</sort_order>
57
  <show_in_default>1</show_in_default>
58
  <show_in_website>0</show_in_website>
59
+ <show_in_store>0</show_in_store>
60
  </api_key>
61
  </fields>
62
  </general>
63
  <tag translate="label, comment">
64
  <label>TagCapsule</label>
65
  <show_in_default>1</show_in_default>
66
+ <show_in_website>0</show_in_website>
67
  <show_in_store>1</show_in_store>
68
  <sort_order>2</sort_order>
69
  <fields>
73
  <source_model>Lengow_Tracker_Model_System_Config_Source_Tracker</source_model>
74
  <sort_order>3</sort_order>
75
  <show_in_default>1</show_in_default>
76
+ <show_in_website>0</show_in_website>
77
  <show_in_store>1</show_in_store>
78
  </type>
79
  <identifiant>
82
  <source_model>Lengow_Tracker_Model_System_Config_Source_Identifiant</source_model>
83
  <sort_order>3</sort_order>
84
  <show_in_default>1</show_in_default>
85
+ <show_in_website>0</show_in_website>
86
  <show_in_store>1</show_in_store>
87
  </identifiant>
88
  </fields>
105
  </fields>
106
  </hidden>
107
  </groups>
108
+ </lentracker>
109
  </sections>
110
  </config>
app/design/adminhtml/default/default/layout/lengow.xml CHANGED
@@ -15,12 +15,12 @@
15
 
16
  <adminhtml_lengow_order_index>
17
  <reference name="content">
18
- <block type="sync/adminhtml_order" name="manageorders.order.grid.container"></block>
19
  </reference>
20
  </adminhtml_lengow_order_index>
21
  <adminhtml_lengow_log_index>
22
  <reference name="content">
23
- <block type="sync/adminhtml_log" name="manageorders.log.grid.container"></block>
24
  </reference>
25
  </adminhtml_lengow_log_index>
26
 
@@ -31,7 +31,7 @@
31
  </action>
32
  </reference>
33
  <reference name="content">
34
- <block type="export/adminhtml_product" name="product.grid" template="lengow/export/product.phtml">
35
  <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
36
  <action method="setUseConfirm">
37
  <params>0</params>
@@ -54,7 +54,7 @@
54
  </action>
55
  </reference>
56
  <reference name="content">
57
- <block type="feed/adminhtml_feed" name="feed.grid" template="lengow/feed/grid.phtml">
58
  <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
59
  <action method="setUseConfirm">
60
  <params>0</params>
@@ -68,9 +68,8 @@
68
  <reference name="sales_order_tabs">
69
  <action method="addTab">
70
  <name>TAB_NAME</name>
71
- <block>sync/adminhtml_order_tab</block>
72
  </action>
73
  </reference>
74
  </adminhtml_sales_order_view>
75
-
76
  </layout>
15
 
16
  <adminhtml_lengow_order_index>
17
  <reference name="content">
18
+ <block type="lensync/adminhtml_order" name="manageorders.order.grid.container"></block>
19
  </reference>
20
  </adminhtml_lengow_order_index>
21
  <adminhtml_lengow_log_index>
22
  <reference name="content">
23
+ <block type="lensync/adminhtml_log" name="manageorders.log.grid.container"></block>
24
  </reference>
25
  </adminhtml_lengow_log_index>
26
 
31
  </action>
32
  </reference>
33
  <reference name="content">
34
+ <block type="lenexport/adminhtml_product" name="product.grid" template="lengow/export/product.phtml">
35
  <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
36
  <action method="setUseConfirm">
37
  <params>0</params>
54
  </action>
55
  </reference>
56
  <reference name="content">
57
+ <block type="lenfeed/adminhtml_feed" name="feed.grid" template="lengow/feed/grid.phtml">
58
  <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
59
  <action method="setUseConfirm">
60
  <params>0</params>
68
  <reference name="sales_order_tabs">
69
  <action method="addTab">
70
  <name>TAB_NAME</name>
71
+ <block>lensync/adminhtml_order_tab</block>
72
  </action>
73
  </reference>
74
  </adminhtml_sales_order_view>
 
75
  </layout>
app/design/adminhtml/default/default/template/lengow/check/point.phtml CHANGED
@@ -7,25 +7,25 @@
7
  <tbody>
8
  <tr id="row_update_module">
9
  <td class="label">
10
- <label for="update_module"><?php echo Mage::helper('tracker')->__('Module\'s version'); ?></label>
11
  </td>
12
  <td class="value">
13
  <?php echo $this->getVersion(); ?>
14
  <?php if($this->isLastVersion()): ?>
15
- <span class="lengow-check lengow-updated"><?php echo Mage::helper('tracker')->__('Your module is already updated'); ?></span>
16
  <?php else: ?>
17
- <span class="lengow-check lengow-must-be-updated"><?php echo Mage::helper('tracker')->__('There is a new version %s of Lengow Module, please update it on your Magento Connect Manager !', $this->getLastVersion()); ?></span>
18
  <?php endif; ?>
19
  </td>
20
  </tr>
21
  <tr id="row_ip_service">
22
  <td class="label">
23
- <label for="ip_service"><?php echo Mage::helper('tracker')->__('IP of your server'); ?></label>
24
  </td>
25
  <td class="value">
26
  <?php echo $this->getRealIP(); ?>
27
  <p class="note">
28
- <?php echo Mage::helper('tracker')->__('Make sure your website IP (%s) address is filled in your Lengow Dashboard.', $this->getRealIP()); ?> <a href="https://solution.lengow.com/api/" target="_blank"><?php echo Mage::helper('tracker')->__('Click here to update it'); ?></a>
29
  </p>
30
  </td>
31
  </tr>
7
  <tbody>
8
  <tr id="row_update_module">
9
  <td class="label">
10
+ <label for="update_module"><?php echo Mage::helper('lentracker')->__('Module\'s version'); ?></label>
11
  </td>
12
  <td class="value">
13
  <?php echo $this->getVersion(); ?>
14
  <?php if($this->isLastVersion()): ?>
15
+ <span class="lengow-check lengow-updated"><?php echo Mage::helper('lentracker')->__('Your module is already updated'); ?></span>
16
  <?php else: ?>
17
+ <span class="lengow-check lengow-must-be-updated"><?php echo Mage::helper('lentracker')->__('There is a new version %s of Lengow Module, please update it on your Magento Connect Manager !', $this->getLastVersion()); ?></span>
18
  <?php endif; ?>
19
  </td>
20
  </tr>
21
  <tr id="row_ip_service">
22
  <td class="label">
23
+ <label for="ip_service"><?php echo Mage::helper('lentracker')->__('IP of your server'); ?></label>
24
  </td>
25
  <td class="value">
26
  <?php echo $this->getRealIP(); ?>
27
  <p class="note">
28
+ <?php echo Mage::helper('lentracker')->__('Make sure your website IP (%s) address is filled in your Lengow Dashboard.', $this->getRealIP()); ?> <a href="https://solution.lengow.com/api/" target="_blank"><?php echo Mage::helper('lentracker')->__('Click here to update it'); ?></a>
29
  </p>
30
  </td>
31
  </tr>
app/design/adminhtml/default/default/template/lengow/dashboard/charts.phtml CHANGED
@@ -60,7 +60,7 @@
60
  </script>
61
  <div style="margin: 20px;">
62
 
63
- <div id="lengow-load"><?php echo Mage::helper('dashboard')->__('Dashboard Lengow'); ?></div>
64
 
65
  <div class="switcher a-right" style="padding:5px 10px;" id="lengow-change-select"></div>
66
 
@@ -72,12 +72,12 @@
72
  <table id="table-feeds">
73
  <thead>
74
  <tr>
75
- <th><span><?php echo Mage::helper('dashboard')->__('ID'); ?></span></th>
76
- <th><span><?php echo Mage::helper('dashboard')->__('Type'); ?></span></th>
77
- <th><span><?php echo Mage::helper('dashboard')->__('Supplier'); ?></span></th>
78
- <th><span><?php echo Mage::helper('dashboard')->__('Name'); ?></span></th>
79
- <th><span><?php echo Mage::helper('dashboard')->__('Products'); ?></span></th>
80
- <th><span><?php echo Mage::helper('dashboard')->__('Enable\'s products'); ?></span></th>
81
  </tr>
82
  </thead>
83
  <tbody></tbody>
60
  </script>
61
  <div style="margin: 20px;">
62
 
63
+ <div id="lengow-load"><?php echo Mage::helper('lendashboard')->__('Dashboard Lengow'); ?></div>
64
 
65
  <div class="switcher a-right" style="padding:5px 10px;" id="lengow-change-select"></div>
66
 
72
  <table id="table-feeds">
73
  <thead>
74
  <tr>
75
+ <th><span><?php echo Mage::helper('lendashboard')->__('ID'); ?></span></th>
76
+ <th><span><?php echo Mage::helper('lendashboard')->__('Type'); ?></span></th>
77
+ <th><span><?php echo Mage::helper('lendashboard')->__('Supplier'); ?></span></th>
78
+ <th><span><?php echo Mage::helper('lendashboard')->__('Name'); ?></span></th>
79
+ <th><span><?php echo Mage::helper('lendashboard')->__('Products'); ?></span></th>
80
+ <th><span><?php echo Mage::helper('lendashboard')->__('Enable\'s products'); ?></span></th>
81
  </tr>
82
  </thead>
83
  <tbody></tbody>
app/design/adminhtml/default/default/template/lengow/export/product.phtml CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
- * @var $this Profileolabs_Lengow_Block_Export_Adminhtml_Product
4
- * @see Profileolabs_Lengow_Block_Export_Adminhtml_Product
5
  */
6
  ?>
7
  <div class="content-header">
8
  <table cellspacing="0">
9
  <tr>
10
- <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('export')->__('Select products to export') ?></h3></td>
11
  <td class="a-right">
12
  <?php echo $this->getButtonsHtml() ?>
13
  </td>
1
  <?php
2
  /**
3
+ * @var $this Lengow_Block_Export_Adminhtml_Product
4
+ * @see Lengow_Block_Export_Adminhtml_Product
5
  */
6
  ?>
7
  <div class="content-header">
8
  <table cellspacing="0">
9
  <tr>
10
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('lenexport')->__('Select products to export') ?></h3></td>
11
  <td class="a-right">
12
  <?php echo $this->getButtonsHtml() ?>
13
  </td>
app/design/adminhtml/default/default/template/lengow/feed/grid.phtml CHANGED
@@ -9,7 +9,7 @@
9
  <tr>
10
  <td style="width:50%;">
11
  <h3 class="icon-head head-products">
12
- <?php echo Mage::helper('feed')->__('Feeds management') ?>
13
  </h3>
14
  </td>
15
  <td class="a-right">
9
  <tr>
10
  <td style="width:50%;">
11
  <h3 class="icon-head head-products">
12
+ <?php echo Mage::helper('lenfeed')->__('Feeds management') ?>
13
  </h3>
14
  </td>
15
  <td class="a-right">
app/design/adminhtml/default/default/template/lengow/sales/order/tab/info.phtml CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
- * @var $this Profileolabs_Lengow_Block_Export_Adminhtml_Product
4
- * @see Profileolabs_Lengow_Block_Export_Adminhtml_Product
5
  */
6
  ?>
7
  <?php
1
  <?php
2
  /**
3
+ * @var $this Lengow_Block_Export_Adminhtml_Product
4
+ * @see Lengow_Block_Export_Adminhtml_Product
5
  */
6
  ?>
7
  <?php
app/design/frontend/base/default/layout/lengow.xml CHANGED
@@ -2,7 +2,7 @@
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="before_body_end">
5
- <block type="tracker/tracker" name="lengow_tracker" template="lengow/tracker/tag.phtml" />
6
  </reference>
7
  </default>
8
 
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="before_body_end">
5
+ <block type="lentracker/tracker" name="lengow_tracker" template="lengow/tracker/tag.phtml" />
6
  </reference>
7
  </default>
8
 
app/design/frontend/base/default/template/lengow/tracker/simpletag.phtml CHANGED
@@ -1,4 +1,4 @@
1
  <!-- Tag_Lengow -->
2
- <img src="https://tracking.lengow.com/lead.php?idClient=<?php echo $this->getData('id_client'); ?>&idGroup=<?php echo $this->getData('id_group'); ?>&price=<?php echo $this->getData('total_paid'); ?>&idCommande=<?php echo $this->getDta('id_order'); ?>&modePaiement=<?php echo $this->getData('mode_paiement'); ?>&listingProduit=<?php echo $this->getData('ids_products'); ?>" alt="" style="width: 1px; height: 1px; border: none;" />
3
  <img src="https://tracking.lengow.com/leadValidation.php?idClient=<?php echo $this->getData('id_client'); ?>&idGroup=<?php echo $this->getData('id_group'); ?>&idCommande=<?php echo $this->getData('id_order'); ?>" alt="" style="width: 1px; height: 1px; border: none;" />
4
  <!-- /Tag_Lengow -->
1
  <!-- Tag_Lengow -->
2
+ <img src="https://tracking.lengow.com/lead.php?idClient=<?php echo $this->getData('id_client'); ?>&idGroup=<?php echo $this->getData('id_group'); ?>&price=<?php echo $this->getData('total_paid'); ?>&idCommande=<?php echo $this->getData('id_order'); ?>&modePaiement=<?php echo $this->getData('mode_paiement'); ?>&listingProduit=<?php echo $this->getData('ids_products'); ?>" alt="" style="width: 1px; height: 1px; border: none;" />
3
  <img src="https://tracking.lengow.com/leadValidation.php?idClient=<?php echo $this->getData('id_client'); ?>&idGroup=<?php echo $this->getData('id_group'); ?>&idCommande=<?php echo $this->getData('id_order'); ?>" alt="" style="width: 1px; height: 1px; border: none;" />
4
  <!-- /Tag_Lengow -->
app/locale/fr_FR/Lengow_Connector.csv CHANGED
@@ -10,8 +10,9 @@
10
  "Level max for category","Niveau maximum de profondeur de catégorie"
11
  "Merge images with parents products if exist","Fusionner les images avec les parents si ils existent"
12
  "Convert data","Convertir les données"
13
- "Replace spcecial chars with html chars","Remplacer les caractères spéciaux par des caractères html"
14
  "Country shipping","Pays de livraison par défaut"
 
15
  "Delay of shipping","Délais de livraison"
16
  "Shipping cost","Frais de la livraison"
17
  "Default shipping cost if matching find","Coût par défaut de la livraison si aucune correspondance n'est trouvée"
@@ -37,7 +38,7 @@
37
  "Only for preproduction's mode : no sync orders with Lengow, import orders every time","Seulement pour un environnement de préproduction : ne synchronise pas les commandes avec Lengow et permet d'importer plusieurs fois une même nouvelle commande"
38
  "Logs","Logs"
39
  "Customer Account","Compte utilisateur"
40
- "Lengow API and TagCapsule","Lengow API et TagCapsule"
41
  "Customer ID","IdClient"
42
  "Your Customer ID of Lengow","Votre ID client Lengow"
43
  "Group ID","IdGroup"
@@ -90,6 +91,9 @@
90
  "Feed ID","ID Flux"
91
  "Feed Name","Nom du flux"
92
  "Current Feed","Flux actuel"
 
 
 
93
  "Export only selected product","Exporter seulement les produits sélectionnés"
94
  "Export product out of stock","Exporter les produits sans stock"
95
  "Product type to export","Type de produit à exporter"
@@ -148,4 +152,21 @@
148
  "Change Lengow's publication","Changer la publication sur Lengow"
149
  "Customer group","Groupe client"
150
  "Use the real date of import's order","Utiliser la date des commandes pour l'import"
151
- "To change the date of import's order with the date of marketplace","Changer la date d'import de la commande avec la date d'achat sur les places de marchés"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  "Level max for category","Niveau maximum de profondeur de catégorie"
11
  "Merge images with parents products if exist","Fusionner les images avec les parents si ils existent"
12
  "Convert data","Convertir les données"
13
+ "Replace special chars with html chars","Remplacer les caractères spéciaux par des caractères html"
14
  "Country shipping","Pays de livraison par défaut"
15
+ "Default country for shipping cost","Pays par défaut pour les frais de livraison"
16
  "Delay of shipping","Délais de livraison"
17
  "Shipping cost","Frais de la livraison"
18
  "Default shipping cost if matching find","Coût par défaut de la livraison si aucune correspondance n'est trouvée"
38
  "Only for preproduction's mode : no sync orders with Lengow, import orders every time","Seulement pour un environnement de préproduction : ne synchronise pas les commandes avec Lengow et permet d'importer plusieurs fois une même nouvelle commande"
39
  "Logs","Logs"
40
  "Customer Account","Compte utilisateur"
41
+ "Lengow API","Lengow API"
42
  "Customer ID","IdClient"
43
  "Your Customer ID of Lengow","Votre ID client Lengow"
44
  "Group ID","IdGroup"
91
  "Feed ID","ID Flux"
92
  "Feed Name","Nom du flux"
93
  "Current Feed","Flux actuel"
94
+ "Enabled store","Boutique activée"
95
+ "Enable store to export","Active la boutique pour l'exportation"
96
+ "Enable store to import","Active la boutique pour l'importation"
97
  "Export only selected product","Exporter seulement les produits sélectionnés"
98
  "Export product out of stock","Exporter les produits sans stock"
99
  "Product type to export","Type de produit à exporter"
152
  "Change Lengow's publication","Changer la publication sur Lengow"
153
  "Customer group","Groupe client"
154
  "Use the real date of import's order","Utiliser la date des commandes pour l'import"
155
+ "Importer les frais de traitement","Permet d'importer les frais de traitement provenant des marketplaces, cela modifiera le total de la commande"
156
+ "Import order in pending payment","Importer les commandes en attente de paiement"
157
+ "Import an order in pendinf payment (like check or money order)","Importer une commande si elle est en attente de paiement (par exemple, une commande payé par chèque ou par virement)"
158
+ "To change the date of import's order with the date of marketplace","Changer la date d'import de la commande avec la date d'achat sur les places de marchés"
159
+ "Split name","Scinder les noms"
160
+ "If one of the name fields is empty, the non-empty field will be split to fill the empty name field","Si le champs des marketplaces nom ou prénom est vide, le module sindéra le champs correctement renseigné en 2"
161
+ "Keep html","Conserver le html"
162
+ "Keep html chars in descrption","Conserver le <html> dans les descriptions"
163
+ "Auto export new product","Exporter les nouveaux produits automatiquement"
164
+ "Auto export a new product on Lengow","Export automatique des nouveaux produits dans Lengow"
165
+ "Choose Store View:","Sélectionner votre vue"
166
+ "Import processing fee from Marketplace","Importer les frais de traitement des markeplaces"
167
+ "Import the processing fee","Importer les frais de traitement"
168
+ "Keep html for the selected fields","Garder l'HTML pour les champs sélectionnés"
169
+ "Choose default shipping","Sélectionner le transporteur par défaut"
170
+ "Default shipping method","La méthode de transport par défaut"
171
+ "Use fake emails","Utilisation de faux emails"
172
+ "Use fake emails for customer creation","Utilisation de faux emails pour la création de client"
media/lengow/import.flag ADDED
File without changes
package.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lengow_Export</name>
4
- <version>2.0.2</version>
5
- <stability>beta</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
@@ -10,10 +10,10 @@
10
  <description>New module of Lengow.&#xD;
11
  Export your catalog, import your orders from all Marketplaces.</description>
12
  <notes>New version of Lengow's Connector</notes>
13
- <authors><author><name>Ludovic</name><user>ludo</user><email>ludovic@lengow.com</email></author><author><name>Romain</name><user>romain</user><email>romain@lengow.com</email></author></authors>
14
- <date>2014-10-01</date>
15
- <time>13:17:54</time>
16
- <contents><target name="magecommunity"><dir name="Lengow"><dir name="Dashboard"><dir name="Block"><dir name="Adminhtml"><dir name="Dashboard"><file name="Charts.php" hash="dae1bbed1ede93b06f62589e93857396"/><file name="Diagrams.php" hash="001995ea1916ca192021ba52c155a466"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7129af0e9ab390e0695f84865a02fdb5"/></dir><dir name="Model"><file name="Config.php" hash="9ac1d092bffd109f02518885f89142c7"/></dir><dir name="etc"><file name="config.xml" hash="be1872bbc46e4827d91b548e26343b5a"/></dir></dir><dir name="Export"><dir name="Block"><dir name="Adminhtml"><dir name="Product"><file name="Grid.php" hash="5ceb46d0b2ba6ab2e64e95eacad57cf4"/></dir><file name="Product.php" hash="b4802cfa8249bfe8c7378d65a5147c1b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="00b4fd0b1eccda884ad12c0d2b61eb7d"/><file name="Security.php" hash="dbf9a95967d3fb6055e50da5dea2b359"/></dir><dir name="Model"><dir name="Catalog"><file name="Product.php" hash="54f3c2eb7c2d7f734ff3830a6fbf4c4a"/></dir><file name="Config.php" hash="99e3221d774542191026baff3776f8b6"/><dir name="Convert"><dir name="Parser"><file name="Product.php" hash="bc664380ca9d37256460613ecdbd8f92"/></dir></dir><dir name="Export"><dir name="Rewrite"><dir name="Catalog"><file name="Config.php" hash="e192cd30c6ed7e4cc370953c3ecd2367"/></dir></dir></dir><dir name="Feed"><file name="Abstract.php" hash="ed13409ab1c507b48b9460c8886bef8d"/><file name="Csv.php" hash="9e53191b25324292f962dec130c0c80a"/><file name="Json.php" hash="4df743bce6647eea36d2677ab7f6a9a8"/><file name="Xml.php" hash="dee5abfe1fa6f066a89a7de9ca3c9f3e"/><file name="Yaml.php" hash="f0c24bd481039c4fc13fa26ef7a4d1b9"/></dir><file name="Generate.php" hash="e8d88c4962f8a913e801040d74829852"/><file name="Observer.php" hash="19847eb801ba2d21d92baaf3474188b7"/><dir name="Shipping"><dir name="Carrier"><file name="Lengow.php" hash="685809c2367ec3509ecbf9f4d07f4661"/></dir></dir><dir name="Source"><file name="Attributes.php" hash="95b485a452aee5b27af0af618211f13c"/><file name="Types.php" hash="6b125e9e5c0dfd5c93cf304441ed47ac"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="111617eb86ef8dd7374efa0d4eabf781"/></dir><dir name="Source"><dir name="Category"><file name="Level.php" hash="b35d3367815682e0ed2827ae8c722e9a"/></dir><file name="Format.php" hash="fd069f484cc3ae0d914fb7a965789d9f"/><file name="Getattributes.php" hash="9ed9accf926ee7ad15a361d45eae5ff6"/><file name="Images.php" hash="e6ec93f301599ea91d69a1f4847e240d"/><file name="Status.php" hash="15db435978f73431541b66db57a91506"/><file name="Types.php" hash="56de65acbb13ee5425b95cc5f9c3f2d2"/></dir></dir></dir><file name=".DS_Store" hash="2e9d9e206608d44ac12e376d529a7440"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="ExportController.php" hash="9d14316a80004e570439c05f5e516368"/></dir></dir><file name="FeedController.php" hash="ddd767d9cf57aa8885ccbec58b59f16d"/></dir><dir name="etc"><file name="config.xml" hash="591d66bc318dcb5a91e98eab94f246b0"/><file name="system.xml" hash="11fa172632e95c372b2de2ffedfba79d"/></dir><file name=".DS_Store" hash="94f3372c1eac7f1e5bacd2a64a662c3a"/></dir><dir name="Feed"><dir name="Block"><dir name="Adminhtml"><dir name="Feed"><file name="Grid.php" hash="6ab140fe779bc7b38c1b004f24ed705c"/><dir name="Renderer"><file name="Migrate.php" hash="e59d5a72241165ec1c8194fc257d6e11"/><file name="Select.php" hash="78808e9061b7a5aa73c2273f18bc0746"/><file name="Url.php" hash="c9060f99ffa7f47140392c4392f793e7"/></dir></dir><file name="Feed.php" hash="96aa5aa6ed7c9e4a708df5b391621421"/></dir></dir><dir name="Helper"><file name="Data.php" hash="23ab67ab3d66ce8c35cfe9c8bff76f76"/></dir><dir name="Model"><file name="Config.php" hash="7487c73a3fe292614c9f4a2b66d8a664"/><file name="Feed.php" hash="2acd56249c12ee3985f699aa65b22295"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="FeedController.php" hash="7a40d4616879c4cb131ca394187113be"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="afbd0d62d8605c3d1228ebe6caada6a0"/><file name="system.xml" hash="22ba605f2529396e4edb41c5ec8e65e6"/></dir></dir><dir name="Sync"><dir name="Block"><dir name="Adminhtml"><file name="Import.php" hash="832bc82dde18ae4bc886933b28f41885"/><dir name="Log"><file name="Grid.php" hash="b699cedfd647ecde78909cc2440b1f03"/></dir><file name="Log.php" hash="c8434ba0a97fb13c25fbfbc4f1841b53"/><dir name="Order"><file name="Grid.php" hash="f5423e0e9f88c29a39e494e8ce72c0e1"/><file name="Tab.php" hash="4c913f7d42506bd3e60e10a5142d9b8a"/></dir><file name="Order.php" hash="2ddb7553c4c67faf0bae5bbbe1be16fe"/></dir><dir name="Payment"><dir name="Info"><file name="Purchaseorder.php" hash="72bbeb480299903b16e505ffdd5d73fe"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="e8846c81d34c1025579151c7372492fb"/><file name="Data.php" hash="05e0c035a6400f6b4b56b33e6bbf424d"/></dir><dir name="Model"><file name="Config.php" hash="f9c20dd17637d203b5de49d6dd6aa3a7"/><dir name="Connector"><file name="Exception.php" hash="de1fa1b69e24fe7b976c03f1ed1ca7f7"/></dir><file name="Connector.php" hash="68eb49a02343c1ef4c2509d3f762fd23"/><dir name="Customer"><file name="Customer.php" hash="6c19bb3c13465edafb961aa57184417e"/></dir><file name="Import.php" hash="85dc8dd337f42f08e8536da73bad21d4"/><file name="Log.php" hash="3dd56825227289f380bf5c0e2f8e848e"/><dir name="Marketplace"><file name="Exception.php" hash="bd7ab8db94e241d022cd6e467e8596ec"/></dir><file name="Marketplace.php" hash="39ff91f3da12da0f7a679ce3b7844a36"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="e3c7a389004afa2a116560e5501cb9fa"/></dir><file name="Log.php" hash="3cc46747828dc075638b115cb8bdbf68"/></dir><file name="Observer.php" hash="35e6671e260525b799c1bb6f39f278aa"/><file name="Order.php" hash="ccf347620fab224efd625284319270a2"/><dir name="Payment"><dir name="Method"><file name="Lengow.php" hash="f49bb516bebb86ceeb822f07c1ca5849"/></dir></dir><dir name="Quote"><file name="Item.php" hash="30f9faf6b299ef64f10785ba16030a17"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Lengow.php" hash="64627df21b7d1d089ce7caa6fb3837a9"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Group.php" hash="640638dcee398949ec4d0c1e2731005d"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="LogController.php" hash="37ced95b8c2bb8ac9d5e865feee8a3d3"/><file name="OrderController.php" hash="ed81163099b035ebbf74e32272c3d75c"/></dir></dir><file name="ApiController.php" hash="ecfc5b4ffc5974bd24907b7b5e719bca"/></dir><dir name="etc"><file name="config.xml" hash="67f88e961c4a3e5348bf30b480f2a96a"/><file name="marketplaces.xml" hash="8da8c63b0a18f3ed6655c1acca23ca20"/><file name="system.xml" hash="a0f410779bc2fccf01ba626ea272a557"/><file name="wsdl.xml" hash="d299fecf68e9f795e26037be4f2115b3"/></dir><dir name="sql"><dir name="lengow_setup"><file name="mysql4-install-2.0.0.0.php" hash="4438ce9c3fa9b2b16162d54e4689e415"/><file name="mysql4-upgrade-2.0.0.0-2.0.0.1.php" hash="8a452156d98da3e2508e7e67fd6b3006"/></dir></dir></dir><dir name="Tracker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Check"><file name="Point.php" hash="b1b7be8e668e789ddfa26a615b4a5040"/></dir><file name="Check.php" hash="bc55760cc20b6ef21bf894f49454ea1e"/></dir></dir></dir><dir name="Tag"><file name="Capsule.php" hash="05369b685fbaa27ad5da96e2b606e4ef"/><file name="Simple.php" hash="14b977c269cdb60a6082e24fef0923dc"/></dir><file name="Tracker.php" hash="b12dc4b32f1de2fb396620f317ce63bb"/></dir><dir name="Helper"><file name="Check.php" hash="8ac8d07d45494fb39bec90ec9f11cdf9"/><file name="Data.php" hash="e526694354fe760f266bf925e5e4ac39"/></dir><dir name="Model"><file name="Capsule.php" hash="55504d0b6398f5a88b5977bf54f5b54b"/><file name="Config.php" hash="d475fd6dd049ed712f69e4a1bfc2036c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Identifiant.php" hash="51943c288cab9456c62a2130405b695b"/><file name="Tracker.php" hash="8fdc4f1d9f02300525aeb295e9cd3dfc"/></dir></dir></dir><file name="Tracker.php" hash="8897c38fe557f52bbaaf8532529f149c"/></dir><dir name="etc"><file name="config.xml" hash="04affc706c0942eec0581b397237733c"/><file name="plugins.xml" hash="d20aa020815fefccac44c1e86b38eb2f"/><file name="system.xml" hash="fa2d44f4591f423264ac792cb50d03f6"/></dir></dir><file name=".DS_Store" hash="9c2c1b22881e97a820d4e7565a869c34"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lengow.xml" hash="5074e8b0efa14c4da96849a31d69b78b"/></dir><dir name="template"><dir name="lengow"><dir name="check"><file name="point.phtml" hash="8e221f846b0731f8e3f1a6229e342166"/></dir><dir name="dashboard"><file name="charts.phtml" hash="e03c9e77fe69066ed335669c38d56266"/></dir><dir name="export"><file name="product.phtml" hash="fcab2dbf0f9ff81992d9b1e75cc1b5c5"/></dir><dir name="feed"><file name="grid.phtml" hash="cb839fc15b928cffaf1aa803a50a370a"/></dir><dir name="sales"><dir name="order"><dir name="tab"><file name="info.phtml" hash="fd76ca51399fd00b52f8430acce8555c"/></dir></dir><dir name="payment"><dir name="info"><file name="purchaseorder.phtml" hash="8e9e7a287ef57fe72023e28747fb0864"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lengow.xml" hash="4d0e2b553b6dc69c10aa7d7e0e78cfb0"/></dir><dir name="template"><dir name="lengow"><dir name="tracker"><file name="simpletag.phtml" hash="1d03ddc50e35828a35bd0cd92306f770"/><file name="tag.phtml" hash="619f7bc6fe20c3dd6c1d82cdf12811b5"/><file name="tagcapsule.phtml" hash="2916e7693ef8ec9fcce5f5a8079d2beb"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Lengow_Connector.csv" hash="fc9d13f3b25c8aaf83b906f6d02dad0c"/></dir></target><target name="mageetc"><dir name="modules"><file name="Lengow_Connector.xml" hash="34b39beecc725740ea1e0bc8d339287a"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="lengow"><dir name="css"><file name="admin.css" hash="aa78dc26e735d8110b88d9974f72a502"/></dir><dir name="js"><file name="charts.min.js" hash="6806368c6a0bf73a5236b452fd5c2332"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="lengow"><dir name="js"><file name="tracker.js" hash="6402a4fbbb81a3b0587ec8c4c375e0a0"/></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lengow_Export</name>
4
+ <version>2.1.0</version>
5
+ <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
10
  <description>New module of Lengow.&#xD;
11
  Export your catalog, import your orders from all Marketplaces.</description>
12
  <notes>New version of Lengow's Connector</notes>
13
+ <authors><author><name>Ludovic</name><user>ludo</user><email>ludovic@lengow.com</email></author><author><name>Romain</name><user>romain</user><email>romain@lengow.com</email></author><author><name>Mathieu</name><user>mathieu</user><email>mathieu.sabourin@lengow.com</email></author><author><name>Benjamin</name><user>benjamin</user><email>benjamin.le-neve@lengow.com</email></author></authors>
14
+ <date>2015-11-24</date>
15
+ <time>09:25:54</time>
16
+ <contents><target name="magecommunity"><dir name="Lengow"><dir name="Dashboard"><dir name="Block"><dir name="Adminhtml"><dir name="Dashboard"><file name="Charts.php" hash="71641cf5b1ccd6267b5566a025dc96a4"/><file name="Diagrams.php" hash="0aeb53d09f0a83d03ce66825283b0046"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7129af0e9ab390e0695f84865a02fdb5"/></dir><dir name="Model"><file name="Config.php" hash="7e0b019175b5ad29f0b70a6e43b5ebce"/></dir><dir name="etc"><file name="config.xml" hash="15a0dde0e691bfb1e32d62ad3ca92cd0"/></dir></dir><dir name="Export"><dir name="Block"><dir name="Adminhtml"><dir name="Product"><file name="Grid.php" hash="9299bea84d78c5c852e0b8f6c05b17b6"/></dir><file name="Product.php" hash="e043c5abef03d0c46ccd51e49c868cf9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3f6f4b46059a479394786987d66eb027"/><file name="Security.php" hash="20cbf93d2c167c320ce8292d9bc186b4"/></dir><dir name="Model"><dir name="Catalog"><file name="Product.php" hash="5cefda415930c953311c8aad2cca5fda"/></dir><file name="Config.php" hash="fba4bed58d9c1a69d247b7cc7c0b6b64"/><dir name="Convert"><dir name="Parser"><file name="Product.php" hash="bc664380ca9d37256460613ecdbd8f92"/></dir></dir><dir name="Export"><dir name="Rewrite"><dir name="Catalog"><file name="Config.php" hash="e192cd30c6ed7e4cc370953c3ecd2367"/></dir></dir></dir><dir name="Feed"><file name="Abstract.php" hash="ed13409ab1c507b48b9460c8886bef8d"/><file name="Csv.php" hash="5958c0bdfc04dd33f59245fded2949d7"/><file name="Json.php" hash="4df743bce6647eea36d2677ab7f6a9a8"/><file name="Xml.php" hash="3202baa8a64b22bd7c39c1022a9b48c8"/><file name="Yaml.php" hash="f0c24bd481039c4fc13fa26ef7a4d1b9"/></dir><file name="Generate.php" hash="c9e3836400937b94cd51a8087e5e75b8"/><file name="Observer.php" hash="dcfeae8ac1130cd4f8e952b3d75d59b4"/><dir name="Shipping"><dir name="Carrier"><file name="Lengow.php" hash="685809c2367ec3509ecbf9f4d07f4661"/></dir></dir><dir name="Source"><file name="Attributes.php" hash="f8cae8fe1a7a15c7b4cd76503bffd053"/><file name="Types.php" hash="513868577816d51f6cc61e75ba43a938"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="140ba6e9cce1204fe0e0c50cf81762ec"/></dir><dir name="Source"><dir name="Category"><file name="Level.php" hash="a1875080def0c89a2bb4b4088f57eac8"/></dir><file name="Format.php" hash="fd069f484cc3ae0d914fb7a965789d9f"/><file name="Getattributes.php" hash="d42c66b3f0ed0c21d5e824400c0b1dc5"/><file name="Images.php" hash="e6ec93f301599ea91d69a1f4847e240d"/><file name="Status.php" hash="449b2bf3c121c3a07aab6072aa629a90"/><file name="Types.php" hash="cab52d0a7e34ff4629ad17d0a2c96362"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="ExportController.php" hash="1ee080105825d45ce474065e57a4e89e"/></dir></dir><file name="FeedController.php" hash="4ac4e3fa4f69099c89d951411bc51838"/></dir><dir name="etc"><file name="config.xml" hash="aa2d5443ed2061f9d053f38cfc3f0f63"/><file name="system.xml" hash="04d019632939dc948d3b1acd0c9bb32b"/></dir></dir><dir name="Feed"><dir name="Block"><dir name="Adminhtml"><dir name="Feed"><file name="Grid.php" hash="74fcb8c472666b89d9ba550357102c38"/><dir name="Renderer"><file name="Migrate.php" hash="a6a1fd08b4269b052d8c9ed447589ae3"/><file name="Select.php" hash="78808e9061b7a5aa73c2273f18bc0746"/><file name="Url.php" hash="2a3c4fa22460806dda478a088a17ced7"/></dir></dir><file name="Feed.php" hash="30e2d20268eb24bbcc9554ba97e5149e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="799d69122855da8c287b86e663f3562d"/></dir><dir name="Model"><file name="Config.php" hash="7487c73a3fe292614c9f4a2b66d8a664"/><file name="Feed.php" hash="9e7096ba72dcb071662842c681e50928"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="FeedController.php" hash="964721ca7619b7c1f16b66d13fed2a54"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="b854253f0a8e41e5df2cc6de4b40892d"/><file name="system.xml" hash="81e6692a37fead4aaa02a4e255ce8464"/></dir></dir><dir name="Sync"><dir name="Block"><dir name="Adminhtml"><file name="Import.php" hash="832bc82dde18ae4bc886933b28f41885"/><dir name="Log"><file name="Grid.php" hash="31416dda25b833416ef9dad2143b2d9f"/></dir><file name="Log.php" hash="e4032e885dbbdd0c3f4112efbc8ef5a2"/><dir name="Order"><file name="Grid.php" hash="313ea7fde1df56b36159e5d37a757ac9"/><file name="Tab.php" hash="405c887f100b259ba9750088b1c17b44"/></dir><file name="Order.php" hash="c5cecae61feb8dacd348124ba3a2ffef"/></dir><dir name="Payment"><dir name="Info"><file name="Purchaseorder.php" hash="ccf3a1c41c21d1ffd315819be1808fec"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="e8846c81d34c1025579151c7372492fb"/><file name="Data.php" hash="d66a6bf80a4d4cb86aa793ad10e4aef3"/></dir><dir name="Model"><file name="Config.php" hash="938e26ef034db15e8a3d977b1a665e25"/><dir name="Connector"><file name="Exception.php" hash="de1fa1b69e24fe7b976c03f1ed1ca7f7"/></dir><file name="Connector.php" hash="544000640f47a5e12482138b1d920ce8"/><dir name="Customer"><file name="Customer.php" hash="2cb9388279a880b8bd602f4b026c9162"/></dir><file name="File.php" hash="d5c9e6af9ca7c7c6013430327b2019df"/><file name="Import.php" hash="8b146e5409105164505b0cc0e316bb2b"/><file name="Log.php" hash="29e1e489b6d125fe64d91693f987a502"/><dir name="Marketplace"><file name="Exception.php" hash="bd7ab8db94e241d022cd6e467e8596ec"/></dir><file name="Marketplace.php" hash="19c8254e80a459b7304a75dc84afd280"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="22e087b5cfee173440877dd0714fee55"/></dir><file name="Log.php" hash="ab90ef25ea4f6369f713325b6ba247e5"/></dir><file name="Observer.php" hash="32e0c71fa9b39308983efdee11eb8ac2"/><file name="Order.php" hash="fd722ee55aa18db7f0d84cd80f00547e"/><dir name="Payment"><dir name="Method"><file name="Lengow.php" hash="34c96c7a150ee18598301f57dbc707bc"/></dir></dir><dir name="Quote"><file name="Exception.php" hash="7002f0d752509f576352e7bbd78b590c"/><file name="Item.php" hash="30f9faf6b299ef64f10785ba16030a17"/></dir><file name="Quote.php" hash="725f739d4664e5bc5da424aa1f6b3df1"/><dir name="Shipping"><dir name="Carrier"><file name="Lengow.php" hash="8340d3cef16fc86306d626a71d2e9ebc"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Group.php" hash="640638dcee398949ec4d0c1e2731005d"/></dir><dir name="Shipping"><file name="Carrier.php" hash="f83fd1e7fb5c2bd50d2ba983e24b6240"/><file name="Method.php" hash="8df07e95712559dad4b37bde3acf9f77"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Lengow"><file name="LogController.php" hash="118fa3fdb4aa3fdd70a7bfb06c7174a2"/><file name="OrderController.php" hash="15406d8c409f6529922b6aa3d8e6f99f"/></dir></dir><file name="ApiController.php" hash="3d62e46fd860b326f288c5869fbe3389"/></dir><dir name="etc"><file name="config.xml" hash="23dae84449429adad6ba2a92ec627c96"/><file name="marketplaces.xml" hash="4645614d6219fe852cd370c4ce52743a"/><file name="system.xml" hash="0366aaf26d72400188bffbc11f85524c"/><file name="wsdl.xml" hash="d299fecf68e9f795e26037be4f2115b3"/></dir><dir name="sql"><dir name="lengow_setup"><file name="mysql4-install-2.0.0.0.php" hash="6856dcca18117fb112e6523139fb47c5"/><file name="mysql4-upgrade-2.0.0.0-2.0.0.1.php" hash="92edfe3518259e1a11213cc80ccaeb34"/><file name="mysql4-upgrade-2.0.2-2.1.0.php" hash="187da13f6ae76378f1118bbf5acaf683"/></dir></dir></dir><dir name="Tracker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Check"><file name="Point.php" hash="de29cb19427434c1713d2dae9c97900a"/></dir><file name="Check.php" hash="877fd7a030feff2ad8bc561a3785be5b"/></dir></dir></dir><dir name="Tag"><file name="Capsule.php" hash="d2ed189be29fd76f6ceb0b8d68f21efe"/><file name="Simple.php" hash="ff8fe8fa9767b75de69f5f8e2dfa6ba1"/></dir><file name="Tracker.php" hash="3bdb94f577a831310f8f12f854739906"/></dir><dir name="Helper"><file name="Check.php" hash="508cf7578343c0807e1f010f7fd52dec"/><file name="Data.php" hash="e526694354fe760f266bf925e5e4ac39"/></dir><dir name="Model"><file name="Capsule.php" hash="55504d0b6398f5a88b5977bf54f5b54b"/><file name="Config.php" hash="7848ae5ddc1f2617effa39e27b3e838e"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Identifiant.php" hash="51943c288cab9456c62a2130405b695b"/><file name="Tracker.php" hash="8fdc4f1d9f02300525aeb295e9cd3dfc"/></dir></dir></dir><file name="Tracker.php" hash="4c740aa3a311a93b8143a69fd1ea3221"/></dir><dir name="etc"><file name="config.xml" hash="5cd30ce68d418e921b7005f1b9afc579"/><file name="plugins.xml" hash="e35408d7ea61c7ccc669cfb5b7bb8567"/><file name="system.xml" hash="e80c43066774e6fdf6e164bf06bf38ee"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lengow.xml" hash="6c61c98c9a6e2f32fa6b8f9d2eef09d4"/></dir><dir name="template"><dir name="lengow"><dir name="check"><file name="point.phtml" hash="9791a2a673d45bb6db850ec802c63a71"/></dir><dir name="dashboard"><file name="charts.phtml" hash="51964c7bcace68d8f4ef23e314f07a8c"/></dir><dir name="export"><file name="product.phtml" hash="8c0c893621573c316bb7da14a3533224"/></dir><dir name="feed"><file name="grid.phtml" hash="b34e7f8ce18ce9605e88a5bc8b806442"/></dir><dir name="sales"><dir name="order"><dir name="tab"><file name="info.phtml" hash="fcaa52401ea83b17e52d0db2f8367b93"/></dir></dir><dir name="payment"><dir name="info"><file name="purchaseorder.phtml" hash="8e9e7a287ef57fe72023e28747fb0864"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lengow.xml" hash="0e6a4eb11f6433d54474bfed8061d560"/></dir><dir name="template"><dir name="lengow"><dir name="tracker"><file name="simpletag.phtml" hash="3b73552b323d00bd053e1086e6f5ff45"/><file name="tag.phtml" hash="619f7bc6fe20c3dd6c1d82cdf12811b5"/><file name="tagcapsule.phtml" hash="2916e7693ef8ec9fcce5f5a8079d2beb"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Lengow_Connector.csv" hash="45a903abe80cd29994ec113b49e07199"/></dir></target><target name="mageetc"><dir name="modules"><file name="Lengow_Connector.xml" hash="34b39beecc725740ea1e0bc8d339287a"/></dir></target><target name="magemedia"><dir name="lengow"><file name="import.flag" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="lengow"><dir name="css"><file name="admin.css" hash="aa78dc26e735d8110b88d9974f72a502"/></dir><dir name="js"><file name="charts.min.js" hash="6806368c6a0bf73a5236b452fd5c2332"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="lengow"><dir name="js"><file name="tracker.js" hash="6402a4fbbb81a3b0587ec8c4c375e0a0"/></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>