Channelpilotsolutions_Channelpilot - Version 2.2.6

Version Notes

- general bugfixes
- added index for product feed export

Download this release

Release Info

Developer Magento Core Team
Extension Channelpilotsolutions_Channelpilot
Version 2.2.6
Comparing to
See all releases


Code changes from version 2.2.5 to 2.2.6

Files changed (41) hide show
  1. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport.php +43 -0
  2. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/Grid.php +87 -0
  3. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/View.php +53 -0
  4. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/View/Form.php +61 -0
  5. app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php +15 -4
  6. app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php +759 -0
  7. app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php +8 -2
  8. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPAbstractHandler.php +33 -30
  9. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php +4 -5
  10. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php +104 -25
  11. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php +48 -593
  12. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php +89 -48
  13. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPOrderHandler.php +152 -35
  14. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php +1 -1
  15. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php +0 -1
  16. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php +4 -4
  17. app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php +1 -1
  18. app/code/community/Channelpilotsolutions/Channelpilot/Model/Abstract.php +4 -4
  19. app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Exportmethod.php +34 -0
  20. app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Producturlgeneration.php +40 -0
  21. app/code/community/Channelpilotsolutions/Channelpilot/Model/Carrier/Cpshipping.php +2 -2
  22. app/code/community/Channelpilotsolutions/Channelpilot/Model/Feedexport/Indexer.php +150 -0
  23. app/code/community/Channelpilotsolutions/Channelpilot/Model/Observer.php +99 -0
  24. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Feedexport/Indexer.php +213 -0
  25. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Feedexport/Indexer/Collection.php +32 -0
  26. app/code/community/Channelpilotsolutions/Channelpilot/controllers/Adminhtml/Channelpilot/FeedexportController.php +55 -0
  27. app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml +24 -1
  28. app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml +43 -8
  29. app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml +34 -6
  30. app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.1.0-2.1.6.php +51 -0
  31. app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.2.5-2.2.6.php +37 -27
  32. app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv +27 -1
  33. app/locale/de_CH/Channelpilotsolutions_Channelpilot.csv +27 -1
  34. app/locale/de_DE/Channelpilotsolutions_Channelpilot.csv +27 -1
  35. app/locale/en_AU/Channelpilotsolutions_Channelpilot.csv +27 -1
  36. app/locale/en_CA/Channelpilotsolutions_Channelpilot.csv +27 -1
  37. app/locale/en_GB/Channelpilotsolutions_Channelpilot.csv +27 -1
  38. app/locale/en_IE/Channelpilotsolutions_Channelpilot.csv +27 -1
  39. app/locale/en_NZ/Channelpilotsolutions_Channelpilot.csv +27 -1
  40. app/locale/en_US/Channelpilotsolutions_Channelpilot.csv +27 -1
  41. package.xml +5 -6
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Feedexport extends Mage_Adminhtml_Block_Widget_Grid_Container
24
+ {
25
+ public function __construct()
26
+ {
27
+ $this->_blockGroup = 'channelpilot_core';
28
+ $this->_controller = 'adminhtml_feedexport';
29
+ $this->_headerText = Mage::helper('channelpilot')->__('CP Channelpilot Product Feed Export');
30
+
31
+ parent::__construct();
32
+ $this->_removeButton('add');
33
+
34
+ $helper = Mage::helper('channelpilot');
35
+ $this->_addButton('truncate_index_table', array(
36
+ 'label' => $helper->__('CP Truncate Index Table'),
37
+ 'onclick' => "
38
+ if(confirm('{$helper->__('CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?')}')) setLocation('{$this->getUrl('*/*/truncate')}')
39
+ ",
40
+ 'class' => 'delete'
41
+ ));
42
+ }
43
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/Grid.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Feedexport_Grid extends Mage_Adminhtml_Block_Widget_Grid
24
+ {
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+ $this->setId('channelpilot_feed_export');
29
+ $this->setDefaultDir('product_id');
30
+ $this->setDefaultDir('ASC');
31
+ $this->setSaveParametersInSession(true);
32
+ $this->setUseAjax(false);
33
+ }
34
+
35
+ protected function _prepareCollection()
36
+ {
37
+ /** @var $storeSwitcherBlock Mage_Adminhtml_Block_Store_Switcher */
38
+ $storeSwitcherBlock = $this->getLayout()->getBlock('store_switcher');
39
+ $storeId = $storeSwitcherBlock->getStoreId();
40
+ $collection = Mage::getModel('channelpilot/feedexport_indexer')->getCollection()
41
+ ->addFieldToFilter('store_id', array('eq' => $storeId));
42
+
43
+ $this->setCollection($collection);
44
+ parent::_prepareCollection();
45
+
46
+ return $this;
47
+ }
48
+
49
+ protected function _prepareColumns()
50
+ {
51
+ $helper = Mage::helper('channelpilot');
52
+
53
+ $this->addColumn('product_id', array(
54
+ 'header' => $helper->__('CP Product ID'),
55
+ 'index' => 'product_id',
56
+ 'type' => 'text',
57
+ ));
58
+
59
+ $this->addColumn('sku', array(
60
+ 'header' => $helper->__('CP Product SKU'),
61
+ 'index' => 'sku',
62
+ 'type' => 'text',
63
+ ));
64
+
65
+ $this->addColumn('created_at', array(
66
+ 'header' => $helper->__('CP Created At'),
67
+ 'index' => 'created_at',
68
+ 'type' => 'datetime',
69
+ 'filter' => false,
70
+ ));
71
+
72
+ return parent::_prepareColumns();
73
+ }
74
+
75
+ public function getGridUrl()
76
+ {
77
+ return $this->getUrl('*/*/', array('_current' => true));
78
+ }
79
+
80
+ public function getRowUrl($row)
81
+ {
82
+ return $this->getUrl('*/*/view', array(
83
+ 'store'=>$this->getRequest()->getParam('store'),
84
+ 'product_id'=>$row->getProductId())
85
+ );
86
+ }
87
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/View.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Feedexport_View extends Mage_Adminhtml_Block_Widget_Form_Container
24
+ {
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+
29
+ $this->_objectId = 'product_id';
30
+ $this->_blockGroup = 'channelpilot_core';
31
+ $this->_controller = 'adminhtml_feedexport';
32
+ $this->_mode = 'view';
33
+
34
+ $this->_removeButton('save');
35
+ $this->_removeButton('delete');
36
+ $this->_removeButton('reset');
37
+ }
38
+
39
+ public function getHeaderText()
40
+ {
41
+ $productId = $this->getRequest()->getParam('product_id');
42
+ $storeId = $this->getRequest()->getParam('store', 1);
43
+ $data = Mage::getResourceModel('channelpilot/feedexport_indexer')->getDataForProductIdAndStoreId($productId, $storeId);
44
+ Mage::register('cp_product_feed_data', $data);
45
+ return Mage::helper('channelpilot')->__('CP Showing feed export data for product %s and store %s - Created at: %s', $productId, $storeId, $data['created_at']);
46
+ }
47
+
48
+ public function getBackUrl()
49
+ {
50
+ $storeId = $this->getRequest()->getParam('store');
51
+ return $this->getUrl('*/*/', array('store' => $storeId));
52
+ }
53
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Feedexport/View/Form.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Feedexport_View_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ protected function _prepareForm()
26
+ {
27
+ $form = new Varien_Data_Form(array(
28
+ 'id' => 'view_form',
29
+ 'action' => '',
30
+ 'method' => 'post',
31
+ ));
32
+ $form->setUseContainer(true);
33
+ $this->setForm($form);
34
+
35
+ $data = Mage::registry('cp_product_feed_data');
36
+
37
+ if(is_array($data) && isset($data['product_data'])) {
38
+ $productData = $data['product_data'];
39
+
40
+ $fieldset = $form->addFieldset('view_product_data', array(
41
+ ));
42
+
43
+ $xml = simplexml_load_string($productData);
44
+ $children = $xml->children();
45
+ $data = array();
46
+ foreach($children as $key => $value) {
47
+ $data[$key] = $value;
48
+ $fieldType = (strlen($value) > 50) ? 'textarea' : 'text';
49
+ $fieldset->addField($key, $fieldType, array(
50
+ 'label' => $key,
51
+ 'name' => $key,
52
+ 'disabled' => true,
53
+ ));
54
+ }
55
+
56
+ $form->setValues($data);
57
+ }
58
+
59
+ return parent::_prepareForm();
60
+ }
61
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php CHANGED
@@ -182,7 +182,7 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
182
  exit();
183
  }
184
 
185
- private function checkSignature() {
186
  $php = Mage::app()->getRequest()->getParam('php', false);
187
  $shop = Mage::app()->getRequest()->getParam('shop', false);
188
  $plugin = Mage::app()->getRequest()->getParam('plugin', false);
@@ -196,7 +196,7 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
196
  }
197
  }
198
 
199
- private function checkActivation($configs, $function) {
200
  foreach ($configs as $config) {
201
  if ($config === true) {
202
  return true;
@@ -205,12 +205,23 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
205
  CPErrorHandler::handle(CPErrors::RESULT_API_DEACTIVATED, "'$function' not activated", "'$function' not activated");
206
  }
207
 
208
- private function checkIp() {
209
  if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
210
- return Mage::getModel('channelpilot/registration')->isIpAuthorized($_SERVER['REMOTE_ADDR']);
211
  }
212
  return true;
213
  }
 
 
 
 
 
 
 
 
 
 
 
214
  }
215
 
216
  ?>
182
  exit();
183
  }
184
 
185
+ protected function checkSignature() {
186
  $php = Mage::app()->getRequest()->getParam('php', false);
187
  $shop = Mage::app()->getRequest()->getParam('shop', false);
188
  $plugin = Mage::app()->getRequest()->getParam('plugin', false);
196
  }
197
  }
198
 
199
+ protected function checkActivation($configs, $function) {
200
  foreach ($configs as $config) {
201
  if ($config === true) {
202
  return true;
205
  CPErrorHandler::handle(CPErrors::RESULT_API_DEACTIVATED, "'$function' not activated", "'$function' not activated");
206
  }
207
 
208
+ protected function checkIp() {
209
  if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
210
+ return Mage::getModel('channelpilot/registration')->isIpAuthorized(Mage::app()->getRequest()->getClientIp());
211
  }
212
  return true;
213
  }
214
+
215
+ public function getAllStoreIds() {
216
+ $storeIds = array();
217
+
218
+ /** @var $website Mage_Core_Model_Website */
219
+ foreach(Mage::app()->getWebsites() as $website) {
220
+ $storeIds = array_merge($storeIds, $website->getStoreIds());
221
+ }
222
+
223
+ return $storeIds;
224
+ }
225
  }
226
 
227
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php ADDED
@@ -0,0 +1,759 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Helper_Export extends Mage_Core_Helper_Abstract
24
+ {
25
+ const MAX_ATTRIBUTE_COUNT_FOR_LIVE_EXPORT = 40;
26
+
27
+ protected $_storeId;
28
+ protected $_siteId;
29
+ protected $_customerGroupId;
30
+ protected $_mediaUrl;
31
+ protected $_webUrl;
32
+ protected $_allCat;
33
+ protected $_limit;
34
+ protected $_last;
35
+ protected $_blankProduct;
36
+ protected $_configurableAttributes = array();
37
+ protected $_imageBaseUrl;
38
+ protected $_maxAdditionalImages;
39
+ protected $_exportFields;
40
+ protected $_currencyChange;
41
+ protected $_replaceFields;
42
+ protected $_parents;
43
+ protected $_backendModel;
44
+ protected $_chunkSize;
45
+ protected $_stockId;
46
+ /** @var $_eavEntity Mage_Eav_Model_Entity_Abstract */
47
+ protected $_eavEntity;
48
+
49
+ public function __construct() {
50
+ $this->_init();
51
+ }
52
+
53
+ /**
54
+ * Check if another currency (other than the base currency) should be used. Displays an error if the
55
+ * given currency could not be found.
56
+ */
57
+ protected function _initCurrencyChange() {
58
+ $this->_currencyChange = null;
59
+ $currencyCode = Mage::app()->getRequest()->getParam('currency', false);
60
+ if ($currencyCode && $currencyCode != '') {
61
+ $result = Mage::getModel('directory/currency')->getCurrencyRates(Mage::app()->getBaseCurrencyCode(), $currencyCode);
62
+ if(count($result) === 0){
63
+ $xml = new SimpleXMLElement('<root></root>');
64
+ $xml->addChild('error', 'wrong currency');
65
+ header('Content-Type: text/xml; charset=utf-8');
66
+ echo $xml->asXML();
67
+ exit();
68
+ }
69
+ $this->_currencyChange = $result[$currencyCode];
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Get PHP's memory limit in bytes.
75
+ * @return int|string
76
+ */
77
+ protected function getPhpMemoryLimitInBytes ()
78
+ {
79
+ $limit = ini_get('memory_limit');
80
+ switch (substr ($limit, -1))
81
+ {
82
+ case 'M': case 'm': return (int)$limit * 1048576; // 1024 * 1024
83
+ case 'K': case 'k': return (int)$limit * 1024;
84
+ case 'G': case 'g': return (int)$limit * 1073741824; // 1024 * 1024 * 1024
85
+ default: return $limit;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Initialize the export.
91
+ *
92
+ * @param int $storeId
93
+ */
94
+ protected function _init() {
95
+ // Initialize the admin application
96
+ Mage::app('admin');
97
+
98
+ $this->_blankProduct = array();
99
+ $this->_blankProduct['entity_id'] = '';
100
+ $this->_blankProduct['sku'] = '';
101
+ $this->_blankProduct['parent_id'] = '';
102
+ $this->_blankProduct['variationTheme'] = '';
103
+ $this->_blankProduct['name'] = '';
104
+ $this->_blankProduct['description'] = '';
105
+ $this->_blankProduct['price'] = '';
106
+ $this->_blankProduct['categories'] = '';
107
+ $this->_blankProduct['manufacturer'] = '';
108
+ $this->_blankProduct['manufacturer_name'] = '';
109
+ $this->_blankProduct['cp_product_url'] = '';
110
+ $this->_blankProduct['cp_image_url'] = '';
111
+ $this->_blankProduct['color'] = '';
112
+ $this->_blankProduct['weight'] = '';
113
+ for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
114
+ $this->_blankProduct['cp_additional_image_'.$i] = '';
115
+ }
116
+
117
+ $specialExportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
118
+ if(!empty($specialExportFields)) {
119
+ foreach($specialExportFields as $field) {
120
+ if (!empty($field['name'])) {
121
+ $this->_blankProduct[preg_replace('/\W/', '', $field['name'])] = $field['value'];
122
+ }
123
+ }
124
+ }
125
+
126
+ $this->_customerGroupId = Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
127
+
128
+ $this->_buildCategoryTree();
129
+ $this->_initCurrencyChange();
130
+ $this->_initConfigurableAttributes();
131
+
132
+ /** @var $mediaConfig Mage_Catalog_Model_Product_Media_Config */
133
+ $mediaConfig = Mage::getSingleton('catalog/product_media_config');
134
+ $this->_imageBaseUrl = $mediaConfig->getBaseMediaUrl();
135
+
136
+ $this->_maxAdditionalImages = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber');
137
+ $this->_exportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
138
+ $this->_replaceFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
139
+
140
+ $this->_initChunkSize();
141
+
142
+ $this->_parents = array();
143
+ }
144
+
145
+ /**
146
+ * Initialize the chunk size for the collection based on PHP's memory limit.
147
+ */
148
+ protected function _initChunkSize() {
149
+ $memoryLimit = $this->getPhpMemoryLimitInBytes();
150
+
151
+ switch($memoryLimit) {
152
+ case $memoryLimit <= 33554432: // 32M
153
+ $this->_chunkSize = 10;
154
+ break;
155
+ case $memoryLimit <= 67108864: // 64M
156
+ $this->_chunkSize = 25;
157
+ break;
158
+ case $memoryLimit <= 134217728: // 128M
159
+ $this->_chunkSize = 50;
160
+ break;
161
+ case $memoryLimit <= 268435456: // 256M
162
+ $this->_chunkSize = 75;
163
+ break;
164
+ default:
165
+ $this->_chunkSize = 100;
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Build the category tree.
171
+ */
172
+ protected function _buildCategoryTree() {
173
+ $this->_allCat = array();
174
+
175
+ $categoryCollection = Mage::getModel('catalog/category')->getCollection()
176
+ ->addAttributeToSelect('name')
177
+ ->addAttributeToSort('path');
178
+
179
+ foreach($categoryCollection as $category) {
180
+ $path = $this->_getCategory($category->getPath());
181
+ if($path !== 0) {
182
+ $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $path . '>' . $category->getName());
183
+ } else {
184
+ $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $category->getName());
185
+ }
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Get the category id from a path.
191
+ * @param $key
192
+ * @return int | string
193
+ */
194
+ protected function _getCategory($key) {
195
+ $return = 0;
196
+ if (strpos($key, '/') != false) {
197
+ $tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
198
+ if (isset($this->_allCat[$tmpKey])) {
199
+ $return = $this->_allCat[$tmpKey];
200
+ } else {
201
+ $return = $this->_getCategory($tmpKey);
202
+ }
203
+ }
204
+ return $return;
205
+ }
206
+
207
+ /**
208
+ * Initialize the configurableAttributes array.
209
+ * Array(
210
+ * [PRODUCT_ID] => ARRAY(
211
+ * [ATTRIBUTE_CODE] => [FRONTEND_LABEL]
212
+ * )
213
+ * )
214
+ */
215
+ protected function _initConfigurableAttributes() {
216
+ $this->_configurableAttributes = array();
217
+
218
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
219
+
220
+ $select = $connection->select()
221
+ ->from(array('super_attribute' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')), array('attribute_id', 'product_id'))
222
+ ->join(array('attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
223
+ 'attribute.attribute_id = super_attribute.attribute_id',
224
+ array('attribute_code', 'frontend_label')
225
+ );
226
+
227
+ $result = $connection->fetchAll($select);
228
+
229
+ foreach($result as $attribute) {
230
+ if(!isset($this->_configurableAttributes[$attribute['product_id']])) {
231
+ $this->_configurableAttributes[$attribute['product_id']] = array();
232
+ }
233
+ $this->_configurableAttributes[$attribute['product_id']][$attribute['attribute_code']] = $attribute['frontend_label'];
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Get an array of attribute codes for all configurable attributes of a product ID.
239
+ *
240
+ * @param int $productId
241
+ * @return array
242
+ */
243
+ protected function _getConfigurableAttributes($productId) {
244
+ $attributeOptions = array();
245
+ if(isset($this->_configurableAttributes[$productId])) {
246
+ foreach($this->_configurableAttributes[$productId] as $attributeCode => $label) {
247
+ $attributeOptions[] = $label;
248
+ }
249
+ }
250
+ return $attributeOptions;
251
+ }
252
+
253
+ /**
254
+ * Get all attributes that need to be selected from the database.
255
+ * @param $attributes array
256
+ * @return array
257
+ */
258
+ protected function _getAttributesForSelect($attributes) {
259
+ $attributesToSelect = array(
260
+ 'entity_id',
261
+ 'sku',
262
+ 'name',
263
+ 'description',
264
+ 'price',
265
+ 'manufacturer',
266
+ 'color',
267
+ 'weight',
268
+ 'media_gallery',
269
+ 'url_key',
270
+ 'url_path',
271
+ 'image',
272
+ 'type_id'
273
+ );
274
+
275
+ $attributeCodes = array();
276
+
277
+ // save all available attribute codes
278
+ foreach($attributes as $code => $attribute) {
279
+ $attributeCodes[] = $code;
280
+ }
281
+
282
+ // add all attributes from the config if the attribute is a Magento attribute and it has
283
+ // not already been added to the $attributesToSelect array
284
+ foreach($this->_exportFields as $field) {
285
+ $attrCode = $field['productattribute'];
286
+ if(in_array($attrCode, $attributeCodes) && !in_array($attrCode, $attributesToSelect)) {
287
+ $attributesToSelect[] = $attrCode;
288
+ }
289
+ }
290
+
291
+ return $attributesToSelect;
292
+
293
+ }
294
+
295
+ /**
296
+ * Sets store specific values for the export based on the parameter $storeId.
297
+ * Returns false if an error occured / the store with id $storeId does not exist.
298
+ * @param int $storeId
299
+ * @return bool
300
+ * @throws Mage_Core_Exception
301
+ */
302
+ protected function _setStoreValues($storeId) {
303
+ try {
304
+ $store = Mage::app()->getStore($storeId);
305
+ } catch(Exception $e) {
306
+ Mage::logException($e);
307
+ return false;;
308
+ }
309
+
310
+ $this->_storeId = $store->getId();
311
+ $this->_siteId = $store->getWebsiteId();
312
+ $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
313
+ $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
314
+
315
+ $stockId = $store->getWebsite()->getStockId();
316
+ $this->_stockId = (!empty($stockId)) ? $stockId : 1;
317
+
318
+ return true;
319
+ }
320
+
321
+ /**
322
+ * @param int $storeId
323
+ * @param array $filterIds
324
+ * @return Mage_Catalog_Model_Resource_Product_Collection|null
325
+ * @throws Mage_Core_Exception
326
+ */
327
+ public function getProductCollection($storeId, array $filterIds = array()) {
328
+ // Set the store values. If an error occurs, return null.
329
+ if(!$this->_setStoreValues($storeId)) {
330
+ return null;
331
+ }
332
+
333
+ /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
334
+ $collection = Mage::getModel('catalog/product')->getCollection();
335
+ $this->_eavEntity = $collection->getEntity();
336
+ $attributes = $collection->getEntity()->loadAllAttributes()->getAttributesByCode();
337
+
338
+ $connection = $collection->getConnection();
339
+
340
+ // addPriceData uses inner join to get the price data for a website_id and a customer_group id
341
+ // so all products that are not associated to $this->_siteId and the customerGroupId (NOT LOGGED IN (0) by default)
342
+ // are not included in this collection.
343
+ // addPriceData is needed for getting the minimal price for bundels
344
+ $collection
345
+ ->addAttributeToSelect('*')
346
+ ->addPriceData($this->_customerGroupId, $this->_siteId)
347
+ ->joinField('qty',
348
+ 'cataloginventory/stock_item',
349
+ 'qty',
350
+ 'product_id=entity_id',
351
+ $connection->quoteInto('{{table}}.stock_id=?', $this->_stockId),
352
+ 'left')
353
+ ->joinField('min_sale_qty',
354
+ 'cataloginventory/stock_item',
355
+ 'min_sale_qty',
356
+ 'product_id=entity_id',
357
+ $connection->quoteInto('{{table}}.stock_id=?', $this->_stockId),
358
+ 'left')
359
+ ->joinField('max_sale_qty',
360
+ 'cataloginventory/stock_item',
361
+ 'max_sale_qty',
362
+ 'product_id=entity_id',
363
+ $connection->quoteInto('{{table}}.stock_id=?', $this->_stockId),
364
+ 'left')
365
+ ->joinField('is_in_stock',
366
+ 'cataloginventory/stock_item',
367
+ 'is_in_stock',
368
+ 'product_id=entity_id',
369
+ $connection->quoteInto('{{table}}.stock_id=?', $this->_stockId),
370
+ 'left')
371
+ ->setStoreId($this->_storeId);
372
+
373
+ // add group price fields
374
+ foreach($this->_exportFields as $field) {
375
+ if(strpos($field['productattribute'], 'group_price') !== false) {
376
+ $groupId = substr($field['productattribute'], 12);
377
+ if(is_numeric($groupId)) {
378
+ $collection->joinField('group_price_'.$groupId,
379
+ 'catalog/product_index_price',
380
+ 'group_price',
381
+ 'entity_id=entity_id',
382
+ $connection->quoteInto('{{table}}.customer_group_id=?', $groupId),
383
+ 'left');
384
+ }
385
+ }
386
+ }
387
+
388
+ if(!empty($filterIds)) {
389
+ $collection->addFieldToFilter('entity_id', array('in' => $filterIds));
390
+ }
391
+
392
+ $this->_backendModel = $collection->getResource()->getAttribute('media_gallery')->getBackend();
393
+
394
+ return $collection;
395
+ }
396
+
397
+ /**
398
+ * Get the url for the product based on the selected method in the system config or from the param $method.
399
+ * @param Mage_Catalog_Model_Product $product
400
+ * @param null|int $method
401
+ * @return string
402
+ */
403
+ public function getProductUrl(Mage_Catalog_Model_Product $product, $method = null) {
404
+ if($method === null) {
405
+ $method = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/product_url_generation_method');
406
+ }
407
+
408
+ switch($method) {
409
+ case Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration::METHOD_URL_PATH:
410
+ $url = $this->_webUrl . $product->getUrlPath();
411
+ break;
412
+ case Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration::METHOD_URL_KEY:
413
+ $url = $this->_webUrl . $product->getUrlKey();
414
+ break;
415
+ case Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration::METHOD_URL_KEY_HTML:
416
+ $url = $this->_webUrl . $product->getUrlKey() . '.html';
417
+ break;
418
+ case Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration::METHOD_GET_PRODUCT_URL:
419
+ $url = $product->getProductUrl();
420
+ break;
421
+ case Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration::METHOD_GET_URL_IN_STORE:
422
+ $url = $product->getUrlInStore($product, array('_store' => $this->_storeId));
423
+ break;
424
+ default:
425
+ $url = '';
426
+ }
427
+
428
+ return $url;
429
+ }
430
+
431
+ /**
432
+ * Get the current $item as array.
433
+ * Returns Array(
434
+ * [ATTRIBUTE_CODE] => [VALUE]
435
+ * )
436
+ * @param Mage_Catalog_Model_Product $item
437
+ * @return array
438
+ */
439
+ public function getFullProductData(Mage_Catalog_Model_Product $item) {
440
+ $imageUrl = $this->_imageBaseUrl . $item->getImage();
441
+
442
+ $isParent = 0;
443
+ if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
444
+ $isParent = 1;
445
+ }
446
+
447
+ $parentId = null;
448
+ if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
449
+ $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getId());
450
+ $parentId = (is_array($parentId) && !empty($parentId)) ? $parentId[0] : null;
451
+ }
452
+
453
+ $configurableAttributes = array();
454
+ if($parentId && isset($this->_variationThemes[$parentId])) {
455
+ $configurableAttributes = $this->_variationThemes[$parentId];
456
+ } else if($isParent && $parentId === null) {
457
+ $configurableAttributes = $this->_getConfigurableAttributes($item->getId());
458
+ $configurableAttributes = (!empty($configurableAttributes)) ? implode('|', $configurableAttributes) : '';
459
+ $this->_variationThemes[$item->getId()] = $configurableAttributes;
460
+ }
461
+
462
+ $colorText = ($this->_eavEntity->getAttribute('color')) ? $item->getAttributeText('color') : '';
463
+
464
+ // set the value to the minimal price if the current product is a bundle, otherwise the product's price
465
+ $calcPrice = ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ? Mage::getModel('bundle/product_price')->getTotalPrices($item, 'min', true, false) : $item->getPrice();
466
+
467
+ $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$calcPrice);
468
+ $price = ($rulePrice) ? $rulePrice : $calcPrice;
469
+
470
+ $product = $this->_blankProduct;
471
+
472
+ $product['entity_id'] = $item->getId();
473
+ $product['sku'] = $item->getSku();
474
+ $product['parent_id'] = $parentId;
475
+ $product['variationTheme'] = $configurableAttributes;
476
+ $product['name'] = $this->_getCleanedStringForXml($item->getName());
477
+ $product['description'] = $this->_getCleanedStringForXml($item->getDescription());
478
+
479
+ $product['price'] = $price;
480
+ if($this->_currencyChange) {
481
+ $product['price'] = round($product['price']*$this->_currencyChange, 2);
482
+ }
483
+
484
+ $product['categories'] = $this->_getCategoryInformation($item);
485
+ if($this->_eavEntity->getAttribute('manufacturer')) {
486
+ $product['manufacturer'] = $this->_getCleanedStringForXml($item->getManufacturer());
487
+ $product['manufacturer_name'] = $this->_getCleanedStringForXml($item->getAttributeText('manufacturer'));
488
+ }
489
+ $product['cp_product_url'] = $this->getProductUrl($item);
490
+ $product['cp_image_url'] = $imageUrl;
491
+ $product['color'] = ($colorText) ? $this->_getCleanedStringForXml($colorText) : null;
492
+ $product['weight'] = $item->getWeight();
493
+
494
+ $product = array_merge($product, $this->_getAdditionalImages($item));
495
+
496
+ $product['is_parent'] = $isParent;
497
+
498
+ $this->_addExportFields($product, $item);
499
+
500
+ if(!empty($this->_replaceFields) && !$isParent && $parentId !== null) {
501
+ $this->_replaceFields($product, $parentId);
502
+ }
503
+
504
+ return $product;
505
+ }
506
+
507
+ /**
508
+ * Get the additional images for a product
509
+ * @param Mage_Catalog_Model_Product $product
510
+ * @return array
511
+ */
512
+ protected function _getAdditionalImages(Mage_Catalog_Model_Product $product) {
513
+ $counter = 1;
514
+ $productData = array();
515
+ $mediaGalleryImages = array();
516
+ if($product->getMediaGalleryImages()) {
517
+ $mediaGalleryImages = $product->getMediaGalleryImages();
518
+ }
519
+ foreach ($mediaGalleryImages as $image) {
520
+ // break if the maximum amount of additional images has been reached
521
+ if ($counter > $this->_maxAdditionalImages) {
522
+ break;
523
+ }
524
+
525
+ // ignore the base image; it has already been added
526
+ if ($image->getFile() == $product->getImage()) {
527
+ continue;
528
+ }
529
+
530
+ $productData['cp_additional_image_' . $counter] = $this->_imageBaseUrl . $image->getFile();
531
+ $counter++;
532
+ }
533
+
534
+ return $productData;
535
+ }
536
+
537
+ /**
538
+ * Add all fields to a product that need to be exported
539
+ * @param $product
540
+ * @param Mage_Catalog_Model_Product $item
541
+ */
542
+ protected function _addExportFields(&$product, Mage_Catalog_Model_Product $item) {
543
+ foreach($this->_exportFields as $field) {
544
+ $code = $field['productattribute'];
545
+ if(strpos($code, 'group_price') !== false) {
546
+ $groupId = substr($code, 12);
547
+ $customerGroup = Mage::getModel('customer/group')->load($groupId);
548
+ $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
549
+ $product['group_price_'.$groupCode] = $item->getData('group_price_'.$customerGroup->getId());
550
+ } else {
551
+ switch($code) {
552
+ // ignore
553
+ case 'parent_id':
554
+ break;
555
+ case 'qty':
556
+ $product[$code] = $item->getQty();
557
+ break;
558
+ case 'stock_status':
559
+ $product[$code] = $item->getIsInStock();
560
+ break;
561
+ case 'min_sale_qty':
562
+ case 'max_sale_qty':
563
+ case 'tax_class_id':
564
+ $product[$code] = $item->getData($code);
565
+ break;
566
+ default:
567
+ $attributeText = ($item->getResource()->getAttribute($code)) ? $item->getAttributeText($code) : false;
568
+ if(is_array($attributeText)) {
569
+ $attributeText = implode(',',$attributeText);
570
+ }
571
+ $product[$code] = ($attributeText) ? $this->_getCleanedStringForXml($attributeText) : $this->_getCleanedStringForXml($item->getData($code));
572
+ }
573
+ }
574
+ }
575
+ }
576
+
577
+ /**
578
+ * Replace all selected fields with the parent's values.
579
+ * @param $product
580
+ * @param $parentId
581
+ */
582
+ protected function _replaceFields(&$product, $parentId) {
583
+ $parent = $this->_getParentById($parentId);
584
+ if($parent !== null && $parent->getId()) {
585
+ $parentImages = $this->_getAdditionalImages($parent);
586
+ foreach($this->_replaceFields as $field) {
587
+ $code = $field['productattribute'];
588
+ if(strpos($code, 'group_price') !== false) {
589
+ $groupId = substr($code, 12);
590
+ $customerGroup = Mage::getModel('customer/group')->load($groupId);
591
+ $groupPrices = $parent->getData('group_price');
592
+ foreach($groupPrices as $groupPrice) {
593
+ if($groupPrice['cust_group'] == $groupId) {
594
+ $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
595
+ $product['group_price_'.$groupCode] = $groupPrice['price'];
596
+ }
597
+ }
598
+ } else if(strpos($code, 'cp_additional_image') !== false && isset($parentImages[$code])) {
599
+ $product[$code] = $parentImages[$code];
600
+ } else {
601
+ switch($code) {
602
+ case 'categories':
603
+ $product['categories'] = $this->_getCategoryInformation($parent);
604
+ break;
605
+ case 'cp_product_url':
606
+ $product[$code] = $this->getProductUrl($parent);
607
+ break;
608
+ case 'cp_image_url':
609
+ $product[$code] = $this->_imageBaseUrl . $parent->getImage();
610
+ break;
611
+ case 'qty':
612
+ $product[$code] = $parent->getStockItem()->getQty();
613
+ break;
614
+ case 'stock_status':
615
+ $product[$code] = $parent->getStockItem()->getIsInStock();
616
+ break;
617
+ case 'min_sale_qty':
618
+ $product[$code] = $parent->getStockItem()->getMinSaleQty();
619
+ break;
620
+ case 'max_sale_qty':
621
+ $product[$code] = $parent->getStockItem()->getMaxSaleQty();
622
+ break;
623
+ case 'tax_class_id':
624
+ $product[$code] = $parent->getData($code);
625
+ break;
626
+ default:
627
+ $attributeText = ($parent->getResource()->getAttribute($code)) ? $parent->getAttributeText($code) : false;
628
+ if(is_array($attributeText)) {
629
+ $attributeText = implode(',',$attributeText);
630
+ }
631
+ $product[$code] = ($attributeText) ? $this->_getCleanedStringForXml($attributeText) : $this->_getCleanedStringForXml($parent->getData($code));
632
+ }
633
+ }
634
+ }
635
+ }
636
+ }
637
+
638
+ /**
639
+ * Adds the values of the $product array to the $xml structure.
640
+ * @param array $product
641
+ * @param SimpleXMLElement $xml
642
+ */
643
+ public function productToXml(array $product, SimpleXMLElement $xml) {
644
+ foreach($product as $code => $value) {
645
+ if(is_array($value)) {
646
+ $node = $xml->addChild($code);
647
+ $this->productToXml($value, $node);
648
+ } else if (is_string($value) || is_numeric($value) || is_bool($value) || is_null($value)) {
649
+ $xml->addChild($code, htmlspecialchars($value));
650
+ }
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Get the category information for a product.
656
+ * @param Mage_Catalog_Model_Product $product
657
+ * @return string
658
+ */
659
+ protected function _getCategoryInformation(Mage_Catalog_Model_Product $product) {
660
+ $arrPath = array();
661
+
662
+ /** @var $category Mage_Catalog_Model_Category */
663
+ foreach($product->getCategoryCollection() as $category) {
664
+ if(isset($this->_allCat[$category->getPath()])) {
665
+ $arrPath[] = $this->_allCat[$category->getPath()];
666
+ }
667
+ }
668
+
669
+ return ltrim(implode(',', $arrPath), '>');
670
+ }
671
+
672
+ /**
673
+ * Get a product by its id. Save the loaded product to an array to cache it.
674
+ * It is used for parent products only so these products do not need to be loaded by each
675
+ * of its child products.
676
+ * @param $parentId
677
+ * @return mixed
678
+ */
679
+ protected function _getParentById($parentId) {
680
+ if(!isset($this->_parents[$parentId])) {
681
+ $parent = Mage::getModel('catalog/product')->load($parentId);
682
+ $this->_parents[$parentId] = ($parent->getId()) ? $parent : null;
683
+ }
684
+ return $this->_parents[$parentId];
685
+ }
686
+
687
+ /**
688
+ * Clean a string for usage in XML.
689
+ * @param $string
690
+ * @return mixed
691
+ */
692
+ protected function _getCleanedStringForXml($string) {
693
+ return $this->_utf8ForXml(html_entity_decode($string));
694
+ }
695
+
696
+ /**
697
+ * Replace all UTF-8 characters that are not allowed in XML with a space.
698
+ * @param $string
699
+ * @return mixed
700
+ */
701
+ protected function _utf8ForXml($string) {
702
+ return preg_replace ('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $string);
703
+ }
704
+
705
+ /**
706
+ * @return mixed
707
+ */
708
+ public function getStoreId()
709
+ {
710
+ return $this->_storeId;
711
+ }
712
+
713
+ public function setStoreVariables($storeId) {
714
+ try {
715
+ $store = Mage::app()->getStore($storeId);
716
+ $this->_storeId = $storeId;
717
+ $this->_siteId = $store->getWebsiteId();
718
+ $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
719
+ $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
720
+ } catch(Exception $e) {
721
+ Mage::logException($e);
722
+ }
723
+ }
724
+
725
+ /**
726
+ * @return mixed
727
+ */
728
+ public function getChunkSize()
729
+ {
730
+ if(empty($this->_chunkSize)) {
731
+ $this->_initChunkSize();
732
+ }
733
+ return $this->_chunkSize;
734
+ }
735
+
736
+ /**
737
+ * @param mixed $chunkSize
738
+ */
739
+ public function setChunkSize($chunkSize)
740
+ {
741
+ $this->_chunkSize = $chunkSize;
742
+ }
743
+
744
+ /**
745
+ * @return mixed
746
+ */
747
+ public function getAttributeCount()
748
+ {
749
+ return (!empty($this->_exportFields)) ? count($this->_exportFields) : 0;
750
+ }
751
+
752
+ /**
753
+ * @return mixed
754
+ */
755
+ public function getBackendModel()
756
+ {
757
+ return $this->_backendModel;
758
+ }
759
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php CHANGED
@@ -38,7 +38,6 @@ require_once 'responses/GetManagedArticlePricesResponse.php';
38
  class ChannelPilotSellerAPI_v1_0 extends SoapClient {
39
 
40
  private $auth;
41
- private $wsdlUrl = 'https://seller.api.channelpilot.com/1_0?wsdl';
42
  private $soapOptions = array(
43
  'connection_timeout' => 20,
44
  'features' => SOAP_SINGLE_ELEMENT_ARRAYS
@@ -77,7 +76,7 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
77
  $this->soapOptions['classmap'][$key] = $value;
78
  }
79
  }
80
- parent::__construct($this->wsdlUrl, $this->soapOptions);
81
  }
82
 
83
  /**
@@ -193,6 +192,13 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
193
  );
194
  }
195
 
 
 
 
 
 
 
 
196
  }
197
 
198
  ?>
38
  class ChannelPilotSellerAPI_v1_0 extends SoapClient {
39
 
40
  private $auth;
 
41
  private $soapOptions = array(
42
  'connection_timeout' => 20,
43
  'features' => SOAP_SINGLE_ELEMENT_ARRAYS
76
  $this->soapOptions['classmap'][$key] = $value;
77
  }
78
  }
79
+ parent::__construct($this->getWsdlUrl(), $this->soapOptions);
80
  }
81
 
82
  /**
192
  );
193
  }
194
 
195
+ /**
196
+ * @return string
197
+ */
198
+ public function getWsdlUrl()
199
+ {
200
+ return Mage::getStoreConfig('channelpilot_general/channelpilot_general/seller_api_wsdl_url');
201
+ }
202
  }
203
 
204
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPAbstractHandler.php CHANGED
@@ -22,24 +22,32 @@ class CPAbstractHandler {
22
  * @return boolean
23
  */
24
  public static function isIpAllowedViaShopId($shopId) {
25
- if (self::ChannelPilot_IP == $_SERVER['REMOTE_ADDR'] || !Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
 
26
  return true;
27
  } else {
28
- return in_array($_SERVER['REMOTE_ADDR'], Mage::getModel('channelpilot/registration')->getAllowedIpsViaShopId($shopId));
29
  }
30
  }
31
 
32
  /**
33
- * Is the IP allowed for this securityToken
 
 
 
34
  *
35
- * @param type $token
 
36
  * @return boolean
37
  */
38
- public static function isIpAllowedViaSecurityToken($token) {
39
- if (self::ChannelPilot_IP == $_SERVER['REMOTE_ADDR'] || !Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
 
40
  return true;
41
- } else {
42
- return in_array($_SERVER['REMOTE_ADDR'], Mage::getModel('channelpilot/registration')->getAllowedIpsViaSecurityToken($token));
 
 
43
  }
44
  }
45
 
@@ -59,25 +67,35 @@ class CPAbstractHandler {
59
 
60
  /**
61
  * Get the merchantId for a security token.
62
- * Returns NULL if record could not be found.
63
  * @param string $token
64
  * @return mixed
65
  */
66
  public static function getMerchantId($token) {
67
- return Mage::getModel('channelpilot/registration')->load($token, 'securityToken')
68
  ->getData('merchantId');
 
 
 
 
 
 
69
  }
70
 
71
  /**
72
  * Get shopId by token for registered shop.
73
- * Returns NULL if no record could be found.
74
  *
75
  * @param string $token
76
  * @return mixed
77
  */
78
  public static function getShopId($token) {
79
- return Mage::getModel('channelpilot/registration')->load($token, 'securityToken')
80
  ->getId();
 
 
 
 
 
 
81
  }
82
 
83
  public static function changeStatusOrders($apiOrders) {
@@ -87,7 +105,7 @@ class CPAbstractHandler {
87
  self::changeStatusOrder($apiOrder->orderHeader);
88
  } else {
89
  $defectiveOrderIncrementIds[] = $apiOrder->orderHeader->orderId;
90
- self::logError("Cannot change orderstatus from order (id: '" . $apiOrder->orderHeader->orderId . "', status: '" . $apiOrder->orderHeader->status->identifier . "')");
91
  }
92
  }
93
  return $defectiveOrderIncrementIds;
@@ -116,7 +134,8 @@ class CPAbstractHandler {
116
  * @param string $msg
117
  */
118
  public static function logError($msg) {
119
- $msg = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] by IP: {$_SERVER['REMOTE_ADDR']}\n$msg";
 
120
 
121
  Mage::log("$msg\n\n", null, 'cp_plugin.log');
122
  Mage::getModel('channelpilot/logs')
@@ -124,22 +143,6 @@ class CPAbstractHandler {
124
  ->setData(array('created' => date('Y-m-d H:i:s'), 'content' => $msg))
125
  ->save();
126
  }
127
-
128
- public static function checkConfig() {
129
- /* if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_NUMBER')==2 && oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_OTHERARTNUM')==''){
130
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No column for other article number", "No column for other article number");
131
- }
132
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_IMPORT')==''){
133
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for unpaid orders", "No folder for unpaid orders");
134
- }
135
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_PAIDIMPORT')==''){
136
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for paid orders", "No folder for paid orders");
137
- }
138
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_CANCEL')==''){
139
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for cancelled orders", "No folder for cancelled orders");
140
- } */
141
- }
142
-
143
  }
144
 
145
  ?>
22
  * @return boolean
23
  */
24
  public static function isIpAllowedViaShopId($shopId) {
25
+ $clientIp = Mage::app()->getRequest()->getClientIp();
26
+ if (self::ChannelPilot_IP == $clientIp || !Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
27
  return true;
28
  } else {
29
+ return in_array($clientIp, Mage::getModel('channelpilot/registration')->getAllowedIpsViaShopId($shopId));
30
  }
31
  }
32
 
33
  /**
34
+ * Is the IP allowed for this securityToken.
35
+ * The param $useConfigSettingCheckIp is currently use by the CpShipping carrier to prevent PayPal from
36
+ * using this shipping method if set to "backend_only". If the param is set to false the step to return true
37
+ * if the config setting to check the ip is set to false will be skipped.
38
  *
39
+ * @param string $token
40
+ * @param bool $useConfigSettingCheckIp
41
  * @return boolean
42
  */
43
+ public static function isIpAllowedViaSecurityToken($token, $useConfigSettingCheckIp = true) {
44
+ $clientIp = Mage::app()->getRequest()->getClientIp();
45
+ if (self::ChannelPilot_IP == $clientIp) {
46
  return true;
47
+ } else if($useConfigSettingCheckIp && !Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
48
+ return true;
49
+ } else {
50
+ return in_array($clientIp, Mage::getModel('channelpilot/registration')->getAllowedIpsViaSecurityToken($token));
51
  }
52
  }
53
 
67
 
68
  /**
69
  * Get the merchantId for a security token.
 
70
  * @param string $token
71
  * @return mixed
72
  */
73
  public static function getMerchantId($token) {
74
+ $merchantId = Mage::getModel('channelpilot/registration')->load($token, 'securityToken')
75
  ->getData('merchantId');
76
+
77
+ if(empty($merchantId)) {
78
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED,'No merchant id found for token.','No merchant id found for token.');
79
+ }
80
+
81
+ return $merchantId;
82
  }
83
 
84
  /**
85
  * Get shopId by token for registered shop.
 
86
  *
87
  * @param string $token
88
  * @return mixed
89
  */
90
  public static function getShopId($token) {
91
+ $shopId = Mage::getModel('channelpilot/registration')->load($token, 'securityToken')
92
  ->getId();
93
+
94
+ if(empty($shopId)) {
95
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED,'No shop id found for token.','No shop id found for token.');
96
+ }
97
+
98
+ return $shopId;
99
  }
100
 
101
  public static function changeStatusOrders($apiOrders) {
105
  self::changeStatusOrder($apiOrder->orderHeader);
106
  } else {
107
  $defectiveOrderIncrementIds[] = $apiOrder->orderHeader->orderId;
108
+ self::logError("Cannot change orderstatus from order (id: '" . $apiOrder->orderHeader->orderId . "', status: '" . $apiOrder->orderHeader->status->identifier . ", msg: ". $apiOrder->header->resultMessage .")");
109
  }
110
  }
111
  return $defectiveOrderIncrementIds;
134
  * @param string $msg
135
  */
136
  public static function logError($msg) {
137
+ $clientIp = Mage::app()->getRequest()->getClientIp();
138
+ $msg = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] by IP: {$clientIp}\n$msg";
139
 
140
  Mage::log("$msg\n\n", null, 'cp_plugin.log');
141
  Mage::getModel('channelpilot/logs')
143
  ->setData(array('created' => date('Y-m-d H:i:s'), 'content' => $msg))
144
  ->save();
145
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
147
 
148
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php CHANGED
@@ -15,7 +15,6 @@ class CPCancellationHandler extends CPAbstractHandler {
15
  $token = Mage::app()->getRequest()->getParam('token', false);
16
  $method = Mage::app()->getRequest()->getParam('method', '');
17
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
18
- self::checkConfig();
19
  $cancelled = array();
20
 
21
  $cancelledOrders = $this->getCancelledOrders();
@@ -66,7 +65,7 @@ class CPCancellationHandler extends CPAbstractHandler {
66
  }
67
  }
68
 
69
- private function hookResult($moreAvailable) {
70
  $hook = new CPHookResponse();
71
  $hook->resultCode = CPResultCodes::SUCCESS;
72
  $hook->resultMessage = "CANCELLATION HOOK SUCCESS";
@@ -74,7 +73,7 @@ class CPCancellationHandler extends CPAbstractHandler {
74
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
75
  }
76
 
77
- private function getCancelledItems() {
78
  $sResult = Mage::getModel('channelpilot/order_item')->getCollection()
79
  ->addFieldToSelect(array('order_item_id', 'marketplace_order_item_id', 'time' => new Zend_Db_Expr('NOW()')))
80
  ->addCanceledSalesOrderItemsFilter()
@@ -110,7 +109,7 @@ class CPCancellationHandler extends CPAbstractHandler {
110
  * Update the channelpilot/order_item table to set the cancelled column.
111
  * @param array $orders
112
  */
113
- private function _updateMarketplaceOrderItems(array $orders = array()) {
114
  foreach($orders as $order) {
115
  foreach($order->cancelledItems as $cpOrderItem) {
116
  if($cpOrderItem->quantityCancelled > 0) {
@@ -123,7 +122,7 @@ class CPCancellationHandler extends CPAbstractHandler {
123
  }
124
  }
125
 
126
- private function getCancelledOrders() {
127
  try {
128
  $result = Mage::getModel('channelpilot/order')->getCollection()
129
  ->addFieldToSelect(array('order_nr', 'marketplace', 'time' => new Zend_Db_Expr('NOW()'), 'status'))
15
  $token = Mage::app()->getRequest()->getParam('token', false);
16
  $method = Mage::app()->getRequest()->getParam('method', '');
17
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
 
18
  $cancelled = array();
19
 
20
  $cancelledOrders = $this->getCancelledOrders();
65
  }
66
  }
67
 
68
+ protected function hookResult($moreAvailable) {
69
  $hook = new CPHookResponse();
70
  $hook->resultCode = CPResultCodes::SUCCESS;
71
  $hook->resultMessage = "CANCELLATION HOOK SUCCESS";
73
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
74
  }
75
 
76
+ protected function getCancelledItems() {
77
  $sResult = Mage::getModel('channelpilot/order_item')->getCollection()
78
  ->addFieldToSelect(array('order_item_id', 'marketplace_order_item_id', 'time' => new Zend_Db_Expr('NOW()')))
79
  ->addCanceledSalesOrderItemsFilter()
109
  * Update the channelpilot/order_item table to set the cancelled column.
110
  * @param array $orders
111
  */
112
+ protected function _updateMarketplaceOrderItems(array $orders = array()) {
113
  foreach($orders as $order) {
114
  foreach($order->cancelledItems as $cpOrderItem) {
115
  if($cpOrderItem->quantityCancelled > 0) {
122
  }
123
  }
124
 
125
+ protected function getCancelledOrders() {
126
  try {
127
  $result = Mage::getModel('channelpilot/order')->getCollection()
128
  ->addFieldToSelect(array('order_nr', 'marketplace', 'time' => new Zend_Db_Expr('NOW()'), 'status'))
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php CHANGED
@@ -15,43 +15,115 @@ class CPDeliveryHandler extends CPAbstractHandler {
15
  $method = Mage::app()->getRequest()->getParam('method', false);
16
  $token = Mage::app()->getRequest()->getParam('token', false);
17
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
18
- self::checkConfig();
19
  $limit = Mage::app()->getRequest()->getParam('limit', 0);
20
  if ($limit) {
21
  try {
22
 
23
- $sResult = Mage::getModel('channelpilot/order')->getCollection()
 
24
  ->addFieldToSelect(array('order_nr', 'marketplace'))
25
  ->addHasShipmentFilter()
26
  ->addFieldToFilter('main_table.status', array(
27
  array('eq' => CPOrderStatus::ID_IMPORTED),
28
  array('eq' => CPOrderStatus::ID_PARTIALLY_DELIVERED)
29
- ))
30
- ->setPageSize($limit)
31
- ->getData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  $deliveries = array();
34
  $shipments = array();
35
  foreach ($sResult AS $order) {
36
  $shipmentIds = explode(',',$order['shipment_ids']);
 
37
  $salesOrder = Mage::getModel('sales/order')->unsetData()->load($order['order_id']);
 
 
 
38
  $deliveryComplete = true;
39
- if($salesOrder && $salesOrder->getId()) {
40
- $deliveryComplete = (!$salesOrder->canShip());
41
- }
42
- foreach($shipmentIds as $shipmentId) {
43
- $delivered = new CPDelivery($order['order_nr'], $order['marketplace'], $deliveryComplete, $order['track_number'], date("Y-m-d", strtotime($order['shipment_created_at'])) . 'T' . date("H:i:s", strtotime($order['shipment_created_at'])));
44
- $delivered->carrierName = $order['title'];
45
- $delivered->shipping = new CPShipping();
46
- $delivered->shipping->typeId = $order['shipping_method'];
47
- $delivered->shipping->typeTitle = $order['title'];
48
- $deliveries[] = $delivered;
49
- $shipments[] = array(
50
- 'order_id' => $order['order_id'],
51
- 'order_nr' => $order['order_nr'], // this field is needed to be able to check for defective orders later
52
- 'shipment_id' => $shipmentId,
53
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
 
 
 
 
 
 
 
 
 
55
  }
56
  if (sizeof($deliveries) == 0) {
57
  self::hookResult(false);
@@ -67,11 +139,18 @@ class CPDeliveryHandler extends CPAbstractHandler {
67
  foreach($shipments as $shipment) {
68
  // if an error occured do not save this shipment
69
  if(!in_array($shipment['order_nr'], $defectiveOrderIncrementIds)) {
70
- unset($shipment['order_nr']);
71
- $shipmentsToInsert[] = $shipment;
 
 
 
 
 
72
  }
73
  }
74
- $insertedRows = Mage::getModel('channelpilot/order_shipment')->addMultipleShipments($shipmentsToInsert);
 
 
75
 
76
  } else {
77
  // Result from registerDeliveries has no success
@@ -91,7 +170,7 @@ class CPDeliveryHandler extends CPAbstractHandler {
91
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
92
  }
93
  } else {
94
- if (empty($_GET['token'])) {
95
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
96
  } else {
97
  CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
@@ -100,7 +179,7 @@ class CPDeliveryHandler extends CPAbstractHandler {
100
  return "Error during handle deliveryHook";
101
  }
102
 
103
- private function hookResult($moreAvailable) {
104
  $hook = new CPHookResponse();
105
  $hook->resultCode = CPResultCodes::SUCCESS;
106
  $hook->resultMessage = "DELIVERY HOOK SUCCESS";
15
  $method = Mage::app()->getRequest()->getParam('method', false);
16
  $token = Mage::app()->getRequest()->getParam('token', false);
17
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
 
18
  $limit = Mage::app()->getRequest()->getParam('limit', 0);
19
  if ($limit) {
20
  try {
21
 
22
+ /** @var $collection Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection */
23
+ $collection = Mage::getModel('channelpilot/order')->getCollection()
24
  ->addFieldToSelect(array('order_nr', 'marketplace'))
25
  ->addHasShipmentFilter()
26
  ->addFieldToFilter('main_table.status', array(
27
  array('eq' => CPOrderStatus::ID_IMPORTED),
28
  array('eq' => CPOrderStatus::ID_PARTIALLY_DELIVERED)
29
+ ));
30
+
31
+ $sResult = array();
32
+ $incomplete = 0;
33
+
34
+ // loop through all orders with deliveries and add every order with
35
+ // a completed delivery until the limit has been reached
36
+ foreach($collection as $order) {
37
+ /** @var $salesOrder Mage_Sales_Model_Order */
38
+ $salesOrder = Mage::getModel('sales/order')->unsetData()->load($order['order_id']);
39
+
40
+ // For now the seller api does not allow partial deliveries.
41
+ // Therefore the variable $deliveryComplete will always be true.
42
+ if($salesOrder && $salesOrder->getId()) {
43
+ // order shipment is not complete yet, so skip this order
44
+ if($salesOrder->canShip()) {
45
+ $incomplete++;
46
+ continue;
47
+ }
48
+
49
+ $sResult[] = $order->getData();
50
+ $limit--;
51
+
52
+ if($limit == 0) {
53
+ break;
54
+ }
55
+ }
56
+ }
57
+
58
+ if($incomplete > 0) {
59
+ self::logError('Skipped '.$incomplete.' orders because the delivery is not completed yet.');
60
+ }
61
 
62
  $deliveries = array();
63
  $shipments = array();
64
  foreach ($sResult AS $order) {
65
  $shipmentIds = explode(',',$order['shipment_ids']);
66
+ /** @var $salesOrder Mage_Sales_Model_Order */
67
  $salesOrder = Mage::getModel('sales/order')->unsetData()->load($order['order_id']);
68
+
69
+ // For now the seller api does not allow partial deliveries.
70
+ // Therefore the variable $deliveryComplete will always be true.
71
  $deliveryComplete = true;
72
+
73
+ $delivered = new CPDelivery($order['order_nr'], $order['marketplace'], $deliveryComplete, $order['track_number'], date("Y-m-d", strtotime($order['shipment_created_at'])) . 'T' . date("H:i:s", strtotime($order['shipment_created_at'])));
74
+ $delivered->carrierName = $order['title'];
75
+ $delivered->shipping = new CPShipping();
76
+ $delivered->shipping->typeId = $order['shipping_method'];
77
+ $delivered->shipping->typeTitle = $order['title'];
78
+
79
+ $deliveredItems = array();
80
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
81
+ foreach($salesOrder->getAllItems() as $orderItem) {
82
+ $cpMarketplaceOrderItem = Mage::getModel('channelpilot/order_item')->getCollection()
83
+ ->addFieldToFilter('order_id', array('eq' => $order['order_id']))
84
+ ->addFieldToFilter('order_item_id', array('eq' => $orderItem->getId()))
85
+ ->getFirstItem();
86
+
87
+ $item = new CPOrderItem();
88
+
89
+ $item->id = $orderItem->getId();
90
+ $item->idExternal = $cpMarketplaceOrderItem->getMarketplaceOrderItemId();
91
+
92
+ $item->article = new CPArticle();
93
+ $item->article->id = $orderItem->getId();
94
+ $item->article->idExternal = $cpMarketplaceOrderItem->getMarketplaceOrderItemId();
95
+ $item->article->title = $orderItem->getName();
96
+
97
+ $item->quantityOrdered = $orderItem->getQtyOrdered();
98
+ $item->quantityDelivered = $orderItem->getQtyShipped();
99
+ $item->quantityCancelled = $orderItem->getQtyCanceled();
100
+
101
+ $item->costsSingle = new CPMoney();
102
+ $item->costsSingle->gross = $orderItem->getPriceInclTax();
103
+ $item->costsSingle->net = $orderItem->getPrice();
104
+ $item->costsSingle->tax = ($orderItem->getPriceInclTax() - $orderItem->getPrice());
105
+ $item->costsSingle->taxRate = $orderItem->getTaxPercent();
106
+
107
+ $item->costsTotal = new CPMoney();
108
+ $item->costsTotal->gross = $orderItem->getRowTotalInclTax();
109
+ $item->costsTotal->net = $orderItem->getRowTotal();
110
+ $item->costsTotal->tax = $orderItem->getTaxAmount();
111
+ $item->costsTotal->taxRate = $orderItem->getTaxPercent();
112
+
113
+ $item->feeSingleNet = 0;
114
+ $item->feeTotalNet = 0;
115
+
116
+ $deliveredItems[] = $item;
117
  }
118
+
119
+ $delivered->deliveredItems = $deliveredItems;
120
+
121
+ $deliveries[] = $delivered;
122
+ $shipments[] = array(
123
+ 'order_id' => $order['order_id'],
124
+ 'order_nr' => $order['order_nr'], // this field is needed to be able to check for defective orders later
125
+ 'shipment_id' => $order['shipment_ids'],
126
+ );
127
  }
128
  if (sizeof($deliveries) == 0) {
129
  self::hookResult(false);
139
  foreach($shipments as $shipment) {
140
  // if an error occured do not save this shipment
141
  if(!in_array($shipment['order_nr'], $defectiveOrderIncrementIds)) {
142
+ $shipmentIds = explode(',', $shipment['shipment_id']);
143
+ foreach($shipmentIds as $shipmentId) {
144
+ $shipmentsToInsert[] = array(
145
+ 'order_id' => $shipment['order_id'],
146
+ 'shipment_id' => $shipmentId,
147
+ );
148
+ }
149
  }
150
  }
151
+ if(count($shipmentsToInsert) > 0) {
152
+ $insertedRows = Mage::getModel('channelpilot/order_shipment')->addMultipleShipments($shipmentsToInsert);
153
+ }
154
 
155
  } else {
156
  // Result from registerDeliveries has no success
170
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
171
  }
172
  } else {
173
+ if ($token) {
174
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
175
  } else {
176
  CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
179
  return "Error during handle deliveryHook";
180
  }
181
 
182
+ protected function hookResult($moreAvailable) {
183
  $hook = new CPHookResponse();
184
  $hook->resultCode = CPResultCodes::SUCCESS;
185
  $hook->resultMessage = "DELIVERY HOOK SUCCESS";
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php CHANGED
@@ -8,23 +8,6 @@
8
  class CPExportHandler extends CPAbstractHandler {
9
 
10
  private $_storeId;
11
- private $_siteId;
12
- private $_customerGroupId;
13
- private $_mediaUrl;
14
- private $_webUrl;
15
- private $_allCat;
16
- private $_limit;
17
- private $_last;
18
- private $_blankProduct;
19
- private $_configurableAttributes = array();
20
- private $_imageBaseUrl;
21
- private $_maxAdditionalImages;
22
- private $_exportFields;
23
- private $_currencyChange;
24
- private $_replaceFields;
25
- private $_parents;
26
- private $_onlyStockAndPriceData;
27
- private $_backendModel;
28
 
29
  /**
30
  * Handle status event
@@ -32,10 +15,7 @@ class CPExportHandler extends CPAbstractHandler {
32
  */
33
  public function handle() {
34
  ini_set('max_execution_time', 7200);
35
- $limit = Mage::app()->getRequest()->getParam('limit', null);
36
  $store = Mage::app()->getRequest()->getParam('store', null);
37
- $this->_limit = $limit;
38
- $this->_last = Mage::app()->getRequest()->getParam('last', null);
39
  try {
40
  $this->_storeId = Mage::app()->getStore($store)->getId();
41
  } catch(Exception $e) {
@@ -43,8 +23,6 @@ class CPExportHandler extends CPAbstractHandler {
43
  return;
44
  }
45
 
46
- $this->initExport();
47
-
48
  // start the xml output right now to output the exported products as soon as
49
  // each product has been processed
50
  header('Content-Type: text/xml; charset=utf-8');
@@ -60,7 +38,7 @@ class CPExportHandler extends CPAbstractHandler {
60
  * Display an error message based on current export (and therefore display) method
61
  * if an exception has occured during Mage::app()->getStore().
62
  */
63
- private function _handleStoreException() {
64
  // The exception thrown by Mage::app()->getStore() has an empty message ...
65
  $xml = new SimpleXMLElement('<root></root>');
66
  $xml->addChild('error', 'Error retrieving store.');
@@ -69,245 +47,22 @@ class CPExportHandler extends CPAbstractHandler {
69
  exit();
70
  }
71
 
72
- /**
73
- * Check if another currency (other than the base currency) should be used. Displays an error if the
74
- * given currency could not be found.
75
- */
76
- private function _initCurrencyChange() {
77
- $this->_currencyChange = null;
78
- $currencyCode = Mage::app()->getRequest()->getParam('currency', false);
79
- if ($currencyCode && $currencyCode != '') {
80
- $result = Mage::getModel('directory/currency')->getCurrencyRates(Mage::app()->getBaseCurrencyCode(), $currencyCode);
81
- if(count($result) === 0){
82
- $xml = new SimpleXMLElement('<root></root>');
83
- $xml->addChild('error', 'wrong currency');
84
- header('Content-Type: text/xml; charset=utf-8');
85
- echo $xml->asXML();
86
- exit();
87
- }
88
- $this->_currencyChange = $result[$currencyCode];
89
- }
90
- }
91
-
92
- /**
93
- * Initialize the export.
94
- */
95
- private function initExport() {
96
- // Initialize the admin application
97
- Mage::app('admin');
98
-
99
- $this->_blankProduct = array();
100
- $this->_blankProduct['entity_id'] = '';
101
- $this->_blankProduct['sku'] = '';
102
- $this->_blankProduct['parent_id'] = '';
103
- $this->_blankProduct['variationTheme'] = '';
104
- $this->_blankProduct['name'] = '';
105
- $this->_blankProduct['description'] = '';
106
- $this->_blankProduct['price'] = '';
107
- $this->_blankProduct['categories'] = '';
108
- $this->_blankProduct['manufacturer'] = '';
109
- $this->_blankProduct['manufacturer_name'] = '';
110
- $this->_blankProduct['cp_product_url'] = '';
111
- $this->_blankProduct['cp_image_url'] = '';
112
- $this->_blankProduct['color'] = '';
113
- $this->_blankProduct['weight'] = '';
114
- for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
115
- $this->_blankProduct['cp_additional_image_'.$i] = '';
116
- }
117
-
118
- $specialExportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
119
- if(!empty($specialExportFields)) {
120
- foreach($specialExportFields as $field) {
121
- if (!empty($field['name'])) {
122
- $this->_blankProduct[preg_replace('/\W/', '', $field['name'])] = $field['value'];
123
- }
124
- }
125
- }
126
-
127
- try {
128
- $store = Mage::app()->getStore($this->_storeId);
129
- $this->_siteId = $store->getWebsiteId();
130
- $this->_customerGroupId = Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
131
- $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
132
- $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
133
- } catch (Exception $e) {
134
- die('Store=' . $this->_storeId . " probably does not exist.");
135
- }
136
-
137
- $this->buildCategoryTree();
138
-
139
- $this->_initCurrencyChange();
140
-
141
- $this->_initConfigurableAttributes();
142
-
143
- /** @var $mediaConfig Mage_Catalog_Model_Product_Media_Config */
144
- $mediaConfig = Mage::getSingleton('catalog/product_media_config');
145
- $this->_imageBaseUrl = $mediaConfig->getBaseMediaUrl();
146
-
147
- $this->_maxAdditionalImages = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber');
148
- $this->_exportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
149
- $this->_replaceFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
150
-
151
- $this->_parents = array();
152
- }
153
-
154
- /**
155
- * Build the category tree.
156
- */
157
- public function buildCategoryTree() {
158
- $this->_allCat = array();
159
-
160
- $categoryCollection = Mage::getModel('catalog/category')->getCollection()
161
- ->addAttributeToSelect('name')
162
- ->addAttributeToSort('path');
163
-
164
- foreach($categoryCollection as $category) {
165
- $path = $this->getCategory($category->getPath());
166
- if($path !== 0) {
167
- $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $path . '>' . $category->getName());
168
- } else {
169
- $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $category->getName());
170
- }
171
- }
172
- }
173
-
174
- /**
175
- * Get the category id from a path.
176
- * @param $key
177
- * @return int | string
178
- */
179
- private function getCategory($key) {
180
- $return = 0;
181
- if (strpos($key, '/') != false) {
182
- $tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
183
- if (isset($this->_allCat[$tmpKey])) {
184
- $return = $this->_allCat[$tmpKey];
185
- } else {
186
- $return = $this->getCategory($tmpKey);
187
- }
188
- }
189
- return $return;
190
- }
191
-
192
- /**
193
- * Initialize the configurableAttributes array.
194
- * Array(
195
- * [PRODUCT_ID] => ARRAY(
196
- * [ATTRIBUTE_CODE] => [FRONTEND_LABEL]
197
- * )
198
- * )
199
- */
200
- private function _initConfigurableAttributes() {
201
- $this->_configurableAttributes = array();
202
-
203
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
204
-
205
- $select = $connection->select()
206
- ->from(array('super_attribute' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')), array('attribute_id', 'product_id'))
207
- ->join(array('attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
208
- 'attribute.attribute_id = super_attribute.attribute_id',
209
- array('attribute_code', 'frontend_label')
210
- );
211
-
212
- $result = $connection->fetchAll($select);
213
-
214
- foreach($result as $attribute) {
215
- if(!isset($this->_configurableAttributes[$attribute['product_id']])) {
216
- $this->_configurableAttributes[$attribute['product_id']] = array();
217
- }
218
- $this->_configurableAttributes[$attribute['product_id']][$attribute['attribute_code']] = $attribute['frontend_label'];
219
- }
220
- }
221
-
222
- /**
223
- * Get an array of attribute codes for all configurable attributes of a product ID.
224
- *
225
- * @param int $productId
226
- * @return array
227
- */
228
- private function _getConfigurableAttributes($productId) {
229
- $attributeOptions = array();
230
- if(isset($this->_configurableAttributes[$productId])) {
231
- foreach($this->_configurableAttributes[$productId] as $attributeCode => $label) {
232
- $attributeOptions[] = $label;
233
- }
234
- }
235
- return $attributeOptions;
236
- }
237
-
238
  /**
239
  * Callback function used for the collection iterator.
240
  * The function receives an array containing the fetched row from the database.
241
  * Saves the product to export in the _productData array.
242
  * @param $args array
243
  */
244
- public function productCallback($args)
245
  {
246
- $product = Mage::getModel('catalog/product');
247
- $product->setData($args['row']);
248
-
249
- if($this->_onlyStockAndPriceData) {
250
- $result = $this->_getOnlyStockAndPriceData($product);
251
- } else {
252
- $this->_backendModel->afterLoad($product);
253
- $result = $this->_getFullProductData($product);
254
- }
255
-
256
- // instead of saving the result and creating the complete xml later,
257
- // the xml for the product is created and echoed right now to improve time and memory usage
258
- $productXml = new SimpleXMLElement('<product></product>');
259
- $this->_productToXml($result, $productXml);
260
- $dom = dom_import_simplexml($productXml);
261
- echo $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
262
- }
263
-
264
- /**
265
- * Get all attributes that need to be selected from the database.
266
- * @param $attributes array
267
- * @return array
268
- */
269
- private function _getAttributesForSelect($attributes) {
270
- $attributesToSelect = array(
271
- 'entity_id',
272
- 'sku',
273
- 'name',
274
- 'description',
275
- 'price',
276
- 'manufacturer',
277
- 'color',
278
- 'weight',
279
- 'media_gallery',
280
- 'url_key',
281
- 'url_path',
282
- 'image',
283
- 'type_id'
284
- );
285
-
286
- $attributeCodes = array();
287
-
288
- // save all available attribute codes
289
- foreach($attributes as $code => $attribute) {
290
- $attributeCodes[] = $code;
291
- }
292
-
293
- // add all attributes from the config if the attribute is a Magento attribute and it has
294
- // not already been added to the $attributesToSelect array
295
- foreach($this->_exportFields as $field) {
296
- $attrCode = $field['productattribute'];
297
- if(in_array($attrCode, $attributeCodes) && !in_array($attrCode, $attributesToSelect)) {
298
- $attributesToSelect[] = $attrCode;
299
- }
300
- }
301
-
302
- return $attributesToSelect;
303
-
304
  }
305
 
306
  /**
307
  * Export the products and return them as array.
308
- * @return array
309
  */
310
- private function _export() {
311
  $flatEnabled = false;
312
  if(class_exists('Mage_Core_Model_App_Emulation')) {
313
  /* @var $flatHelper Mage_Catalog_Helper_Product_Flat */
@@ -324,365 +79,65 @@ class CPExportHandler extends CPAbstractHandler {
324
  }
325
  }
326
 
327
- /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
328
- $collection = Mage::getModel('catalog/product')->getCollection();
329
- $attributes = $collection->getEntity()->loadAllAttributes()->getAttributesByCode();
330
-
331
- // only use the needed attributes instead of every available
332
- $attributeCodes = $this->_getAttributesForSelect($attributes);
333
 
334
- // addPriceData uses inner join to get the price data for a website_id and a customer_group id
335
- // so all products that are not associated to $this->_siteId and the customerGroupId (NOT LOGGED IN (0) by default)
336
- // are not included in this collection.
337
- // addPriceData is needed for getting the minimal price for bundels
338
- $collection
339
- ->addAttributeToSelect($attributeCodes, 'left')
340
- ->addPriceData($this->_customerGroupId, $this->_siteId)
341
- ->joinField('qty',
342
- 'cataloginventory/stock_item',
343
- 'qty',
344
- 'product_id=entity_id',
345
- '{{table}}.stock_id=1',
346
- 'left')
347
- ->joinField('min_sale_qty',
348
- 'cataloginventory/stock_item',
349
- 'min_sale_qty',
350
- 'product_id=entity_id',
351
- '{{table}}.stock_id=1',
352
- 'left')
353
- ->joinField('max_sale_qty',
354
- 'cataloginventory/stock_item',
355
- 'max_sale_qty',
356
- 'product_id=entity_id',
357
- '{{table}}.stock_id=1',
358
- 'left')
359
- ->joinField('is_in_stock',
360
- 'cataloginventory/stock_item',
361
- 'is_in_stock',
362
- 'product_id=entity_id',
363
- '{{table}}.stock_id=1',
364
- 'left')
365
- ->addAttributeToSort('type_id')
366
- ->setStoreId($this->_storeId);
367
 
368
- // add group price fields
369
- foreach($this->_exportFields as $field) {
370
- if(strpos($field['productattribute'], 'group_price') !== false) {
371
- $groupId = substr($field['productattribute'], 12);
372
- if(is_numeric($groupId)) {
373
- $collection->joinField('group_price_'.$groupId,
374
- 'catalog/product_index_price',
375
- 'group_price',
376
- 'entity_id=entity_id',
377
- '{{table}}.customer_group_id='.$groupId,
378
- 'left');
379
- }
380
  }
381
- }
382
 
383
- $this->_backendModel = $collection->getResource()->getAttribute('media_gallery')->getBackend();
384
- $this->_onlyStockAndPriceData = (Mage::app()->getRequest()->getParam('priceStock', '') === "true");
385
 
386
- /** @var $iterator Mage_Core_Model_Resource_Iterator */
387
- $iterator = Mage::getSingleton('core/resource_iterator');
388
- $iterator->walk($collection->getSelect(), array(array($this, 'productCallback')));
389
 
390
- // stop emulating admin store and set initial environment
391
- if ($flatEnabled) {
392
- $emulationModel->stopEnvironmentEmulation($initialEnvironmentInfo);
393
- }
394
- }
395
-
396
- /**
397
- * Get the current $item as array.
398
- * Returns Array(
399
- * [ATTRIBUTE_CODE] => [VALUE]
400
- * )
401
- * @param Mage_Catalog_Model_Product $item
402
- * @return array
403
- */
404
- private function _getFullProductData(Mage_Catalog_Model_Product $item) {
405
- $imageUrl = $this->_imageBaseUrl . $item->getImage();
406
-
407
- $isParent = 0;
408
- if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
409
- $isParent = 1;
410
- }
411
-
412
- $parentId = null;
413
- if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
414
- $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getId());
415
- $parentId = (is_array($parentId) && !empty($parentId)) ? $parentId[0] : null;
416
- }
417
-
418
- $configurableAttributes = array();
419
- if($parentId && isset($this->_variationThemes[$parentId])) {
420
- $configurableAttributes = $this->_variationThemes[$parentId];
421
- } else if($isParent && $parentId === null) {
422
- $configurableAttributes = $this->_getConfigurableAttributes($item->getId());
423
- $configurableAttributes = (!empty($configurableAttributes)) ? implode('|', $configurableAttributes) : '';
424
- $this->_variationThemes[$item->getId()] = $configurableAttributes;
425
- }
426
-
427
- // workaround... $item->getProductUrl() sometimes adds store code to url (e.g. <url>?___store=default)
428
- $productUrl = $this->_webUrl . $item->getUrlPath();
429
- $colorText = $item->getAttributeText('color');
430
-
431
- // set the value to the minimal price if the current product is a bundle, otherwise the product's price
432
- $calcPrice = ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ? Mage::getModel('bundle/product_price')->getTotalPrices($item, 'min', true, false) : $item->getPrice();
433
-
434
- $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$calcPrice);
435
- $price = ($rulePrice) ? $rulePrice : $calcPrice;
436
-
437
- $product = $this->_blankProduct;
438
-
439
- $product['entity_id'] = $item->getId();
440
- $product['sku'] = $item->getSku();
441
- $product['parent_id'] = $parentId;
442
- $product['variationTheme'] = $configurableAttributes;
443
- $product['name'] = $this->_getCleanedStringForXml($item->getName());
444
- $product['description'] = $this->_getCleanedStringForXml($item->getDescription());
445
-
446
- $product['price'] = $price;
447
- if($this->_currencyChange) {
448
- $product['price'] = round($product['price']*$this->_currencyChange, 2);
449
- }
450
-
451
- $product['categories'] = $this->_getCategoryInformation($item);
452
- $product['manufacturer'] = $this->_getCleanedStringForXml($item->getManufacturer());
453
- $product['manufacturer_name'] = $this->_getCleanedStringForXml($item->getAttributeText('manufacturer'));
454
- $product['cp_product_url'] = $productUrl;
455
- $product['cp_image_url'] = $imageUrl;
456
- $product['color'] = ($colorText) ? $this->_getCleanedStringForXml($colorText) : null;
457
- $product['weight'] = $item->getWeight();
458
-
459
- $product = array_merge($product, $this->_getAdditionalImages($item));
460
 
461
- $product['is_parent'] = $isParent;
 
 
 
462
 
463
- $this->_addExportFields($product, $item);
 
464
 
465
- if(!empty($this->_replaceFields) && !$isParent && $parentId !== null) {
466
- $this->_replaceFields($product, $parentId);
467
- }
468
-
469
- return $product;
470
- }
471
-
472
- /**
473
- * Get the additional images for a product
474
- * @param Mage_Catalog_Model_Product $product
475
- * @return array
476
- */
477
- private function _getAdditionalImages(Mage_Catalog_Model_Product $product) {
478
- $counter = 1;
479
- $productData = array();
480
- foreach ($product->getMediaGalleryImages() as $image) {
481
- // break if the maximum amount of additional images has been reached
482
- if ($counter > $this->_maxAdditionalImages) {
483
- break;
484
- }
485
-
486
- // ignore the base image; it has already been added
487
- if ($image->getFile() == $product->getImage()) {
488
- continue;
489
- }
490
-
491
- $productData['cp_additional_image_' . $counter] = $this->_imageBaseUrl . $image->getFile();
492
- $counter++;
493
- }
494
-
495
- return $productData;
496
- }
497
-
498
- /**
499
- * Add all fields to a product that need to be exported
500
- * @param $product
501
- * @param Mage_Catalog_Model_Product $item
502
- */
503
- private function _addExportFields(&$product, Mage_Catalog_Model_Product $item) {
504
- foreach($this->_exportFields as $field) {
505
- $code = $field['productattribute'];
506
- if(strpos($code, 'group_price') !== false) {
507
- $groupId = substr($code, 12);
508
- $customerGroup = Mage::getModel('customer/group')->load($groupId);
509
- $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
510
- $product['group_price_'.$groupCode] = $item->getData('group_price_'.$customerGroup->getId());
511
- } else {
512
- switch($code) {
513
- // ignore
514
- case 'parent_id':
515
- break;
516
- case 'qty':
517
- $product[$code] = $item->getQty();
518
- break;
519
- case 'stock_status':
520
- $product[$code] = $item->getIsInStock();
521
- break;
522
- case 'min_sale_qty':
523
- case 'max_sale_qty':
524
- case 'tax_class_id':
525
- $product[$code] = $item->getData($code);
526
- break;
527
- default:
528
- $attributeText = ($item->getResource()->getAttribute($code)) ? $item->getAttributeText($code) : false;
529
- if(is_array($attributeText)) {
530
- $attributeText = implode(',',$attributeText);
531
- }
532
- $product[$code] = ($attributeText) ? $this->_getCleanedStringForXml($attributeText) : $this->_getCleanedStringForXml($item->getData($code));
533
  }
534
  }
535
- }
536
- }
537
-
538
- /**
539
- * Replace all selected fields with the parent's values.
540
- * @param $product
541
- * @param $parentId
542
- */
543
- private function _replaceFields(&$product, $parentId) {
544
- $parent = $this->_getParentById($parentId);
545
- if($parent !== null && $parent->getId()) {
546
- $parentImages = $this->_getAdditionalImages($parent);
547
- foreach($this->_replaceFields as $field) {
548
- $code = $field['productattribute'];
549
- if(strpos($code, 'group_price') !== false) {
550
- $groupId = substr($code, 12);
551
- $customerGroup = Mage::getModel('customer/group')->load($groupId);
552
- $groupPrices = $parent->getData('group_price');
553
- foreach($groupPrices as $groupPrice) {
554
- if($groupPrice['cust_group'] == $groupId) {
555
- $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
556
- $product['group_price_'.$groupCode] = $groupPrice['price'];
557
- }
558
- }
559
- } else if(strpos($code, 'cp_additional_image') !== false && isset($parentImages[$code])) {
560
- $product[$code] = $parentImages[$code];
561
- } else {
562
- switch($code) {
563
- case 'categories':
564
- $product['categories'] = $this->_getCategoryInformation($parent);
565
- break;
566
- case 'cp_product_url':
567
- $product[$code] = $this->_webUrl . $parent->getUrlPath();
568
- break;
569
- case 'cp_image_url':
570
- $product[$code] = $this->_imageBaseUrl . $parent->getImage();
571
- break;
572
- case 'qty':
573
- $product[$code] = $parent->getStockItem()->getQty();
574
- break;
575
- case 'stock_status':
576
- $product[$code] = $parent->getStockItem()->getIsInStock();
577
- break;
578
- case 'min_sale_qty':
579
- $product[$code] = $parent->getStockItem()->getMinSaleQty();
580
- break;
581
- case 'max_sale_qty':
582
- $product[$code] = $parent->getStockItem()->getMaxSaleQty();
583
- break;
584
- case 'tax_class_id':
585
- $product[$code] = $parent->getData($code);
586
- break;
587
- default:
588
- $attributeText = ($parent->getResource()->getAttribute($code)) ? $parent->getAttributeText($code) : false;
589
- if(is_array($attributeText)) {
590
- $attributeText = implode(',',$attributeText);
591
- }
592
- $product[$code] = ($attributeText) ? $this->_getCleanedStringForXml($attributeText) : $this->_getCleanedStringForXml($parent->getData($code));
593
- }
594
- }
595
  }
596
- }
597
- }
598
 
599
- /**
600
- * Get only the stock and price data for a product as array. Attributes: entity_id, sku, price, qty.
601
- * Array(
602
- * [ATTRIBUTE_CODE] => [VALUE]
603
- * )
604
- * @param Mage_Catalog_Model_Product $item
605
- * @return array
606
- */
607
- private function _getOnlyStockAndPriceData(Mage_Catalog_Model_Product $item) {
608
- $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$item->getPrice());
609
- $price = ($rulePrice) ? $rulePrice : $item->getPrice();
610
-
611
- $product['entity_id'] = $item->getId();
612
- $product['sku'] = $item->getSku();
613
- $product['price'] = $price;
614
- if($this->_currencyChange) {
615
- $product['price'] = round($product['price']*$this->_currencyChange, 2);
616
  }
617
 
618
- $product['qty'] = $item->getQty();
619
-
620
- return $product;
621
- }
622
-
623
- /**
624
- * Adds the values of the $product array to the $xml structure.
625
- * @param array $product
626
- * @param SimpleXMLElement $xml
627
- */
628
- private function _productToXml(array $product, SimpleXMLElement $xml) {
629
- foreach($product as $code => $value) {
630
- if(is_array($value)) {
631
- $node = $xml->addChild($code);
632
- $this->_productToXml($value, $node);
633
- } else if (is_string($value) || is_numeric($value) || is_bool($value) || is_null($value)) {
634
- $xml->addChild($code, htmlspecialchars($value));
635
- }
636
- }
637
- }
638
-
639
- /**
640
- * Get the category information for a product.
641
- * @param Mage_Catalog_Model_Product $product
642
- * @return string
643
- */
644
- private function _getCategoryInformation(Mage_Catalog_Model_Product $product) {
645
- $arrPath = array();
646
-
647
- /** @var $category Mage_Catalog_Model_Category */
648
- foreach($product->getCategoryCollection() as $category) {
649
- $arrPath[] = $this->_allCat[$category->getPath()];
650
- }
651
-
652
- return ltrim(implode(',', $arrPath), '>');
653
- }
654
-
655
- /**
656
- * Get a product by its id. Save the loaded product to an array to cache it.
657
- * It is used for parent products only so these products do not need to be loaded by each
658
- * of its child products.
659
- * @param $parentId
660
- * @return mixed
661
- */
662
- private function _getParentById($parentId) {
663
- if(!isset($this->_parents[$parentId])) {
664
- $parent = Mage::getModel('catalog/product')->load($parentId);
665
- $this->_parents[$parentId] = ($parent->getId()) ? $parent : null;
666
  }
667
- return $this->_parents[$parentId];
668
- }
669
-
670
- /**
671
- * Clean a string for usage in XML.
672
- * @param $string
673
- * @return mixed
674
- */
675
- private function _getCleanedStringForXml($string) {
676
- return $this->_utf8ForXml(html_entity_decode($string));
677
- }
678
-
679
- /**
680
- * Replace all UTF-8 characters that are not allowed in XML with a space.
681
- * @param $string
682
- * @return mixed
683
- */
684
- private function _utf8ForXml($string) {
685
- return preg_replace ('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $string);
686
  }
687
  }
688
 
8
  class CPExportHandler extends CPAbstractHandler {
9
 
10
  private $_storeId;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  /**
13
  * Handle status event
15
  */
16
  public function handle() {
17
  ini_set('max_execution_time', 7200);
 
18
  $store = Mage::app()->getRequest()->getParam('store', null);
 
 
19
  try {
20
  $this->_storeId = Mage::app()->getStore($store)->getId();
21
  } catch(Exception $e) {
23
  return;
24
  }
25
 
 
 
26
  // start the xml output right now to output the exported products as soon as
27
  // each product has been processed
28
  header('Content-Type: text/xml; charset=utf-8');
38
  * Display an error message based on current export (and therefore display) method
39
  * if an exception has occured during Mage::app()->getStore().
40
  */
41
+ protected function _handleStoreException() {
42
  // The exception thrown by Mage::app()->getStore() has an empty message ...
43
  $xml = new SimpleXMLElement('<root></root>');
44
  $xml->addChild('error', 'Error retrieving store.');
47
  exit();
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Callback function used for the collection iterator.
52
  * The function receives an array containing the fetched row from the database.
53
  * Saves the product to export in the _productData array.
54
  * @param $args array
55
  */
56
+ public function indexedExportCallback($args)
57
  {
58
+ $row = $args['row'];
59
+ echo $row['product_data'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  /**
63
  * Export the products and return them as array.
 
64
  */
65
+ protected function _export() {
66
  $flatEnabled = false;
67
  if(class_exists('Mage_Core_Model_App_Emulation')) {
68
  /* @var $flatHelper Mage_Catalog_Helper_Product_Flat */
79
  }
80
  }
81
 
82
+ /** @var $exportHelper Channelpilotsolutions_Channelpilot_Helper_Export */
83
+ $exportHelper = Mage::helper('channelpilot/export');
84
+ $exportMethod = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_export_method');
 
 
 
85
 
86
+ // live export
87
+ if(
88
+ $exportMethod == Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Exportmethod::EXPORT_METHOD_LIVE &&
89
+ $exportHelper->getAttributeCount() <= Channelpilotsolutions_Channelpilot_Helper_Export::MAX_ATTRIBUTE_COUNT_FOR_LIVE_EXPORT
90
+ ) {
91
+ $collection = $exportHelper->getProductCollection($this->_storeId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ // collection could not be loaded
94
+ if($collection === null) {
95
+ return null;
 
 
 
 
 
 
 
 
 
96
  }
 
97
 
98
+ $chunkSize = $exportHelper->getChunkSize();
99
+ $pages = ceil($collection->getSize() / $chunkSize);
100
 
101
+ $collection->setPageSize($chunkSize);
 
 
102
 
103
+ $backendModel = $exportHelper->getBackendModel();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
+ for($i = 1; $i <= $pages; $i++) {
106
+ $collection->clear();
107
+ $collection->setCurPage($i);
108
+ foreach($collection as $item) {
109
 
110
+ $backendModel->afterLoad($item);
111
+ $productData = $exportHelper->getFullProductData($item);
112
 
113
+ $productXml = new SimpleXMLElement('<product></product>');
114
+ $exportHelper->productToXml($productData, $productXml);
115
+ $dom = dom_import_simplexml($productXml);
116
+ echo $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
  }
119
+ } else { // indexed export
120
+ $collection = Mage::getModel('channelpilot/feedexport_indexer')
121
+ ->getCollection()
122
+ ->addFieldToFilter('store_id', array('eq' => $this->_storeId));
123
+
124
+ // output an error in case the collection is empty / no data found for store
125
+ if($collection->getSize() == 0) {
126
+ $xml = new SimpleXMLElement('<error></error>');
127
+ $xml->addChild('message', 'No data found for store '.$this->_storeId.' in index table. Please reindex the data.');
128
+ $dom = dom_import_simplexml($xml);
129
+ echo $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
130
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
 
 
132
 
133
+ $iterator = Mage::getSingleton('core/resource_iterator');
134
+ $iterator->walk($collection->getSelect(), array(array($this, 'indexedExportCallback')));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
+ // stop emulating admin store and set initial environment
138
+ if ($flatEnabled) {
139
+ $emulationModel->stopEnvironmentEmulation($initialEnvironmentInfo);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
  }
143
 
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php CHANGED
@@ -44,7 +44,24 @@ class CPNewPriceHandler extends CPAbstractHandler {
44
  CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update: " . $e->getMessage());
45
  }
46
  }
 
47
  self::hookResult($result->moreAvailable, $unknownArticles);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  } else {
49
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no priceId set for method: " . $methodParam, "no priceId set for method: " . $methodParam);
50
  }
@@ -63,7 +80,7 @@ class CPNewPriceHandler extends CPAbstractHandler {
63
  * @param array $unknownArticles
64
  * @return mixed
65
  */
66
- private function _manageArticlePrices($result, $token, &$unknownArticles) {
67
  $lastPriceUpdate = null;
68
 
69
  $shopId = self::getShopId($token);
@@ -76,64 +93,75 @@ class CPNewPriceHandler extends CPAbstractHandler {
76
  $taxCalculation = Mage::getModel('tax/calculation');
77
  $taxRateRequest = $taxCalculation->getRateRequest(null, null, null, $store);
78
  $taxRates = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  foreach ($result->managedArticlePrices as $articlePrice) {
80
  $id = $articlePrice->article->id;
81
- $articleNumber = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
82
- $product = null;
83
- switch ($articleNumber) {
84
- case 'product_id':
85
- $product = Mage::getSingleton('catalog/product')->load($id);
 
 
 
 
 
 
 
 
 
 
86
  break;
87
- case 'sku':
88
- $product = Mage::getSingleton('catalog/product')->loadByAttribute('sku', $id);
 
89
  break;
90
  default:
91
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Error by choosing article number '$articleNumber'", "Error by choosing article number '$articleNumber'");
92
  break;
93
  }
94
- if (empty($product)) {
95
- $unknownArticles[] = $id;
96
- } else {
97
- if ($useNet && empty($taxRates[$product->getTaxClassId()])) {
98
- $taxRates[$product->getTaxClassId()] = $taxCalculation->getRate($taxRateRequest->setProductClassId($product->getTaxClassId()));
99
- }
100
- $price = $useNet ? $articlePrice->price / (($taxRates[$product->getTaxClassId()] / 100) + 1) : $articlePrice->price;
101
- $field = Mage::getStoreConfig('channelpilot_pricecontrol/general_prices/channelpilot_generalPriceField');
102
- switch ($field) {
103
- case 'price':
104
- Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->entityId), array('price' => round($price, 4)), $shopId);
105
- break;
106
- case 'special_price':
107
- Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->entityId), array('special_price' => round($price, 4)), $shopId);
108
- break;
109
- default:
110
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, " Error by choosing price field '$field'", "Error by choosing price field '$field'");
111
- break;
112
- }
113
- }
114
  $lastPriceUpdate = $articlePrice->lastUpdate;
115
  }
116
 
117
-
118
- /**
119
- * reindex prices
120
- *
121
- * 1 = Product Attributes
122
- * 2 = Product prices
123
- * 3 = Catalog URL Rewrites
124
- * 4 = Product Flat Data
125
- * 5 = Category Flat Data
126
- * 6 = Category Products
127
- * 7 = Catalog Search Index
128
- * 8 = Stock Status
129
- * 9 = Tag Aggregation Data
130
- */
131
- Mage::getModel('index/process')->load(2)->reindexEverything();
132
-
133
  return $lastPriceUpdate;
134
  }
135
 
136
- private function hookResult($moreAvailable, $errorArticles = null) {
137
  $hook = new CPHookResponse();
138
  $hook->resultCode = CPResultCodes::SUCCESS;
139
  $hook->resultMessage = "NEW PRICE HOOK SUCCESS";
@@ -143,10 +171,23 @@ class CPNewPriceHandler extends CPAbstractHandler {
143
  } else {
144
  $hook->unknownArticles = $errorArticles;
145
  }
146
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
- private function getLastPriceUpdate($priceId) {
150
  $cpPrices = Mage::getModel('channelpilot/prices')->load($priceId);
151
  try {
152
  if ($cpPrices && $cpPrices->getId()) {
44
  CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update: " . $e->getMessage());
45
  }
46
  }
47
+
48
  self::hookResult($result->moreAvailable, $unknownArticles);
49
+
50
+ /**
51
+ * reindex prices
52
+ *
53
+ * 1 = Product Attributes
54
+ * 2 = Product prices
55
+ * 3 = Catalog URL Rewrites
56
+ * 4 = Product Flat Data
57
+ * 5 = Category Flat Data
58
+ * 6 = Category Products
59
+ * 7 = Catalog Search Index
60
+ * 8 = Stock Status
61
+ * 9 = Tag Aggregation Data
62
+ */
63
+ Mage::getModel('index/process')->load(2)->reindexEverything();
64
+ exit();
65
  } else {
66
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no priceId set for method: " . $methodParam, "no priceId set for method: " . $methodParam);
67
  }
80
  * @param array $unknownArticles
81
  * @return mixed
82
  */
83
+ protected function _manageArticlePrices($result, $token, &$unknownArticles) {
84
  $lastPriceUpdate = null;
85
 
86
  $shopId = self::getShopId($token);
93
  $taxCalculation = Mage::getModel('tax/calculation');
94
  $taxRateRequest = $taxCalculation->getRateRequest(null, null, null, $store);
95
  $taxRates = array();
96
+
97
+ $field = Mage::getStoreConfig('channelpilot_pricecontrol/general_prices/channelpilot_generalPriceField');
98
+
99
+ if(!in_array($field, array('price', 'special_price'))) {
100
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, " Error by choosing price field '$field'", "Error by choosing price field '$field'");
101
+ }
102
+
103
+ $resource = Mage::getModel('catalog/product')->getResource();
104
+
105
+ // in case the prices are net prices, store the tax rate for every product
106
+ if($useNet) {
107
+ $productIds = array();
108
+
109
+ // get every used product entity_id
110
+ foreach ($result->managedArticlePrices as $articlePrice) {
111
+ $id = $articlePrice->article->id;
112
+ if($field == 'sku') {
113
+ $id = Mage::getModel('catalog/product')->getIdBySku($articlePrice->article->id);
114
+ }
115
+ $productIds[] = $id;
116
+ }
117
+
118
+ // create a collection selecting the fields tax_class_id, entity_id and sku
119
+ // for all products from $result->managedArticlePrices
120
+ $collection = Mage::getModel('catalog/product')->getCollection()
121
+ ->addAttributeToSelect(array('tax_class_id', 'entity_id', 'sku'))
122
+ ->addFieldToFilter($field, array('in' => $productIds));
123
+
124
+
125
+ // store the tax rate for every product
126
+ /** @var $product Mage_Catalog_Model_Product */
127
+ foreach($collection as $product) {
128
+ $taxRates[$product->getId()] = $taxCalculation->getRate($taxRateRequest->setProductClassId($product->getTaxClassId()));
129
+ }
130
+ }
131
+
132
  foreach ($result->managedArticlePrices as $articlePrice) {
133
  $id = $articlePrice->article->id;
134
+ if($field == 'sku') {
135
+ $id = Mage::getModel('catalog/product')->getIdBySku($articlePrice->article->id);
136
+ }
137
+
138
+ $product = Mage::getModel('catalog/product')
139
+ ->unsetData()
140
+ ->setId($id)
141
+ ->setStoreId($shopId);
142
+
143
+ $price = $useNet ? $articlePrice->price / (($taxRates[$id] / 100) + 1) : $articlePrice->price;
144
+ $field = Mage::getStoreConfig('channelpilot_pricecontrol/general_prices/channelpilot_generalPriceField');
145
+ switch ($field) {
146
+ case 'price':
147
+ $product->setPrice($price);
148
+ $resource->saveAttribute($product, 'price');
149
  break;
150
+ case 'special_price':
151
+ $product->setSpecialPrice($price);
152
+ $resource->saveAttribute($product, 'special_price');
153
  break;
154
  default:
155
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, " Error by choosing price field '$field'", "Error by choosing price field '$field'");
156
  break;
157
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  $lastPriceUpdate = $articlePrice->lastUpdate;
159
  }
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  return $lastPriceUpdate;
162
  }
163
 
164
+ protected function hookResult($moreAvailable, $errorArticles = null) {
165
  $hook = new CPHookResponse();
166
  $hook->resultCode = CPResultCodes::SUCCESS;
167
  $hook->resultMessage = "NEW PRICE HOOK SUCCESS";
171
  } else {
172
  $hook->unknownArticles = $errorArticles;
173
  }
174
+
175
+ // Turn off output buffering
176
+ ini_set('output_buffering', 'off');
177
+ // Turn off PHP output compression
178
+ ini_set('zlib.output_compression', false);
179
+
180
+ // Implicitly flush the buffer(s)
181
+ ini_set('implicit_flush', true);
182
+ ob_implicit_flush(true);
183
+
184
+ header(self::defaultHeader);
185
+ print_r(json_encode($hook));
186
+
187
+ ob_flush();
188
  }
189
 
190
+ protected function getLastPriceUpdate($priceId) {
191
  $cpPrices = Mage::getModel('channelpilot/prices')->load($priceId);
192
  try {
193
  if ($cpPrices && $cpPrices->getId()) {
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPOrderHandler.php CHANGED
@@ -7,10 +7,11 @@
7
  */
8
  class CPOrderHandler extends CPAbstractHandler {
9
 
10
- var $shopId;
11
- var $store;
12
- var $websiteId;
13
- var $ordersImported;
 
14
 
15
  /**
16
  * Handle order event
@@ -19,7 +20,6 @@ class CPOrderHandler extends CPAbstractHandler {
19
  $token = Mage::app()->getRequest()->getParam('token', false);
20
  $this->ordersImported = array();
21
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
22
- self::checkConfig();
23
  $merchantId = self::getMerchantId($token);
24
  try {
25
  $this->shopId = self::getShopId($token);
@@ -62,12 +62,12 @@ class CPOrderHandler extends CPAbstractHandler {
62
  if (empty($token)) {
63
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
64
  } else {
65
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $_GET['token'], "ip not allowed by token: " . $_GET['token']);
66
  }
67
  }
68
  }
69
 
70
- private function hookResult($moreAvailable) {
71
  $hook = new CPHookResponse();
72
  $hook->resultCode = CPResultCodes::SUCCESS;
73
  $hook->resultMessage = "ORDERS HOOK SUCCESS";
@@ -75,7 +75,7 @@ class CPOrderHandler extends CPAbstractHandler {
75
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
76
  }
77
 
78
- private function importOrders($apiOrders) {
79
  $orders = array();
80
  foreach ($apiOrders as $apiOrder) {
81
  $apiOrder = $this->_cleanOrderOfMultipleRowsOfSameItem($apiOrder);
@@ -84,13 +84,14 @@ class CPOrderHandler extends CPAbstractHandler {
84
  return $orders;
85
  }
86
 
87
- private function _getQuote($apiOrder) {
88
  try {
89
  $useAdminMode = Mage::getStoreConfigFlag('channelpilot_marketplace/channelpilot_marketplace/use_admin_mode');
90
  /** @var $quote Mage_Sales_Model_Quote */
91
  $quote = ($useAdminMode) ? Mage::getSingleton('adminhtml/session_quote')->getQuote()->setStoreId($this->shopId) : Mage::getModel('sales/quote')->setStoreId($this->shopId);
92
  $customer = self::getCustomer($apiOrder);
93
  $quote->assignCustomer($customer);
 
94
 
95
  $useEmulation = false;
96
  if($useAdminMode && class_exists('Mage_Core_Model_App_Emulation')) {
@@ -121,14 +122,78 @@ class CPOrderHandler extends CPAbstractHandler {
121
  $shippingAddress->setCompany($apiOrder->addressDelivery->company);
122
  }
123
 
124
- $shippingAddress
125
- ->setCollectShippingRates(true)
126
- ->collectShippingRates()
127
- ->setShippingMethod($apiOrder->shipping->typeId)
128
- ->setPaymentMethod($apiOrder->payment->typeId);
129
- $quote->setShippingAddress($shippingAddress);
130
 
 
 
 
 
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  if (strpos($apiOrder->payment->typeId, 'cp_mp') === false) {
133
  $quote->getPayment()->importData(array('method' => $apiOrder->payment->typeId));
134
  } else {
@@ -161,7 +226,7 @@ class CPOrderHandler extends CPAbstractHandler {
161
  * @param object $apiOrder
162
  * @return object
163
  */
164
- private function _cleanOrderOfMultipleRowsOfSameItem($apiOrder) {
165
  $temp = array();
166
 
167
  foreach ($apiOrder->itemsOrdered as $orderItem) {
@@ -203,7 +268,7 @@ class CPOrderHandler extends CPAbstractHandler {
203
  return $apiOrder;
204
  }
205
 
206
- private function importOrder($apiOrder) {
207
  $orderId = self::getOrderId($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
208
  if (!empty($orderId)) {
209
  $order = Mage::getModel('sales/order')->load($orderId);
@@ -227,9 +292,56 @@ class CPOrderHandler extends CPAbstractHandler {
227
 
228
  $quote->collectTotals()->save();
229
 
230
- $service = Mage::getModel('sales/service_quote', $quote);
231
- $service->submitAll();
232
- $order = $service->getOrder();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  $apiOrder->orderHeader->orderId = $order->getIncrementId();
234
 
235
  try {
@@ -249,13 +361,13 @@ class CPOrderHandler extends CPAbstractHandler {
249
  Mage::app('admin');
250
  $order->delete();
251
  CPErrorHandler::logError("Exception during insert order \n" . $e->getMessage() . "\n" . $e->getTraceAsString());
 
252
  $apiOrder->orderHeader->status->hasError = true;
253
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert order: " . $e->getMessage();
254
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
255
  return $apiOrder;
256
  }
257
 
258
- $items = $order->getAllItems();
259
  $orderItemsResponse = array();
260
  try {
261
  foreach ($items as $item) {
@@ -297,6 +409,7 @@ class CPOrderHandler extends CPAbstractHandler {
297
  Mage::app('admin');
298
  $order->delete();
299
  CPErrorHandler::logError("Exception during insert order item: " . $e->getMessage() . "\n" . $e->getTraceAsString());
 
300
  $apiOrder->orderHeader->status->hasError = true;
301
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert into: " . $e->getMessage();
302
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
@@ -306,15 +419,12 @@ class CPOrderHandler extends CPAbstractHandler {
306
  }
307
  }
308
  } catch (Exception $e) {
309
- $collection = Mage::getModel('channelpilot/order_item')->getCollection()
310
- ->addFieldToFilter('order_id', array('eq' => $order->getId()));
311
- $collection->walk('delete');
312
- $marketplaceOrder = Mage::getModel('channelpilot/order')->load($order->getId());
313
- $marketplaceOrder->delete();
314
  Mage::register('isSecureArea', true);
315
  Mage::app('admin');
316
  $order->delete();
317
  CPErrorHandler::logError("Exception during insert order" . $e->getMessage() . "\n" . $e->getTraceAsString());
 
318
  $apiOrder->orderHeader->status->hasError = true;
319
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert order item: " . $e->getMessage();
320
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
@@ -359,7 +469,12 @@ class CPOrderHandler extends CPAbstractHandler {
359
 
360
  $order->save();
361
  } catch (Exception $e) {
 
 
 
 
362
  CPErrorHandler::logError("Exception during importOrder: " . $e->getMessage() . "\n" . $e->getTraceAsString());
 
363
  $apiOrder->orderHeader->status->hasError = true;
364
  $apiOrder->orderHeader->status->errorMessage = "Exception during importOrder: " . $e->getMessage();
365
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
@@ -372,7 +487,7 @@ class CPOrderHandler extends CPAbstractHandler {
372
  *
373
  * @param type $id
374
  */
375
- private function getProduct($id) {
376
  $selectedArticleId = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
377
  $product = null;
378
  switch ($selectedArticleId) {
@@ -397,7 +512,7 @@ class CPOrderHandler extends CPAbstractHandler {
397
  return $product;
398
  }
399
 
400
- private function getCustomer($apiOrder) {
401
  $customer = Mage::getModel('customer/customer')
402
  ->setWebsiteId($this->websiteId)
403
  ->loadByEmail(CustomerFunctions::getUserName($apiOrder->customer->email));
@@ -412,9 +527,11 @@ class CPOrderHandler extends CPAbstractHandler {
412
  $customer->firstname = $apiOrder->customer->nameFirst;
413
  $customer->lastname = $apiOrder->customer->nameLast;
414
  $customer->email = $apiOrder->customer->email;
415
- foreach ($apiOrder->customer->customerGroups as $userGroup) {
416
- $customer->setData('group_id', $userGroup->id);
417
- }
 
 
418
  if ($apiOrder->addressInvoice->genderId == 1) {
419
  $customer->setGender(
420
  Mage::getResourceModel('customer/customer')
@@ -559,7 +676,7 @@ class CPOrderHandler extends CPAbstractHandler {
559
  * @param type $apiOrder
560
  * @return boolean
561
  */
562
- private function getOrderItems($apiOrder) {
563
  $dbOrderItems = array();
564
 
565
  $itemCollection = Mage::getModel('channelpilot/order_item')->getCollection()
@@ -586,12 +703,12 @@ class CPOrderHandler extends CPAbstractHandler {
586
  return $apiOrder;
587
  }
588
 
589
- private function getOrderId($externalOrderId, $source) {
590
  $order = Mage::getModel('channelpilot/order')->loadByMarketplaceOrderIdAndMarketplace($externalOrderId, $source);
591
  return ($order && $order->getId()) ? $order->getId() : null;
592
  }
593
 
594
- private function deleteCPOrder($orderId) {
595
  $collection = Mage::getModel('channelpilot/order_item')->getCollection()
596
  ->addFieldToFilter('order_id', array('eq' => $orderId));
597
  $collection->walk('delete');
@@ -601,7 +718,7 @@ class CPOrderHandler extends CPAbstractHandler {
601
  $collection->walk('delete');
602
  }
603
 
604
- private function getOrdersFromDb() {
605
  $orders = array();
606
 
607
  $collection = Mage::getModel('channelpilot/order_item')->getCollection()
7
  */
8
  class CPOrderHandler extends CPAbstractHandler {
9
 
10
+ protected $shopId;
11
+ protected $store;
12
+ protected $websiteId;
13
+ protected $ordersImported;
14
+ protected $_salesOrderTaxId;
15
 
16
  /**
17
  * Handle order event
20
  $token = Mage::app()->getRequest()->getParam('token', false);
21
  $this->ordersImported = array();
22
  if ($token && self::isIpAllowedViaSecurityToken($token)) {
 
23
  $merchantId = self::getMerchantId($token);
24
  try {
25
  $this->shopId = self::getShopId($token);
62
  if (empty($token)) {
63
  CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
64
  } else {
65
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
66
  }
67
  }
68
  }
69
 
70
+ protected function hookResult($moreAvailable) {
71
  $hook = new CPHookResponse();
72
  $hook->resultCode = CPResultCodes::SUCCESS;
73
  $hook->resultMessage = "ORDERS HOOK SUCCESS";
75
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
76
  }
77
 
78
+ protected function importOrders($apiOrders) {
79
  $orders = array();
80
  foreach ($apiOrders as $apiOrder) {
81
  $apiOrder = $this->_cleanOrderOfMultipleRowsOfSameItem($apiOrder);
84
  return $orders;
85
  }
86
 
87
+ protected function _getQuote($apiOrder) {
88
  try {
89
  $useAdminMode = Mage::getStoreConfigFlag('channelpilot_marketplace/channelpilot_marketplace/use_admin_mode');
90
  /** @var $quote Mage_Sales_Model_Quote */
91
  $quote = ($useAdminMode) ? Mage::getSingleton('adminhtml/session_quote')->getQuote()->setStoreId($this->shopId) : Mage::getModel('sales/quote')->setStoreId($this->shopId);
92
  $customer = self::getCustomer($apiOrder);
93
  $quote->assignCustomer($customer);
94
+ $quote->removeAllItems();
95
 
96
  $useEmulation = false;
97
  if($useAdminMode && class_exists('Mage_Core_Model_App_Emulation')) {
122
  $shippingAddress->setCompany($apiOrder->addressDelivery->company);
123
  }
124
 
125
+ $quote->save();
 
 
 
 
 
126
 
127
+ // set total values
128
+ // total gross
129
+ $quote->setGrandTotal($apiOrder->summary->totalSumOrder->gross);
130
+ $quote->setBaseGrandTotal($apiOrder->summary->totalSumOrder->gross);
131
 
132
+ // net
133
+ $quote->setSubtotal($apiOrder->summary->totalSumOrder->net);
134
+ $quote->setBaseSubtotal($apiOrder->summary->totalSumOrder->net);
135
+ $quote->setSubtotalWithDiscount($apiOrder->summary->totalSumOrder->net);
136
+ $quote->setBaseSubtotalWithDiscount($apiOrder->summary->totalSumOrder->net);
137
+
138
+ // set item values
139
+ /** @var $item Mage_Sales_Model_Quote_Item */
140
+ foreach($quote->getAllItems() as $item) {
141
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
142
+ if ($orderItem->article->id == $item->getSku() || $orderItem->article->id == $item->getProductId()) {
143
+ // net - single (Magento calculates the net prices so use gross values here ...)
144
+ $item->setPrice($orderItem->costsSingle->gross);
145
+ $item->setBasePrice($orderItem->costsSingle->gross);
146
+ $item->setCustomPrice($orderItem->costsSingle->gross);
147
+
148
+ // single gross
149
+ $item->setOriginalCustomPrice($orderItem->costsSingle->gross);
150
+ $item->setPriceInclTax($orderItem->costsSingle->gross);
151
+ $item->setBasePriceInclTax($orderItem->costsSingle->gross);
152
+
153
+ // tax
154
+ $item->setTaxPercent($orderItem->costsTotal->taxRate);
155
+ $item->setTaxAmount($orderItem->costsTotal->tax);
156
+ $item->setBaseTaxAmount($orderItem->costsTotal->tax);
157
+
158
+ // total net
159
+ $item->setRowTotal($orderItem->costsTotal->gross);
160
+ $item->setBaseRowTotal($orderItem->costsTotal->gross);
161
+
162
+ // total gross
163
+ $item->setRowTotalInclTax($orderItem->costsTotal->gross);
164
+ $item->setBaseRowTotalInclTax($orderItem->costsTotal->gross);
165
+
166
+ $item->save();
167
+ }
168
+ }
169
+ }
170
+
171
+ // set shipping amount and recollect shipping rates based on the values from the marketplace
172
+ $quote->getShippingAddress()->setShippingMethod($apiOrder->shipping->typeId);
173
+ $quote->getShippingAddress()->setCollectShippingRates(true);
174
+ $quote->getShippingAddress()->collectShippingRates();
175
+
176
+ /** @var $address Mage_Sales_Model_Quote_Address */
177
+ $address = $quote->getShippingAddress();
178
+ $shippingValues = $apiOrder->shipping;
179
+ $shippingAmount = $shippingValues->costs->gross;
180
+
181
+ $address->setShippingAmount($shippingValues->costs->gross);
182
+ $address->setBaseShippingAmount($shippingValues->costs->gross);
183
+
184
+ $rates = $address->collectShippingRates()->getGroupedAllShippingRates();
185
+
186
+ foreach($rates as $carrier) {
187
+ foreach($carrier as $rate) {
188
+ $rate->setPrice($shippingAmount);
189
+ $rate->save();
190
+ }
191
+ }
192
+
193
+ $address->setCollectShippingRates(false);
194
+ $address->save();
195
+
196
+ $quote->getPayment()->setMethod($apiOrder->payment->typeId);
197
  if (strpos($apiOrder->payment->typeId, 'cp_mp') === false) {
198
  $quote->getPayment()->importData(array('method' => $apiOrder->payment->typeId));
199
  } else {
226
  * @param object $apiOrder
227
  * @return object
228
  */
229
+ protected function _cleanOrderOfMultipleRowsOfSameItem($apiOrder) {
230
  $temp = array();
231
 
232
  foreach ($apiOrder->itemsOrdered as $orderItem) {
268
  return $apiOrder;
269
  }
270
 
271
+ protected function importOrder($apiOrder) {
272
  $orderId = self::getOrderId($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
273
  if (!empty($orderId)) {
274
  $order = Mage::getModel('sales/order')->load($orderId);
292
 
293
  $quote->collectTotals()->save();
294
 
295
+ // check if an error occured during the creation of an order
296
+ try {
297
+ /** @var $service Mage_Sales_Model_Service_Quote */
298
+ $service = Mage::getModel('sales/service_quote', $quote);
299
+ $service->submitAll();
300
+ } catch(Exception $e) {
301
+ CPErrorHandler::logError("Exception in importOrder: ".$e->getMessage());
302
+ $apiOrder->orderHeader->status->hasError = true;
303
+ $apiOrder->orderHeader->status->errorMessage = "Exception in importOrder: ".$e->getMessage();
304
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
305
+ return $apiOrder;
306
+ }
307
+
308
+ /** @var $order Mage_Sales_Model_Order */
309
+ $order = $service->getOrder();
310
+ $items = $order->getAllItems();
311
+
312
+ // check if the order has items and the amount of items matches the amount from the seller api
313
+ if(count($items) == 0 || count($apiOrder->itemsOrdered) != count($items)) {
314
+ Mage::register('isSecureArea', true);
315
+ Mage::app('admin');
316
+ $order->delete();
317
+
318
+ $articleIds = array();
319
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
320
+ $articleIds[] = $orderItem->article->id;
321
+ }
322
+
323
+ $idField = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
324
+
325
+ $orderItemIds = array();
326
+ foreach($items as $item) {
327
+ $orderItemIds[] = ($idField == 'product_id') ? $item->getProductId() : $item->getSku();
328
+ }
329
+
330
+ $articleCount = count($articleIds);
331
+ $orderItemCount = count($orderItemIds);
332
+
333
+ $articleIds = implode(',', $articleIds);
334
+ $orderItemIds = implode(',', $orderItemIds);
335
+
336
+ $msg = "Order items is empty or does not match the amount of items sent by the seller api. Ordered Items (seller api) (".$articleCount."): " . $articleIds . " - ordered items (quote) (".$orderItemCount."): " . $orderItemIds . " - current id field: ".$idField;
337
+
338
+ CPErrorHandler::logError($msg);
339
+ $apiOrder->orderHeader->status->hasError = true;
340
+ $apiOrder->orderHeader->status->errorMessage = $msg;
341
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
342
+ return $apiOrder;
343
+ }
344
+
345
  $apiOrder->orderHeader->orderId = $order->getIncrementId();
346
 
347
  try {
361
  Mage::app('admin');
362
  $order->delete();
363
  CPErrorHandler::logError("Exception during insert order \n" . $e->getMessage() . "\n" . $e->getTraceAsString());
364
+ $apiOrder->orderHeader->orderId = null;
365
  $apiOrder->orderHeader->status->hasError = true;
366
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert order: " . $e->getMessage();
367
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
368
  return $apiOrder;
369
  }
370
 
 
371
  $orderItemsResponse = array();
372
  try {
373
  foreach ($items as $item) {
409
  Mage::app('admin');
410
  $order->delete();
411
  CPErrorHandler::logError("Exception during insert order item: " . $e->getMessage() . "\n" . $e->getTraceAsString());
412
+ $apiOrder->orderHeader->orderId = null;
413
  $apiOrder->orderHeader->status->hasError = true;
414
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert into: " . $e->getMessage();
415
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
419
  }
420
  }
421
  } catch (Exception $e) {
422
+ self::deleteCPOrder($order->getId());
 
 
 
 
423
  Mage::register('isSecureArea', true);
424
  Mage::app('admin');
425
  $order->delete();
426
  CPErrorHandler::logError("Exception during insert order" . $e->getMessage() . "\n" . $e->getTraceAsString());
427
+ $apiOrder->orderHeader->orderId = null;
428
  $apiOrder->orderHeader->status->hasError = true;
429
  $apiOrder->orderHeader->status->errorMessage = "Exception during insert order item: " . $e->getMessage();
430
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
469
 
470
  $order->save();
471
  } catch (Exception $e) {
472
+ self::deleteCPOrder($order->getId());
473
+ Mage::register('isSecureArea', true);
474
+ Mage::app('admin');
475
+ $order->delete();
476
  CPErrorHandler::logError("Exception during importOrder: " . $e->getMessage() . "\n" . $e->getTraceAsString());
477
+ $apiOrder->orderHeader->orderId = null;
478
  $apiOrder->orderHeader->status->hasError = true;
479
  $apiOrder->orderHeader->status->errorMessage = "Exception during importOrder: " . $e->getMessage();
480
  $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
487
  *
488
  * @param type $id
489
  */
490
+ protected function getProduct($id) {
491
  $selectedArticleId = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
492
  $product = null;
493
  switch ($selectedArticleId) {
512
  return $product;
513
  }
514
 
515
+ protected function getCustomer($apiOrder) {
516
  $customer = Mage::getModel('customer/customer')
517
  ->setWebsiteId($this->websiteId)
518
  ->loadByEmail(CustomerFunctions::getUserName($apiOrder->customer->email));
527
  $customer->firstname = $apiOrder->customer->nameFirst;
528
  $customer->lastname = $apiOrder->customer->nameLast;
529
  $customer->email = $apiOrder->customer->email;
530
+ if(isset($apiOrder->customer->customerGroups)) {
531
+ foreach ($apiOrder->customer->customerGroups as $userGroup) {
532
+ $customer->setData('group_id', $userGroup->id);
533
+ }
534
+ }
535
  if ($apiOrder->addressInvoice->genderId == 1) {
536
  $customer->setGender(
537
  Mage::getResourceModel('customer/customer')
676
  * @param type $apiOrder
677
  * @return boolean
678
  */
679
+ protected function getOrderItems($apiOrder) {
680
  $dbOrderItems = array();
681
 
682
  $itemCollection = Mage::getModel('channelpilot/order_item')->getCollection()
703
  return $apiOrder;
704
  }
705
 
706
+ protected function getOrderId($externalOrderId, $source) {
707
  $order = Mage::getModel('channelpilot/order')->loadByMarketplaceOrderIdAndMarketplace($externalOrderId, $source);
708
  return ($order && $order->getId()) ? $order->getId() : null;
709
  }
710
 
711
+ protected function deleteCPOrder($orderId) {
712
  $collection = Mage::getModel('channelpilot/order_item')->getCollection()
713
  ->addFieldToFilter('order_id', array('eq' => $orderId));
714
  $collection->walk('delete');
718
  $collection->walk('delete');
719
  }
720
 
721
+ protected function getOrdersFromDb() {
722
  $orders = array();
723
 
724
  $collection = Mage::getModel('channelpilot/order_item')->getCollection()
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php CHANGED
@@ -74,7 +74,7 @@ class CPPaymentHandler extends CPAbstractHandler {
74
  return "Error during handle paymentHook";
75
  }
76
 
77
- private function hookResult($moreAvailable) {
78
  $hook = new CPHookResponse();
79
  $hook->resultCode = CPResultCodes::SUCCESS;
80
  $hook->resultMessage = "PAYMENT HOOK SUCCESS";
74
  return "Error during handle paymentHook";
75
  }
76
 
77
+ protected function hookResult($moreAvailable) {
78
  $hook = new CPHookResponse();
79
  $hook->resultCode = CPResultCodes::SUCCESS;
80
  $hook->resultMessage = "PAYMENT HOOK SUCCESS";
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php CHANGED
@@ -11,7 +11,6 @@ class CPRegisterHandler extends CPAbstractHandler {
11
  * Handle register event
12
  */
13
  public function handle() {
14
- self::checkConfig();
15
  $new = false;
16
 
17
  $multishopId = Mage::app()->getRequest()->getParam('multishopid', false);
11
  * Handle register event
12
  */
13
  public function handle() {
 
14
  $new = false;
15
 
16
  $multishopId = Mage::app()->getRequest()->getParam('multishopid', false);
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php CHANGED
@@ -73,7 +73,7 @@ class CPStatusHandler extends CPAbstractHandler {
73
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
74
  }
75
 
76
- private function getShops() {
77
  $allStores = Mage::app()->getStores();
78
  $shops = array();
79
  foreach ($allStores as $_eachStoreId => $val) {
@@ -90,7 +90,7 @@ class CPStatusHandler extends CPAbstractHandler {
90
  return $shops;
91
  }
92
 
93
- private function getDeliveryTypes($shopId) {
94
  $carriers = Mage::getStoreConfig('carriers', $shopId);
95
  $methods = Mage::getSingleton('shipping/config')->getActiveCarriers($shopId);
96
  $deliveryTypes = array();
@@ -112,7 +112,7 @@ class CPStatusHandler extends CPAbstractHandler {
112
  return $deliveryTypes;
113
  }
114
 
115
- private function getPaymentTypes($shopId) {
116
  $paymentTypes = array();
117
  $payments = Mage::getSingleton('payment/config')->getActiveMethods();
118
  foreach ($payments as $paymentCode => $paymentModel) {
@@ -150,7 +150,7 @@ class CPStatusHandler extends CPAbstractHandler {
150
  return $paymentTypes;
151
  }
152
 
153
- private function getCustomerGroups() {
154
  $customerGroups = array();
155
  $customerGroupCollection = Mage::getModel('customer/group')->getCollection();
156
  try {
73
  $hook->writeResponse(self::defaultHeader, json_encode($hook));
74
  }
75
 
76
+ protected function getShops() {
77
  $allStores = Mage::app()->getStores();
78
  $shops = array();
79
  foreach ($allStores as $_eachStoreId => $val) {
90
  return $shops;
91
  }
92
 
93
+ protected function getDeliveryTypes($shopId) {
94
  $carriers = Mage::getStoreConfig('carriers', $shopId);
95
  $methods = Mage::getSingleton('shipping/config')->getActiveCarriers($shopId);
96
  $deliveryTypes = array();
112
  return $deliveryTypes;
113
  }
114
 
115
+ protected function getPaymentTypes($shopId) {
116
  $paymentTypes = array();
117
  $payments = Mage::getSingleton('payment/config')->getActiveMethods();
118
  foreach ($payments as $paymentCode => $paymentModel) {
150
  return $paymentTypes;
151
  }
152
 
153
+ protected function getCustomerGroups() {
154
  $customerGroups = array();
155
  $customerGroupCollection = Mage::getModel('customer/group')->getCollection();
156
  try {
app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php CHANGED
@@ -46,7 +46,7 @@ class CPHookResponse {
46
  public function writeResponse($header, $response) {
47
  header($header);
48
  print_r($response);
49
- exit();
50
  }
51
 
52
  }
46
  public function writeResponse($header, $response) {
47
  header($header);
48
  print_r($response);
49
+ exit();
50
  }
51
 
52
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Abstract.php CHANGED
@@ -152,7 +152,7 @@ class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Mod
152
  return $params;
153
  }
154
 
155
- private function _getOrderId() {
156
  $info = $this->getInfoInstance();
157
 
158
  if ($this->_isPlaceOrder()) {
@@ -165,7 +165,7 @@ class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Mod
165
  }
166
  }
167
 
168
- private function _getAmount() {
169
  $info = $this->getInfoInstance();
170
  if ($this->_isPlaceOrder()) {
171
  return (double) $info->getOrder()->getQuoteBaseGrandTotal();
@@ -174,7 +174,7 @@ class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Mod
174
  }
175
  }
176
 
177
- private function _getCurrencyCode() {
178
  $info = $this->getInfoInstance();
179
 
180
  if ($this->_isPlaceOrder()) {
@@ -184,7 +184,7 @@ class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Mod
184
  }
185
  }
186
 
187
- private function _isPlaceOrder() {
188
  $info = $this->getInfoInstance();
189
  if ($info instanceof Mage_Sales_Model_Quote_Payment) {
190
  return false;
152
  return $params;
153
  }
154
 
155
+ protected function _getOrderId() {
156
  $info = $this->getInfoInstance();
157
 
158
  if ($this->_isPlaceOrder()) {
165
  }
166
  }
167
 
168
+ protected function _getAmount() {
169
  $info = $this->getInfoInstance();
170
  if ($this->_isPlaceOrder()) {
171
  return (double) $info->getOrder()->getQuoteBaseGrandTotal();
174
  }
175
  }
176
 
177
+ protected function _getCurrencyCode() {
178
  $info = $this->getInfoInstance();
179
 
180
  if ($this->_isPlaceOrder()) {
184
  }
185
  }
186
 
187
+ protected function _isPlaceOrder() {
188
  $info = $this->getInfoInstance();
189
  if ($info instanceof Mage_Sales_Model_Quote_Payment) {
190
  return false;
app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Exportmethod.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Exportmethod
24
+ {
25
+ const EXPORT_METHOD_LIVE = 1;
26
+ const EXPORT_METHOD_INDEXED = 2;
27
+
28
+ public function toOptionArray() {
29
+ return array(
30
+ array('value' => self::EXPORT_METHOD_LIVE, 'label' => Mage::helper('channelpilot')->__('CP Live')),
31
+ array('value' => self::EXPORT_METHOD_INDEXED, 'label' => Mage::helper('channelpilot')->__('CP Indexed')),
32
+ );
33
+ }
34
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Producturlgeneration.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Producturlgeneration
24
+ {
25
+ const METHOD_URL_PATH = 1;
26
+ const METHOD_URL_KEY = 2;
27
+ const METHOD_URL_KEY_HTML = 3;
28
+ const METHOD_GET_PRODUCT_URL = 4;
29
+ const METHOD_GET_URL_IN_STORE = 5;
30
+
31
+ public function toOptionArray() {
32
+ return array(
33
+ array('value' => self::METHOD_URL_PATH, 'label' => Mage::helper('channelpilot')->__("CP base url + url_path")),
34
+ array('value' => self::METHOD_URL_KEY, 'label' => Mage::helper('channelpilot')->__("CP base url + url_key")),
35
+ array('value' => self::METHOD_URL_KEY_HTML, 'label' => Mage::helper('channelpilot')->__("CP base url + url_key + .html")),
36
+ array('value' => self::METHOD_GET_PRODUCT_URL, 'label' => Mage::helper('channelpilot')->__("CP Method getProductUrl")),
37
+ array('value' => self::METHOD_GET_URL_IN_STORE, 'label' => Mage::helper('channelpilot')->__("CP Method getUrlInStore")),
38
+ );
39
+ }
40
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Carrier/Cpshipping.php CHANGED
@@ -16,7 +16,7 @@
16
  * @category Channelpilotsolutions
17
  * @package Channelpilotsolutions_Channelpilot
18
  * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Bj�rn Wehner <info@channelpilot.com>
20
  * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
  * @link http://www.channelpilot.com
22
  */
@@ -39,7 +39,7 @@ class Channelpilotsolutions_Channelpilot_Model_Carrier_Cpshipping
39
  protected function isAdmin() {
40
  $token = Mage::app()->getRequest()->getParam('token', false);
41
  if($token) {
42
- if(CPAbstractHandler::isIpAllowedViaSecurityToken($token)) {
43
  return true;
44
  }
45
  }
16
  * @category Channelpilotsolutions
17
  * @package Channelpilotsolutions_Channelpilot
18
  * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Bj�rn Wehner <info@channelpilot.com>
20
  * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
  * @link http://www.channelpilot.com
22
  */
39
  protected function isAdmin() {
40
  $token = Mage::app()->getRequest()->getParam('token', false);
41
  if($token) {
42
+ if(CPAbstractHandler::isIpAllowedViaSecurityToken($token, false)) {
43
  return true;
44
  }
45
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Feedexport/Indexer.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer extends Mage_Index_Model_Indexer_Abstract
24
+ {
25
+ const EVENT_MATCH_RESULT_KEY = 'channelpilot_product_feed_export_result';
26
+
27
+ const EVENT_KEY_UPDATE_PRODUCT_ID = 'channelpilot_feed_export_update_product_id';
28
+ const EVENT_KEY_DELETE_PRODUCT_ID = 'channelpilot_feed_export_delete_product_id';
29
+ const EVENT_KEY_MASS_ACTION_PRODUCT_IDS = 'channelpilot_feed_export_mass_action_product_ids';
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ protected $_matchedEntities = array(
35
+ Mage_Catalog_Model_Product::ENTITY => array(
36
+ Mage_Index_Model_Event::TYPE_SAVE,
37
+ Mage_Index_Model_Event::TYPE_DELETE,
38
+ Mage_Index_Model_Event::TYPE_MASS_ACTION,
39
+ )
40
+ );
41
+
42
+ /**
43
+ * Initialize resource model
44
+ *
45
+ */
46
+ protected function _construct()
47
+ {
48
+ $this->_init('channelpilot/feedexport_indexer');
49
+ }
50
+
51
+ /**
52
+ * Retrieve Indexer name
53
+ *
54
+ * @return string
55
+ */
56
+ public function getName()
57
+ {
58
+ return Mage::helper('channelpilot')->__('CP Channelpilot Product Feed Export');
59
+ }
60
+
61
+ /**
62
+ * Retrieve Indexer description
63
+ *
64
+ * @return string
65
+ */
66
+ public function getDescription()
67
+ {
68
+ return Mage::helper('channelpilot')->__('CP Index product data for the Channelpilot product feed export');
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @param Mage_Index_Model_Event $event
74
+ */
75
+ protected function _registerEvent(Mage_Index_Model_Event $event)
76
+ {
77
+ $dataObj = $event->getDataObject();
78
+ switch($event->getType()) {
79
+ case Mage_Index_Model_Event::TYPE_SAVE:
80
+ $event->addNewData(self::EVENT_KEY_UPDATE_PRODUCT_ID, $dataObj->getId());
81
+ break;
82
+ case Mage_Index_Model_Event::TYPE_DELETE:
83
+ $event->addNewData(self::EVENT_KEY_DELETE_PRODUCT_ID, $dataObj->getId());
84
+ break;
85
+ case Mage_Index_Model_Event::TYPE_MASS_ACTION:
86
+ $event->addNewData(self::EVENT_KEY_MASS_ACTION_PRODUCT_IDS, $dataObj->getProductIds());
87
+ break;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @param Mage_Index_Model_Event $event
93
+ */
94
+ protected function _processEvent(Mage_Index_Model_Event $event)
95
+ {
96
+ $data = $event->getNewData();
97
+ if(
98
+ (isset($data[self::EVENT_KEY_UPDATE_PRODUCT_ID]) && !empty($data[self::EVENT_KEY_UPDATE_PRODUCT_ID]))
99
+ || (isset($data[self::EVENT_KEY_DELETE_PRODUCT_ID]) && !empty($data[self::EVENT_KEY_DELETE_PRODUCT_ID]))
100
+ ||(isset($data[self::EVENT_KEY_MASS_ACTION_PRODUCT_IDS]) && !empty($data[self::EVENT_KEY_MASS_ACTION_PRODUCT_IDS]))
101
+ ) {
102
+ $this->callEventHandler($event);
103
+ }
104
+ }
105
+
106
+ /**
107
+ * match whether the reindexing should be fired
108
+ * @param Mage_Index_Model_Event $event
109
+ * @return bool
110
+ */
111
+ public function matchEvent(Mage_Index_Model_Event $event)
112
+ {
113
+ $data = $event->getNewData();
114
+ if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
115
+ return $data[self::EVENT_MATCH_RESULT_KEY];
116
+ }
117
+ $entity = $event->getEntity();
118
+ $result = true;
119
+ if($entity != Mage_Catalog_Model_Product::ENTITY){
120
+ return;
121
+ }
122
+ $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
123
+ return $result;
124
+ }
125
+
126
+ /**
127
+ * Rebuild all index data
128
+ */
129
+ public function reindexAll()
130
+ {
131
+ $this->_getResource()->reindexAll();
132
+ }
133
+
134
+ /**
135
+ * Get data for a specific productId and storeId.
136
+ * @param int $productId
137
+ * @param int $storeId
138
+ * @return mixed
139
+ */
140
+ public function getDataForProductIdAndStoreId($productId, $storeId) {
141
+ return $this->_getResource()->getDataForProductIdAndStoreId($productId, $storeId);
142
+ }
143
+
144
+ /**
145
+ * Truncate the index table.
146
+ */
147
+ public function truncateIndexTable() {
148
+ $this->_getResource()->truncateIndexTable();
149
+ }
150
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Observer.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Observer
24
+ {
25
+ /**
26
+ * @param Varien_Event_Observer $observer
27
+ */
28
+ public function modelConfigDataSaveBefore(Varien_Event_Observer $observer) {
29
+ $event = $observer->getEvent();
30
+ $config = $event->getObject();
31
+ $section = $config->getSection();
32
+ if(strtolower($section) == 'channelpilot_export') {
33
+ $groups = $config->getGroups();
34
+ $groups = $this->_checkDataFields($groups);
35
+ $config->setGroups($groups);
36
+ $this->_checkProductUrlGenerationMethod($groups);
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Change the status of the product feed export to require reindex.
42
+ */
43
+ protected function _changeStatusToRequireReindex() {
44
+ // set status to require reindex for the product export feed index
45
+ /** @var $process Mage_Index_Model_Indexer */
46
+ $process = Mage::getSingleton('index/indexer')->getProcessByCode('channelpilot_feed_export');
47
+ $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
48
+ }
49
+
50
+ /**
51
+ * Checks if the data fields have changed. In that case set the index status to "require reindex" for the
52
+ * product feed export index.
53
+ * It will also create a (session) message for the user. This notice will be shown if the user
54
+ * selected too many data fields if the export method is set to "live" and will tell the user that the
55
+ * export will now use the indexed method and that the product feed export index needs to be kept up to date.
56
+ * @param array $groups
57
+ */
58
+ protected function _checkDataFields($groups) {
59
+ if(isset($groups['channelpilot_productfeed']['fields']['channelpilot_exportfields']['value'])) {
60
+ $currentDataFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
61
+ $dataFields = $groups['channelpilot_productfeed']['fields']['channelpilot_exportfields']['value'];
62
+ if(isset($dataFields['__empty'])) {
63
+ unset($dataFields['__empty']);
64
+ }
65
+
66
+ // check if the selected data fields have changed
67
+ if(count($dataFields) != count($currentDataFields)) {
68
+ $this->_changeStatusToRequireReindex();
69
+
70
+ // add a notice if the export method is set to live and there are too many datafields selected
71
+ if(
72
+ $groups['channelpilot_productfeed']['fields']['channelpilot_export_method']['value'] == Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Exportmethod::EXPORT_METHOD_LIVE
73
+ && count($dataFields) > Channelpilotsolutions_Channelpilot_Helper_Export::MAX_ATTRIBUTE_COUNT_FOR_LIVE_EXPORT
74
+ ) {
75
+ Mage::getSingleton('adminhtml/session')->addNotice(
76
+ Mage::helper('channelpilot')->__("CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.", Channelpilotsolutions_Channelpilot_Helper_Export::MAX_ATTRIBUTE_COUNT_FOR_LIVE_EXPORT)
77
+ );
78
+ $groups['channelpilot_productfeed']['fields']['channelpilot_export_method']['value'] = Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Exportmethod::EXPORT_METHOD_INDEXED;
79
+ }
80
+ }
81
+ }
82
+ return $groups;
83
+ }
84
+
85
+ /**
86
+ * Checks if the method to generate the product url has been changed. In this case
87
+ * set the indexer process status to require reindex if the export method is set to indexed.
88
+ * @param array $groups
89
+ */
90
+ protected function _checkProductUrlGenerationMethod($groups) {
91
+ $currentProductUrlGenerationMethod = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/product_url_generation_method');
92
+ if(isset($groups['channelpilot_productfeed']['fields']['product_url_generation_method']['value'])) {
93
+ $method = $groups['channelpilot_productfeed']['fields']['product_url_generation_method']['value'];
94
+ if($method != $currentProductUrlGenerationMethod) {
95
+ $this->_changeStatusToRequireReindex();
96
+ }
97
+ }
98
+ }
99
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Feedexport/Indexer.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer extends Mage_Index_Model_Resource_Abstract
24
+ {
25
+ /**
26
+ * Define main index table
27
+ *
28
+ */
29
+ protected function _construct()
30
+ {
31
+ $this->_init('channelpilot/product_feed_export_index', 'product_id');
32
+ }
33
+
34
+ /**
35
+ * @param array $productIds the product ids that should be reindexed
36
+ * @param array $storeIds the store ids that should be used for reindexing the product data
37
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer
38
+ * @throws Exception
39
+ */
40
+ protected function _reindexProductIds($productIds, $storeIds) {
41
+ if(empty($productIds)) {
42
+ $productIds = array();
43
+ }
44
+
45
+ if(!is_array($productIds)) {
46
+ $productIds = array($productIds);
47
+ }
48
+
49
+ if(!is_array($storeIds)) {
50
+ $storeIds = array($storeIds);
51
+ }
52
+
53
+ $adapter = $this->_getWriteAdapter();
54
+
55
+ try {
56
+ /** @var $export Channelpilotsolutions_Channelpilot_Model_Export */
57
+ $export = Mage::helper('channelpilot/export');
58
+ $chunkSize = $export->getChunkSize();
59
+ foreach($storeIds as $storeId) {
60
+
61
+ $collection = $export->getProductCollection($storeId, $productIds);
62
+ if($collection === null) {
63
+ continue;
64
+ }
65
+ $pages = ceil($collection->getSize() / $chunkSize);
66
+
67
+ $collection->setPageSize($chunkSize);
68
+
69
+ for($i = 1; $i <= $pages; $i++) {
70
+ $adapter->beginTransaction();
71
+
72
+ $collection->clear();
73
+ $collection->setCurPage($i);
74
+ foreach($collection as $item) {
75
+ $where = array();
76
+ $where[] = $adapter->quoteInto('product_id = ?', $item->getId());
77
+ $where[] = $adapter->quoteInto('store_id = ?', $storeId);
78
+ $adapter->delete($this->getMainTable(), $where);
79
+
80
+ $bind = array();
81
+
82
+ $productData = $export->getFullProductData($item);
83
+
84
+ $productXml = new SimpleXMLElement('<product></product>');
85
+ $export->productToXml($productData, $productXml);
86
+ $dom = dom_import_simplexml($productXml);
87
+
88
+ $bind['product_id'] = $item->getId();
89
+ $bind['store_id'] = $storeId;
90
+ $bind['sku'] = $item->getData('sku');
91
+ $bind['created_at'] = now();
92
+ $bind['product_data'] = $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
93
+ $adapter->insert($this->getMainTable(), $bind);
94
+ }
95
+
96
+ $adapter->commit();
97
+ }
98
+ }
99
+ } catch (Exception $e) {
100
+ $adapter->rollBack();
101
+ throw $e;
102
+ }
103
+
104
+ return $this;
105
+ }
106
+
107
+ /**
108
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer
109
+ * @throws Exception
110
+ */
111
+ public function reindexAll() {
112
+ $storeIds = Mage::helper('channelpilot')->getAllStoreIds();
113
+ $this->_reindexProductIds(null, $storeIds);
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ * Process produce delete
119
+ * If the deleted product was found in a composite product(s) update it
120
+ *
121
+ * @param Mage_Index_Model_Event $event
122
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer
123
+ */
124
+ public function catalogProductDelete(Mage_Index_Model_Event $event)
125
+ {
126
+ $data = $event->getNewData();
127
+ if(!isset($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_UPDATE_PRODUCT_ID])) {
128
+ return $this;
129
+ }
130
+ /** @var $dataObject Mage_Catalog_Model_Product */
131
+ $dataObject = $event->getDataObject();
132
+ $storeIds = $dataObject->getStoreId();
133
+ if($storeIds == 0) {
134
+ $storeIds = $event->getDataObject()->getStoreIds();
135
+ }
136
+ $this->_reindexProductIds($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_UPDATE_PRODUCT_ID], $storeIds);
137
+
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * Process product save.
143
+ * Method is responsible for index support
144
+ * when product was saved and changed attribute(s) has an effect on price.
145
+ *
146
+ * @param Mage_Index_Model_Event $event
147
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer
148
+ */
149
+ public function catalogProductSave(Mage_Index_Model_Event $event)
150
+ {
151
+ $data = $event->getNewData();
152
+ if(!isset($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_UPDATE_PRODUCT_ID])) {
153
+ return $this;
154
+ }
155
+ /** @var $dataObject Mage_Catalog_Model_Product */
156
+ $dataObject = $event->getDataObject();
157
+ $storeIds = $dataObject->getStoreId();
158
+ if($storeIds == 0) {
159
+ $storeIds = $event->getDataObject()->getStoreIds();
160
+ }
161
+ $this->_reindexProductIds($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_UPDATE_PRODUCT_ID], $storeIds);
162
+
163
+ return $this;
164
+ }
165
+
166
+ /**
167
+ * Process product mass update action
168
+ *
169
+ * @param Mage_Index_Model_Event $event
170
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer
171
+ */
172
+ public function catalogProductMassAction(Mage_Index_Model_Event $event)
173
+ {
174
+ $data = $event->getNewData();
175
+ if(!isset($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_MASS_ACTION_PRODUCT_IDS])) {
176
+ return $this;
177
+ }
178
+
179
+ $storeIds = Mage::helper('channelpilot')->getAllStoreIds();
180
+ $this->_reindexProductIds($data[Channelpilotsolutions_Channelpilot_Model_Feedexport_Indexer::EVENT_KEY_MASS_ACTION_PRODUCT_IDS], $storeIds);
181
+
182
+ return $this;
183
+ }
184
+
185
+ /**
186
+ * Load the entry for a specific productId and storeId.
187
+ * @param int $productId
188
+ * @param int $storeId
189
+ * @return array
190
+ */
191
+ public function getDataForProductIdAndStoreId($productId, $storeId) {
192
+ $read = $this->getReadConnection();
193
+ if($read) {
194
+ $select = $read->select()
195
+ ->from($this->getTable('channelpilot/product_feed_export_index'))
196
+ ->where($read->quoteInto('product_id = ?', $productId))
197
+ ->where($read->quoteInto('store_id = ?', $storeId));
198
+
199
+ return $read->fetchRow($select);
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Truncate the index table.
205
+ */
206
+ public function truncateIndexTable() {
207
+ $write = $this->_getWriteAdapter();
208
+
209
+ if($write) {
210
+ $write->truncateTable($this->getMainTable());
211
+ }
212
+ }
213
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Feedexport/Indexer/Collection.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Feedexport_Indexer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
24
+ {
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/feedexport_indexer');
31
+ }
32
+ }
app/code/community/Channelpilotsolutions/Channelpilot/controllers/Adminhtml/Channelpilot/FeedexportController.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the GNU General Public License (GPL 3)
8
+ * that is bundled with this package in the file LICENSE.txt
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
13
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
14
+ * needs please refer to http://www.channelpilot.com for more information.
15
+ *
16
+ * @category Channelpilotsolutions
17
+ * @package Channelpilotsolutions_Channelpilot
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Björn Wehner <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Adminhtml_Channelpilot_FeedexportController extends Mage_Adminhtml_Controller_Action
24
+ {
25
+ public function indexAction() {
26
+ $this->loadLayout();
27
+ $this->renderLayout();
28
+ }
29
+
30
+ public function viewAction(){
31
+ $storeId = $this->getRequest()->getParam('store', false);
32
+ if($storeId === false) {
33
+ Mage::getSingleton('adminhtml/session')->addNotice(
34
+ Mage::helper('channelpilot')->__('CP Please specify store.')
35
+ );
36
+ $this->_redirect('*/*/');
37
+ return;
38
+ }
39
+ $this->loadLayout();
40
+ $this->renderLayout();
41
+ }
42
+
43
+ public function truncateAction() {
44
+ $helper = Mage::helper('channelpilot');
45
+
46
+ Mage::getModel('channelpilot/feedexport_indexer')->truncateIndexTable();
47
+
48
+ /** @var $process Mage_Index_Model_Indexer */
49
+ $process = Mage::getSingleton('index/indexer')->getProcessByCode('channelpilot_feed_export');
50
+ $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
51
+
52
+ Mage::getSingleton('adminhtml/session')->addSuccess($helper->__('CP The data has been deleted. Please reindex the export data.'));
53
+ $this->_redirect('*/*/');
54
+ }
55
+ }
app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml CHANGED
@@ -22,12 +22,35 @@
22
  */
23
  -->
24
  <config>
25
- <acl>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  <resources>
27
  <admin>
28
  <children>
29
  <system>
30
  <children>
 
 
 
 
 
 
 
 
31
  <config>
32
  <children>
33
  <channelpilot_general translate="title" module="channelpilot">
22
  */
23
  -->
24
  <config>
25
+ <menu>
26
+ <system translate="title" module="adminhtml">
27
+ <children>
28
+ <convert>
29
+ <children>
30
+ <cp_product_feed_export translate="title" module="channelpilot">
31
+ <title>CP Channelpilot Product Feed Export</title>
32
+ <action>adminhtml/channelpilot_feedexport</action>
33
+ <sort_order>100</sort_order>
34
+ </cp_product_feed_export>
35
+ </children>
36
+ </convert>
37
+ </children>
38
+ </system>
39
+ </menu>
40
+ <acl>
41
  <resources>
42
  <admin>
43
  <children>
44
  <system>
45
  <children>
46
+ <convert>
47
+ <children>
48
+ <cp_product_feed_export>
49
+ <title>CP Channelpilot Product Feed Export</title>
50
+ <sort_order>100</sort_order>
51
+ </cp_product_feed_export>
52
+ </children>
53
+ </convert>
54
  <config>
55
  <children>
56
  <channelpilot_general translate="title" module="channelpilot">
app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml CHANGED
@@ -24,10 +24,17 @@
24
  <config>
25
  <modules>
26
  <Channelpilotsolutions_Channelpilot>
27
- <version>2.2.5</version>
28
  </Channelpilotsolutions_Channelpilot>
29
  </modules>
30
  <global>
 
 
 
 
 
 
 
31
  <models>
32
  <channelpilot_adminhtml>
33
  <class>Channelpilotsolutions_Channelpilot_Adminhtml_Model</class>
@@ -57,6 +64,9 @@
57
  <logs>
58
  <table>cp_logging</table>
59
  </logs>
 
 
 
60
  </entities>
61
  </channelpilot_resource>
62
  </models>
@@ -87,6 +97,17 @@
87
  <class>Channelpilotsolutions_Channelpilot_Helper</class>
88
  </channelpilot>
89
  </helpers>
 
 
 
 
 
 
 
 
 
 
 
90
  </global>
91
  <adminhtml>
92
  <translate>
@@ -98,13 +119,13 @@
98
  </Channelpilotsolutions_Channelpilot>
99
  </modules>
100
  </translate>
101
- <layout>
102
- <updates>
103
- <channelpilot>
104
- <file>Channelpilotsolutions/channelpilot.xml</file>
105
- </channelpilot>
106
- </updates>
107
- </layout>
108
  </adminhtml>
109
  <frontend>
110
  <routers>
@@ -153,6 +174,7 @@
153
  <channelpilot_useNews>0</channelpilot_useNews>
154
  <channelpilot_checkIp>1</channelpilot_checkIp>
155
  <channelpilot_articlenumber>product_id</channelpilot_articlenumber>
 
156
  </channelpilot_general>
157
  </channelpilot_general>
158
  <channelpilot_tracking>
@@ -164,7 +186,9 @@
164
  </channelpilot_tracking>
165
  <channelpilot_export>
166
  <channelpilot_productfeed>
 
167
  <channelpilot_useExport>0</channelpilot_useExport>
 
168
  </channelpilot_productfeed>
169
  </channelpilot_export>
170
  <channelpilot_marketplace>
@@ -181,4 +205,15 @@
181
  </channelpilot_general>
182
  </channelpilot_pricecontrol>
183
  </default>
 
 
 
 
 
 
 
 
 
 
 
184
  </config>
24
  <config>
25
  <modules>
26
  <Channelpilotsolutions_Channelpilot>
27
+ <version>2.2.6</version>
28
  </Channelpilotsolutions_Channelpilot>
29
  </modules>
30
  <global>
31
+ <index>
32
+ <indexer>
33
+ <channelpilot_feed_export>
34
+ <model>channelpilot/feedexport_indexer</model>
35
+ </channelpilot_feed_export>
36
+ </indexer>
37
+ </index>
38
  <models>
39
  <channelpilot_adminhtml>
40
  <class>Channelpilotsolutions_Channelpilot_Adminhtml_Model</class>
64
  <logs>
65
  <table>cp_logging</table>
66
  </logs>
67
+ <product_feed_export_index>
68
+ <table>cp_product_feed_export_index</table>
69
+ </product_feed_export_index>
70
  </entities>
71
  </channelpilot_resource>
72
  </models>
97
  <class>Channelpilotsolutions_Channelpilot_Helper</class>
98
  </channelpilot>
99
  </helpers>
100
+ <events>
101
+ <model_config_data_save_before>
102
+ <observers>
103
+ <cp_check_for_changed_export_data_fields>
104
+ <type>singleton</type>
105
+ <class>channelpilot/observer</class>
106
+ <method>modelConfigDataSaveBefore</method>
107
+ </cp_check_for_changed_export_data_fields>
108
+ </observers>
109
+ </model_config_data_save_before>
110
+ </events>
111
  </global>
112
  <adminhtml>
113
  <translate>
119
  </Channelpilotsolutions_Channelpilot>
120
  </modules>
121
  </translate>
122
+ <layout>
123
+ <updates>
124
+ <channelpilotsolutions_channelpilot>
125
+ <file>channelpilot.xml</file>
126
+ </channelpilotsolutions_channelpilot>
127
+ </updates>
128
+ </layout>
129
  </adminhtml>
130
  <frontend>
131
  <routers>
174
  <channelpilot_useNews>0</channelpilot_useNews>
175
  <channelpilot_checkIp>1</channelpilot_checkIp>
176
  <channelpilot_articlenumber>product_id</channelpilot_articlenumber>
177
+ <seller_api_wsdl_url>https://seller.api.channelpilot.com/1_0?wsdl</seller_api_wsdl_url>
178
  </channelpilot_general>
179
  </channelpilot_general>
180
  <channelpilot_tracking>
186
  </channelpilot_tracking>
187
  <channelpilot_export>
188
  <channelpilot_productfeed>
189
+ <channelpilot_export_method>1</channelpilot_export_method>
190
  <channelpilot_useExport>0</channelpilot_useExport>
191
+ <product_url_generation_method>4</product_url_generation_method>
192
  </channelpilot_productfeed>
193
  </channelpilot_export>
194
  <channelpilot_marketplace>
205
  </channelpilot_general>
206
  </channelpilot_pricecontrol>
207
  </default>
208
+ <admin>
209
+ <routers>
210
+ <adminhtml>
211
+ <args>
212
+ <modules>
213
+ <Channelpilotsolutions_Channelpilot after="Mage_Adminhtml">Channelpilotsolutions_Channelpilot_Adminhtml</Channelpilotsolutions_Channelpilot>
214
+ </modules>
215
+ </args>
216
+ </adminhtml>
217
+ </routers>
218
+ </admin>
219
  </config>
app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml CHANGED
@@ -83,6 +83,15 @@
83
  <show_in_website>1</show_in_website>
84
  <show_in_store>1</show_in_store>
85
  </channelpilot_articlenumber>
 
 
 
 
 
 
 
 
 
86
  </fields>
87
  </channelpilot_general>
88
  </groups>
@@ -181,7 +190,7 @@
181
  <label>CP Activate?</label>
182
  <frontend_type>select</frontend_type>
183
  <source_model>adminhtml/system_config_source_yesno</source_model>
184
- <sort_order>0</sort_order>
185
  <show_in_default>1</show_in_default>
186
  <show_in_website>1</show_in_website>
187
  <show_in_store>1</show_in_store>
@@ -190,17 +199,36 @@
190
  <label>CP Password</label>
191
  <comment>CP Protect your data feed with a password. For example: 'www.testshop.com/channelpilot?password=12345'</comment>
192
  <frontend_type>password</frontend_type>
193
- <sort_order>1</sort_order>
194
  <show_in_default>1</show_in_default>
195
  <show_in_website>1</show_in_website>
196
  <show_in_store>1</show_in_store>
197
  </channelpilot_password>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <channelpilot_exportfields>
199
  <label>CP Select data fields</label>
200
  <comment>CP Select the data fields you want to provide on ChannelPilot. Some product attributes are always included. (Entity_Id, Sku, name, description, price, manufacturer, color, categories, product_url, image_url, additional_image_1, additional_image_2, additional_image_3, weight)</comment>
201
  <frontend_model>channelpilot_core/adminhtml_field_exportfields</frontend_model>
202
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
203
- <sort_order>2</sort_order>
204
  <show_in_default>1</show_in_default>
205
  <show_in_website>1</show_in_website>
206
  <show_in_store>1</show_in_store>
@@ -210,7 +238,7 @@
210
  <comment>CP Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.</comment>
211
  <frontend_model>channelpilot_core/adminhtml_field_specialfields</frontend_model>
212
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
213
- <sort_order>3</sort_order>
214
  <show_in_default>1</show_in_default>
215
  <show_in_website>1</show_in_website>
216
  <show_in_store>1</show_in_store>
@@ -220,7 +248,7 @@
220
  <comment>CP Select the data fields you want to be overwritten by the respective value of the parent article.</comment>
221
  <frontend_model>channelpilot_core/adminhtml_field_replacefields</frontend_model>
222
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
223
- <sort_order>4</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>
@@ -230,7 +258,7 @@
230
  <comment>CP How many additional productimages should be exported?</comment>
231
  <frontend_type>select</frontend_type>
232
  <source_model>channelpilot_adminhtml/imagenumber_values</source_model>
233
- <sort_order>5</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>
83
  <show_in_website>1</show_in_website>
84
  <show_in_store>1</show_in_store>
85
  </channelpilot_articlenumber>
86
+ <seller_api_wsdl_url>
87
+ <label>CP Seller api wsdl url</label>
88
+ <comment>CP Default url: https://seller.api.channelpilot.com/1_0?wsdl</comment>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>40</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </seller_api_wsdl_url>
95
  </fields>
96
  </channelpilot_general>
97
  </groups>
190
  <label>CP Activate?</label>
191
  <frontend_type>select</frontend_type>
192
  <source_model>adminhtml/system_config_source_yesno</source_model>
193
+ <sort_order>10</sort_order>
194
  <show_in_default>1</show_in_default>
195
  <show_in_website>1</show_in_website>
196
  <show_in_store>1</show_in_store>
199
  <label>CP Password</label>
200
  <comment>CP Protect your data feed with a password. For example: 'www.testshop.com/channelpilot?password=12345'</comment>
201
  <frontend_type>password</frontend_type>
202
+ <sort_order>20</sort_order>
203
  <show_in_default>1</show_in_default>
204
  <show_in_website>1</show_in_website>
205
  <show_in_store>1</show_in_store>
206
  </channelpilot_password>
207
+ <channelpilot_export_method>
208
+ <label>CP Export Method</label>
209
+ <comment>CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.</comment>
210
+ <frontend_type>select</frontend_type>
211
+ <source_model>channelpilot/adminhtml_source_exportmethod</source_model>
212
+ <sort_order>25</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>1</show_in_store>
216
+ </channelpilot_export_method>
217
+ <product_url_generation_method>
218
+ <label>CP Product Url Generation Method</label>
219
+ <frontend_type>select</frontend_type>
220
+ <source_model>channelpilot/adminhtml_source_producturlgeneration</source_model>
221
+ <sort_order>29</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ </product_url_generation_method>
226
  <channelpilot_exportfields>
227
  <label>CP Select data fields</label>
228
  <comment>CP Select the data fields you want to provide on ChannelPilot. Some product attributes are always included. (Entity_Id, Sku, name, description, price, manufacturer, color, categories, product_url, image_url, additional_image_1, additional_image_2, additional_image_3, weight)</comment>
229
  <frontend_model>channelpilot_core/adminhtml_field_exportfields</frontend_model>
230
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
231
+ <sort_order>30</sort_order>
232
  <show_in_default>1</show_in_default>
233
  <show_in_website>1</show_in_website>
234
  <show_in_store>1</show_in_store>
238
  <comment>CP Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.</comment>
239
  <frontend_model>channelpilot_core/adminhtml_field_specialfields</frontend_model>
240
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
241
+ <sort_order>40</sort_order>
242
  <show_in_default>1</show_in_default>
243
  <show_in_website>1</show_in_website>
244
  <show_in_store>1</show_in_store>
248
  <comment>CP Select the data fields you want to be overwritten by the respective value of the parent article.</comment>
249
  <frontend_model>channelpilot_core/adminhtml_field_replacefields</frontend_model>
250
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
251
+ <sort_order>50</sort_order>
252
  <show_in_default>1</show_in_default>
253
  <show_in_website>1</show_in_website>
254
  <show_in_store>1</show_in_store>
258
  <comment>CP How many additional productimages should be exported?</comment>
259
  <frontend_type>select</frontend_type>
260
  <source_model>channelpilot_adminhtml/imagenumber_values</source_model>
261
+ <sort_order>60</sort_order>
262
  <show_in_default>1</show_in_default>
263
  <show_in_website>1</show_in_website>
264
  <show_in_store>1</show_in_store>
app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.1.0-2.1.6.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package Channelpilotsolutions_Channelpilot
17
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
18
+ * @author Björn Wehner <info@channelpilot.com>
19
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
+ * @link http://www.channelpilot.com
21
+ */
22
+
23
+ $installer = $this;
24
+
25
+ $installer->startSetup();
26
+
27
+ $tableName = Mage::getSingleton('core/resource')->getTableName('channelpilot/order_item');
28
+ $dbname = (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname');
29
+
30
+ /** @var $write Magento_Db_Adapter_Pdo_Mysql */
31
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
32
+
33
+ $sql = "
34
+ SELECT count(*) FROM information_schema.COLUMNS
35
+ WHERE COLUMN_NAME='id' AND TABLE_NAME='{$tableName}' AND TABLE_SCHEMA='{$dbname}';
36
+ ";
37
+
38
+ $result = $write->fetchOne($sql);
39
+
40
+ if($result == 0) {
41
+ $installer->run("
42
+ ALTER TABLE `{$tableName}`
43
+ DROP PRIMARY KEY;
44
+
45
+ ALTER TABLE `{$tableName}`
46
+ ADD COLUMN `id` INT(10) NOT NULL AUTO_INCREMENT COMMENT 'id' FIRST,
47
+ ADD PRIMARY KEY (`id`);
48
+ ");
49
+ }
50
+
51
+ $installer->endSetup();
app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.2.5-2.2.6.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Channelpilotsolutions
16
  * @package Channelpilotsolutions_Channelpilot
17
  * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
18
- * @author Bj�rn Wehner <info@channelpilot.com>
19
  * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
  * @link http://www.channelpilot.com
21
  */
@@ -26,35 +26,45 @@ $installer->startSetup();
26
  $adapter = $installer->getConnection();
27
 
28
  /**
29
- * Create table 'channelpilot/productexport'
30
  */
31
- $table = $adapter->newTable($installer->getTable('channelpilot/productexport'))
32
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
33
- 'auto_increment' => true,
34
- 'unsigned' => true,
35
- 'nullable' => false,
36
- 'primary' => true,
37
- ), 'id')
38
- ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
39
- 'nullable' => false,
40
- 'unsigned' => true,
41
  ), 'product_id')
42
- ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
43
- 'nullable' => false,
44
- 'unsigned' => true,
 
45
  ), 'store_id')
46
- ->addColumn('is_update_needed', Varien_Db_Ddl_Table::TYPE_TINYINT, 1, array(
47
- 'nullable' => false,
48
- 'unsigned' => true,
49
- 'default' => 1,
50
- ), 'is_update_needed')
 
51
  ->addColumn('product_data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
52
- 'nullable' => false,
53
- 'unsigned' => true,
54
- 'default' => '',
55
- ), 'product_data');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  $adapter->createTable($table);
57
 
58
- $installer->endSetup();
59
-
60
- Mage::getModel('channelpilot/productexport')->initializeProductExport();
15
  * @category Channelpilotsolutions
16
  * @package Channelpilotsolutions_Channelpilot
17
  * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
18
+ * @author Bj�rn Wehner <info@channelpilot.com>
19
  * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
  * @link http://www.channelpilot.com
21
  */
26
  $adapter = $installer->getConnection();
27
 
28
  /**
29
+ * Create table 'channelpilot/product_feed_export_index'
30
  */
31
+ $table = $adapter->newTable($installer->getTable('channelpilot/product_feed_export_index'))
32
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
33
+ 'unsigned' => true,
34
+ 'nullable' => false,
35
+ 'primary' => true,
 
 
 
 
 
36
  ), 'product_id')
37
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 5, array(
38
+ 'nullable' => false,
39
+ 'unsigned' => true,
40
+ 'primary' => true,
41
  ), 'store_id')
42
+ ->addColumn('sku', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
43
+ 'nullable' => false,
44
+ ), 'sku')
45
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
46
+ 'nullable' => false,
47
+ ), 'created_at')
48
  ->addColumn('product_data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
49
+ 'nullable' => false,
50
+ ), 'product_data')
51
+ ->addForeignKey('FK_CP_FEED_EXPORT_PRODUCT_ID',
52
+ 'product_id',
53
+ $installer->getTable('catalog/product'),
54
+ 'entity_id',
55
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
56
+ Varien_Db_Ddl_Table::ACTION_CASCADE
57
+ )
58
+ ->addForeignKey('FK_CP_FEED_EXPORT_STORE_ID',
59
+ 'store_id',
60
+ $installer->getTable('core/store'),
61
+ 'store_id',
62
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
63
+ Varien_Db_Ddl_Table::ACTION_CASCADE
64
+ )
65
+ ->addIndex('IDX_CP_FEED_EXPORT_PRODUCT_ID', 'product_id')
66
+ ->addIndex('IDX_CP_FEED_EXPORT_STORE_ID', 'store_id')
67
+ ->addIndex('IDX_CP_FEED_EXPORT_SKU', 'sku');
68
  $adapter->createTable($table);
69
 
70
+ $installer->endSetup();
 
 
app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
72
+
73
+ "CP Export Method","Exportmethode"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","Wenn Sie die Methode 'Indiziert' wählen, dann müssen Sie sicherstellen, dass der Index 'Channelpilot Produktfeed-Export' immer aktuell ist. Sollten Sie mehr als 40 Datenfelder ausgewählt haben, wird, unabhängig davon welche Option Sie gewählt haben, der Modus 'Indiziert' verwendet."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indiziert"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Produktfeed-Export"
78
+ "CP Index product data for the Channelpilot product feed export","Indiziert die Produktdaten für den ChannelPilot Produktfeed-Export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","Sie haben mehr als %s Datenfelder für den ChannelPilot Produktfeed-Export ausgewählt. Bitte beachten Sie, dass unabhängig von der gewählten Option, fortan der Exportmodus 'Indiziert' verwendet wird. Halten Sie daher bitte den ChannelPilot Produktfeed-Export-Index aktuell."
80
+ "CP Product ID","Produkt ID"
81
+ "CP Product SKU","Produkt SKU"
82
+ "CP Created At","Erstellt"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Zeige Exportdaten für das Produkt %s und Store %s - die Daten wurden erstellt am: %s"
84
+ "CP Please specify store.","Bitte geben Sie den Store an."
85
+ "CP The data has been deleted. Please reindex the export data.","Die Daten wurden gelöscht. Bitte reindizieren Sie die Exportdaten."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warnung, sämtliche Exportdaten werden gelöscht. Möchten Sie fortfahren ?"
87
+ "CP Truncate Index Table","Indextabelle leeren"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Standard Url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Methode zur Erstellung der Produkt-URL"
93
+ "CP base url + url_path","Basis URL + url_path"
94
+ "CP base url + url_key","Basis URL + url_key"
95
+ "CP base url + url_key + .html","Basis URL + url_key + .html"
96
+ "CP Method getProductUrl","getProductUrl Methode"
97
+ "CP Method getUrlInStore","getUrlInStore Methode"
app/locale/de_CH/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
72
+
73
+ "CP Export Method","Exportmethode"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","Wenn Sie die Methode 'Indiziert' wählen, dann müssen Sie sicherstellen, dass der Index 'Channelpilot Produktfeed-Export' immer aktuell ist. Sollten Sie mehr als 40 Datenfelder ausgewählt haben, wird, unabhängig davon welche Option Sie gewählt haben, der Modus 'Indiziert' verwendet."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indiziert"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Produktfeed-Export"
78
+ "CP Index product data for the Channelpilot product feed export","Indiziert die Produktdaten für den ChannelPilot Produktfeed-Export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","Sie haben mehr als %s Datenfelder für den ChannelPilot Produktfeed-Export ausgewählt. Bitte beachten Sie, dass unabhängig von der gewählten Option, fortan der Exportmodus 'Indiziert' verwendet wird. Halten Sie daher bitte den ChannelPilot Produktfeed-Export-Index aktuell."
80
+ "CP Product ID","Produkt ID"
81
+ "CP Product SKU","Produkt SKU"
82
+ "CP Created At","Erstellt"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Zeige Exportdaten für das Produkt %s und Store %s - die Daten wurden erstellt am: %s"
84
+ "CP Please specify store.","Bitte geben Sie den Store an."
85
+ "CP The data has been deleted. Please reindex the export data.","Die Daten wurden gelöscht. Bitte reindizieren Sie die Exportdaten."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warnung, sämtliche Exportdaten werden gelöscht. Möchten Sie fortfahren ?"
87
+ "CP Truncate Index Table","Indextabelle leeren"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Standard Url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Methode zur Erstellung der Produkt-URL"
93
+ "CP base url + url_path","Basis URL + url_path"
94
+ "CP base url + url_key","Basis URL + url_key"
95
+ "CP base url + url_key + .html","Basis URL + url_key + .html"
96
+ "CP Method getProductUrl","getProductUrl Methode"
97
+ "CP Method getUrlInStore","getUrlInStore Methode"
app/locale/de_DE/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Admin-Modus für den Import der Marktplatzbestellungen benutzen"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","Wenn Marktplatzbestellungen importiert werden kann der Admin-Modus genutz werden. Sollte dieser genutzt werden dann bedenken Sie bitte, dass sämtliche Prüfungen nicht durchlaufen werden die es normalerweise tun, wie: die bestellte Menge ist geringer als die eingestellte Mindestbestellmenge; Bestellungen werden importiert die Produkte haben die ausverkauft oder nur noch in einer geringeren Stückzahl vorhanden sind."
72
+
73
+ "CP Export Method","Exportmethode"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","Wenn Sie die Methode 'Indiziert' wählen, dann müssen Sie sicherstellen, dass der Index 'Channelpilot Produktfeed-Export' immer aktuell ist. Sollten Sie mehr als 40 Datenfelder ausgewählt haben, wird, unabhängig davon welche Option Sie gewählt haben, der Modus 'Indiziert' verwendet."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indiziert"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Produktfeed-Export"
78
+ "CP Index product data for the Channelpilot product feed export","Indiziert die Produktdaten für den ChannelPilot Produktfeed-Export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","Sie haben mehr als %s Datenfelder für den ChannelPilot Produktfeed-Export ausgewählt. Bitte beachten Sie, dass unabhängig von der gewählten Option, fortan der Exportmodus 'Indiziert' verwendet wird. Halten Sie daher bitte den ChannelPilot Produktfeed-Export-Index aktuell."
80
+ "CP Product ID","Produkt ID"
81
+ "CP Product SKU","Produkt SKU"
82
+ "CP Created At","Erstellt"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Zeige Exportdaten für das Produkt %s und Store %s - die Daten wurden erstellt am: %s"
84
+ "CP Please specify store.","Bitte geben Sie den Store an."
85
+ "CP The data has been deleted. Please reindex the export data.","Die Daten wurden gelöscht. Bitte reindizieren Sie die Exportdaten."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warnung, sämtliche Exportdaten werden gelöscht. Möchten Sie fortfahren ?"
87
+ "CP Truncate Index Table","Indextabelle leeren"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Standard Url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Methode zur Erstellung der Produkt-URL"
93
+ "CP base url + url_path","Basis URL + url_path"
94
+ "CP base url + url_key","Basis URL + url_key"
95
+ "CP base url + url_key + .html","Basis URL + url_key + .html"
96
+ "CP Method getProductUrl","getProductUrl Methode"
97
+ "CP Method getUrlInStore","getUrlInStore Methode"
app/locale/en_AU/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
app/locale/en_CA/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
app/locale/en_GB/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
app/locale/en_IE/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
app/locale/en_NZ/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
app/locale/en_US/Channelpilotsolutions_Channelpilot.csv CHANGED
@@ -68,4 +68,30 @@
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
- "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  "CP JavaScript","JavaScript"
69
 
70
  "CP Use Admin Mode for order import","Use Admin Mode for order import"
71
+ "CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount.","CP When importing marketplace orders you can use the admin mode. When choosing the admin mode please note that all checks are disabled thar are normally applied, like: ordering a product which amount is less than the configured minimum allowed quantity in shopping cart, import orders which have products that are sold out or the available amount is less than the ordered amount."
72
+
73
+ "CP Export Method","Export Method"
74
+ "CP If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option.","If you choose the indexed method, make sure that the 'Channelpilot Product Feed Export' index is always up to date. Please note, that if you select more than 40 data fields, that the indexed method will be used regardless of the selected option."
75
+ "CP Live","Live"
76
+ "CP Indexed","Indexed"
77
+ "CP Channelpilot Product Feed Export","ChannelPilot Product Feed Export"
78
+ "CP Index product data for the Channelpilot product feed export","Index product data for the Channelpilot product feed export"
79
+ "CP You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date.","You have added more than %s data fields for the product feed export. Please note that with this amount the 'indexed' export method will re used regardless of the selected one. Keep in mind that you have to keep the ChannelPilot Product Feed Export index up to date."
80
+ "CP Product ID","Product ID"
81
+ "CP Product SKU","Product SKU"
82
+ "CP Created At","Created at"
83
+ "CP Showing feed export data for product %s and store %s - Created at: %s","Showing feed export data for product %s and store %s - Created at: %s"
84
+ "CP Please specify store.","Please specify store."
85
+ "CP The data has been deleted. Please reindex the export data.","The data has been deleted. Please reindex the export data."
86
+ "CP Warning, this will delete all entries and the data has to be reindexed. Proceed ?","Warning, this will delete all entries and the data has to be reindexed. Do you wish to proceed ?"
87
+ "CP Truncate Index Table","Truncate Index Table"
88
+
89
+ "CP Default url: https://seller.api.channelpilot.com/1_0?wsdl", "Default url: https://seller.api.channelpilot.com/1_0?wsdl"
90
+ "CP Seller api wsdl url","Seller api wsdl url"
91
+
92
+ "CP Product Url Generation Method","Product Url Generation Method"
93
+ "CP base url + url_path","base url + url_path"
94
+ "CP base url + url_key","base url + url_key"
95
+ "CP base url + url_key + .html","base url + url_key + .html"
96
+ "CP Method getProductUrl","Method getProductUrl"
97
+ "CP Method getUrlInStore","Method getUrlInStore"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Channelpilotsolutions_Channelpilot</name>
4
- <version>2.2.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
@@ -27,12 +27,11 @@
27
  &lt;/ul&gt;&#xD;
28
  Just get more information about ChannelPilot: &lt;a href="http://www.channelpilot.com"&gt;www.channelpilot.com&lt;/a&gt;</description>
29
  <notes>- general bugfixes&#xD;
30
- - improved performance for feed export&#xD;
31
- - added support to use the admin area for order import</notes>
32
  <authors><author><name>ChannelPilot Solutions GmbH</name><user>auto-converted</user><email>info@channelpilot.com</email></author></authors>
33
- <date>2015-10-29</date>
34
- <time>12:17:22</time>
35
- <contents><target name="magecommunity"><dir name="Channelpilotsolutions"><dir name="Channelpilot"><dir name="Adminhtml"><dir name="Model"><dir name="Articlenumber"><file name="Values.php" hash="f2744ef8301e25e096318f34eb97c2bf"/></dir><dir name="Cookiemode"><file name="Values.php" hash="1ec39f85bb7562c1b6a4614f759d9124"/></dir><dir name="Grossnet"><file name="Values.php" hash="11eaf553b0ec34299524ec6d5a9f1e13"/></dir><dir name="Imagenumber"><file name="Values.php" hash="010dbb2ec946627f338bc500d3d8d747"/></dir><dir name="Orderstatus"><file name="Values.php" hash="39823f1757a41c848ad4505d09aca9d2"/></dir><dir name="Pricefield"><file name="Values.php" hash="6b02dfa3fa93daafa8325d66a986b4ac"/></dir><dir name="Truefalse"><file name="Values.php" hash="e07f105d7d8dc9881690f162cd23472d"/></dir><dir name="Truefalsesecurity"><file name="Values.php" hash="509b5e1cc7cabbe179373bc0ed490499"/></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="Field"><file name="Abstract.php" hash="fc0aae8ea2b0bc8aab16ecba459b8988"/><file name="Exportfields.php" hash="8017ae4a421013309b731aff45bf997a"/><file name="Replacefields.php" hash="55266f9270660519a6ce1843048467e3"/><file name="Specialfields.php" hash="4723404c20af3390d6d820318b21c1f6"/><file name="Trackingkeys.php" hash="6164e184bf6ac2b1e81169251752a551"/></dir><file name="Hintlogo.php" hash="1daa84afa8820f71a0d1630ee2311da6"/></dir><dir name="Tracking"><file name="Tracking.php" hash="3be4cdf75739c3dc1078f90be82380c6"/></dir></dir><dir name="Helper"><dir name="api"><dir name="1_0"><dir name="responses"><file name="GetManagedArticlePricesResponse.php" hash="9ad5adee1952b9408b442449791a1f34"/><file name="GetNewMarketplaceOrdersResponse.php" hash="cd5db953a84759b93a35a360956c4624"/><file name="GetServerTimeResponse.php" hash="07d157639b5bf715aa3f93b0d9e4b736"/><file name="Response.php" hash="c76ce62707a862e1c59346c668055b5d"/><file name="UpdateArticleResult.php" hash="a014c60be447fbb9cf48c947c8e9822f"/><file name="UpdateArticlesResponse.php" hash="338619d50391d91defb5c9d41370022f"/><file name="UpdateOrderResult.php" hash="0fbd88371624270a8cb2c4209a89cfac"/><file name="UpdateOrdersResponse.php" hash="b0ad5828da633b05e654da393b15526a"/></dir><dir name="thin"><file name="CPAddress.php" hash="885fb4517335421fbd8cbc882ae336b1"/><file name="CPArticle.php" hash="1adce1ce33acdd0185dee06010040b18"/><file name="CPArticleUpdate.php" hash="45f514823895c754010f8f11a1ff683a"/><file name="CPAuth.php" hash="cf5fe570dbd98e3e6339b20cec826b7b"/><file name="CPCancellation.php" hash="9bf808e265e09d166466313405a167fc"/><file name="CPCustomer.php" hash="62babdf11e9b4d80ae0afbbf96ba329d"/><file name="CPDelivery.php" hash="a270104ae1c253adee0ad1ffb5e01c65"/><file name="CPDiscount.php" hash="5d6f2766869134a86761c12230dc32d1"/><file name="CPManagedArticlePrice.php" hash="65c4c0df04b7c8d20294874de11640d6"/><file name="CPMoney.php" hash="952131eccc8470e107c78e15c94b6495"/><file name="CPOrder.php" hash="32623885f664e9b5871fc48b6ba0c801"/><file name="CPOrderHeader.php" hash="828377182e8197c304f230a783606993"/><file name="CPOrderItem.php" hash="dfe2440a08e3d0f13e638fc4090e6c52"/><file name="CPOrderStatus.php" hash="e0e767388dd9a1ab8be5a990f1ab1259"/><file name="CPOrderSummary.php" hash="fceaa6a79b5fc892062681f518fd0243"/><file name="CPPayment.php" hash="698b42f377910ef04d50a545e599fbca"/><file name="CPResponseHeader.php" hash="53930210d68046183e3be306996ea9b9"/><file name="CPShipping.php" hash="eaddceace28cdc6ba72434a6321d8c47"/></dir><file name="CPResultCodes.php" hash="955180ee33f14b4afa93f6eb1b5df53f"/><file name="ChannelPilotSellerAPI_v1_0.php" hash="76f458bece7e3344d0ffa788370e2026"/></dir></dir><dir name="handler"><file name="CPAbstractHandler.php" hash="78518d108e7ed273ec33056504869763"/><file name="CPCancellationHandler.php" hash="e7470edc465be2a3608102549efc436f"/><file name="CPDebugHandler.php" hash="51845f353b8e3d94ec324c3a750d9cc7"/><file name="CPDeliveryHandler.php" hash="11eee388729b17b21938a067edd66e54"/><file name="CPErrorHandler.php" hash="5d728c064c068fdf8354fa87882e4dba"/><file name="CPExportHandler.php" hash="34952b631cb90ad0b556642537b07794"/><file name="CPNewPriceHandler.php" hash="e0c1be684439c2336dd240aff9d8647e"/><file name="CPNewsHandler.php" hash="10757d4bbb3d10a3090dab9587c86132"/><file name="CPOrderHandler.php" hash="cdf76d6674c506508610347d247c0b2f"/><file name="CPPaymentHandler.php" hash="8ebbfdd04b92a0f7d72a8cbe8ba183d4"/><file name="CPRegisterHandler.php" hash="8ea51b6fc2e7820a4bac3f5e52377112"/><file name="CPStatusHandler.php" hash="573384fb4856d085f036edbc9388c2cd"/></dir><dir name="responses"><file name="CPGetStatusHookResponse.php" hash="672609ebcaa23aa0de85aed04c7662d8"/><file name="CPHookResponse.php" hash="3cda426724f3b3b97df344b4e76fc805"/><file name="CPRegisterHookResponse.php" hash="206de6433d0795ebdabff98129cc2fb7"/></dir><dir name="special"><file name="CustomerFunctions.php" hash="0d343d3c9c3cb87232c833e0772f730e"/></dir><file name="CPErrors.php" hash="3659c38a1ed3be4aa4ec03d93e68a84e"/><file name="Data.php" hash="9222c52259fda441689e134102ca4c55"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Source"><file name="Trackingmethod.php" hash="e32ab184b05377af38e4d912022cb889"/></dir></dir><dir name="Carrier"><file name="Cpshipping.php" hash="689b093872e690a9b1b1b5173365e7f8"/></dir><dir name="Order"><file name="Item.php" hash="7e64ca596a4a66e7c5052d0981745cf8"/><file name="Shipment.php" hash="71651ad5489eca654f47e41fd12e79a6"/></dir><dir name="Resource"><dir name="Logs"><file name="Collection.php" hash="d02494433e6369ddd552e04db867e9d5"/></dir><dir name="Order"><dir name="Item"><file name="Collection.php" hash="954e3889a8b8f93510a36be1a13c2fb8"/></dir><dir name="Shipment"><file name="Collection.php" hash="6aa1fd002807916effa760169a2e769d"/></dir><file name="Collection.php" hash="00423726d837a71042527c588cfc4b11"/><file name="Item.php" hash="485669b3f6dd7646ae9299547dc3a88f"/><file name="Shipment.php" hash="5d1514d5721b501fda7e71e6a15f931d"/></dir><dir name="Prices"><file name="Collection.php" hash="6d49bf71e50a0d2b0e087d52036a08ef"/></dir><dir name="Registration"><file name="Collection.php" hash="81423be65cf2ee706203ac03b5e83236"/></dir><file name="Logs.php" hash="b406da96412148256028b8c73444b0d9"/><file name="Order.php" hash="be971d53867fafbbf7c582dbe860e107"/><file name="Prices.php" hash="30275edca721b6986ff6bd39648bf4eb"/><file name="Registration.php" hash="a9f4190c21762c3f39c9647291e8e194"/></dir><file name="Abstract.php" hash="26580a64f5ae3d005b68e4563dbb1aea"/><file name="Logs.php" hash="85c27d3b47cbd97fc197a1ba8ae60dc6"/><file name="Order.php" hash="431bda96fe598fbb5a64928b940d8c13"/><file name="Payment.php" hash="223ab9dec3315f3dada4298f0418151a"/><file name="Paymenttypes.php" hash="ca90419f6e4603be3f70a214d95177c3"/><file name="Prices.php" hash="c1c966c0a3001fee90d14c050f00b66a"/><file name="Registration.php" hash="0719bdd075942a8706ccae12a35e91af"/></dir><dir name="controllers"><file name="IndexController.php" hash="ca07da3c0b2c689e9c0a8e552b6c7004"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8ad60dd724140db26bdf69b4baeabbc5"/><file name="config.xml" hash="f4f44ba0f796f938e79cd7eff1f4bc7b"/><file name="system.xml" hash="1555b7a34ad9fb281f5014acdd35cda6"/></dir><dir name="sql"><dir name="channelpilot_setup"><file name="mysql4-install-2.0.0.php" hash="f89d8be8b1ed7a6793ba6a2516de3528"/><file name="mysql4-upgrade-1.0.0-2.0.0.php" hash="12264e29678f7a56b002cd693dafd56f"/><file name="mysql4-upgrade-2.1.6-2.2.0.php" hash="4327290be3ce3226544515a72e6a74cf"/><file name="mysql4-upgrade-2.2.5-2.2.6.php" hash="b780b4273e42c73e1459935a003974b4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Channelpilotsolutions_Channelpilot.xml" hash="d14c5346561667941ef4f6e9e55666cd"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="Channelpilotsolutions"><file name="channelpilot.xml" hash="2952fa387aadf60f36b6fea9b5c69fb8"/></dir></dir><dir name="template"><dir name="Channelpilotsolutions"><file name="clicktracking_js.phtml" hash="20d1883b633d814587e5dd1661364fc1"/><file name="salestracking_js.phtml" hash="61c77c6fdab88cfac5989e7d47a8c5a4"/><file name="tracking_image.phtml" hash="f2477e9bf58ed34950b049db5af8a712"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="channelpilotsolutions"><file name="array_dropdown.phtml" hash="5717b5f3ca67bb4da734572fdca1a907"/><file name="config_hint.phtml" hash="c92f883df809f89278492d1e22a352d7"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="1cba569e9ec981939eb4a9c3da7ea979"/></dir><dir name="de_CH"><file name="Channelpilotsolutions_Channelpilot.csv" hash="1cba569e9ec981939eb4a9c3da7ea979"/></dir><dir name="de_AT"><file name="Channelpilotsolutions_Channelpilot.csv" hash="1cba569e9ec981939eb4a9c3da7ea979"/></dir><dir name="fr_FR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="23217faa0b1c623750bb91d1e324e082"/></dir><dir name="fr_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="23217faa0b1c623750bb91d1e324e082"/></dir><dir name="en_AU"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="en_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="en_GB"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="en_IE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="en_NZ"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="en_US"><file name="Channelpilotsolutions_Channelpilot.csv" hash="6ca86d9f43bbc1917c572d5d1d935677"/></dir><dir name="es_AR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CL"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CO"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_ES"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_MX"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_PA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_PE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_VE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir></target></contents>
36
  <compatible/>
37
  <dependencies/>
38
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Channelpilotsolutions_Channelpilot</name>
4
+ <version>2.2.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
27
  &lt;/ul&gt;&#xD;
28
  Just get more information about ChannelPilot: &lt;a href="http://www.channelpilot.com"&gt;www.channelpilot.com&lt;/a&gt;</description>
29
  <notes>- general bugfixes&#xD;
30
+ - added index for product feed export</notes>
 
31
  <authors><author><name>ChannelPilot Solutions GmbH</name><user>auto-converted</user><email>info@channelpilot.com</email></author></authors>
32
+ <date>2016-02-26</date>
33
+ <time>09:28:19</time>
34
+ <contents><target name="magecommunity"><dir name="Channelpilotsolutions"><dir name="Channelpilot"><dir name="Adminhtml"><dir name="Model"><dir name="Articlenumber"><file name="Values.php" hash="f2744ef8301e25e096318f34eb97c2bf"/></dir><dir name="Cookiemode"><file name="Values.php" hash="1ec39f85bb7562c1b6a4614f759d9124"/></dir><dir name="Grossnet"><file name="Values.php" hash="11eaf553b0ec34299524ec6d5a9f1e13"/></dir><dir name="Imagenumber"><file name="Values.php" hash="010dbb2ec946627f338bc500d3d8d747"/></dir><dir name="Orderstatus"><file name="Values.php" hash="39823f1757a41c848ad4505d09aca9d2"/></dir><dir name="Pricefield"><file name="Values.php" hash="6b02dfa3fa93daafa8325d66a986b4ac"/></dir><dir name="Truefalse"><file name="Values.php" hash="e07f105d7d8dc9881690f162cd23472d"/></dir><dir name="Truefalsesecurity"><file name="Values.php" hash="509b5e1cc7cabbe179373bc0ed490499"/></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="Feedexport"><dir name="View"><file name="Form.php" hash="539382c03bf5b43cb3e9ca6aa3ebfa10"/></dir><file name="Grid.php" hash="2e62d6614e84d6073d33fb079f50f907"/><file name="View.php" hash="44887305f3570fdc95cdf5dbf2a5e563"/></dir><dir name="Field"><file name="Abstract.php" hash="fc0aae8ea2b0bc8aab16ecba459b8988"/><file name="Exportfields.php" hash="8017ae4a421013309b731aff45bf997a"/><file name="Replacefields.php" hash="55266f9270660519a6ce1843048467e3"/><file name="Specialfields.php" hash="4723404c20af3390d6d820318b21c1f6"/><file name="Trackingkeys.php" hash="6164e184bf6ac2b1e81169251752a551"/></dir><file name="Feedexport.php" hash="df8d33aa8c32e52158fa31e9d9af3950"/><file name="Hintlogo.php" hash="1daa84afa8820f71a0d1630ee2311da6"/></dir><dir name="Tracking"><file name="Tracking.php" hash="3be4cdf75739c3dc1078f90be82380c6"/></dir></dir><dir name="Helper"><dir name="api"><dir name="1_0"><dir name="responses"><file name="GetManagedArticlePricesResponse.php" hash="9ad5adee1952b9408b442449791a1f34"/><file name="GetNewMarketplaceOrdersResponse.php" hash="cd5db953a84759b93a35a360956c4624"/><file name="GetServerTimeResponse.php" hash="07d157639b5bf715aa3f93b0d9e4b736"/><file name="Response.php" hash="c76ce62707a862e1c59346c668055b5d"/><file name="UpdateArticleResult.php" hash="a014c60be447fbb9cf48c947c8e9822f"/><file name="UpdateArticlesResponse.php" hash="338619d50391d91defb5c9d41370022f"/><file name="UpdateOrderResult.php" hash="0fbd88371624270a8cb2c4209a89cfac"/><file name="UpdateOrdersResponse.php" hash="b0ad5828da633b05e654da393b15526a"/></dir><dir name="thin"><file name="CPAddress.php" hash="885fb4517335421fbd8cbc882ae336b1"/><file name="CPArticle.php" hash="1adce1ce33acdd0185dee06010040b18"/><file name="CPArticleUpdate.php" hash="45f514823895c754010f8f11a1ff683a"/><file name="CPAuth.php" hash="cf5fe570dbd98e3e6339b20cec826b7b"/><file name="CPCancellation.php" hash="9bf808e265e09d166466313405a167fc"/><file name="CPCustomer.php" hash="62babdf11e9b4d80ae0afbbf96ba329d"/><file name="CPDelivery.php" hash="a270104ae1c253adee0ad1ffb5e01c65"/><file name="CPDiscount.php" hash="5d6f2766869134a86761c12230dc32d1"/><file name="CPManagedArticlePrice.php" hash="65c4c0df04b7c8d20294874de11640d6"/><file name="CPMoney.php" hash="952131eccc8470e107c78e15c94b6495"/><file name="CPOrder.php" hash="32623885f664e9b5871fc48b6ba0c801"/><file name="CPOrderHeader.php" hash="828377182e8197c304f230a783606993"/><file name="CPOrderItem.php" hash="dfe2440a08e3d0f13e638fc4090e6c52"/><file name="CPOrderStatus.php" hash="e0e767388dd9a1ab8be5a990f1ab1259"/><file name="CPOrderSummary.php" hash="fceaa6a79b5fc892062681f518fd0243"/><file name="CPPayment.php" hash="698b42f377910ef04d50a545e599fbca"/><file name="CPResponseHeader.php" hash="53930210d68046183e3be306996ea9b9"/><file name="CPShipping.php" hash="eaddceace28cdc6ba72434a6321d8c47"/></dir><file name="CPResultCodes.php" hash="955180ee33f14b4afa93f6eb1b5df53f"/><file name="ChannelPilotSellerAPI_v1_0.php" hash="acbdc4a0f2bac0755922ac46910ac52e"/></dir></dir><dir name="handler"><file name="CPAbstractHandler.php" hash="367bafb0c7e6a1296969ed9a21e922b4"/><file name="CPCancellationHandler.php" hash="38edd8e152f87ddb2e0a84abcb5f7e98"/><file name="CPDebugHandler.php" hash="51845f353b8e3d94ec324c3a750d9cc7"/><file name="CPDeliveryHandler.php" hash="43965d9fb84cb148e8b2ccd03483e584"/><file name="CPErrorHandler.php" hash="5d728c064c068fdf8354fa87882e4dba"/><file name="CPExportHandler.php" hash="819c62aa9a99f021f2c3a07109a623dd"/><file name="CPNewPriceHandler.php" hash="2c6e7b889ed872cd28fa5026e0cc57dc"/><file name="CPNewsHandler.php" hash="10757d4bbb3d10a3090dab9587c86132"/><file name="CPOrderHandler.php" hash="c632f421c89a14c37cdbe6e195cdf636"/><file name="CPPaymentHandler.php" hash="02f7bdb20b5672d23c511bb635ffea72"/><file name="CPRegisterHandler.php" hash="45280a1256b4047aff82cb0b24ee7e1b"/><file name="CPStatusHandler.php" hash="f378b4b56ac502fc035cfabc062cd43c"/></dir><dir name="responses"><file name="CPGetStatusHookResponse.php" hash="672609ebcaa23aa0de85aed04c7662d8"/><file name="CPHookResponse.php" hash="df481afb1680964780126fcd68c00818"/><file name="CPRegisterHookResponse.php" hash="206de6433d0795ebdabff98129cc2fb7"/></dir><dir name="special"><file name="CustomerFunctions.php" hash="0d343d3c9c3cb87232c833e0772f730e"/></dir><file name="CPErrors.php" hash="3659c38a1ed3be4aa4ec03d93e68a84e"/><file name="Data.php" hash="cdd617730e9bf291ac62ef928eca39c6"/><file name="Export.php" hash="e91fb55a9dcf0b72bfa3812ee213debb"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Source"><file name="Exportmethod.php" hash="604cb29e7871ac54697582dc51f67842"/><file name="Producturlgeneration.php" hash="a9e7fb7aecf048858a1af4f1fae9ead6"/><file name="Trackingmethod.php" hash="e32ab184b05377af38e4d912022cb889"/></dir></dir><dir name="Carrier"><file name="Cpshipping.php" hash="5c73d41a01797c86137d036584db36ae"/></dir><dir name="Feedexport"><file name="Indexer.php" hash="447a342567484ba84ba67494ce30d63e"/></dir><dir name="Order"><file name="Item.php" hash="7e64ca596a4a66e7c5052d0981745cf8"/><file name="Shipment.php" hash="71651ad5489eca654f47e41fd12e79a6"/></dir><dir name="Resource"><dir name="Feedexport"><dir name="Indexer"><file name="Collection.php" hash="e0957ac77559f71f544aa5c70db5d80e"/></dir><file name="Indexer.php" hash="367c813db1aff8331629c400af3b8c99"/></dir><dir name="Logs"><file name="Collection.php" hash="d02494433e6369ddd552e04db867e9d5"/></dir><dir name="Order"><dir name="Item"><file name="Collection.php" hash="954e3889a8b8f93510a36be1a13c2fb8"/></dir><dir name="Shipment"><file name="Collection.php" hash="6aa1fd002807916effa760169a2e769d"/></dir><file name="Collection.php" hash="00423726d837a71042527c588cfc4b11"/><file name="Item.php" hash="485669b3f6dd7646ae9299547dc3a88f"/><file name="Shipment.php" hash="5d1514d5721b501fda7e71e6a15f931d"/></dir><dir name="Prices"><file name="Collection.php" hash="6d49bf71e50a0d2b0e087d52036a08ef"/></dir><dir name="Registration"><file name="Collection.php" hash="81423be65cf2ee706203ac03b5e83236"/></dir><file name="Logs.php" hash="b406da96412148256028b8c73444b0d9"/><file name="Order.php" hash="be971d53867fafbbf7c582dbe860e107"/><file name="Prices.php" hash="30275edca721b6986ff6bd39648bf4eb"/><file name="Registration.php" hash="a9f4190c21762c3f39c9647291e8e194"/></dir><file name="Abstract.php" hash="a142674a12bf57e8c98724b4ead154f8"/><file name="Logs.php" hash="85c27d3b47cbd97fc197a1ba8ae60dc6"/><file name="Observer.php" hash="9e18ed13078767de556617fe6fb7d445"/><file name="Order.php" hash="431bda96fe598fbb5a64928b940d8c13"/><file name="Payment.php" hash="223ab9dec3315f3dada4298f0418151a"/><file name="Paymenttypes.php" hash="ca90419f6e4603be3f70a214d95177c3"/><file name="Prices.php" hash="c1c966c0a3001fee90d14c050f00b66a"/><file name="Registration.php" hash="0719bdd075942a8706ccae12a35e91af"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Channelpilot"><file name="FeedexportController.php" hash="9770c6d8fb2b957936e5e17c6282ab17"/></dir></dir><file name="IndexController.php" hash="ca07da3c0b2c689e9c0a8e552b6c7004"/></dir><dir name="etc"><file name="adminhtml.xml" hash="916b5e121b31dceffe732afec9c6019f"/><file name="config.xml" hash="3f12cc7a7db32d2e32fb7edee8a5f33f"/><file name="system.xml" hash="7b6bb850ed7600ffd2b5b5a9687eaf09"/></dir><dir name="sql"><dir name="channelpilot_setup"><file name="mysql4-install-2.0.0.php" hash="f89d8be8b1ed7a6793ba6a2516de3528"/><file name="mysql4-upgrade-1.0.0-2.0.0.php" hash="12264e29678f7a56b002cd693dafd56f"/><file name="mysql4-upgrade-2.1.0-2.1.6.php" hash="7f76ad8deebb387a635e05c39b32e458"/><file name="mysql4-upgrade-2.1.6-2.2.0.php" hash="4327290be3ce3226544515a72e6a74cf"/><file name="mysql4-upgrade-2.2.5-2.2.6.php" hash="a1b2b1ba0227b6553202af9f2ce8abb1"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Channelpilotsolutions_Channelpilot.xml" hash="d14c5346561667941ef4f6e9e55666cd"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="Channelpilotsolutions"><file name="channelpilot.xml" hash="2952fa387aadf60f36b6fea9b5c69fb8"/></dir></dir><dir name="template"><dir name="Channelpilotsolutions"><file name="clicktracking_js.phtml" hash="20d1883b633d814587e5dd1661364fc1"/><file name="salestracking_js.phtml" hash="61c77c6fdab88cfac5989e7d47a8c5a4"/><file name="tracking_image.phtml" hash="f2477e9bf58ed34950b049db5af8a712"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="channelpilotsolutions"><file name="array_dropdown.phtml" hash="5717b5f3ca67bb4da734572fdca1a907"/><file name="config_hint.phtml" hash="c92f883df809f89278492d1e22a352d7"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="c67ab461fb1ad4cc42958646bc3cc5db"/></dir><dir name="de_CH"><file name="Channelpilotsolutions_Channelpilot.csv" hash="c67ab461fb1ad4cc42958646bc3cc5db"/></dir><dir name="de_AT"><file name="Channelpilotsolutions_Channelpilot.csv" hash="c67ab461fb1ad4cc42958646bc3cc5db"/></dir><dir name="fr_FR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="23217faa0b1c623750bb91d1e324e082"/></dir><dir name="fr_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="23217faa0b1c623750bb91d1e324e082"/></dir><dir name="en_AU"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="en_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="en_GB"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="en_IE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="en_NZ"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="en_US"><file name="Channelpilotsolutions_Channelpilot.csv" hash="5d535e9bc597ff62a64a999f1b1c8879"/></dir><dir name="es_AR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CL"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CO"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_CR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_ES"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_MX"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_PA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_PE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir><dir name="es_VE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="e457ab4f2c03c46e8ce69bc6eb1dcc25"/></dir></target></contents>
35
  <compatible/>
36
  <dependencies/>
37
  </package>