Channelpilotsolutions_Channelpilot - Version 2.2.3

Version Notes

- general bugfixes

Download this release

Release Info

Developer ChannelPilot Solutions GmbH
Extension Channelpilotsolutions_Channelpilot
Version 2.2.3
Comparing to
See all releases


Code changes from version 2.2.2 to 2.2.3

Files changed (67) hide show
  1. app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Articlenumber/Values.php +32 -32
  2. app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Orderstatus/Values.php +46 -46
  3. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Abstract.php +44 -44
  4. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php +76 -68
  5. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Replacefields.php +72 -72
  6. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Specialfields.php +54 -54
  7. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Trackingkeys.php +66 -66
  8. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Hintlogo.php +11 -11
  9. app/code/community/Channelpilotsolutions/Channelpilot/Block/Tracking/Tracking.php +139 -139
  10. app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php +222 -222
  11. app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php +0 -296
  12. app/code/community/Channelpilotsolutions/Channelpilot/Helper/ExportData.php +0 -575
  13. app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php +198 -198
  14. app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/thin/CPDelivery.php +54 -54
  15. app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/thin/CPPayment.php +37 -37
  16. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPAbstractHandler.php +142 -137
  17. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php +146 -146
  18. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDebugHandler.php +49 -49
  19. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php +103 -103
  20. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php +601 -559
  21. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php +172 -172
  22. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewsHandler.php +44 -44
  23. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPOrderHandler.php +604 -605
  24. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php +85 -85
  25. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php +123 -123
  26. app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php +172 -172
  27. app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php +54 -54
  28. app/code/community/Channelpilotsolutions/Channelpilot/Model/Abstract.php +201 -201
  29. app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Trackingmethod.php +33 -33
  30. app/code/community/Channelpilotsolutions/Channelpilot/Model/Carrier/Cpshipping.php +86 -86
  31. app/code/community/Channelpilotsolutions/Channelpilot/Model/Logs.php +38 -38
  32. app/code/community/Channelpilotsolutions/Channelpilot/Model/Order.php +74 -65
  33. app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Item.php +52 -52
  34. app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Shipment.php +44 -44
  35. app/code/community/Channelpilotsolutions/Channelpilot/Model/Payment.php +111 -111
  36. app/code/community/Channelpilotsolutions/Channelpilot/Model/PaymentTypes.php +0 -18
  37. app/code/community/Channelpilotsolutions/Channelpilot/Model/Paymenttypes.php +18 -18
  38. app/code/community/Channelpilotsolutions/Channelpilot/Model/Prices.php +38 -38
  39. app/code/community/Channelpilotsolutions/Channelpilot/Model/Registration.php +73 -73
  40. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs.php +31 -31
  41. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs/Collection.php +31 -31
  42. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order.php +103 -81
  43. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Collection.php +97 -97
  44. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item.php +59 -59
  45. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item/Collection.php +97 -97
  46. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment.php +51 -51
  47. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment/Collection.php +31 -31
  48. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices.php +32 -32
  49. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices/Collection.php +31 -31
  50. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration.php +97 -97
  51. app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration/Collection.php +31 -31
  52. app/code/community/Channelpilotsolutions/Channelpilot/controllers/IndexController.php +36 -36
  53. app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml +60 -60
  54. app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml +182 -182
  55. app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml +575 -575
  56. app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-install-2.0.0.php +206 -206
  57. app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-1.0.0-2.0.0.php +179 -179
  58. app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.1.6-2.2.0.php +57 -57
  59. app/design/adminhtml/base/default/template/channelpilotsolutions/array_dropdown.phtml +174 -174
  60. app/design/adminhtml/base/default/template/channelpilotsolutions/config_hint.phtml +145 -145
  61. app/design/frontend/base/default/layout/Channelpilotsolutions/channelpilot.xml +42 -42
  62. app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking_js.phtml +26 -26
  63. app/design/frontend/base/default/template/Channelpilotsolutions/gtm.phtml +0 -44
  64. app/design/frontend/base/default/template/Channelpilotsolutions/salestracking_js.phtml +46 -46
  65. app/design/frontend/base/default/template/Channelpilotsolutions/tracking_image.phtml +26 -26
  66. app/etc/modules/Channelpilotsolutions_Channelpilot.xml +33 -33
  67. package.xml +6 -6
app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Articlenumber/Values.php CHANGED
@@ -1,33 +1,33 @@
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
- * @subpackage adminhtml_model_cookiemode
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <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_Model_Articlenumber_Values
24
- {
25
- public function toOptionArray()
26
- {
27
- return array(
28
- array('value' => 'product_id', 'label'=>'Entity ID'),
29
- array('value' => 'sku', 'label'=>'Sku')
30
- );
31
- }
32
- }
33
  ?>
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
+ * @subpackage adminhtml_model_cookiemode
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <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_Model_Articlenumber_Values
24
+ {
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => 'product_id', 'label'=>'Entity ID'),
29
+ array('value' => 'sku', 'label'=>'Sku')
30
+ );
31
+ }
32
+ }
33
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Orderstatus/Values.php CHANGED
@@ -1,47 +1,47 @@
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
- * @subpackage adminhtml_model_cookiemode
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_Adminhtml_Model_Orderstatus_Values {
25
-
26
- public function toOptionArray() {
27
-
28
- $sQuery = "select * from sales_order_status;";
29
- $dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
30
- try {
31
- $sResult = $dbConnection->fetchAll($sQuery);
32
- $result_array = array();
33
- $result_array[] = array('value' => "---", 'label' => "---");
34
- foreach ($sResult as $resultType) {
35
- $result_array[] = array('value' => $resultType['status'], 'label' => $resultType['label']);
36
- }
37
- } catch (Exception $e) {
38
- $dbConnection->closeConnection();
39
- }
40
- $dbConnection->closeConnection();
41
-
42
- return $result_array;
43
- }
44
-
45
- }
46
-
47
  ?>
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
+ * @subpackage adminhtml_model_cookiemode
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_Adminhtml_Model_Orderstatus_Values {
25
+
26
+ public function toOptionArray() {
27
+
28
+ $sQuery = "select * from sales_order_status;";
29
+ $dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
30
+ try {
31
+ $sResult = $dbConnection->fetchAll($sQuery);
32
+ $result_array = array();
33
+ $result_array[] = array('value' => "---", 'label' => "---");
34
+ foreach ($sResult as $resultType) {
35
+ $result_array[] = array('value' => $resultType['status'], 'label' => $resultType['label']);
36
+ }
37
+ } catch (Exception $e) {
38
+ $dbConnection->closeConnection();
39
+ }
40
+ $dbConnection->closeConnection();
41
+
42
+ return $result_array;
43
+ }
44
+
45
+ }
46
+
47
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Abstract.php CHANGED
@@ -1,45 +1,45 @@
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
- * @subpackage block_adminhtml_field
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
-
24
- abstract class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
-
26
- /**
27
- * Get all product attribute codes as array. Returned format:
28
- * [0] => Array
29
- * (
30
- * [attribute_code] => code
31
- * )
32
- * @param array $excludeAttributeCodes Attribute codes used for a NOT IN filter
33
- * @return array
34
- */
35
- protected function _getProductAttributeCodes(array $excludeAttributeCodes = array()) {
36
- $query = new Zend_Db_Select(Mage::getSingleton('core/resource')->getConnection('core_read'));
37
- $query->from(Mage::getSingleton('core/resource')->getTableName('eav_entity_type'), array('entity_type_id'))
38
- ->where('entity_type_code = ?', 'catalog_product');
39
- return Mage::getResourceModel('eav/entity_attribute_collection')
40
- ->addFieldToSelect('attribute_code')
41
- ->addFieldToFilter('entity_type_id', array('eq' => new Zend_Db_Expr('('.$query.')')))
42
- ->addFieldToFilter('attribute_code', array('nin' => $excludeAttributeCodes))
43
- ->getData();
44
- }
45
  }
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
+ * @subpackage block_adminhtml_field
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
+
24
+ abstract class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
+
26
+ /**
27
+ * Get all product attribute codes as array. Returned format:
28
+ * [0] => Array
29
+ * (
30
+ * [attribute_code] => code
31
+ * )
32
+ * @param array $excludeAttributeCodes Attribute codes used for a NOT IN filter
33
+ * @return array
34
+ */
35
+ protected function _getProductAttributeCodes(array $excludeAttributeCodes = array()) {
36
+ $query = new Zend_Db_Select(Mage::getSingleton('core/resource')->getConnection('core_read'));
37
+ $query->from(Mage::getSingleton('core/resource')->getTableName('eav_entity_type'), array('entity_type_id'))
38
+ ->where('entity_type_code = ?', 'catalog_product');
39
+ return Mage::getResourceModel('eav/entity_attribute_collection')
40
+ ->addFieldToSelect('attribute_code')
41
+ ->addFieldToFilter('entity_type_id', array('eq' => new Zend_Db_Expr('('.$query.')')))
42
+ ->addFieldToFilter('attribute_code', array('nin' => $excludeAttributeCodes))
43
+ ->getData();
44
+ }
45
  }
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php CHANGED
@@ -1,69 +1,77 @@
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
- * @subpackage block_adminhtml_field
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Exportfields extends Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract {
25
-
26
- public function __construct() {
27
- $this->addColumn('productattribute', array(
28
- 'label' => Mage::helper('adminhtml')->__('Data field'),
29
- 'size' => 30
30
- ));
31
- $this->_addAfter = false;
32
-
33
- parent::__construct();
34
- $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
35
- }
36
-
37
- protected function _renderCellTemplate($columnName) {
38
- if (empty($this->_columns[$columnName])) {
39
- throw new Exception('Wrong column name specified.');
40
- }
41
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
-
43
- if ($columnName == 'productattribute') {
44
- $rendered = '<select name="' . $inputName . '">';
45
-
46
- // Get attribute codes and types
47
- $attributes = $this->_getProductAttributeCodes(array(
48
- 'sku','price','name','description','manufacturer','color','weight', 'parent_id'
49
- ));
50
-
51
- $attributes[]['attribute_code'] = 'qty';
52
- $attributes[]['attribute_code'] = 'stock_status';
53
- $attributes[]['attribute_code'] = 'cp_color_attribute_id';
54
- $attributes[]['attribute_code'] = 'type_id';
55
- $attributes[]['attribute_code'] = 'parent_id';
56
- asort($attributes);
57
- foreach ($attributes as $attribute) {
58
- $rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
59
- }
60
- $rendered .= '</select>';
61
- return $rendered;
62
- }
63
-
64
- return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
65
- }
66
-
67
- }
68
-
 
 
 
 
 
 
 
 
69
  ?>
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
+ * @subpackage block_adminhtml_field
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Exportfields extends Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract {
25
+
26
+ public function __construct() {
27
+ $this->addColumn('productattribute', array(
28
+ 'label' => Mage::helper('adminhtml')->__('Data field'),
29
+ 'size' => 30
30
+ ));
31
+ $this->_addAfter = false;
32
+
33
+ parent::__construct();
34
+ $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
35
+ }
36
+
37
+ protected function _renderCellTemplate($columnName) {
38
+ if (empty($this->_columns[$columnName])) {
39
+ throw new Exception('Wrong column name specified.');
40
+ }
41
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
+
43
+ if ($columnName == 'productattribute') {
44
+ $rendered = '<select name="' . $inputName . '">';
45
+
46
+ // Get attribute codes and types
47
+ $attributes = $this->_getProductAttributeCodes(array(
48
+ 'sku','price','name','description','manufacturer','color','weight', 'parent_id'
49
+ ));
50
+
51
+ $attributes[]['attribute_code'] = 'qty';
52
+ $attributes[]['attribute_code'] = 'stock_status';
53
+ $attributes[]['attribute_code'] = 'cp_color_attribute_id';
54
+ $attributes[]['attribute_code'] = 'type_id';
55
+ $attributes[]['attribute_code'] = 'parent_id';
56
+ asort($attributes);
57
+ foreach ($attributes as $attribute) {
58
+ if($attribute['attribute_code'] == 'group_price') {
59
+ $customerGroupCollection = Mage::getModel('customer/group')->getCollection();
60
+ $strGroupPrice = 'group_price';
61
+ foreach($customerGroupCollection as $group) {
62
+ $rendered .= '<option value="' . $strGroupPrice.'_'.$group->getId(). '">' . $strGroupPrice.' - '.$group->getCustomerGroupCode() . '</option>';
63
+ }
64
+ } else {
65
+ $rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
66
+ }
67
+ }
68
+ $rendered .= '</select>';
69
+ return $rendered;
70
+ }
71
+
72
+ return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
73
+ }
74
+
75
+ }
76
+
77
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Replacefields.php CHANGED
@@ -1,73 +1,73 @@
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
- * @subpackage block_adminhtml_field
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Replacefields extends Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract {
25
-
26
- public function __construct() {
27
- $this->addColumn('productattribute', array(
28
- 'label' => Mage::helper('adminhtml')->__('Data field'),
29
- 'size' => 30
30
- ));
31
- $this->_addAfter = false;
32
-
33
- parent::__construct();
34
- $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
35
- }
36
-
37
- protected function _renderCellTemplate($columnName) {
38
- if (empty($this->_columns[$columnName])) {
39
- throw new Exception('Wrong column name specified.');
40
- }
41
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
-
43
- if ($columnName == 'productattribute') {
44
- $rendered = '<select name="' . $inputName . '">';
45
- $attributes = $this->_getProductAttributeCodes(array(
46
- 'sku','price','name','description','manufacturer','color','weight'
47
- ));
48
-
49
- $attributes[]['attribute_code'] = 'qty';
50
- $attributes[]['attribute_code'] = 'stock_status';
51
- $attributes[]['attribute_code'] = 'cp_color_attribute_id';
52
- $attributes[]['attribute_code'] = 'parent_id';
53
-
54
- $attributes[]['attribute_code'] = 'categories';
55
- $attributes[]['attribute_code'] = 'cp_image_url';
56
- $attributes[]['attribute_code'] = 'cp_product_url';
57
- $attributes[]['attribute_code'] = 'cp_additional_image_1';
58
- $attributes[]['attribute_code'] = 'cp_additional_image_2';
59
- $attributes[]['attribute_code'] = 'cp_additional_image_3';
60
- asort($attributes);
61
- foreach ($attributes as $attribute) {
62
- $rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
63
- }
64
- $rendered .= '</select>';
65
- return $rendered;
66
- }
67
-
68
- return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
69
- }
70
-
71
- }
72
-
73
  ?>
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
+ * @subpackage block_adminhtml_field
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Replacefields extends Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Abstract {
25
+
26
+ public function __construct() {
27
+ $this->addColumn('productattribute', array(
28
+ 'label' => Mage::helper('adminhtml')->__('Data field'),
29
+ 'size' => 30
30
+ ));
31
+ $this->_addAfter = false;
32
+
33
+ parent::__construct();
34
+ $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
35
+ }
36
+
37
+ protected function _renderCellTemplate($columnName) {
38
+ if (empty($this->_columns[$columnName])) {
39
+ throw new Exception('Wrong column name specified.');
40
+ }
41
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
+
43
+ if ($columnName == 'productattribute') {
44
+ $rendered = '<select name="' . $inputName . '">';
45
+ $attributes = $this->_getProductAttributeCodes(array(
46
+ 'sku','price','name','description','manufacturer','color','weight'
47
+ ));
48
+
49
+ $attributes[]['attribute_code'] = 'qty';
50
+ $attributes[]['attribute_code'] = 'stock_status';
51
+ $attributes[]['attribute_code'] = 'cp_color_attribute_id';
52
+ $attributes[]['attribute_code'] = 'parent_id';
53
+
54
+ $attributes[]['attribute_code'] = 'categories';
55
+ $attributes[]['attribute_code'] = 'cp_image_url';
56
+ $attributes[]['attribute_code'] = 'cp_product_url';
57
+ $attributes[]['attribute_code'] = 'cp_additional_image_1';
58
+ $attributes[]['attribute_code'] = 'cp_additional_image_2';
59
+ $attributes[]['attribute_code'] = 'cp_additional_image_3';
60
+ asort($attributes);
61
+ foreach ($attributes as $attribute) {
62
+ $rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
63
+ }
64
+ $rendered .= '</select>';
65
+ return $rendered;
66
+ }
67
+
68
+ return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
69
+ }
70
+
71
+ }
72
+
73
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Specialfields.php CHANGED
@@ -1,55 +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
- * @subpackage block_adminhtml_field
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Specialfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
-
26
- protected $magentoAttributes;
27
-
28
- public function __construct() {
29
- $this->addColumn('name', array(
30
- 'label' => Mage::helper('adminhtml')->__('Data field name'),
31
- 'size' => 30
32
- ));
33
- $this->addColumn('value', array(
34
- 'label' => Mage::helper('adminhtml')->__('Data field value'),
35
- 'size' => 30
36
- ));
37
- $this->_addAfter = false;
38
-
39
- parent::__construct();
40
- $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
41
- }
42
-
43
- protected function _renderCellTemplate($columnName) {
44
- if (empty($this->_columns[$columnName])) {
45
- throw new Exception('Wrong column name specified.');
46
- }
47
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
48
-
49
-
50
- return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
51
- }
52
-
53
- }
54
-
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
+ * @subpackage block_adminhtml_field
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Specialfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
+
26
+ protected $magentoAttributes;
27
+
28
+ public function __construct() {
29
+ $this->addColumn('name', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Data field name'),
31
+ 'size' => 30
32
+ ));
33
+ $this->addColumn('value', array(
34
+ 'label' => Mage::helper('adminhtml')->__('Data field value'),
35
+ 'size' => 30
36
+ ));
37
+ $this->_addAfter = false;
38
+
39
+ parent::__construct();
40
+ $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
41
+ }
42
+
43
+ protected function _renderCellTemplate($columnName) {
44
+ if (empty($this->_columns[$columnName])) {
45
+ throw new Exception('Wrong column name specified.');
46
+ }
47
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
48
+
49
+
50
+ return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
51
+ }
52
+
53
+ }
54
+
55
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Trackingkeys.php CHANGED
@@ -1,67 +1,67 @@
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
- * @subpackage block_adminhtml_field
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Trackingkeys extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
-
26
- protected $magentoAttributes;
27
-
28
- public function __construct() {
29
- $this->addColumn('shop', array(
30
- 'label' => Mage::helper('adminhtml')->__('Shop'),
31
- 'size' => 15
32
- ));
33
- $this->addColumn('trackingkey', array(
34
- 'label' => Mage::helper('adminhtml')->__('TrackingKey'),
35
- 'size' => 28
36
- ));
37
- $this->_addAfter = false;
38
-
39
- parent::__construct();
40
- $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
41
- }
42
-
43
- protected function _renderCellTemplate($columnName) {
44
- if (empty($this->_columns[$columnName])) {
45
- throw new Exception('Wrong column name specified.');
46
- }
47
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
48
-
49
- if ($columnName == 'shop') {
50
- $rendered = '<select name="' . $inputName . '">';
51
- $storeCollection = Mage::getSingleton('core/store')->getCollection()
52
- ->addFieldToFilter('code', array('neq' => Mage_Core_Model_Store::ADMIN_CODE))
53
- ->setOrder('website_id', 'ASC');
54
-
55
- foreach ($storeCollection as $store) {
56
- $rendered .= '<option value="' . $store->getId() . '">' . $store->getName() . '</option>';
57
- }
58
-
59
- $rendered .= '</select>';
60
- return $rendered;
61
- }
62
- return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
63
- }
64
-
65
- }
66
-
67
  ?>
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
+ * @subpackage block_adminhtml_field
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Trackingkeys extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
25
+
26
+ protected $magentoAttributes;
27
+
28
+ public function __construct() {
29
+ $this->addColumn('shop', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Shop'),
31
+ 'size' => 15
32
+ ));
33
+ $this->addColumn('trackingkey', array(
34
+ 'label' => Mage::helper('adminhtml')->__('TrackingKey'),
35
+ 'size' => 28
36
+ ));
37
+ $this->_addAfter = false;
38
+
39
+ parent::__construct();
40
+ $this->setTemplate('channelpilotsolutions/array_dropdown.phtml');
41
+ }
42
+
43
+ protected function _renderCellTemplate($columnName) {
44
+ if (empty($this->_columns[$columnName])) {
45
+ throw new Exception('Wrong column name specified.');
46
+ }
47
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
48
+
49
+ if ($columnName == 'shop') {
50
+ $rendered = '<select name="' . $inputName . '">';
51
+ $storeCollection = Mage::getSingleton('core/store')->getCollection()
52
+ ->addFieldToFilter('code', array('neq' => Mage_Core_Model_Store::ADMIN_CODE))
53
+ ->setOrder('website_id', 'ASC');
54
+
55
+ foreach ($storeCollection as $store) {
56
+ $rendered .= '<option value="' . $store->getId() . '">' . $store->getName() . '</option>';
57
+ }
58
+
59
+ $rendered .= '</select>';
60
+ return $rendered;
61
+ }
62
+ return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
63
+ }
64
+
65
+ }
66
+
67
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Hintlogo.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Hintlogo extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
4
-
5
- protected $_template = 'channelpilotsolutions/config_hint.phtml';
6
-
7
- public function render(Varien_Data_Form_Element_Abstract $element) {
8
- return $this->toHtml();
9
- }
10
-
11
- }
1
+ <?php
2
+
3
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Hintlogo extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
4
+
5
+ protected $_template = 'channelpilotsolutions/config_hint.phtml';
6
+
7
+ public function render(Varien_Data_Form_Element_Abstract $element) {
8
+ return $this->toHtml();
9
+ }
10
+
11
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Block/Tracking/Tracking.php CHANGED
@@ -1,140 +1,140 @@
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_Tracking_Tracking extends Mage_Core_Block_Template
24
- {
25
- const IMAGE_URL_CLICK = 'https://click.cptrack.de/verify';
26
- const IMAGE_URL_SALE = 'https://sale.cptrack.de/';
27
-
28
- /**
29
- * Flag to wether use the click or sales tracking.
30
- * @var bool
31
- */
32
- protected $_isSale;
33
-
34
- public function __construct() {
35
- $this->_isSale = false;
36
- }
37
-
38
- /**
39
- * Check if tracking is enabled.
40
- * @return bool
41
- */
42
- public function isEnabled() {
43
- return Mage::getStoreConfigFlag('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking');
44
- }
45
-
46
- /**
47
- * Check if the current tracking mode is set to "Image".
48
- * @return bool
49
- */
50
- public function isTrackingModeImage() {
51
- return Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/method') == Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Trackingmethod::TRACKING_METHOD_IMAGE;
52
- }
53
-
54
- /**
55
- * Get the tracking key for the current shop.
56
- * @return mixed
57
- */
58
- public function getTrackingKey() {
59
- $storeId = Mage::app()->getStore()->getId();
60
- $trackingKeys = unserialize(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_trackingkeys'));
61
- foreach ($trackingKeys as $element) {
62
- if ($element['shop'] == $storeId) {
63
- return $element['trackingkey'];
64
- }
65
- }
66
- }
67
-
68
- /**
69
- * Get the order with the last increment id from the checkout session.
70
- * Returns false if the order could not be loaded.
71
- * @return Mage_Sales_Model_Order | bool
72
- */
73
- public function getOrder() {
74
- $lastIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
75
- $order = Mage::getModel('sales/order')->loadByIncrementId($lastIncrementId);
76
- if($order && $order->getId()) {
77
- return $order;
78
- }
79
-
80
- Mage::log('Could not load order with increment id '.$lastIncrementId.' for sales tracking.');
81
- return false;
82
- }
83
-
84
- /**
85
- * Get the identifier field for the product (entity_id oder sku).
86
- * @return string
87
- */
88
- public function getProductIdField() {
89
- return Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
90
- }
91
-
92
- /**
93
- * Get the tracking cookie mode.
94
- * @return string
95
- */
96
- public function getCookieMode() {
97
- return Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_cookiemode');
98
- }
99
-
100
- /**
101
- * Get the url for the tracking image.
102
- * @return string
103
- */
104
- public function getImageUrl() {
105
- if($this->_isSale) {
106
- $order = $this->getOrder();
107
- if($order) {
108
- $url = self::IMAGE_URL_SALE
109
- . '?trackingKey='.urlencode($this->getTrackingKey())
110
- . '&cookie='.urlencode($this->getCookieMode())
111
- . '&orderId='.urlencode($order->getId())
112
- . '&orderTotal='.urlencode($order->getGrandTotal() - $order->getTaxAmount());
113
-
114
- $productIdField = $this->getProductIdField();
115
- $i = 1;
116
- foreach($order->getItemsCollection(array(), true) as $item) {
117
- $url .= '&id'.$i.'='.urlencode($item->getData($productIdField))
118
- . '&price'.$i.'='.urlencode($item->getPrice())
119
- . '&amount'.$i.'='.urlencode($item->getQtyOrdered());
120
- $i++;
121
- }
122
-
123
- return $url;
124
- }
125
- return '';
126
- }
127
- return self::IMAGE_URL_CLICK;
128
- }
129
-
130
- /**
131
- * Set the isSale flag. If the param is set to anything that can be interpreted as
132
- * true, the class variable _isSale is set to true.
133
- * @param bool|false $isSale
134
- */
135
- public function setIsSale($isSale = false) {
136
- if($isSale) {
137
- $this->_isSale = true;
138
- }
139
- }
140
  }
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_Tracking_Tracking extends Mage_Core_Block_Template
24
+ {
25
+ const IMAGE_URL_CLICK = 'https://click.cptrack.de/verify';
26
+ const IMAGE_URL_SALE = 'https://sale.cptrack.de/';
27
+
28
+ /**
29
+ * Flag to wether use the click or sales tracking.
30
+ * @var bool
31
+ */
32
+ protected $_isSale;
33
+
34
+ public function __construct() {
35
+ $this->_isSale = false;
36
+ }
37
+
38
+ /**
39
+ * Check if tracking is enabled.
40
+ * @return bool
41
+ */
42
+ public function isEnabled() {
43
+ return Mage::getStoreConfigFlag('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking');
44
+ }
45
+
46
+ /**
47
+ * Check if the current tracking mode is set to "Image".
48
+ * @return bool
49
+ */
50
+ public function isTrackingModeImage() {
51
+ return Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/method') == Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_Trackingmethod::TRACKING_METHOD_IMAGE;
52
+ }
53
+
54
+ /**
55
+ * Get the tracking key for the current shop.
56
+ * @return mixed
57
+ */
58
+ public function getTrackingKey() {
59
+ $storeId = Mage::app()->getStore()->getId();
60
+ $trackingKeys = unserialize(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_trackingkeys'));
61
+ foreach ($trackingKeys as $element) {
62
+ if ($element['shop'] == $storeId) {
63
+ return $element['trackingkey'];
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Get the order with the last increment id from the checkout session.
70
+ * Returns false if the order could not be loaded.
71
+ * @return Mage_Sales_Model_Order | bool
72
+ */
73
+ public function getOrder() {
74
+ $lastIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
75
+ $order = Mage::getModel('sales/order')->loadByIncrementId($lastIncrementId);
76
+ if($order && $order->getId()) {
77
+ return $order;
78
+ }
79
+
80
+ Mage::log('Could not load order with increment id '.$lastIncrementId.' for sales tracking.');
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * Get the identifier field for the product (entity_id oder sku).
86
+ * @return string
87
+ */
88
+ public function getProductIdField() {
89
+ return Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
90
+ }
91
+
92
+ /**
93
+ * Get the tracking cookie mode.
94
+ * @return string
95
+ */
96
+ public function getCookieMode() {
97
+ return Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_cookiemode');
98
+ }
99
+
100
+ /**
101
+ * Get the url for the tracking image.
102
+ * @return string
103
+ */
104
+ public function getImageUrl() {
105
+ if($this->_isSale) {
106
+ $order = $this->getOrder();
107
+ if($order) {
108
+ $url = self::IMAGE_URL_SALE
109
+ . '?trackingKey='.urlencode($this->getTrackingKey())
110
+ . '&cookie='.urlencode($this->getCookieMode())
111
+ . '&orderId='.urlencode($order->getId())
112
+ . '&orderTotal='.urlencode($order->getGrandTotal() - $order->getTaxAmount());
113
+
114
+ $productIdField = $this->getProductIdField();
115
+ $i = 1;
116
+ foreach($order->getItemsCollection(array(), true) as $item) {
117
+ $url .= '&id'.$i.'='.urlencode($item->getData($productIdField))
118
+ . '&price'.$i.'='.urlencode($item->getPrice())
119
+ . '&amount'.$i.'='.urlencode($item->getQtyOrdered());
120
+ $i++;
121
+ }
122
+
123
+ return $url;
124
+ }
125
+ return '';
126
+ }
127
+ return self::IMAGE_URL_CLICK;
128
+ }
129
+
130
+ /**
131
+ * Set the isSale flag. If the param is set to anything that can be interpreted as
132
+ * true, the class variable _isSale is set to true.
133
+ * @param bool|false $isSale
134
+ */
135
+ public function setIsSale($isSale = false) {
136
+ if($isSale) {
137
+ $this->_isSale = true;
138
+ }
139
+ }
140
  }
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php CHANGED
@@ -1,223 +1,223 @@
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
- * @subpackage helper
19
- * @copyright Copyright (c) 2013 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- require_once 'CPErrors.php';
25
-
26
- // Handler
27
- require_once 'handler/CPAbstractHandler.php';
28
- require_once 'handler/CPErrorHandler.php';
29
- require_once 'handler/CPExportHandler.php';
30
- require_once 'handler/CPStatusHandler.php';
31
- require_once 'handler/CPRegisterHandler.php';
32
- require_once 'handler/CPNewPriceHandler.php';
33
- require_once 'handler/CPOrderHandler.php';
34
- require_once 'handler/CPDeliveryHandler.php';
35
- require_once 'handler/CPCancellationHandler.php';
36
- require_once 'handler/CPNewsHandler.php';
37
- require_once 'handler/CPDebugHandler.php';
38
- require_once 'handler/CPPaymentHandler.php';
39
-
40
- // RESPONSES
41
- require_once 'responses/CPHookResponse.php';
42
- require_once 'responses/CPGetStatusHookResponse.php';
43
- require_once 'responses/CPRegisterHookResponse.php';
44
-
45
- // API
46
- require_once 'api/1_0/thin/CPDelivery.php';
47
- require_once 'api/1_0/ChannelPilotSellerAPI_v1_0.php';
48
- require_once 'api/1_0/CPResultCodes.php';
49
-
50
- // special customer functions
51
- require_once 'special/CustomerFunctions.php';
52
-
53
- class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Abstract {
54
-
55
- const GET_REGISTER = "register";
56
- const GET_EXPORT = "export";
57
- const GET_STATUS = "status";
58
- const GET_IMPORT_ORDERS = "orders";
59
- const GET_DELIVERED = "deliveries";
60
- const GET_CANCELLATION = "cancellations";
61
- const GET_NEWS = "news";
62
- const GET_NEWPRICES = "prices";
63
- const GET_DEBUG = "debug";
64
- const GET_PAYMENTS = "payments";
65
-
66
- public function __construct($root = 'root') {
67
-
68
- }
69
-
70
- public function createXml() {
71
- if (Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_useExport')) {
72
- $password = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_password');
73
- $paramPassword = Mage::app()->getRequest()->getParam('password', false);
74
- if ($password == '' || ($paramPassword AND $paramPassword == $password)) {
75
- $handler = new CPExportHandler(CPExportHandler::METHOD_XML);
76
- $handler->handle();
77
- exit();
78
- }
79
- }
80
- return;
81
- }
82
-
83
- // API CONNECTOR
84
- public function api() {
85
- $hook = null;
86
- if ($this->checkIp() === false) {
87
- return;
88
- }
89
-
90
- $newsActive = false;
91
- if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_useNews')) {
92
- $newsActive = true;
93
- }
94
- $marketplaceActive = false;
95
- if (Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_useMarketplaces')) {
96
- $marketplaceActive = true;
97
- }
98
- $pricecontrolActive = false;
99
- if (Mage::getStoreConfig('channelpilot_pricecontrol/channelpilot_general/channelpilot_usePricecontrol')) {
100
- $pricecontrolActive = true;
101
- }
102
- $exportActive = false;
103
- if (Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_useExport')) {
104
- $exportActive = true;
105
- }
106
-
107
- $method = Mage::app()->getRequest()->getParam('method', '');
108
- switch ($method) {
109
- // Send method
110
- case self::GET_STATUS:
111
- $this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
112
- $handler = new CPStatusHandler();
113
- $hook = $handler->handle();
114
- break;
115
-
116
- // Send method + merchantid + multishopid + token + ips
117
- case self::GET_REGISTER:
118
- $this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
119
- $this->checkSignature();
120
- $handler = new CPRegisterHandler();
121
- $hook = $handler->handle();
122
- break;
123
-
124
- // Send Method + token
125
- case self::GET_IMPORT_ORDERS:
126
- $this->checkActivation(array($marketplaceActive), 'marketplace');
127
- $this->checkSignature();
128
- $handler = new CPOrderHandler();
129
- $hook = $handler->handle();
130
- break;
131
- // Send Method + token
132
- case self::GET_DELIVERED:
133
- $this->checkActivation(array($marketplaceActive), 'marketplace');
134
- $this->checkSignature();
135
- $handler = new CPDeliveryHandler();
136
- $hook = $handler->handle();
137
- break;
138
-
139
- // Send Method + token
140
- case self::GET_CANCELLATION:
141
- $this->checkActivation(array($marketplaceActive), 'marketplace');
142
- $this->checkSignature();
143
- $handler = new CPCancellationHandler();
144
- $hook = $handler->handle();
145
- break;
146
-
147
- // Send method
148
- case self::GET_NEWS:
149
- $this->checkActivation(array($newsActive), 'news');
150
- $this->checkSignature();
151
- $handler = new CPNewsHandler();
152
- $hook = $handler->handle();
153
- break;
154
-
155
- // Send method + token + priceId
156
- case self::GET_NEWPRICES:
157
- $this->checkActivation(array($pricecontrolActive), 'pricecontrol');
158
- $handler = new CPNewPriceHandler();
159
- $hook = $handler->handle();
160
- break;
161
-
162
- // Send method + limit + shopId ( + last)
163
- case self::GET_EXPORT:
164
- $this->checkActivation(array($exportActive), 'export');
165
- $handler = new CPExportHandler();
166
- $hook = $handler->handle(CPExportHandler::METHOD_JSON);
167
- break;
168
-
169
- // Send method + limit + shopId ( + last)
170
- case self::GET_DEBUG:
171
- $this->checkSignature();
172
- $handler = new CPDebugHandler();
173
- $hook = $handler->handle();
174
- break;
175
-
176
- case self::GET_PAYMENTS:
177
- $this->checkSignature();
178
- $this->checkActivation(array($marketplaceActive), 'marketplace');
179
- $handler = new CPPaymentHandler();
180
- $handler->handle();
181
- break;
182
-
183
- default:
184
- $hook = "not supported method: " . $method;
185
- break;
186
- }
187
- header("Content-Type: application/json;");
188
- print_r(json_encode($hook));
189
- exit();
190
- }
191
-
192
- private function checkSignature() {
193
- $php = Mage::app()->getRequest()->getParam('php', false);
194
- $shop = Mage::app()->getRequest()->getParam('shop', false);
195
- $plugin = Mage::app()->getRequest()->getParam('plugin', false);
196
- IF ($php && $shop && $plugin) {
197
- if ($php == phpversion() && $shop == CPHookResponse::getSignatureShop() && $plugin == CPHookResponse::getModuleVersion()) {
198
- return true;
199
- }
200
- CPErrorHandler::handle(CPErrors::RESULT_SIGNATURE_MISMATCH, "Signature changed", "Signature changed \n" . $php . " -> " . phpversion() . "\n" . $shop . " -> " . CPHookResponse::getSignatureShop() . "\n" . $plugin . " -> " . CPHookResponse::getModuleVersion());
201
- } else {
202
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "Missing params for signature check", "Missing params for signature check");
203
- }
204
- }
205
-
206
- private function checkActivation($configs, $function) {
207
- foreach ($configs as $config) {
208
- if ($config === true) {
209
- return true;
210
- }
211
- }
212
- CPErrorHandler::handle(CPErrors::RESULT_API_DEACTIVATED, "'$function' not activated", "'$function' not activated");
213
- }
214
-
215
- private function checkIp() {
216
- if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
217
- return Mage::getModel('channelpilot/registration')->isIpAuthorized($_SERVER['REMOTE_ADDR']);
218
- }
219
- return true;
220
- }
221
- }
222
-
223
  ?>
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
+ * @subpackage helper
19
+ * @copyright Copyright (c) 2013 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ require_once 'CPErrors.php';
25
+
26
+ // Handler
27
+ require_once 'handler/CPAbstractHandler.php';
28
+ require_once 'handler/CPErrorHandler.php';
29
+ require_once 'handler/CPExportHandler.php';
30
+ require_once 'handler/CPStatusHandler.php';
31
+ require_once 'handler/CPRegisterHandler.php';
32
+ require_once 'handler/CPNewPriceHandler.php';
33
+ require_once 'handler/CPOrderHandler.php';
34
+ require_once 'handler/CPDeliveryHandler.php';
35
+ require_once 'handler/CPCancellationHandler.php';
36
+ require_once 'handler/CPNewsHandler.php';
37
+ require_once 'handler/CPDebugHandler.php';
38
+ require_once 'handler/CPPaymentHandler.php';
39
+
40
+ // RESPONSES
41
+ require_once 'responses/CPHookResponse.php';
42
+ require_once 'responses/CPGetStatusHookResponse.php';
43
+ require_once 'responses/CPRegisterHookResponse.php';
44
+
45
+ // API
46
+ require_once 'api/1_0/thin/CPDelivery.php';
47
+ require_once 'api/1_0/ChannelPilotSellerAPI_v1_0.php';
48
+ require_once 'api/1_0/CPResultCodes.php';
49
+
50
+ // special customer functions
51
+ require_once 'special/CustomerFunctions.php';
52
+
53
+ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Abstract {
54
+
55
+ const GET_REGISTER = "register";
56
+ const GET_EXPORT = "export";
57
+ const GET_STATUS = "status";
58
+ const GET_IMPORT_ORDERS = "orders";
59
+ const GET_DELIVERED = "deliveries";
60
+ const GET_CANCELLATION = "cancellations";
61
+ const GET_NEWS = "news";
62
+ const GET_NEWPRICES = "prices";
63
+ const GET_DEBUG = "debug";
64
+ const GET_PAYMENTS = "payments";
65
+
66
+ public function __construct($root = 'root') {
67
+
68
+ }
69
+
70
+ public function createXml() {
71
+ if (Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_useExport')) {
72
+ $password = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_password');
73
+ $paramPassword = Mage::app()->getRequest()->getParam('password', false);
74
+ if ($password == '' || ($paramPassword AND $paramPassword == $password)) {
75
+ $handler = new CPExportHandler(CPExportHandler::METHOD_XML);
76
+ $handler->handle();
77
+ exit();
78
+ }
79
+ }
80
+ return;
81
+ }
82
+
83
+ // API CONNECTOR
84
+ public function api() {
85
+ $hook = null;
86
+ if ($this->checkIp() === false) {
87
+ return;
88
+ }
89
+
90
+ $newsActive = false;
91
+ if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_useNews')) {
92
+ $newsActive = true;
93
+ }
94
+ $marketplaceActive = false;
95
+ if (Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_useMarketplaces')) {
96
+ $marketplaceActive = true;
97
+ }
98
+ $pricecontrolActive = false;
99
+ if (Mage::getStoreConfig('channelpilot_pricecontrol/channelpilot_general/channelpilot_usePricecontrol')) {
100
+ $pricecontrolActive = true;
101
+ }
102
+ $exportActive = false;
103
+ if (Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_useExport')) {
104
+ $exportActive = true;
105
+ }
106
+
107
+ $method = Mage::app()->getRequest()->getParam('method', '');
108
+ switch ($method) {
109
+ // Send method
110
+ case self::GET_STATUS:
111
+ $this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
112
+ $handler = new CPStatusHandler();
113
+ $hook = $handler->handle();
114
+ break;
115
+
116
+ // Send method + merchantid + multishopid + token + ips
117
+ case self::GET_REGISTER:
118
+ $this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
119
+ $this->checkSignature();
120
+ $handler = new CPRegisterHandler();
121
+ $hook = $handler->handle();
122
+ break;
123
+
124
+ // Send Method + token
125
+ case self::GET_IMPORT_ORDERS:
126
+ $this->checkActivation(array($marketplaceActive), 'marketplace');
127
+ $this->checkSignature();
128
+ $handler = new CPOrderHandler();
129
+ $hook = $handler->handle();
130
+ break;
131
+ // Send Method + token
132
+ case self::GET_DELIVERED:
133
+ $this->checkActivation(array($marketplaceActive), 'marketplace');
134
+ $this->checkSignature();
135
+ $handler = new CPDeliveryHandler();
136
+ $hook = $handler->handle();
137
+ break;
138
+
139
+ // Send Method + token
140
+ case self::GET_CANCELLATION:
141
+ $this->checkActivation(array($marketplaceActive), 'marketplace');
142
+ $this->checkSignature();
143
+ $handler = new CPCancellationHandler();
144
+ $hook = $handler->handle();
145
+ break;
146
+
147
+ // Send method
148
+ case self::GET_NEWS:
149
+ $this->checkActivation(array($newsActive), 'news');
150
+ $this->checkSignature();
151
+ $handler = new CPNewsHandler();
152
+ $hook = $handler->handle();
153
+ break;
154
+
155
+ // Send method + token + priceId
156
+ case self::GET_NEWPRICES:
157
+ $this->checkActivation(array($pricecontrolActive), 'pricecontrol');
158
+ $handler = new CPNewPriceHandler();
159
+ $hook = $handler->handle();
160
+ break;
161
+
162
+ // Send method + limit + shopId ( + last)
163
+ case self::GET_EXPORT:
164
+ $this->checkActivation(array($exportActive), 'export');
165
+ $handler = new CPExportHandler();
166
+ $hook = $handler->handle(CPExportHandler::METHOD_JSON);
167
+ break;
168
+
169
+ // Send method + limit + shopId ( + last)
170
+ case self::GET_DEBUG:
171
+ $this->checkSignature();
172
+ $handler = new CPDebugHandler();
173
+ $hook = $handler->handle();
174
+ break;
175
+
176
+ case self::GET_PAYMENTS:
177
+ $this->checkSignature();
178
+ $this->checkActivation(array($marketplaceActive), 'marketplace');
179
+ $handler = new CPPaymentHandler();
180
+ $handler->handle();
181
+ break;
182
+
183
+ default:
184
+ $hook = "not supported method: " . $method;
185
+ break;
186
+ }
187
+ header("Content-Type: application/json;");
188
+ print_r(json_encode($hook));
189
+ exit();
190
+ }
191
+
192
+ private function checkSignature() {
193
+ $php = Mage::app()->getRequest()->getParam('php', false);
194
+ $shop = Mage::app()->getRequest()->getParam('shop', false);
195
+ $plugin = Mage::app()->getRequest()->getParam('plugin', false);
196
+ IF ($php && $shop && $plugin) {
197
+ if ($php == phpversion() && $shop == CPHookResponse::getSignatureShop() && $plugin == CPHookResponse::getModuleVersion()) {
198
+ return true;
199
+ }
200
+ CPErrorHandler::handle(CPErrors::RESULT_SIGNATURE_MISMATCH, "Signature changed", "Signature changed \n" . $php . " -> " . phpversion() . "\n" . $shop . " -> " . CPHookResponse::getSignatureShop() . "\n" . $plugin . " -> " . CPHookResponse::getModuleVersion());
201
+ } else {
202
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "Missing params for signature check", "Missing params for signature check");
203
+ }
204
+ }
205
+
206
+ private function checkActivation($configs, $function) {
207
+ foreach ($configs as $config) {
208
+ if ($config === true) {
209
+ return true;
210
+ }
211
+ }
212
+ CPErrorHandler::handle(CPErrors::RESULT_API_DEACTIVATED, "'$function' not activated", "'$function' not activated");
213
+ }
214
+
215
+ private function checkIp() {
216
+ if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
217
+ return Mage::getModel('channelpilot/registration')->isIpAuthorized($_SERVER['REMOTE_ADDR']);
218
+ }
219
+ return true;
220
+ }
221
+ }
222
+
223
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php DELETED
@@ -1,296 +0,0 @@
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
- protected $_productEntityTypeId = null;
26
- protected $_masterProductQuery = null;
27
-
28
- /**
29
- * Get the entity_type_id for catalog_product.
30
- * @return mixed
31
- */
32
- public function getEntityTypeIdForProduct() {
33
- if($this->_productEntityTypeId === null) {
34
- // Get the entity type for products
35
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
36
- $query = new Zend_Db_Select($connection);
37
- $query->from(Mage::getSingleton('core/resource')->getTableName('eav/entity_type'), array('entity_type_id'));
38
- $query->where("entity_type_code = 'catalog_product'");
39
-
40
- $this->_productEntityTypeId = $connection->fetchOne($query);
41
- }
42
- return $this->_productEntityTypeId;
43
- }
44
-
45
- /**
46
- * Get all product attributes.
47
- * @return mixed
48
- */
49
- public function getProductAttributes() {
50
- // Get attribute codes and types
51
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
52
- $query = new Zend_Db_Select($connection);
53
- $query->from(Mage::getSingleton('core/resource')->getTableName('eav/attribute'),
54
- array('attribute_id', 'attribute_code', 'backend_type', 'frontend_input')
55
- );
56
- $query->where('entity_type_id = ?', $this->getEntityTypeIdForProduct());
57
-
58
- return $connection->FetchAssoc($query);
59
- }
60
-
61
- /**
62
- * Get the attribute options for an attribute_id.
63
- *
64
- * @param int $attributeId
65
- * @return array
66
- */
67
- public function getAttributeOptions($attributeId, $storeId) {
68
- // Get the option_id => value from the attribute options
69
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
70
- $query = new Zend_Db_Select($connection);
71
- $query->from(array('ao' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_option')),
72
- array(
73
- 'option_id' => new Zend_Db_Expr($connection->quoteInto(
74
- 'CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.option_id) ELSE
75
- MAX(CASE WHEN aov.store_id = ? THEN aov.option_id ELSE NULL END)
76
- END', $storeId
77
- )),
78
- 'value' => new Zend_Db_Expr($connection->quoteInto(
79
- 'CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.value) ELSE
80
- MAX(CASE WHEN aov.store_id = ? THEN aov.value ELSE NULL END)
81
- END', $storeId
82
- ))
83
- )
84
- );
85
- $query->join(array('aov' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_option_value')),
86
- 'ao.option_id = aov.option_id',
87
- null
88
- );
89
- $query->where('aov.store_id IN(0, ?)', $storeId);
90
- $query->where('ao.attribute_id = ?', $attributeId);
91
- $query->group(array('aov.option_id'));
92
-
93
- return $connection->fetchPairs($query);
94
- }
95
-
96
- /**
97
- * Get the additional image urls for an entity_id.
98
- * @param int $entityId
99
- * @return array
100
- */
101
- public function getAdditionalImageUrl($entityId, $storeId, $mediaGalleryAttributeId, $baseImageAttributeId) {
102
- $store = Mage::app()->getStore($storeId);
103
- $mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
104
-
105
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
106
- $galleryImagePrefix = $connection->quote($mediaUrl . 'catalog/product');
107
-
108
- $subquery = new Zend_Db_Select($connection);
109
- $subquery->from(Mage::getSingleton('core/resource')->getTableName(array('catalog/product', 'varchar')),
110
- array('value')
111
- );
112
- $subquery->where('entity_id = ?', $entityId);
113
- $subquery->where('attribute_id = ?', $baseImageAttributeId);
114
-
115
-
116
- $query = new Zend_Db_Select($connection);
117
- $query->from(array('gallery' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery')),
118
- array(
119
- 'value_id' => new Zend_Db_Expr("GROUP_CONCAT(gallery.value_id SEPARATOR ',')"),
120
- 'value' => new Zend_Db_Expr("GROUP_CONCAT(CONCAT(" . $galleryImagePrefix . ", gallery.value) SEPARATOR ',')")
121
- )
122
- );
123
- $query->join(array('gallery_value' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery_value')),
124
- 'gallery.value_id = gallery_value.value_id',
125
- null
126
- );
127
- $query->where('gallery_value.store_id IN(0, ?)', $storeId);
128
- $query->where('gallery_value.disabled = 0');
129
- $query->where('gallery.entity_id = ?', $entityId);
130
- $query->where('gallery.attribute_id = ?', $mediaGalleryAttributeId);
131
- $query->where('gallery.value NOT IN(?)', $subquery);
132
- $query->order('gallery_value.position ASC');
133
-
134
- $connection->setFetchMode(ZEND_DB::FETCH_NUM);
135
- return $connection->fetchAll($query);
136
- }
137
-
138
- /**
139
- * Get the master product query.
140
- * @param int $storeId
141
- * @param string $exportDataFieldIds
142
- * @return null|string
143
- */
144
- public function getMasterProductQuery($storeId, $exportDataFieldIds) {
145
- if($this->_masterProductQuery === null) {
146
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
147
- // Build queries for each attribute type
148
- $backendTypes = array(
149
- 'datetime',
150
- 'decimal',
151
- 'int',
152
- 'text',
153
- 'varchar',
154
- );
155
- $queries = array();
156
- foreach ($backendTypes as $backendType) {
157
- // Get store value if there is one, otherwise, global value
158
- $query = new Zend_Db_Select($connection);
159
- $query->from(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
160
- array('value' => new Zend_Db_Expr($connection->quoteInto(
161
- 'CASE WHEN SUM(ev.store_id) = 0 THEN MAX(ev.value) ELSE
162
- MAX(CASE WHEN ev.store_id = ? THEN ev.value ELSE NULL END)
163
- END', $storeId
164
- )), 'ev.attribute_id')
165
- );
166
- $query->join(array('ev' => Mage::getSingleton('core/resource')->getTableName(array('catalog/product', $backendType))),
167
- 'ce.entity_id = ev.entity_id',
168
- null
169
- );
170
- $query->where('ev.store_id IN(0, ?)', $storeId);
171
- $query->where('ev.entity_type_id = ?', $this->getEntityTypeIdForProduct());
172
- $query->where('ev.entity_id = @ENTITY_ID');
173
- $query->where('ev.attribute_id IN('.$exportDataFieldIds.')');
174
- $query->group(array('ev.attribute_id', 'ev.entity_id'));
175
-
176
- $queries[] = $query->__toString();
177
- }
178
- $this->_masterProductQuery = implode(" UNION ALL ", $queries);
179
- }
180
- return $this->_masterProductQuery;
181
- }
182
-
183
- /**
184
- * Get the export fields from the system config.
185
- * @param array $attributeCodes
186
- * @return array
187
- */
188
- public function getExportFields(array $attributeCodes, &$blankProduct) {
189
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
190
- $result = array('code' => array(), 'id' => array(), 'use_type_id' => false);
191
- foreach (array_keys($blankProduct) as $key) {
192
- $result['code'][] = $key;
193
- $tmpid = array_search($key, $attributeCodes);
194
- if (!empty($tmpid)) {
195
- $result['id'][] = $connection->quote($tmpid);
196
- }
197
- }
198
-
199
- $export_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
200
- $result['use_type_id'] = false;
201
- if (!empty($export_fields)) {
202
- foreach ($export_fields as $element) {
203
- if (!empty($element['productattribute'])) {
204
- $blankProduct[preg_replace('/\W/', '', $element['productattribute'])] = '';
205
- $result['code'][] = $element['productattribute'];
206
- if($element['productattribute'] == 'type_id') {
207
- $result['use_type_id'] = true;
208
- } else {
209
- $tmpid = array_search($element['productattribute'], $attributeCodes);
210
- if (!empty($tmpid)) {
211
- $result['id'][] = $connection->quote($tmpid);
212
- }
213
- }
214
- }
215
- }
216
- }
217
-
218
- $tmpid = array_search('status', $attributeCodes);
219
- if (!empty($tmpid)) {
220
- $result['id'][] = $connection->quote($tmpid);;
221
- }
222
- $tmpid = array_search('url_path', $attributeCodes);
223
- if (!empty($tmpid)) {
224
- $result['id'][] = $connection->quote($tmpid);;
225
- }
226
- $tmpid = array_search('image', $attributeCodes);
227
- if (!empty($tmpid)) {
228
- $result['id'][] = $connection->quote($tmpid);;
229
- }
230
- $result['id'] = implode(',', $result['id']);
231
-
232
- return $result;
233
- }
234
-
235
- /**
236
- * Set the special export fields to the _blankProduct.
237
- * @param array $blankProduct
238
- */
239
- public function setSpecialExportField(&$blankProduct) {
240
- $special_export_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
241
- if (!empty($special_export_fields)) {
242
- foreach ($special_export_fields as $element) {
243
- if (!empty($element['name'])) {
244
- $blankProduct[preg_replace('/\W/', '', $element['name'])] = $element['value'];
245
- }
246
- }
247
- }
248
- }
249
-
250
- /**
251
- * Build the category tree and return it as array.
252
- * @return array
253
- */
254
- public function buildCategoryTree() {
255
- $allCat = array();
256
- $oldCatPath = '';
257
- $oldCatTree = '';
258
-
259
- $categoryCollection = Mage::getModel('catalog/category')->getCollection()
260
- ->addAttributeToSelect('name')
261
- ->addAttributeToSort('path');
262
-
263
- foreach($categoryCollection as $category) {
264
- // if (strpos($category->getPath(), $oldCatPath) !== 0) {
265
- // start tree
266
- $path = $this->getCategory($category->getPath(), $allCat);
267
- if($path !== 0) {
268
- $allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $path . '>' . $category->getName());
269
- $oldCatTree = $path . '>' . $category->getName();
270
- } else {
271
- $allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $category->getName());
272
- $oldCatTree = $category->getName();
273
- }
274
- // } else {
275
- // // continue tree
276
- // $allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $oldCatTree . '>' . $category->getName());
277
- // $oldCatTree = $allCat[$category->getPath()];
278
- // }
279
- }
280
-
281
- return $allCat;
282
- }
283
-
284
- private function getCategory($key, $allCat) {
285
- $return = 0;
286
- if (strpos($key, '/') != false) {
287
- $tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
288
- if (isset($allCat[$tmpKey])) {
289
- $return = $allCat[$tmpKey];
290
- } else {
291
- $return = $this->getCategory($tmpKey, $allCat);
292
- }
293
- }
294
- return $return;
295
- }
296
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Channelpilotsolutions/Channelpilot/Helper/ExportData.php DELETED
@@ -1,575 +0,0 @@
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
- * @subpackage helper
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class ExportData {
25
-
26
- private $_storeId;
27
- private $_siteId;
28
- private $_mediaUrl;
29
- private $_webUrl;
30
- private $_dbConnection;
31
- private $_allCat;
32
- private $_currencyChange;
33
- private $_storeCode;
34
- private $oldCatPath;
35
- private $xml;
36
- private $_mediaGalleryAttributeId;
37
- private $_productEntityTypeId;
38
- private $_variationThemes;
39
- private $_blankProduct;
40
- private $_baseImageAttributeId;
41
-
42
- function __construct() {
43
-
44
-
45
- // Increase maximum execution time to 4 hours
46
- ini_set('max_execution_time', 7200);
47
-
48
- // Initialize the admin application
49
- Mage::app('admin');
50
-
51
- // Get the table prefix
52
- // $tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
53
-
54
- // Get database connection
55
- $this->_dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
56
-
57
- $this->_blankProduct = array();
58
- $this->_blankProduct['entity_id'] = '';
59
- $this->_blankProduct['sku'] = '';
60
- $this->_blankProduct['parent_id'] = '';
61
- $this->_blankProduct['variationTheme'] = '';
62
- $this->_blankProduct['name'] = '';
63
- $this->_blankProduct['description'] = '';
64
- $this->_blankProduct['price'] = '';
65
- $this->_blankProduct['categories'] = '';
66
- $this->_blankProduct['manufacturer'] = '';
67
- $this->_blankProduct['cp_product_url'] = '';
68
- $this->_blankProduct['cp_image_url'] = '';
69
- $this->_blankProduct['color'] = '';
70
- $this->_blankProduct['weight'] = '';
71
- for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
72
- $this->_blankProduct['cp_additional_image_'.$i] = '';
73
- }
74
- }
75
-
76
- // Run the main application and call the appropriate function
77
- // depending on the command.
78
- public function _runMain() {
79
- try {
80
- $storeId = Mage::app()->getRequest()->getParam('store', null);
81
- $this->_storeId = Mage::app()->getStore($storeId)->getId();
82
- } catch(Exception $e) {
83
- // The exception thrown by Mage::app()->getStore() has an empty message ...
84
- echo "<error>Error retrieving store.</error>";
85
- return;
86
- }
87
-
88
- $currencyCode = Mage::app()->getRequest()->getParam('currency', false);
89
- if ($currencyCode && $currencyCode != '') {
90
- $result = Mage::getModel('directory/currency')->getCurrencyRates(Mage::app()->getBaseCurrencyCode(), $currencyCode);
91
- if(count($result) === 0){
92
- echo "<error>wrong currency</error>";
93
- return;
94
- }
95
- $this->_currencyChange = $result[$currencyCode];
96
-
97
- }
98
- // Validate store and get information
99
- $this->_getStoreInformation();
100
-
101
- // Run extraction
102
- return $this->_extractFromMySQL();
103
- }
104
-
105
- /**
106
- * Get the category information for an entity_id.
107
- * @param int $entityId
108
- * @return string
109
- */
110
- private function _getCategoryInformation($entityId) {
111
- if (substr(Mage::getVersion(), 2, 3) >= 6 && Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category', $this->_storeId)) {
112
- $query = new Zend_Db_Select($this->_dbConnection);
113
- $query->distinct();
114
- $query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
115
- array('fs.entity_id', 'fs.path', 'fs.name')
116
- );
117
- $query->join(array('fs' => Mage::getSingleton('core/resource')->getTableName(array('catalog/category_flat', 'store_'.$this->_storeId))),
118
- 'pi.category_id = fs.entity_id',
119
- null
120
- );
121
- $query->where('pi.product_id = ?', $entityId);
122
- $query->where('pi.store_id = ?', $this->_storeId);
123
- $query->order('fs.path ASC');
124
- } else {
125
- $query = new Zend_Db_Select($this->_dbConnection);
126
- $query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
127
- array('pi.category_id', 'ce.path')
128
- );
129
- $query->join(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/category')),
130
- 'pi.category_id = ce.entity_id',
131
- null
132
- );
133
- $query->where('pi.product_id = ?', $entityId);
134
- $query->where('pi.is_parent = 1');
135
- $query->where('pi.store_id = ?', $this->_storeId);
136
- $query->order('ce.path ASC');
137
- }
138
-
139
- $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
140
-
141
- $categoriesTable = $this->_dbConnection->fetchAll($query);
142
- $categorieField = '';
143
- $this->oldCatPath = '';
144
- foreach ($categoriesTable as $categorie) {
145
- if (($this->oldCatPath == '') || (strpos($categorie[1], $this->oldCatPath) !== 0)) {
146
- // Start tree
147
- if ($this->oldCatPath !== '') {
148
- if ($categorieField !== '') {
149
- $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
150
- } else {
151
- $categorieField = $this->_allCat[$this->oldCatPath];
152
- }
153
- }
154
- $this->oldCatPath = $categorie[1];
155
- } else {
156
- // Add to tree
157
- $this->oldCatPath = $categorie[1];
158
- }
159
- }
160
- if ($categorieField !== '') {
161
- $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
162
- } else {
163
- if ($this->oldCatPath !== '') {
164
- $categorieField = $this->_allCat[$this->oldCatPath];
165
- }
166
- }
167
-
168
- return $categorieField;
169
- }
170
-
171
- /**
172
- * Get the count of all products.
173
- * @return mixed
174
- */
175
- private function _getProductCount() {
176
- $query = new Zend_Db_Select($this->_dbConnection);
177
- $query->from(array('cpe' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
178
- new Zend_Db_Expr('count(*)')
179
- );
180
- $query->join(array('cpw' => Mage::getSingleton('core/resource')->getTableName('catalog/product_website')),
181
- 'cpw.product_id = cpe.entity_id',
182
- null
183
- );
184
- $query->where('cpw.website_id = ?', $this->_siteId);
185
- $query->where("IFNULL(cpe.sku, '') != ''");
186
-
187
- $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
188
- return $this->_dbConnection->fetchAll($query);
189
- }
190
-
191
- /**
192
- * Get products from the database limited by the count and offset.
193
- * @param int $count
194
- * @param int $offset
195
- * @return mixed
196
- */
197
- private function _getProductEntities($count, $offset) {
198
- // Get all entity_ids for all products in the selected store
199
- $columns = array('cpe.entity_id', 'cpe.sku', 'cpe.type_id');
200
- $query = new Zend_Db_Select($this->_dbConnection);
201
-
202
- $subquery = new Zend_Db_Select($this->_dbConnection);
203
- $subquery->from(Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link'), array('parent_id'));
204
- $subquery->where('product_id = cpe.entity_id');
205
- $subquery->limit(1);
206
-
207
- $columns['parent'] = new Zend_Db_Expr('('.$subquery.')');
208
-
209
- $subquery = new Zend_Db_Select($this->_dbConnection);
210
- $subquery->from(Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link'), array(
211
- new Zend_Db_Expr('COUNT(*)')
212
- ));
213
- $subquery->where('parent_id = cpe.entity_id');
214
- $subquery->limit(1);
215
-
216
- $columns['is_parent'] = new Zend_Db_Expr('('.$subquery.')');
217
-
218
- $subquery = new Zend_Db_Select($this->_dbConnection);
219
- $subquery->from(Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_status'), array('qty'));
220
- $subquery->where('product_id = cpe.entity_id');
221
- $subquery->where('website_id = ?', $this->_siteId);
222
- $subquery->where('stock_id = 1');
223
- $subquery->limit(1);
224
-
225
- $columns['qty'] = new Zend_Db_Expr('('.$subquery.')');
226
-
227
- $subquery = new Zend_Db_Select($this->_dbConnection);
228
- $subquery->from(Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_status'), array('stock_status'));
229
- $subquery->where('product_id = cpe.entity_id');
230
- $subquery->where('website_id = ?', $this->_siteId);
231
- $subquery->where('stock_id = 1');
232
- $subquery->limit(1);
233
-
234
- $columns['stock_status'] = new Zend_Db_Expr('('.$subquery.')');
235
-
236
- $subquery = new Zend_Db_Select($this->_dbConnection);
237
- $subquery->from(array('crpp' => Mage::getSingleton('core/resource')->getTableName('catalogrule/rule_product_price')), array('crpp.rule_price'));
238
- $subquery->where('crpp.rule_date = CURDATE()');
239
- $subquery->where('crpp.product_id = cpe.entity_id');
240
- $subquery->where('crpp.customer_group_id = 1');
241
- $subquery->where('crpp.website_id = ?', $this->_siteId);
242
-
243
- $columns['cat_price'] = new Zend_Db_Expr('('.$subquery.')');
244
-
245
- $query->from(array('cpe' => Mage::getSingleton('core/resource')->getTableName('catalog/product')), $columns);
246
- $query->join(array('cpw' => Mage::getSingleton('core/resource')->getTableName('catalog/product_website')),
247
- 'cpw.product_id = cpe.entity_id',
248
- null
249
- );
250
- $query->where('cpw.website_id = ?', $this->_siteId);
251
- $query->where("IFNULL(cpe.sku, '') != ''");
252
- $query->order(array('is_parent DESC', 'entity_id DESC'));
253
- $query->limit($count, $offset);
254
-
255
- return $this->_dbConnection->fetchAssoc($query);
256
- }
257
-
258
- /**
259
- * Get the variation theme for a product id.
260
- * @param int $productId
261
- * @param int $isParent
262
- * @param int $parentId
263
- * @return string
264
- */
265
- private function _getVariationTheme($productId, $isParent, $parentId = 0) {
266
- if (intval($isParent) > 0) {
267
- $varQuery = new Zend_Db_Select($this->_dbConnection);
268
- $varQuery->from(array('cpsa' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')),
269
- array('ea.attribute_code')
270
- );
271
- $varQuery->joinLeft(array('ea' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
272
- 'ea.attribute_id = cpsa.attribute_id',
273
- null
274
- );
275
- $varQuery->where('cpsa.product_id = ?', $productId);
276
- $varQuery->order('ea.attribute_id');
277
-
278
- $varresults = $this->_dbConnection->fetchAll($varQuery);
279
- $variationTheme = "";
280
- foreach ($varresults as $varresult) {
281
- $variationTheme = $variationTheme . "|" . $varresult[0];
282
- }
283
- $variationTheme = ltrim($variationTheme, "|");
284
- $this->_variationThemes[$productId] = $variationTheme;
285
- return $variationTheme;
286
- } else {
287
- if (!empty($parentId)) {
288
- return $this->_variationThemes[$parentId];
289
- }
290
- }
291
- }
292
-
293
- // Extract natively directly from the database
294
- private function _extractFromMySQL() {
295
- // Increase maximium length for group_concat (for additional image URLs field)
296
- $query = "SET SESSION group_concat_max_len = 1000000;";
297
- $this->_dbConnection->query($query);
298
-
299
- $this->_allCat = Mage::helper('channelpilot/export')->buildCategoryTree();
300
-
301
- // By default, set media gallery attribute id to 703
302
- // Look it up later
303
- $this->_mediaGalleryAttributeId = 703;
304
-
305
- // Get the entity type for products
306
- $this->_productEntityTypeId = Mage::helper('channelpilot/export')->getEntityTypeIdForProduct();
307
-
308
- // Get attribute codes and types
309
- $attributes = Mage::helper('channelpilot/export')->getProductAttributes();
310
-
311
- $attributeCodes = array();
312
- $attributeOptions = array();
313
-
314
- Mage::helper('channelpilot/export')->setSpecialExportField($this->_blankProduct);
315
-
316
- foreach ($attributes as $row) {
317
- // Save attribute ID for media gallery
318
- if ($row['attribute_code'] == 'media_gallery') {
319
- $this->_mediaGalleryAttributeId = $row['attribute_id'];
320
- }
321
-
322
- if($row['attribute_code'] == 'image') {
323
- $this->_baseImageAttributeId = $row['attribute_id'];
324
- }
325
-
326
- if($row['backend_type'] != 'static') {
327
- $attributeCodes[$row['attribute_id']] = $row['attribute_code'];
328
- }
329
-
330
- // If the type is multiple choice, cache the option values
331
- // in a lookup array for performance (avoids several joins/aggregations)
332
- if ($row['frontend_input'] == 'select' || $row['frontend_input'] == 'multiselect') {
333
- $result = Mage::helper('channelpilot/export')->getAttributeOptions($row['attribute_id'], $this->_storeId);
334
- // If found, then save the lookup table in the attributeOptions array
335
- if (is_array($result)) {
336
- $attributeOptions[$row['attribute_id']] = $result;
337
- } else {
338
- // Otherwise, leave a blank array
339
- $attributeOptions[$row['attribute_id']] = array();
340
- }
341
- $result = null;
342
- }
343
- }
344
-
345
- $this->_displayProductData($attributeCodes, $attributeOptions);
346
-
347
- return;
348
- }
349
-
350
- /**
351
- * Create a product and output it as xml.
352
- * @param array $attributeCodes
353
- * @param array $attributeOptions
354
- */
355
- private function _displayProductData(array $attributeCodes, array $attributeOptions) {
356
- $selectLimit = 100;
357
- $count = $this->_getProductCount();
358
- $counter = 0;
359
-
360
- $border = (int) $count[0][0] - $selectLimit;
361
- if ($border < $count[0][0]) {
362
- $border = $count[0][0];
363
- }
364
-
365
- $exportFields = Mage::helper('channelpilot/export')->getExportFields($attributeCodes, $this->_blankProduct);
366
-
367
- // Build queries for each attribute type
368
- $MasterProductQuery = Mage::helper('channelpilot/export')->getMasterProductQuery($this->_storeId, $exportFields['id']);
369
-
370
- $parentProductArray = array();
371
- $this->_variationThemes = array();
372
- while ($counter <= $border) {
373
- // Get all entity_ids for all products in the selected store
374
- $EntityIds = $this->_getProductEntities($selectLimit, $counter);
375
- // Loop through each product and output the data
376
- foreach ($EntityIds as $entity) {
377
- // Fill the master query with the entity ID
378
- $query = str_replace('@ENTITY_ID', $entity['entity_id'], $MasterProductQuery);
379
- $result = $this->_dbConnection->query($query);
380
- // Create a new product record
381
- $product = $this->_blankProduct;
382
- $product['variationTheme'] = $this->_getVariationTheme($entity['entity_id'], $entity['is_parent'], $entity['parent']);
383
-
384
- // Initialize basic product data
385
- $product['entity_id'] = $entity['entity_id'];
386
- $product['sku'] = $entity['sku'];
387
-
388
- // Escape the SKU (it may contain double-quotes)
389
- $product['sku'] = str_replace('"', '""', $product['sku']);
390
- $product['is_parent'] = $entity['is_parent'] > 0 ? 1 : 0;
391
-
392
- $product_status = null;
393
- $product_url = null;
394
- $product_image = null;
395
- // Loop through each field in the row and get the value
396
- foreach($result->fetchAll() as $column) {
397
- // Translate the option option_id to a value.
398
- if (isset($attributeOptions[$column[1]])) {
399
- // Convert all option values
400
- $optionValues = explode(',', $column[0]);
401
- $convertedOptionValues = array();
402
- foreach ($optionValues as $optionValue) {
403
- if (isset($attributeOptions[$column[1]][$optionValue]) == true) {
404
- // If a option_id is found, translate it
405
- $convertedOptionValues[] = $attributeOptions[$column[1]][$optionValue];
406
- }
407
- }
408
- // Erase values that are set to zero
409
- if ($column[0] == '0') {
410
- $column[0] = '';
411
- } elseif (!empty($convertedOptionValues)) {
412
- // Use convert values if any conversions exist
413
- $column[0] = implode(',', $convertedOptionValues);
414
- }
415
- // Otherwise, leave value as-is
416
- }
417
-
418
- if (in_array($attributeCodes[$column[1]], $exportFields['code'])) {
419
- $product[$attributeCodes[$column[1]]] = $column[0];
420
- }
421
-
422
- if ($attributeCodes[$column[1]] == 'status') {
423
- $product_status = $column[0];
424
- }
425
- if ($attributeCodes[$column[1]] == 'url_path') {
426
- $product_url = $column[0];
427
- }
428
- if ($attributeCodes[$column[1]] == 'image') {
429
- $product_image = $column[0];
430
- }
431
- }
432
-
433
- $result = null;
434
-
435
- // Skip product that are disabled or have no status
436
- if (empty($product_status) || $product_status == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
437
- continue;
438
- }
439
- // Get category information
440
- $product['categories'] = $this->_getCategoryInformation($entity['entity_id']);
441
- // Get stock quantity
442
- // NOTE: stock_id = 1 is the 'Default' stock
443
- if (in_array('qty', $exportFields['code'])) {
444
- if (empty($entity['qty']) == true) {
445
- $product['qty'] = '0';
446
- } else {
447
- $product['qty'] = $entity['qty'];
448
- }
449
- }
450
-
451
- if (in_array('stock_status', $exportFields['code'])) {
452
- if (empty($entity['stock_status']) == true) {
453
- $product['stock_status'] = '';
454
- } else {
455
- $product['stock_status'] = $entity['stock_status'];
456
- }
457
- }
458
- $stockInfoResult = null;
459
-
460
- // Get additional image URLs
461
- $galleryValues = Mage::helper('channelpilot/export')->getAdditionalImageUrl(
462
- $entity['entity_id'],
463
- $this->_storeId,
464
- $this->_mediaGalleryAttributeId,$this->_baseImageAttributeId
465
- );
466
-
467
- if (empty($galleryValues) != true) {
468
- $additional_images = explode(',', $galleryValues[0][1]);
469
- for($i = 0; $i < Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
470
- if (isset($additional_images[$i])) {
471
- $product['cp_additional_image_' . ($i + 1)] = $additional_images[$i];
472
- }
473
- }
474
- }
475
-
476
- // Get parent ID
477
- if (empty($entity['parent']) != true && in_array('parent_id', $exportFields['code'])) {
478
- $product['parent_id'] = $entity['parent'];
479
- }
480
-
481
- // Override price with catalog price rule, if found
482
- if (empty($entity['cat_price']) != true) {
483
- // Override price with catalog rule price
484
- $product['price'] = $entity['cat_price'];
485
- }
486
-
487
- // Calculate image and product URLs
488
- if (empty($product_url) == false) {
489
- $product['cp_product_url'] = $this->_urlPathJoin($this->_webUrl, $product_url);
490
- }
491
-
492
- if (empty($product_image) == false) {
493
- $product['cp_image_url'] = $this->_urlPathJoin($this->_mediaUrl, 'catalog/product');
494
- $product['cp_image_url'] = $this->_urlPathJoin($product['cp_image_url'], $product_image);
495
- }
496
-
497
- $replace_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
498
- if (!empty($replace_fields)) {
499
- // PARENT
500
- if ($entity['is_parent'] > 0) {
501
- foreach ($replace_fields as $element) {
502
- if (!empty($element['productattribute']) && array_key_exists($element['productattribute'], $product)) {
503
- $parentProductArray[$product['id']][$element['productattribute']] = $product[$element['productattribute']];
504
- }
505
- }
506
- } else {
507
- // CHILD
508
- if ($entity['parent'] != null) {
509
- foreach ($replace_fields as $element) {
510
- if (!empty($element['productattribute']) && array_key_exists($element['productattribute'], $product)) {
511
- $product[$element['productattribute']] = $parentProductArray[$entity['parent']][$element['productattribute']];
512
- }
513
- }
514
- }
515
- }
516
- }
517
-
518
- if($exportFields['use_type_id']) {
519
- $product['type_id'] = $entity['type_id'];
520
- }
521
-
522
- if(isset($this->_currencyChange)) {
523
- $product['price'] = round($product['price']*$this->_currencyChange, 2);
524
- }
525
-
526
- $this->xml = new SimpleXMLElement("<product></product>");
527
- echo str_replace('<?xml version="1.0"?>', '', $this->toXML($product));
528
- $this->xml = null;
529
- }
530
- $counter = $counter + $selectLimit;
531
- }
532
- }
533
-
534
- // Join two URL paths and handle forward slashes
535
- private function _urlPathJoin($part1, $part2) {
536
- return rtrim($part1, '/') . '/' . ltrim($part2, '/');
537
- }
538
-
539
- // Die if the storeId is invalid
540
- private function _getStoreInformation() {
541
- try {
542
- // Get the store object
543
- $store = Mage::app()->getStore($this->_storeId);
544
-
545
- // Load the store information
546
- $this->_siteId = $store->getWebsiteId();
547
- $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
548
- $this->_storeCode = Mage::getStoreConfig('web/url/use_store') ? $store->getCode(). "/" : "";
549
- $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
550
- } catch (Exception $e) {
551
- die('Store=' . $this->_storeId . " probably does not exist.");
552
- }
553
- }
554
-
555
- private function toXML($array) {
556
- $this->iterate($array, $this->xml);
557
- return $this->xml->asXML();
558
- }
559
-
560
- private function iterate($element, $xmlNode) {
561
- if (is_array($element)) {
562
- foreach ($element as $name => $value) {
563
- if (is_string($value) || is_numeric($value) || is_bool($value)) {
564
- $xmlNode->$name = $value;
565
- } else {
566
- $xmlNode->$name = null;
567
- $this->iterate($value, $xmlNode->$name);
568
- }
569
- }
570
- }
571
- }
572
-
573
- }
574
-
575
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php CHANGED
@@ -1,198 +1,198 @@
1
- <?php
2
-
3
- // include the stub-classes
4
- require_once 'thin/CPAuth.php';
5
- require_once 'thin/CPResponseHeader.php';
6
- require_once 'thin/CPArticleUpdate.php';
7
- require_once 'thin/CPAddress.php';
8
- require_once 'thin/CPArticle.php';
9
- require_once 'thin/CPCancellation.php';
10
- require_once 'thin/CPDiscount.php';
11
- require_once 'thin/CPManagedArticlePrice.php';
12
- require_once 'thin/CPMoney.php';
13
- require_once 'thin/CPPayment.php';
14
- require_once 'thin/CPCustomer.php';
15
- require_once 'thin/CPOrderItem.php';
16
- require_once 'thin/CPShipping.php';
17
- require_once 'thin/CPOrderStatus.php';
18
- require_once 'thin/CPOrderHeader.php';
19
- require_once 'thin/CPOrder.php';
20
- require_once 'thin/CPOrderSummary.php';
21
-
22
- // request-classes
23
- // response-classes
24
- require_once 'responses/Response.php';
25
- require_once 'responses/GetServerTimeResponse.php';
26
- require_once 'responses/UpdateArticlesResponse.php';
27
- require_once 'responses/UpdateArticleResult.php';
28
- require_once 'responses/UpdateOrdersResponse.php';
29
- require_once 'responses/UpdateOrderResult.php';
30
- require_once 'responses/GetNewMarketplaceOrdersResponse.php';
31
- require_once 'responses/GetManagedArticlePricesResponse.php';
32
-
33
- /**
34
- * Main API-Class
35
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
36
- * @version 1.0
37
- */
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
45
- );
46
- private $classmap = array(
47
- 'CPAuth' => 'CPAuth',
48
- 'CPResponseHeader' => 'CPResponseHeader',
49
- 'AbstractResponse' => 'AbstractResponse',
50
- 'GetServerTimeResponse' => 'GetServerTimeResponse',
51
- 'CPArticleUpdate' => 'CPArticleUpdate',
52
- 'UpdateArticlesResponse' => 'UpdateArticlesResponse',
53
- 'UpdateArticleResult' => 'UpdateArticleResult',
54
- 'UpdateOrdersResponse' => 'UpdateOrdersResponse',
55
- 'UpdateOrderResult' => 'UpdateOrderResult',
56
- 'CPAddress' => 'CPAddress',
57
- 'CPArticle' => 'CPArticle',
58
- 'CPDiscount' => 'CPDiscount',
59
- 'CPManagedArticlePrice' => 'CPManagedArticlePrice',
60
- 'CPMoney' => 'CPMoney',
61
- 'CPPayment' => 'CPPayment',
62
- 'CPCustomer' => 'CPCustomer',
63
- 'CPOrderItem' => 'CPOrderItem',
64
- 'CPShipping' => 'CPShipping',
65
- 'CPOrderStatus' => 'CPOrderStatus',
66
- 'CPOrderHeader' => 'CPOrderHeader',
67
- 'CPOrder' => 'CPOrder',
68
- 'CPOrderSummary' => 'CPOrderSummary',
69
- 'GetNewMarketplaceOrdersResponse' => 'GetNewMarketplaceOrdersResponse'
70
- );
71
-
72
- public function ChannelPilotSellerAPI_v1_0($merchantId, $shopToken) {
73
- $this->auth = new CPAuth($merchantId, $shopToken);
74
-
75
- foreach ($this->classmap as $key => $value) {
76
- if (!isset($this->soapOptions['classmap'][$key])) {
77
- $this->soapOptions['classmap'][$key] = $value;
78
- }
79
- }
80
- parent::__construct($this->wsdlUrl, $this->soapOptions);
81
- }
82
-
83
- /**
84
- * Receives the acutal server time. Can be used to test the connection.
85
- * @return GetServerTimeResponse
86
- */
87
- public function getServerTime() {
88
- return $this->__call(
89
- 'getServerTime',
90
- array(
91
- new SoapParam($this->auth, 'auth')
92
- )
93
- );
94
- }
95
-
96
- /**
97
- * updates an array of articles in batch
98
- * @return UpdateArticlesResponse
99
- */
100
- public function updateArticles(array $articles) {
101
- return $this->__call(
102
- 'updateArticles',
103
- array(
104
- new SoapParam($this->auth, 'auth'),
105
- new SoapParam($articles, 'articles')
106
- )
107
- );
108
- }
109
-
110
- /**
111
- * retrieves new marketplace orders
112
- * @return GetNewMarketplaceOrdersResponse
113
- */
114
- public function getNewMarketplaceOrders() {
115
- return $this->__call(
116
- 'getNewMarketplaceOrders',
117
- array(
118
- new SoapParam($this->auth, 'auth')
119
- )
120
- );
121
- }
122
-
123
- /**
124
- * update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
125
- * q
126
- * @return GetNewMarketplaceOrdersResponse
127
- */
128
-
129
-
130
- /**
131
- * update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
132
- * @param array $orders array of CPOrders
133
- * @param type $mapOrderItemIds boolean, if channelPilot should map your internal orderItemIds
134
- * @return type
135
- */
136
- public function setImportedOrders(array $orders, $mapOrderItemIds) {
137
- return $this->__call(
138
- 'setImportedOrders',
139
- array(
140
- new SoapParam($this->auth, 'auth'),
141
- new SoapParam($orders, 'importedOrders'),
142
- new SoapParam($mapOrderItemIds, 'mapOrderItemIds'),
143
- )
144
- );
145
- }
146
-
147
-
148
- public function registerDeliveries(array $deliveries) {
149
- return $this->__call(
150
- 'registerDeliveries',
151
- array(
152
- new SoapParam($this->auth, 'auth'),
153
- new SoapParam($deliveries, 'deliveries')
154
- )
155
- );
156
- }
157
-
158
- public function registerCancellations(array $cancellations) {
159
- return $this->__call(
160
- 'registerCancellations',
161
- array(
162
- new SoapParam($this->auth, 'auth'),
163
- new SoapParam($cancellations, 'cancellations')
164
- )
165
- );
166
- }
167
-
168
- public function getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom) {
169
- return $this->__call(
170
- 'getDynamicArticlePrices',
171
- array(
172
- new SoapParam($this->auth, 'auth'),
173
- new SoapParam($priceId, 'priceId'),
174
- new SoapParam(null, 'pagination'),
175
- new SoapParam($method, 'method'),
176
- new SoapParam($filterArticles, 'filterArticles'),
177
- new SoapParam($filterFrom, 'filterFrom')
178
- )
179
- );
180
- }
181
-
182
- /**
183
- * Set paymentTime in ChannelPilot. Send CPOrder with CPOrderHeader and CPPayment (paymentTime is necessary).
184
- * @param CPOrder[] $orders
185
- * @return UpdateOrdersResponse
186
- */
187
- public function setPaidOrders(array $orders) {
188
- return $this->__call(
189
- 'setPaidOrders', array(
190
- new SoapParam($this->auth, 'auth'),
191
- new SoapParam($orders, 'paidOrders')
192
- )
193
- );
194
- }
195
-
196
- }
197
-
198
- ?>
1
+ <?php
2
+
3
+ // include the stub-classes
4
+ require_once 'thin/CPAuth.php';
5
+ require_once 'thin/CPResponseHeader.php';
6
+ require_once 'thin/CPArticleUpdate.php';
7
+ require_once 'thin/CPAddress.php';
8
+ require_once 'thin/CPArticle.php';
9
+ require_once 'thin/CPCancellation.php';
10
+ require_once 'thin/CPDiscount.php';
11
+ require_once 'thin/CPManagedArticlePrice.php';
12
+ require_once 'thin/CPMoney.php';
13
+ require_once 'thin/CPPayment.php';
14
+ require_once 'thin/CPCustomer.php';
15
+ require_once 'thin/CPOrderItem.php';
16
+ require_once 'thin/CPShipping.php';
17
+ require_once 'thin/CPOrderStatus.php';
18
+ require_once 'thin/CPOrderHeader.php';
19
+ require_once 'thin/CPOrder.php';
20
+ require_once 'thin/CPOrderSummary.php';
21
+
22
+ // request-classes
23
+ // response-classes
24
+ require_once 'responses/Response.php';
25
+ require_once 'responses/GetServerTimeResponse.php';
26
+ require_once 'responses/UpdateArticlesResponse.php';
27
+ require_once 'responses/UpdateArticleResult.php';
28
+ require_once 'responses/UpdateOrdersResponse.php';
29
+ require_once 'responses/UpdateOrderResult.php';
30
+ require_once 'responses/GetNewMarketplaceOrdersResponse.php';
31
+ require_once 'responses/GetManagedArticlePricesResponse.php';
32
+
33
+ /**
34
+ * Main API-Class
35
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
36
+ * @version 1.0
37
+ */
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
45
+ );
46
+ private $classmap = array(
47
+ 'CPAuth' => 'CPAuth',
48
+ 'CPResponseHeader' => 'CPResponseHeader',
49
+ 'AbstractResponse' => 'AbstractResponse',
50
+ 'GetServerTimeResponse' => 'GetServerTimeResponse',
51
+ 'CPArticleUpdate' => 'CPArticleUpdate',
52
+ 'UpdateArticlesResponse' => 'UpdateArticlesResponse',
53
+ 'UpdateArticleResult' => 'UpdateArticleResult',
54
+ 'UpdateOrdersResponse' => 'UpdateOrdersResponse',
55
+ 'UpdateOrderResult' => 'UpdateOrderResult',
56
+ 'CPAddress' => 'CPAddress',
57
+ 'CPArticle' => 'CPArticle',
58
+ 'CPDiscount' => 'CPDiscount',
59
+ 'CPManagedArticlePrice' => 'CPManagedArticlePrice',
60
+ 'CPMoney' => 'CPMoney',
61
+ 'CPPayment' => 'CPPayment',
62
+ 'CPCustomer' => 'CPCustomer',
63
+ 'CPOrderItem' => 'CPOrderItem',
64
+ 'CPShipping' => 'CPShipping',
65
+ 'CPOrderStatus' => 'CPOrderStatus',
66
+ 'CPOrderHeader' => 'CPOrderHeader',
67
+ 'CPOrder' => 'CPOrder',
68
+ 'CPOrderSummary' => 'CPOrderSummary',
69
+ 'GetNewMarketplaceOrdersResponse' => 'GetNewMarketplaceOrdersResponse'
70
+ );
71
+
72
+ public function ChannelPilotSellerAPI_v1_0($merchantId, $shopToken) {
73
+ $this->auth = new CPAuth($merchantId, $shopToken);
74
+
75
+ foreach ($this->classmap as $key => $value) {
76
+ if (!isset($this->soapOptions['classmap'][$key])) {
77
+ $this->soapOptions['classmap'][$key] = $value;
78
+ }
79
+ }
80
+ parent::__construct($this->wsdlUrl, $this->soapOptions);
81
+ }
82
+
83
+ /**
84
+ * Receives the acutal server time. Can be used to test the connection.
85
+ * @return GetServerTimeResponse
86
+ */
87
+ public function getServerTime() {
88
+ return $this->__call(
89
+ 'getServerTime',
90
+ array(
91
+ new SoapParam($this->auth, 'auth')
92
+ )
93
+ );
94
+ }
95
+
96
+ /**
97
+ * updates an array of articles in batch
98
+ * @return UpdateArticlesResponse
99
+ */
100
+ public function updateArticles(array $articles) {
101
+ return $this->__call(
102
+ 'updateArticles',
103
+ array(
104
+ new SoapParam($this->auth, 'auth'),
105
+ new SoapParam($articles, 'articles')
106
+ )
107
+ );
108
+ }
109
+
110
+ /**
111
+ * retrieves new marketplace orders
112
+ * @return GetNewMarketplaceOrdersResponse
113
+ */
114
+ public function getNewMarketplaceOrders() {
115
+ return $this->__call(
116
+ 'getNewMarketplaceOrders',
117
+ array(
118
+ new SoapParam($this->auth, 'auth')
119
+ )
120
+ );
121
+ }
122
+
123
+ /**
124
+ * update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
125
+ * q
126
+ * @return GetNewMarketplaceOrdersResponse
127
+ */
128
+
129
+
130
+ /**
131
+ * update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
132
+ * @param array $orders array of CPOrders
133
+ * @param type $mapOrderItemIds boolean, if channelPilot should map your internal orderItemIds
134
+ * @return type
135
+ */
136
+ public function setImportedOrders(array $orders, $mapOrderItemIds) {
137
+ return $this->__call(
138
+ 'setImportedOrders',
139
+ array(
140
+ new SoapParam($this->auth, 'auth'),
141
+ new SoapParam($orders, 'importedOrders'),
142
+ new SoapParam($mapOrderItemIds, 'mapOrderItemIds'),
143
+ )
144
+ );
145
+ }
146
+
147
+
148
+ public function registerDeliveries(array $deliveries) {
149
+ return $this->__call(
150
+ 'registerDeliveries',
151
+ array(
152
+ new SoapParam($this->auth, 'auth'),
153
+ new SoapParam($deliveries, 'deliveries')
154
+ )
155
+ );
156
+ }
157
+
158
+ public function registerCancellations(array $cancellations) {
159
+ return $this->__call(
160
+ 'registerCancellations',
161
+ array(
162
+ new SoapParam($this->auth, 'auth'),
163
+ new SoapParam($cancellations, 'cancellations')
164
+ )
165
+ );
166
+ }
167
+
168
+ public function getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom) {
169
+ return $this->__call(
170
+ 'getDynamicArticlePrices',
171
+ array(
172
+ new SoapParam($this->auth, 'auth'),
173
+ new SoapParam($priceId, 'priceId'),
174
+ new SoapParam(null, 'pagination'),
175
+ new SoapParam($method, 'method'),
176
+ new SoapParam($filterArticles, 'filterArticles'),
177
+ new SoapParam($filterFrom, 'filterFrom')
178
+ )
179
+ );
180
+ }
181
+
182
+ /**
183
+ * Set paymentTime in ChannelPilot. Send CPOrder with CPOrderHeader and CPPayment (paymentTime is necessary).
184
+ * @param CPOrder[] $orders
185
+ * @return UpdateOrdersResponse
186
+ */
187
+ public function setPaidOrders(array $orders) {
188
+ return $this->__call(
189
+ 'setPaidOrders', array(
190
+ new SoapParam($this->auth, 'auth'),
191
+ new SoapParam($orders, 'paidOrders')
192
+ )
193
+ );
194
+ }
195
+
196
+ }
197
+
198
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/thin/CPDelivery.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
-
3
- /**
4
- * Holds information about a delivery.
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPDelivery {
9
- /**
10
- * @var type CPOrderHeader
11
- */
12
- public $orderHeader;
13
-
14
- /**
15
- * are all to be delivered items deliverd after this delivery?
16
- * @var type boolean
17
- */
18
- public $isDeliveryCompleted;
19
-
20
- /**
21
- * tracking-number for this delivery
22
- * @var type String
23
- */
24
- public $trackingNumber;
25
-
26
- /**
27
- * the Carrier (DHL/UPS/...). if not set, channelpilot will take the default-Carrier defined for the orders shippingType
28
- * @var type String
29
- */
30
- public $carrierName;
31
-
32
- /**
33
- *
34
- * @var type CPShipping
35
- */
36
- public $shipping;
37
-
38
- public $deliveryTime;
39
-
40
- /**
41
- * array of delivered items. is only evaluated and neccessary if ($isDeliveryCompleted == false).
42
- * @var type CPOrderItem[]
43
- */
44
- public $deliveredItems = array();
45
-
46
- function __construct($orderId, $source, $isDeliveryCompleted, $trackingNumber, $deliveryTime) {
47
- $this->orderHeader = new CPOrderHeader(null, $orderId, $source, $isDeliveryCompleted ? CPOrderStatus::ID_DELIVERED : CPOrderStatus::ID_PARTIALLY_DELIVERED, null, false);
48
- $this->trackingNumber = $trackingNumber;
49
- $this->deliveryTime = $deliveryTime;
50
- $this->isDeliveryCompleted = $isDeliveryCompleted;
51
- }
52
- }
53
-
54
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * Holds information about a delivery.
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPDelivery {
9
+ /**
10
+ * @var type CPOrderHeader
11
+ */
12
+ public $orderHeader;
13
+
14
+ /**
15
+ * are all to be delivered items deliverd after this delivery?
16
+ * @var type boolean
17
+ */
18
+ public $isDeliveryCompleted;
19
+
20
+ /**
21
+ * tracking-number for this delivery
22
+ * @var type String
23
+ */
24
+ public $trackingNumber;
25
+
26
+ /**
27
+ * the Carrier (DHL/UPS/...). if not set, channelpilot will take the default-Carrier defined for the orders shippingType
28
+ * @var type String
29
+ */
30
+ public $carrierName;
31
+
32
+ /**
33
+ *
34
+ * @var type CPShipping
35
+ */
36
+ public $shipping;
37
+
38
+ public $deliveryTime;
39
+
40
+ /**
41
+ * array of delivered items. is only evaluated and neccessary if ($isDeliveryCompleted == false).
42
+ * @var type CPOrderItem[]
43
+ */
44
+ public $deliveredItems = array();
45
+
46
+ function __construct($orderId, $source, $isDeliveryCompleted, $trackingNumber, $deliveryTime) {
47
+ $this->orderHeader = new CPOrderHeader(null, $orderId, $source, $isDeliveryCompleted ? CPOrderStatus::ID_DELIVERED : CPOrderStatus::ID_PARTIALLY_DELIVERED, null, false);
48
+ $this->trackingNumber = $trackingNumber;
49
+ $this->deliveryTime = $deliveryTime;
50
+ $this->isDeliveryCompleted = $isDeliveryCompleted;
51
+ }
52
+ }
53
+
54
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/thin/CPPayment.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
-
3
- class CPPayment {
4
- /**
5
- * id of the payment type
6
- * @var string
7
- */
8
- public $typeId;
9
-
10
- /**
11
- * title of the payment title
12
- * @var string
13
- */
14
- public $typeTitle;
15
-
16
- /**
17
- * costs for payment
18
- * @var string
19
- */
20
- public $costs;
21
-
22
- /**
23
- * When was the order payed? Timestamp formatted in ISO 8601 (e.g. "2009-06-30T18:30:00+02:00")
24
- * @var string
25
- */
26
- public $paymentTime;
27
-
28
- /**
29
- *
30
- * @param string $paymentTime
31
- */
32
- function __construct($paymentTime) {
33
- $this->paymentTime = $paymentTime;
34
- }
35
- }
36
-
37
- ?>
1
+ <?php
2
+
3
+ class CPPayment {
4
+ /**
5
+ * id of the payment type
6
+ * @var string
7
+ */
8
+ public $typeId;
9
+
10
+ /**
11
+ * title of the payment title
12
+ * @var string
13
+ */
14
+ public $typeTitle;
15
+
16
+ /**
17
+ * costs for payment
18
+ * @var string
19
+ */
20
+ public $costs;
21
+
22
+ /**
23
+ * When was the order payed? Timestamp formatted in ISO 8601 (e.g. "2009-06-30T18:30:00+02:00")
24
+ * @var string
25
+ */
26
+ public $paymentTime;
27
+
28
+ /**
29
+ *
30
+ * @param string $paymentTime
31
+ */
32
+ function __construct($paymentTime) {
33
+ $this->paymentTime = $paymentTime;
34
+ }
35
+ }
36
+
37
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPAbstractHandler.php CHANGED
@@ -1,137 +1,142 @@
1
- <?php
2
-
3
- /**
4
- * an cp abstract handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPAbstractHandler {
9
-
10
- const defaultHeader = "Content-Type: application/json;";
11
- const errorHeader_forbidden = "HTTP/1.0 403 Forbidden";
12
- const ChannelPilot_IP = "148.251.65.130";
13
- const DB_REGISTRATION = "cp_registration";
14
- const DB_PRICES = "cp_prices";
15
- const DB_ORDERS = "cp_marketplace_orders";
16
- const DB_ORDER_ITEMS = "cp_marketplace_order_items";
17
-
18
- /**
19
- * Is the IP allowed for this shopId
20
- *
21
- * @param type $shopId
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
-
46
- /**
47
- * Is the shop still registered?
48
- *
49
- * @param integer $shopId
50
- * @return boolean
51
- */
52
- public static function isShopRegistered($shopId) {
53
- $collection = Mage::getSingleton('channelpilot/registration')->getCollection()
54
- ->addFieldToSelect('shopId')
55
- ->addFieldToFilter('shopId', array('eq' => $shopId));
56
-
57
- return (count($collection) > 0);
58
- }
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) {
84
- foreach ($apiOrders as $apiOrder) {
85
- if ($apiOrder->header->resultCode == CPResultCodes::SUCCESS) {
86
- self::changeStatusOrder($apiOrder->orderHeader);
87
- } else {
88
- self::logError("Cannot change orderstatus from order (id: '" . $apiOrder->orderHeader->orderId . "', status: '" . $apiOrder->orderHeader->status->identifier . "')");
89
- }
90
- }
91
- }
92
-
93
- public static function changeStatusOrder($apiOrderHeader) {
94
- $order = Mage::getModel('channelpilot/order')->load($apiOrderHeader->orderId);
95
- if($order && $order->getId()) {
96
- $order->setData('status', $apiOrderHeader->status->identifier);
97
- try {
98
- $order->save();
99
- } catch (Exception $e) {
100
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during changeStatusOrder: " . $e->getMessage(), "Exception during update cp_marketplace_orders: ". $apiOrderHeader->status->identifier . "\n" . $e->getMessage());
101
- }
102
- }
103
- }
104
-
105
- /**
106
- * log the error in the cp_marketplace - log file
107
- *
108
- * @param string $msg
109
- */
110
- public static function logError($msg) {
111
- $msg = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] by IP: {$_SERVER['REMOTE_ADDR']}\n$msg";
112
-
113
- Mage::log("$msg\n\n", null, 'cp_plugin.log');
114
- Mage::getModel('channelpilot/logs')
115
- ->unsetData()
116
- ->setData(array('created' => date('Y-m-d H:i:s'), 'content' => $msg))
117
- ->save();
118
- }
119
-
120
- public static function checkConfig() {
121
- /* if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_NUMBER')==2 && oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_OTHERARTNUM')==''){
122
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No column for other article number", "No column for other article number");
123
- }
124
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_IMPORT')==''){
125
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for unpaid orders", "No folder for unpaid orders");
126
- }
127
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_PAIDIMPORT')==''){
128
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for paid orders", "No folder for paid orders");
129
- }
130
- if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_CANCEL')==''){
131
- CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for cancelled orders", "No folder for cancelled orders");
132
- } */
133
- }
134
-
135
- }
136
-
137
- ?>
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * an cp abstract handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPAbstractHandler {
9
+
10
+ const defaultHeader = "Content-Type: application/json;";
11
+ const errorHeader_forbidden = "HTTP/1.0 403 Forbidden";
12
+ const ChannelPilot_IP = "148.251.65.130";
13
+ const DB_REGISTRATION = "cp_registration";
14
+ const DB_PRICES = "cp_prices";
15
+ const DB_ORDERS = "cp_marketplace_orders";
16
+ const DB_ORDER_ITEMS = "cp_marketplace_order_items";
17
+
18
+ /**
19
+ * Is the IP allowed for this shopId
20
+ *
21
+ * @param type $shopId
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
+
46
+ /**
47
+ * Is the shop still registered?
48
+ *
49
+ * @param integer $shopId
50
+ * @return boolean
51
+ */
52
+ public static function isShopRegistered($shopId) {
53
+ $collection = Mage::getSingleton('channelpilot/registration')->getCollection()
54
+ ->addFieldToSelect('shopId')
55
+ ->addFieldToFilter('shopId', array('eq' => $shopId));
56
+
57
+ return (count($collection) > 0);
58
+ }
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) {
84
+ foreach ($apiOrders as $apiOrder) {
85
+ if ($apiOrder->header->resultCode == CPResultCodes::SUCCESS) {
86
+ self::changeStatusOrder($apiOrder->orderHeader);
87
+ } else {
88
+ self::logError("Cannot change orderstatus from order (id: '" . $apiOrder->orderHeader->orderId . "', status: '" . $apiOrder->orderHeader->status->identifier . "')");
89
+ }
90
+ }
91
+ }
92
+
93
+ public static function changeStatusOrder($apiOrderHeader) {
94
+ if(!empty($apiOrderHeader->oderId)) {
95
+ $order = Mage::getModel('channelpilot/order')->loadByOrderNr($apiOrderHeader->orderId);
96
+ if($order && $order->getId()) {
97
+ $order->setData('status', $apiOrderHeader->status->identifier);
98
+ try {
99
+ $order->save();
100
+ } catch (Exception $e) {
101
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during changeStatusOrder: " . $e->getMessage(), "Exception during update cp_marketplace_orders: ". $apiOrderHeader->status->identifier . "\n" . $e->getMessage());
102
+ }
103
+ } else {
104
+ $header = print_r($apiOrderHeader, true);
105
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "error loading order: ".$header, "error loading order: ".$header);
106
+ }
107
+ }
108
+ }
109
+
110
+ /**
111
+ * log the error in the cp_marketplace - log file
112
+ *
113
+ * @param string $msg
114
+ */
115
+ public static function logError($msg) {
116
+ $msg = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] by IP: {$_SERVER['REMOTE_ADDR']}\n$msg";
117
+
118
+ Mage::log("$msg\n\n", null, 'cp_plugin.log');
119
+ Mage::getModel('channelpilot/logs')
120
+ ->unsetData()
121
+ ->setData(array('created' => date('Y-m-d H:i:s'), 'content' => $msg))
122
+ ->save();
123
+ }
124
+
125
+ public static function checkConfig() {
126
+ /* if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_NUMBER')==2 && oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_ART_OTHERARTNUM')==''){
127
+ CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No column for other article number", "No column for other article number");
128
+ }
129
+ if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_IMPORT')==''){
130
+ CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for unpaid orders", "No folder for unpaid orders");
131
+ }
132
+ if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_PAIDIMPORT')==''){
133
+ CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for paid orders", "No folder for paid orders");
134
+ }
135
+ if(oxConfig::getInstance()->getShopConfVar('CPMARKETPLACE_CANCEL')==''){
136
+ CPErrorHandler::handle(CPErrors::RESULT_CONFIG_INVALID, "No folder for cancelled orders", "No folder for cancelled orders");
137
+ } */
138
+ }
139
+
140
+ }
141
+
142
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php CHANGED
@@ -1,146 +1,146 @@
1
- <?php
2
-
3
- /**
4
- * an cp cancellation handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPCancellationHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle cancellation hook.
12
- * @return type
13
- */
14
- public function handle() {
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();
22
- foreach ($cancelledOrders as $orders) {
23
- if (isset($orders)) {
24
- $cancelled[] = $orders;
25
- }
26
- }
27
- $cancelledOrderItems = $this->getCancelledItems();
28
-
29
- foreach ($cancelledOrderItems as $orders) {
30
- if (isset($orders)) {
31
- $cancelled[] = $orders;
32
- }
33
- }
34
-
35
- if (sizeof($cancelled) == 0) {
36
- self::hookResult(false);
37
- }
38
- $merchantId = self::getMerchantId($token);
39
- $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
40
- $result = $api->registerCancellations($cancelled);
41
- if ($result->header->resultCode == CPResultCodes::SUCCESS) {
42
- self::changeStatusOrders($result->updateResults);
43
- try {
44
- Mage::getModel('channelpilot/order_item')->updateCancelledQty($cancelledOrderItems);
45
- } catch(Exception $e) {
46
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
47
- }
48
- } else {
49
- // Result from registerDeliveries has no success
50
- self::logError("request registerCancellations() resultCode " . $result->header->resultCode);
51
- $hook = new CPHookResponse();
52
- $hook->resultCode = CPResultCodes::SUCCESS;
53
- $hook->resultMessage = "request registerCancellations() resultCode " . $result->header->resultCode;
54
- $hook->moreAvailable = false;
55
- $hook->apiResultCode = $result->header->resultCode;
56
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
57
- }
58
- self::hookResult(true);
59
- } else {
60
- if (empty($token
61
- )) {
62
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
63
- } else {
64
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
65
- }
66
- }
67
- }
68
-
69
- private function hookResult($moreAvailable) {
70
- $hook = new CPHookResponse();
71
- $hook->resultCode = CPResultCodes::SUCCESS;
72
- $hook->resultMessage = "CANCELLATION HOOK SUCCESS";
73
- $hook->moreAvailable = $moreAvailable;
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()
81
- ->getData();
82
-
83
- try {
84
- $order = null;
85
- $orderId = null;
86
- $orders = array();
87
- foreach ($sResult AS $result) {
88
- if ($orderId == null || $orderId != $result['order_nr']) {
89
- if ($orderId != null) {
90
- $orders[] = $order;
91
- }
92
- $isWholeOrderCanceled = ($result['sales_order_state'] == Mage_Sales_Model_Order::STATE_CLOSED);
93
- $order = new CPCancellation($result['order_nr'], $result['marketplace'], $result['status'], date("Y-m-d", strtotime($result['time'])) . 'T' . date("H:i:s", strtotime($result['time'])), $isWholeOrderCanceled);
94
- $orderId = $result['order_nr'];
95
- }
96
- $item = new CPOrderItem();
97
- $item->id = $result['order_item_id'];
98
- $item->idExternal = $result['marketplace_order_item_id'];
99
- $item->quantityCancelled = $result['qty_refunded'];
100
- $order->cancelledItems[] = $item;
101
- }
102
- $orders[] = $order;
103
- return $orders;
104
- } catch (Exception $e) {
105
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
106
- }
107
- }
108
-
109
- /**
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) {
117
- Mage::getModel('channelpilot/order_item')->unsetData()
118
- ->load($cpOrderItem->id)
119
- ->setData('cancelled', $cpOrderItem->quantityCancelled)
120
- ->save();
121
- }
122
- }
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'))
130
- ->addFieldToFilter('main_table.status', array('neq' => CPOrderStatus::ID_CANCELLED))
131
- ->addCancelledSalesOrderFilter()
132
- ->getData();
133
-
134
- $orders = array();
135
- foreach ($result AS $order) {
136
- $cancelled = new CPCancellation($order['order_nr'], $order['marketplace'], $order['status'], date("Y-m-d", strtotime($order['time'])) . 'T' . date("H:i:s", strtotime($order['time'])), true);
137
- $orders[] = $cancelled;
138
- }
139
- return $orders;
140
- } catch (Exception $e) {
141
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
142
- }
143
- }
144
- }
145
-
146
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp cancellation handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPCancellationHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle cancellation hook.
12
+ * @return type
13
+ */
14
+ public function handle() {
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();
22
+ foreach ($cancelledOrders as $orders) {
23
+ if (isset($orders)) {
24
+ $cancelled[] = $orders;
25
+ }
26
+ }
27
+ $cancelledOrderItems = $this->getCancelledItems();
28
+
29
+ foreach ($cancelledOrderItems as $orders) {
30
+ if (isset($orders)) {
31
+ $cancelled[] = $orders;
32
+ }
33
+ }
34
+
35
+ if (sizeof($cancelled) == 0) {
36
+ self::hookResult(false);
37
+ }
38
+ $merchantId = self::getMerchantId($token);
39
+ $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
40
+ $result = $api->registerCancellations($cancelled);
41
+ if ($result->header->resultCode == CPResultCodes::SUCCESS) {
42
+ self::changeStatusOrders($result->updateResults);
43
+ try {
44
+ Mage::getModel('channelpilot/order_item')->updateCancelledQty($cancelledOrderItems);
45
+ } catch(Exception $e) {
46
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
47
+ }
48
+ } else {
49
+ // Result from registerDeliveries has no success
50
+ self::logError("request registerCancellations() resultCode " . $result->header->resultCode);
51
+ $hook = new CPHookResponse();
52
+ $hook->resultCode = CPResultCodes::SUCCESS;
53
+ $hook->resultMessage = "request registerCancellations() resultCode " . $result->header->resultCode;
54
+ $hook->moreAvailable = false;
55
+ $hook->apiResultCode = $result->header->resultCode;
56
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
57
+ }
58
+ self::hookResult(true);
59
+ } else {
60
+ if (empty($token
61
+ )) {
62
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
63
+ } else {
64
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
65
+ }
66
+ }
67
+ }
68
+
69
+ private function hookResult($moreAvailable) {
70
+ $hook = new CPHookResponse();
71
+ $hook->resultCode = CPResultCodes::SUCCESS;
72
+ $hook->resultMessage = "CANCELLATION HOOK SUCCESS";
73
+ $hook->moreAvailable = $moreAvailable;
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()
81
+ ->getData();
82
+
83
+ try {
84
+ $order = null;
85
+ $orderId = null;
86
+ $orders = array();
87
+ foreach ($sResult AS $result) {
88
+ if ($orderId == null || $orderId != $result['order_nr']) {
89
+ if ($orderId != null) {
90
+ $orders[] = $order;
91
+ }
92
+ $isWholeOrderCanceled = ($result['sales_order_state'] == Mage_Sales_Model_Order::STATE_CLOSED);
93
+ $order = new CPCancellation($result['order_nr'], $result['marketplace'], $result['status'], date("Y-m-d", strtotime($result['time'])) . 'T' . date("H:i:s", strtotime($result['time'])), $isWholeOrderCanceled);
94
+ $orderId = $result['order_nr'];
95
+ }
96
+ $item = new CPOrderItem();
97
+ $item->id = $result['order_item_id'];
98
+ $item->idExternal = $result['marketplace_order_item_id'];
99
+ $item->quantityCancelled = $result['qty_refunded'];
100
+ $order->cancelledItems[] = $item;
101
+ }
102
+ $orders[] = $order;
103
+ return $orders;
104
+ } catch (Exception $e) {
105
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
106
+ }
107
+ }
108
+
109
+ /**
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) {
117
+ Mage::getModel('channelpilot/order_item')->unsetData()
118
+ ->load($cpOrderItem->id)
119
+ ->setData('cancelled', $cpOrderItem->quantityCancelled)
120
+ ->save();
121
+ }
122
+ }
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'))
130
+ ->addFieldToFilter('main_table.status', array('neq' => CPOrderStatus::ID_CANCELLED))
131
+ ->addCancelledSalesOrderFilter()
132
+ ->getData();
133
+
134
+ $orders = array();
135
+ foreach ($result AS $order) {
136
+ $cancelled = new CPCancellation($order['order_nr'], $order['marketplace'], $order['status'], date("Y-m-d", strtotime($order['time'])) . 'T' . date("H:i:s", strtotime($order['time'])), true);
137
+ $orders[] = $cancelled;
138
+ }
139
+ return $orders;
140
+ } catch (Exception $e) {
141
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: " . $e->getMessage());
142
+ }
143
+ }
144
+ }
145
+
146
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDebugHandler.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
-
3
- /**
4
- * an cp export handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPDebugHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle status event
12
- *
13
- */
14
- public function handle() {
15
- $token = Mage::app()->getRequest()->getParam('token', false);
16
- if ($token && self::isIpAllowedViaSecurityToken($token)) {
17
- $limit = Mage::app()->getRequest()->getParam('limit', 0);
18
- if ($limit) {
19
- $logEntries = Mage::getModel('channelpilot/logs')->getCollection()
20
- ->setPageSize($limit)
21
- ->setOrder('id', 'DESC');
22
-
23
- $hook = new CPHookResponse();
24
- $hook->resultCode = CPResultCodes::SUCCESS;
25
- $hook->logs = $logEntries->getData();
26
- $hook->resultMessage = "LoggingData of " . sizeof($hook->logs) . " entries";
27
- $hook->moreAvailable = true;
28
- if (sizeof($hook->logs) < $limit) {
29
- $hook->moreAvailable = false;
30
- }
31
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
32
- } else {
33
- $hook = new CPHookResponse();
34
- $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
35
- $hook->resultMessage = ($limit == 0) ? "No data to display" : "Not enough parameter set";
36
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
37
- }
38
- } else {
39
- if (empty($token)) {
40
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
41
- } else {
42
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
43
- }
44
- }
45
- }
46
-
47
- }
48
-
49
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp export handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPDebugHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle status event
12
+ *
13
+ */
14
+ public function handle() {
15
+ $token = Mage::app()->getRequest()->getParam('token', false);
16
+ if ($token && self::isIpAllowedViaSecurityToken($token)) {
17
+ $limit = Mage::app()->getRequest()->getParam('limit', 0);
18
+ if ($limit) {
19
+ $logEntries = Mage::getModel('channelpilot/logs')->getCollection()
20
+ ->setPageSize($limit)
21
+ ->setOrder('id', 'DESC');
22
+
23
+ $hook = new CPHookResponse();
24
+ $hook->resultCode = CPResultCodes::SUCCESS;
25
+ $hook->logs = $logEntries->getData();
26
+ $hook->resultMessage = "LoggingData of " . sizeof($hook->logs) . " entries";
27
+ $hook->moreAvailable = true;
28
+ if (sizeof($hook->logs) < $limit) {
29
+ $hook->moreAvailable = false;
30
+ }
31
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
32
+ } else {
33
+ $hook = new CPHookResponse();
34
+ $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
35
+ $hook->resultMessage = ($limit == 0) ? "No data to display" : "Not enough parameter set";
36
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
37
+ }
38
+ } else {
39
+ if (empty($token)) {
40
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
41
+ } else {
42
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
43
+ }
44
+ }
45
+ }
46
+
47
+ }
48
+
49
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php CHANGED
@@ -1,103 +1,103 @@
1
- <?php
2
-
3
- /**
4
- * an cp delivery handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPDeliveryHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle delivery hook.
12
- * @return type
13
- */
14
- public function handle() {
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
- 'shipment_id' => $shipmentId,
52
- );
53
- }
54
- }
55
- if (sizeof($deliveries) == 0) {
56
- self::hookResult(false);
57
- }
58
-
59
- $merchantId = self::getMerchantId($token);
60
- $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
61
- $result = $api->registerDeliveries($deliveries);
62
- if ($result->header->resultCode == CPResultCodes::SUCCESS) {
63
- self::changeStatusOrders($result->updateResults);
64
- $insertedRows = Mage::getModel('channelpilot/order_shipment')->addMultipleShipments($shipments);
65
-
66
- } else {
67
- // Result from registerDeliveries has no success
68
- self::logError("request registerDeliveries() resultCode " . $result->header->resultCode);
69
- $hook = new CPHookResponse();
70
- $hook->resultCode = CPResultCodes::SUCCESS;
71
- $hook->resultMessage = "request registerDeliveries() resultCode " . $result->header->resultCode;
72
- $hook->moreAvailable = false;
73
- $hook->apiResultCode = $result->header->resultCode;
74
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
75
- }
76
- self::hookResult(true);
77
- } catch (Exception $e) {
78
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle DeliveryHook: " . $e->getMessage(), "Exception in handle DeliveryHook: " . $e->getMessage());
79
- }
80
- } else {
81
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
82
- }
83
- } else {
84
- if (empty($_GET['token'])) {
85
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
86
- } else {
87
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
88
- }
89
- }
90
- return "Error during handle deliveryHook";
91
- }
92
-
93
- private function hookResult($moreAvailable) {
94
- $hook = new CPHookResponse();
95
- $hook->resultCode = CPResultCodes::SUCCESS;
96
- $hook->resultMessage = "DELIVERY HOOK SUCCESS";
97
- $hook->moreAvailable = $moreAvailable;
98
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
99
- }
100
-
101
- }
102
-
103
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp delivery handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPDeliveryHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle delivery hook.
12
+ * @return type
13
+ */
14
+ public function handle() {
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
+ 'shipment_id' => $shipmentId,
52
+ );
53
+ }
54
+ }
55
+ if (sizeof($deliveries) == 0) {
56
+ self::hookResult(false);
57
+ }
58
+
59
+ $merchantId = self::getMerchantId($token);
60
+ $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
61
+ $result = $api->registerDeliveries($deliveries);
62
+ if ($result->header->resultCode == CPResultCodes::SUCCESS) {
63
+ self::changeStatusOrders($result->updateResults);
64
+ $insertedRows = Mage::getModel('channelpilot/order_shipment')->addMultipleShipments($shipments);
65
+
66
+ } else {
67
+ // Result from registerDeliveries has no success
68
+ self::logError("request registerDeliveries() resultCode " . $result->header->resultCode);
69
+ $hook = new CPHookResponse();
70
+ $hook->resultCode = CPResultCodes::SUCCESS;
71
+ $hook->resultMessage = "request registerDeliveries() resultCode " . $result->header->resultCode;
72
+ $hook->moreAvailable = false;
73
+ $hook->apiResultCode = $result->header->resultCode;
74
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
75
+ }
76
+ self::hookResult(true);
77
+ } catch (Exception $e) {
78
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle DeliveryHook: " . $e->getMessage(), "Exception in handle DeliveryHook: " . $e->getMessage());
79
+ }
80
+ } else {
81
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
82
+ }
83
+ } else {
84
+ if (empty($_GET['token'])) {
85
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
86
+ } else {
87
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
88
+ }
89
+ }
90
+ return "Error during handle deliveryHook";
91
+ }
92
+
93
+ private function hookResult($moreAvailable) {
94
+ $hook = new CPHookResponse();
95
+ $hook->resultCode = CPResultCodes::SUCCESS;
96
+ $hook->resultMessage = "DELIVERY HOOK SUCCESS";
97
+ $hook->moreAvailable = $moreAvailable;
98
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
99
+ }
100
+
101
+ }
102
+
103
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php CHANGED
@@ -1,559 +1,601 @@
1
- <?php
2
-
3
- /**
4
- * an cp export handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPExportHandler extends CPAbstractHandler {
9
-
10
- private $_storeId;
11
- private $_siteId;
12
- private $_mediaUrl;
13
- private $_webUrl;
14
- private $_allCat;
15
- private $oldCatPath;
16
- private $_limit;
17
- private $_last;
18
- private $_blankProduct;
19
- private $_exportMethod;
20
- private $_configurableAttributes = array();
21
- private $_imageBaseUrl;
22
- private $_maxAdditionalImages;
23
- private $_exportFields;
24
- private $_currencyChange;
25
- private $_replaceFields;
26
-
27
- const METHOD_XML = 0;
28
- const METHOD_JSON = 1;
29
-
30
- /**
31
- * Handle status event
32
- *
33
- */
34
- public function handle($exportMethod = self::METHOD_XML) {
35
- $limit = Mage::app()->getRequest()->getParam('limit', null);
36
- $store = Mage::app()->getRequest()->getParam('store', null);
37
- $this->_exportMethod = $exportMethod;
38
- $this->_limit = $limit;
39
- $this->_last = Mage::app()->getRequest()->getParam('last', null);
40
- try {
41
- $this->_storeId = Mage::app()->getStore($store)->getId();
42
- } catch(Exception $e) {
43
- $this->_handleStoreException();
44
- return;
45
- }
46
-
47
- $this->initExport();
48
- $productData = $this->_export();
49
-
50
- switch($this->_exportMethod) {
51
- case self::METHOD_XML:
52
- $this->_toXml($productData);
53
- break;
54
- case self::METHOD_JSON:
55
- $this->_toJson($productData);
56
- break;
57
- default:
58
- echo "Export method not supported.";
59
- return;
60
- }
61
- }
62
-
63
- /**
64
- * Display an error message based on current export (and therefore display) method
65
- * if an exception has occured during Mage::app()->getStore().
66
- */
67
- private function _handleStoreException() {
68
- // The exception thrown by Mage::app()->getStore() has an empty message ...
69
- switch($this->_exportMethod) {
70
- case self::METHOD_XML:
71
- $xml = new SimpleXMLElement('<root></root>');
72
- $xml->addChild('error', 'Error retrieving store.');
73
- header('Content-Type: text/xml; charset=utf-8');
74
- echo $xml->asXML();
75
- break;
76
- case self::METHOD_JSON:
77
- default:
78
- $hook = new CPHookResponse();
79
- $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
80
- $hook->resultMessage = "Error retrieving store.";
81
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
82
- }
83
- }
84
-
85
- /**
86
- * Check if another currency (other than the base currency) should be used. Displays an error if the
87
- * given currency could not be found.
88
- */
89
- private function _initCurrencyChange() {
90
- $this->_currencyChange = null;
91
- $currencyCode = Mage::app()->getRequest()->getParam('currency', false);
92
- if ($currencyCode && $currencyCode != '') {
93
- $result = Mage::getModel('directory/currency')->getCurrencyRates(Mage::app()->getBaseCurrencyCode(), $currencyCode);
94
- if(count($result) === 0){
95
- switch($this->_exportMethod) {
96
- case self::METHOD_XML:
97
- $xml = new SimpleXMLElement('<root></root>');
98
- $xml->addChild('error', 'wrong currency');
99
- header('Content-Type: text/xml; charset=utf-8');
100
- echo $xml->asXML();
101
- exit();
102
- case self::METHOD_JSON:
103
- default:
104
- $hook = new CPHookResponse();
105
- $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
106
- $hook->resultMessage = "wrong currency";
107
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
108
- }
109
- }
110
- $this->_currencyChange = $result[$currencyCode];
111
- }
112
- }
113
-
114
- /**
115
- * Initialize the export.
116
- */
117
- private function initExport() {
118
- ini_set('max_execution_time', 7200);
119
-
120
- // Initialize the admin application
121
- Mage::app('admin');
122
-
123
- $this->_blankProduct = array();
124
- $this->_blankProduct['entity_id'] = '';
125
- $this->_blankProduct['sku'] = '';
126
- $this->_blankProduct['parent_id'] = '';
127
- $this->_blankProduct['variationTheme'] = '';
128
- $this->_blankProduct['name'] = '';
129
- $this->_blankProduct['description'] = '';
130
- $this->_blankProduct['price'] = '';
131
- $this->_blankProduct['categories'] = '';
132
- $this->_blankProduct['manufacturer'] = '';
133
- $this->_blankProduct['cp_product_url'] = '';
134
- $this->_blankProduct['cp_image_url'] = '';
135
- $this->_blankProduct['color'] = '';
136
- $this->_blankProduct['weight'] = '';
137
- for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
138
- $this->_blankProduct['cp_additional_image_'.$i] = '';
139
- }
140
-
141
- $specialExportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
142
- if(!empty($specialExportFields)) {
143
- foreach($specialExportFields as $field) {
144
- if (!empty($field['name'])) {
145
- $this->_blankProduct[preg_replace('/\W/', '', $field['name'])] = $field['value'];
146
- }
147
- }
148
- }
149
-
150
- try {
151
- $store = Mage::app()->getStore($this->_storeId);
152
- $this->_siteId = $store->getWebsiteId();
153
- $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
154
- $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
155
- } catch (Exception $e) {
156
- die('Store=' . $this->_storeId . " probably does not exist.");
157
- }
158
-
159
- $this->buildCategoryTree();
160
-
161
- $this->_initCurrencyChange();
162
-
163
- $this->_initConfigurableAttributes();
164
-
165
- /** @var $mediaConfig Mage_Catalog_Model_Product_Media_Config */
166
- $mediaConfig = Mage::getSingleton('catalog/product_media_config');
167
- $this->_imageBaseUrl = $mediaConfig->getBaseMediaUrl();
168
-
169
- $this->_maxAdditionalImages = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber');
170
- $this->_exportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
171
- $this->_replaceFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
172
- }
173
-
174
- /**
175
- * Build the category tree.
176
- */
177
- public function buildCategoryTree() {
178
- $this->_allCat = array();
179
- $this->oldCatPath = '';
180
-
181
- $categoryCollection = Mage::getModel('catalog/category')->getCollection()
182
- ->addAttributeToSelect('name')
183
- ->addAttributeToSort('path');
184
-
185
- foreach($categoryCollection as $category) {
186
- $path = $this->getCategory($category->getPath());
187
- if($path !== 0) {
188
- $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $path . '>' . $category->getName());
189
- } else {
190
- $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $category->getName());
191
- }
192
- }
193
- }
194
-
195
- /**
196
- * Get the category id from a path.
197
- * @param $key
198
- * @return int | string
199
- */
200
- private function getCategory($key) {
201
- $return = 0;
202
- if (strpos($key, '/') != false) {
203
- $tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
204
- if (isset($this->_allCat[$tmpKey])) {
205
- $return = $this->_allCat[$tmpKey];
206
- } else {
207
- $return = $this->getCategory($tmpKey);
208
- }
209
- }
210
- return $return;
211
- }
212
-
213
- /**
214
- * Initialize the configurableAttributes array.
215
- * Array(
216
- * [PRODUCT_ID] => ARRAY(
217
- * [ATTRIBUTE_CODE] => [FRONTEND_LABEL]
218
- * )
219
- * )
220
- */
221
- private function _initConfigurableAttributes() {
222
- $this->_configurableAttributes = array();
223
-
224
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
225
-
226
- $select = $connection->select()
227
- ->from(array('super_attribute' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')), array('attribute_id', 'product_id'))
228
- ->join(array('attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
229
- 'attribute.attribute_id = super_attribute.attribute_id',
230
- array('attribute_code', 'frontend_label')
231
- );
232
-
233
- $result = $connection->fetchAll($select);
234
-
235
- foreach($result as $attribute) {
236
- if(!isset($this->_configurableAttributes[$attribute['product_id']])) {
237
- $this->_configurableAttributes[$attribute['product_id']] = array();
238
- }
239
- $this->_configurableAttributes[$attribute['product_id']][$attribute['attribute_code']] = $attribute['frontend_label'];
240
- }
241
- }
242
-
243
- /**
244
- * Get an array of attribute codes for all configurable attributes of a product ID.
245
- *
246
- * @param int $productId
247
- * @return array
248
- */
249
- private function _getConfigurableAttributes($productId) {
250
- $attributeOptions = array();
251
- if(isset($this->_configurableAttributes[$productId])) {
252
- foreach($this->_configurableAttributes[$productId] as $attributeCode => $label) {
253
- $attributeOptions[] = $label;
254
- }
255
- }
256
- return $attributeOptions;
257
- }
258
-
259
- /**
260
- * Export the products and return them as array.
261
- * @return array
262
- */
263
- private function _export() {
264
- $flatEnabled = false;
265
- if(class_exists('Mage_Core_Model_App_Emulation')) {
266
- /* @var $flatHelper Mage_Catalog_Helper_Product_Flat */
267
- $flatHelper = Mage::helper('catalog/product_flat');
268
- /* @var $emulationModel Mage_Core_Model_App_Emulation */
269
- $emulationModel = Mage::getModel('core/app_emulation');
270
- if ($flatHelper) {
271
- $flatEnabled = method_exists($flatHelper, 'isAvailable') ? $flatHelper->isAvailable() : $flatHelper->isEnabled();
272
- if($flatEnabled) {
273
- // Emulate admin environment to disable using flat model - otherwise we won't get global stats
274
- // for all stores
275
- $initialEnvironmentInfo = $emulationModel->startEnvironmentEmulation(0, Mage_Core_Model_App_Area::AREA_ADMINHTML);
276
- }
277
- }
278
- }
279
-
280
- /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
281
- $collection = Mage::getModel('catalog/product')->getCollection()
282
- ->addAttributeToSelect('*')
283
- ->joinField('qty',
284
- 'cataloginventory/stock_item',
285
- 'qty',
286
- 'product_id=entity_id',
287
- '{{table}}.stock_id=1',
288
- 'left')
289
- ->addAttributeToSort('type_id')
290
- ->setStoreId($this->_storeId);
291
-
292
- if($this->_last) {
293
- $collection->setCurPage($this->_last);
294
- }
295
-
296
- if($this->_limit) {
297
- $collection->setPageSize($this->_limit);
298
- }
299
-
300
- /** @var $backendModel Mage_Catalog_Model_Product_Attribute_Backend_Media */
301
- $backendModel = $collection->getResource()->getAttribute('media_gallery')->getBackend();
302
-
303
- $onlyStockAndPriceData = (Mage::app()->getRequest()->getParam('priceStock', '') === "true");
304
-
305
- $productData = array();
306
-
307
- /** @var $item Mage_Catalog_Model_Product */
308
- foreach ($collection as $item) {
309
-
310
- if($onlyStockAndPriceData) {
311
- $product = $this->_getOnlyStockAndPriceData($item);
312
- } else {
313
- $backendModel->afterLoad($item);
314
- $product = $this->_getFullProductData($item);
315
- }
316
-
317
- $productData[] = $product;
318
- }
319
-
320
- // stop emulating admin store and set initial environment
321
- if ($flatEnabled) {
322
- $emulationModel->stopEnvironmentEmulation($initialEnvironmentInfo);
323
- }
324
-
325
- return $productData;
326
- }
327
-
328
- /**
329
- * Get the current $item as array.
330
- * Returns Array(
331
- * [ATTRIBUTE_CODE] => [VALUE]
332
- * )
333
- * @param Mage_Catalog_Model_Product $item
334
- * @return array
335
- */
336
- private function _getFullProductData(Mage_Catalog_Model_Product $item) {
337
- $imageUrl = $this->_imageBaseUrl . $item->getImage();
338
-
339
- $isParent = 0;
340
- if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
341
- $isParent = 1;
342
- }
343
-
344
- $parentId = null;
345
- if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
346
- $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getId());
347
- if(is_array($parentId) && !empty($parentId)) {
348
- $parentId = $parentId[0];
349
- }
350
- }
351
-
352
- $configurableAttributes = array();
353
- if($parentId && isset($this->_variationThemes[$parentId])) {
354
- $configurableAttributes = $this->_variationThemes[$parentId];
355
- } else if($isParent && $parentId === null) {
356
- $configurableAttributes = $this->_getConfigurableAttributes($item->getId());
357
- $configurableAttributes = (!empty($configurableAttributes)) ? implode('|', $configurableAttributes) : '';
358
- $this->_variationThemes[$item->getId()] = $configurableAttributes;
359
- }
360
-
361
- // workaround... $item->getProductUrl() sometimes adds store code to url (e.g. <url>?___store=default)
362
- $productUrl = $this->_webUrl . $item->getUrlPath();
363
- $colorText = $item->getAttributeText('color');
364
- $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$item->getPrice());
365
- $price = ($rulePrice) ? $rulePrice : $item->getPrice();
366
-
367
- $product = $this->_blankProduct;
368
-
369
- $product['entity_id'] = $item->getId();
370
- $product['sku'] = $item->getSku();
371
- $product['parent_id'] = $parentId;
372
- $product['variationTheme'] = $configurableAttributes;
373
- $product['name'] = $item->getName();
374
- $product['description'] = html_entity_decode($item->getDescription());
375
-
376
- $product['price'] = $price;
377
- if($this->_currencyChange) {
378
- $product['price'] = round($product['price']*$this->_currencyChange, 2);
379
- }
380
-
381
- $product['categories'] = $this->_getCategoryInformation($item);
382
- $product['manufacturer'] = $item->getManufacturer();
383
- $product['cp_product_url'] = $productUrl;
384
- $product['cp_image_url'] = $imageUrl;
385
- $product['color'] = ($colorText) ? $colorText : null;
386
- $product['weight'] = $item->getWeight();
387
-
388
- $counter = 1;
389
- foreach ($item->getMediaGalleryImages() as $image) {
390
- if ($counter > $this->_maxAdditionalImages) {
391
- break;
392
- }
393
-
394
- if ($image->getFile() == $item->getImage()) {
395
- continue;
396
- }
397
-
398
- $product['cp_additional_image_' . $counter] = $this->_imageBaseUrl . $image->getFile();
399
- $counter++;
400
- }
401
-
402
- $product['is_parent'] = $isParent;
403
-
404
- foreach($this->_exportFields as $field) {
405
- $code = $field['productattribute'];
406
- switch($code) {
407
- case 'qty':
408
- $product[$code] = $item->getQty();
409
- break;
410
- case 'stock_status':
411
- $product[$code] = $item->getStockItem()->getIsInStock();
412
- break;
413
- default:
414
- $attributeText = $item->getAttributeText($code);
415
- if(is_array($attributeText)) {
416
- $attributeText = implode(',',$attributeText);
417
- }
418
- $product[$code] = ($attributeText) ? $attributeText : $item->getData($code);
419
- }
420
- }
421
-
422
- if(!empty($this->_replaceFields) && !$isParent && $parentId !== null) {
423
- $parent = Mage::getModel('catalog/product')->load($parentId);
424
- foreach($this->_replaceFields as $field) {
425
- $code = $field['productattribute'];
426
- switch($code) {
427
- case 'qty':
428
- $product[$code] = $parent->getStockItem->getQty();
429
- break;
430
- case 'stock_status':
431
- $product[$code] = $parent->getStockItem()->getIsInStock();
432
- break;
433
- default:
434
- $attributeText = $parent->getAttributeText($code);
435
- if(is_array($attributeText)) {
436
- $attributeText = implode(',',$attributeText);
437
- }
438
- $product[$code] = ($attributeText) ? $attributeText : $parent->getData($code);
439
- }
440
- }
441
- }
442
-
443
- return $product;
444
- }
445
-
446
- /**
447
- * Get only the stock and price data for a product as array. Attributes: entity_id, sku, price, qty.
448
- * Array(
449
- * [ATTRIBUTE_CODE] => [VALUE]
450
- * )
451
- * @param Mage_Catalog_Model_Product $item
452
- * @return array
453
- */
454
- private function _getOnlyStockAndPriceData(Mage_Catalog_Model_Product $item) {
455
- $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$item->getPrice());
456
- $price = ($rulePrice) ? $rulePrice : $item->getPrice();
457
-
458
- $product['entity_id'] = $item->getId();
459
- $product['sku'] = $item->getSku();
460
- $product['price'] = $price;
461
- if($this->_currencyChange) {
462
- $product['price'] = round($product['price']*$this->_currencyChange, 2);
463
- }
464
-
465
- $product['qty'] = $item->getQty();
466
-
467
- return $product;
468
- }
469
-
470
- /**
471
- * Creates and shows an XML based on the values of the $productData array created by the export method.
472
- * Sends a Content-Type header.
473
- * @param array $productData
474
- */
475
- private function _toXml(array $productData) {
476
- $xml = new SimpleXMLElement('<root></root>');
477
- $xmlCatalog = $xml->addChild('catalog');
478
- foreach($productData as $product) {
479
- $xmlProduct = $xmlCatalog->addChild('product');
480
- $this->_productToXml($product, $xmlProduct);
481
- }
482
- header('Content-Type: text/xml; charset=utf-8');
483
- echo $xml->asXML();
484
- exit();
485
- }
486
-
487
- /**
488
- * Adds the values of the $product array to the $xml structure.
489
- * @param array $product
490
- * @param SimpleXMLElement $xml
491
- */
492
- private function _productToXml(array $product, SimpleXMLElement $xml) {
493
- foreach($product as $code => $value) {
494
- if(is_array($value)) {
495
- $node = $xml->addChild($code);
496
- $this->_productToXml($value, $node);
497
- } else if (is_string($value) || is_numeric($value) || is_bool($value) || is_null($value)) {
498
- $xml->addChild($code, htmlspecialchars($value));
499
- }
500
- }
501
- }
502
-
503
- /**
504
- * Shows the content of $productData as JSON.
505
- * @param array $productData
506
- */
507
- private function _toJson(array $productData) {
508
- $hook = new CPHookResponse();
509
- $hook->resultCode = CPResultCodes::SUCCESS;
510
- $hook->products = $productData;
511
- $hook->resultMessage = "ProductData of " . sizeof($hook->products) . " articles";
512
- $hook->moreAvailable = true;
513
- if (sizeof($hook->products) < $this->_limit) {
514
- $hook->moreAvailable = false;
515
- }
516
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
517
- }
518
-
519
- /**
520
- * Get the category information for a product.
521
- * @param Mage_Catalog_Model_Product $product
522
- * @return string
523
- */
524
- private function _getCategoryInformation(Mage_Catalog_Model_Product $product) {
525
- $categorieField = '';
526
- $this->oldCatPath = '';
527
-
528
- /** @var $category Mage_Catalog_Model_Category */
529
- foreach($product->getCategoryCollection() as $category) {
530
- if (($this->oldCatPath == '') || (strpos($category->getPath(), $this->oldCatPath) != 0)) {
531
- // Start tree
532
- if ($this->oldCatPath != '') {
533
- if ($categorieField != '') {
534
- $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
535
- } else {
536
- $categorieField = $this->_allCat[$this->oldCatPath];
537
- }
538
- }
539
- $this->oldCatPath = $category->getPath();
540
- } else {
541
- // Add to tree
542
- $this->oldCatPath = $category->getPath();
543
- }
544
-
545
- }
546
-
547
- if ($categorieField != '') {
548
- $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
549
- } else {
550
- if ($this->oldCatPath != '') {
551
- $categorieField = $this->_allCat[$this->oldCatPath];
552
- }
553
- }
554
-
555
- return ltrim($categorieField, '>');
556
- }
557
- }
558
-
559
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * an cp export handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPExportHandler extends CPAbstractHandler {
9
+
10
+ private $_storeId;
11
+ private $_siteId;
12
+ private $_mediaUrl;
13
+ private $_webUrl;
14
+ private $_allCat;
15
+ private $oldCatPath;
16
+ private $_limit;
17
+ private $_last;
18
+ private $_blankProduct;
19
+ private $_exportMethod;
20
+ private $_configurableAttributes = array();
21
+ private $_imageBaseUrl;
22
+ private $_maxAdditionalImages;
23
+ private $_exportFields;
24
+ private $_currencyChange;
25
+ private $_replaceFields;
26
+
27
+ const METHOD_XML = 0;
28
+ const METHOD_JSON = 1;
29
+
30
+ /**
31
+ * Handle status event
32
+ *
33
+ */
34
+ public function handle($exportMethod = self::METHOD_XML) {
35
+ $limit = Mage::app()->getRequest()->getParam('limit', null);
36
+ $store = Mage::app()->getRequest()->getParam('store', null);
37
+ $this->_exportMethod = $exportMethod;
38
+ $this->_limit = $limit;
39
+ $this->_last = Mage::app()->getRequest()->getParam('last', null);
40
+ try {
41
+ $this->_storeId = Mage::app()->getStore($store)->getId();
42
+ } catch(Exception $e) {
43
+ $this->_handleStoreException();
44
+ return;
45
+ }
46
+
47
+ $this->initExport();
48
+ $productData = $this->_export();
49
+
50
+ switch($this->_exportMethod) {
51
+ case self::METHOD_XML:
52
+ $this->_toXml($productData);
53
+ break;
54
+ case self::METHOD_JSON:
55
+ $this->_toJson($productData);
56
+ break;
57
+ default:
58
+ echo "Export method not supported.";
59
+ return;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Display an error message based on current export (and therefore display) method
65
+ * if an exception has occured during Mage::app()->getStore().
66
+ */
67
+ private function _handleStoreException() {
68
+ // The exception thrown by Mage::app()->getStore() has an empty message ...
69
+ switch($this->_exportMethod) {
70
+ case self::METHOD_XML:
71
+ $xml = new SimpleXMLElement('<root></root>');
72
+ $xml->addChild('error', 'Error retrieving store.');
73
+ header('Content-Type: text/xml; charset=utf-8');
74
+ echo $xml->asXML();
75
+ break;
76
+ case self::METHOD_JSON:
77
+ default:
78
+ $hook = new CPHookResponse();
79
+ $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
80
+ $hook->resultMessage = "Error retrieving store.";
81
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Check if another currency (other than the base currency) should be used. Displays an error if the
87
+ * given currency could not be found.
88
+ */
89
+ private function _initCurrencyChange() {
90
+ $this->_currencyChange = null;
91
+ $currencyCode = Mage::app()->getRequest()->getParam('currency', false);
92
+ if ($currencyCode && $currencyCode != '') {
93
+ $result = Mage::getModel('directory/currency')->getCurrencyRates(Mage::app()->getBaseCurrencyCode(), $currencyCode);
94
+ if(count($result) === 0){
95
+ switch($this->_exportMethod) {
96
+ case self::METHOD_XML:
97
+ $xml = new SimpleXMLElement('<root></root>');
98
+ $xml->addChild('error', 'wrong currency');
99
+ header('Content-Type: text/xml; charset=utf-8');
100
+ echo $xml->asXML();
101
+ exit();
102
+ case self::METHOD_JSON:
103
+ default:
104
+ $hook = new CPHookResponse();
105
+ $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
106
+ $hook->resultMessage = "wrong currency";
107
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
108
+ }
109
+ }
110
+ $this->_currencyChange = $result[$currencyCode];
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Initialize the export.
116
+ */
117
+ private function initExport() {
118
+ ini_set('max_execution_time', 7200);
119
+
120
+ // Initialize the admin application
121
+ Mage::app('admin');
122
+
123
+ $this->_blankProduct = array();
124
+ $this->_blankProduct['entity_id'] = '';
125
+ $this->_blankProduct['sku'] = '';
126
+ $this->_blankProduct['parent_id'] = '';
127
+ $this->_blankProduct['variationTheme'] = '';
128
+ $this->_blankProduct['name'] = '';
129
+ $this->_blankProduct['description'] = '';
130
+ $this->_blankProduct['price'] = '';
131
+ $this->_blankProduct['categories'] = '';
132
+ $this->_blankProduct['manufacturer'] = '';
133
+ $this->_blankProduct['cp_product_url'] = '';
134
+ $this->_blankProduct['cp_image_url'] = '';
135
+ $this->_blankProduct['color'] = '';
136
+ $this->_blankProduct['weight'] = '';
137
+ for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
138
+ $this->_blankProduct['cp_additional_image_'.$i] = '';
139
+ }
140
+
141
+ $specialExportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
142
+ if(!empty($specialExportFields)) {
143
+ foreach($specialExportFields as $field) {
144
+ if (!empty($field['name'])) {
145
+ $this->_blankProduct[preg_replace('/\W/', '', $field['name'])] = $field['value'];
146
+ }
147
+ }
148
+ }
149
+
150
+ try {
151
+ $store = Mage::app()->getStore($this->_storeId);
152
+ $this->_siteId = $store->getWebsiteId();
153
+ $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
154
+ $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
155
+ } catch (Exception $e) {
156
+ die('Store=' . $this->_storeId . " probably does not exist.");
157
+ }
158
+
159
+ $this->buildCategoryTree();
160
+
161
+ $this->_initCurrencyChange();
162
+
163
+ $this->_initConfigurableAttributes();
164
+
165
+ /** @var $mediaConfig Mage_Catalog_Model_Product_Media_Config */
166
+ $mediaConfig = Mage::getSingleton('catalog/product_media_config');
167
+ $this->_imageBaseUrl = $mediaConfig->getBaseMediaUrl();
168
+
169
+ $this->_maxAdditionalImages = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber');
170
+ $this->_exportFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
171
+ $this->_replaceFields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
172
+ }
173
+
174
+ /**
175
+ * Build the category tree.
176
+ */
177
+ public function buildCategoryTree() {
178
+ $this->_allCat = array();
179
+ $this->oldCatPath = '';
180
+
181
+ $categoryCollection = Mage::getModel('catalog/category')->getCollection()
182
+ ->addAttributeToSelect('name')
183
+ ->addAttributeToSort('path');
184
+
185
+ foreach($categoryCollection as $category) {
186
+ $path = $this->getCategory($category->getPath());
187
+ if($path !== 0) {
188
+ $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $path . '>' . $category->getName());
189
+ } else {
190
+ $this->_allCat[$category->getPath()] = str_replace('Root Catalog', 'Home', $category->getName());
191
+ }
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Get the category id from a path.
197
+ * @param $key
198
+ * @return int | string
199
+ */
200
+ private function getCategory($key) {
201
+ $return = 0;
202
+ if (strpos($key, '/') != false) {
203
+ $tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
204
+ if (isset($this->_allCat[$tmpKey])) {
205
+ $return = $this->_allCat[$tmpKey];
206
+ } else {
207
+ $return = $this->getCategory($tmpKey);
208
+ }
209
+ }
210
+ return $return;
211
+ }
212
+
213
+ /**
214
+ * Initialize the configurableAttributes array.
215
+ * Array(
216
+ * [PRODUCT_ID] => ARRAY(
217
+ * [ATTRIBUTE_CODE] => [FRONTEND_LABEL]
218
+ * )
219
+ * )
220
+ */
221
+ private function _initConfigurableAttributes() {
222
+ $this->_configurableAttributes = array();
223
+
224
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
225
+
226
+ $select = $connection->select()
227
+ ->from(array('super_attribute' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')), array('attribute_id', 'product_id'))
228
+ ->join(array('attribute' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
229
+ 'attribute.attribute_id = super_attribute.attribute_id',
230
+ array('attribute_code', 'frontend_label')
231
+ );
232
+
233
+ $result = $connection->fetchAll($select);
234
+
235
+ foreach($result as $attribute) {
236
+ if(!isset($this->_configurableAttributes[$attribute['product_id']])) {
237
+ $this->_configurableAttributes[$attribute['product_id']] = array();
238
+ }
239
+ $this->_configurableAttributes[$attribute['product_id']][$attribute['attribute_code']] = $attribute['frontend_label'];
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Get an array of attribute codes for all configurable attributes of a product ID.
245
+ *
246
+ * @param int $productId
247
+ * @return array
248
+ */
249
+ private function _getConfigurableAttributes($productId) {
250
+ $attributeOptions = array();
251
+ if(isset($this->_configurableAttributes[$productId])) {
252
+ foreach($this->_configurableAttributes[$productId] as $attributeCode => $label) {
253
+ $attributeOptions[] = $label;
254
+ }
255
+ }
256
+ return $attributeOptions;
257
+ }
258
+
259
+ /**
260
+ * Export the products and return them as array.
261
+ * @return array
262
+ */
263
+ private function _export() {
264
+ $flatEnabled = false;
265
+ if(class_exists('Mage_Core_Model_App_Emulation')) {
266
+ /* @var $flatHelper Mage_Catalog_Helper_Product_Flat */
267
+ $flatHelper = Mage::helper('catalog/product_flat');
268
+ /* @var $emulationModel Mage_Core_Model_App_Emulation */
269
+ $emulationModel = Mage::getModel('core/app_emulation');
270
+ if ($flatHelper) {
271
+ $flatEnabled = method_exists($flatHelper, 'isAvailable') ? $flatHelper->isAvailable() : $flatHelper->isEnabled();
272
+ if($flatEnabled) {
273
+ // Emulate admin environment to disable using flat model - otherwise we won't get global stats
274
+ // for all stores
275
+ $initialEnvironmentInfo = $emulationModel->startEnvironmentEmulation(0, Mage_Core_Model_App_Area::AREA_ADMINHTML);
276
+ }
277
+ }
278
+ }
279
+
280
+ /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
281
+ $collection = Mage::getModel('catalog/product')->getCollection()
282
+ ->addAttributeToSelect('*')
283
+ ->joinField('qty',
284
+ 'cataloginventory/stock_item',
285
+ 'qty',
286
+ 'product_id=entity_id',
287
+ '{{table}}.stock_id=1',
288
+ 'left')
289
+ ->addAttributeToSort('type_id')
290
+ ->setStoreId($this->_storeId);
291
+
292
+ // add group price fields
293
+ foreach($this->_exportFields as $field) {
294
+ if(strpos($field['productattribute'], 'group_price') !== false) {
295
+ $groupId = substr($field['productattribute'], 12);
296
+ if(is_numeric($groupId)) {
297
+ $collection->joinField('group_price_'.$groupId,
298
+ 'catalog/product_index_price',
299
+ 'group_price',
300
+ 'entity_id=entity_id',
301
+ '{{table}}.customer_group_id='.$groupId,
302
+ 'left');
303
+ }
304
+ }
305
+ }
306
+
307
+ if($this->_last) {
308
+ $collection->setCurPage($this->_last);
309
+ }
310
+
311
+ if($this->_limit) {
312
+ $collection->setPageSize($this->_limit);
313
+ }
314
+
315
+ /** @var $backendModel Mage_Catalog_Model_Product_Attribute_Backend_Media */
316
+ $backendModel = $collection->getResource()->getAttribute('media_gallery')->getBackend();
317
+
318
+ $onlyStockAndPriceData = (Mage::app()->getRequest()->getParam('priceStock', '') === "true");
319
+
320
+ $productData = array();
321
+
322
+ /** @var $item Mage_Catalog_Model_Product */
323
+ foreach ($collection as $item) {
324
+
325
+ if($onlyStockAndPriceData) {
326
+ $product = $this->_getOnlyStockAndPriceData($item);
327
+ } else {
328
+ $backendModel->afterLoad($item);
329
+ $product = $this->_getFullProductData($item);
330
+ }
331
+
332
+ $productData[] = $product;
333
+ }
334
+
335
+ // stop emulating admin store and set initial environment
336
+ if ($flatEnabled) {
337
+ $emulationModel->stopEnvironmentEmulation($initialEnvironmentInfo);
338
+ }
339
+
340
+ return $productData;
341
+ }
342
+
343
+ /**
344
+ * Get the current $item as array.
345
+ * Returns Array(
346
+ * [ATTRIBUTE_CODE] => [VALUE]
347
+ * )
348
+ * @param Mage_Catalog_Model_Product $item
349
+ * @return array
350
+ */
351
+ private function _getFullProductData(Mage_Catalog_Model_Product $item) {
352
+ $imageUrl = $this->_imageBaseUrl . $item->getImage();
353
+
354
+ $isParent = 0;
355
+ if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
356
+ $isParent = 1;
357
+ }
358
+
359
+ $parentId = null;
360
+ if ($item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
361
+ $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getId());
362
+ if(is_array($parentId) && !empty($parentId)) {
363
+ $parentId = $parentId[0];
364
+ }
365
+ }
366
+
367
+ $configurableAttributes = array();
368
+ if($parentId && isset($this->_variationThemes[$parentId])) {
369
+ $configurableAttributes = $this->_variationThemes[$parentId];
370
+ } else if($isParent && $parentId === null) {
371
+ $configurableAttributes = $this->_getConfigurableAttributes($item->getId());
372
+ $configurableAttributes = (!empty($configurableAttributes)) ? implode('|', $configurableAttributes) : '';
373
+ $this->_variationThemes[$item->getId()] = $configurableAttributes;
374
+ }
375
+
376
+ // workaround... $item->getProductUrl() sometimes adds store code to url (e.g. <url>?___store=default)
377
+ $productUrl = $this->_webUrl . $item->getUrlPath();
378
+ $colorText = $item->getAttributeText('color');
379
+ $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$item->getPrice());
380
+ $price = ($rulePrice) ? $rulePrice : $item->getPrice();
381
+
382
+ $product = $this->_blankProduct;
383
+
384
+ $product['entity_id'] = $item->getId();
385
+ $product['sku'] = $item->getSku();
386
+ $product['parent_id'] = $parentId;
387
+ $product['variationTheme'] = $configurableAttributes;
388
+ $product['name'] = html_entity_decode($item->getName());
389
+ $product['description'] = html_entity_decode($item->getDescription());
390
+
391
+ $product['price'] = $price;
392
+ if($this->_currencyChange) {
393
+ $product['price'] = round($product['price']*$this->_currencyChange, 2);
394
+ }
395
+
396
+ $product['categories'] = $this->_getCategoryInformation($item);
397
+ $product['manufacturer'] = html_entity_decode($item->getManufacturer());
398
+ $product['cp_product_url'] = $productUrl;
399
+ $product['cp_image_url'] = $imageUrl;
400
+ $product['color'] = ($colorText) ? html_entity_decode($colorText) : null;
401
+ $product['weight'] = $item->getWeight();
402
+
403
+ $counter = 1;
404
+ foreach ($item->getMediaGalleryImages() as $image) {
405
+ // break if the maximum amount of additional images has been reached
406
+ if ($counter > $this->_maxAdditionalImages) {
407
+ break;
408
+ }
409
+
410
+ // ignore the base image; it has already been added
411
+ if ($image->getFile() == $item->getImage()) {
412
+ continue;
413
+ }
414
+
415
+ $product['cp_additional_image_' . $counter] = $this->_imageBaseUrl . $image->getFile();
416
+ $counter++;
417
+ }
418
+
419
+ $product['is_parent'] = $isParent;
420
+
421
+ foreach($this->_exportFields as $field) {
422
+ $code = $field['productattribute'];
423
+ if(strpos($code, 'group_price') !== false) {
424
+ $groupId = substr($code, 12);
425
+ $customerGroup = Mage::getModel('customer/group')->load($groupId);
426
+ $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
427
+ $product['group_price_'.$groupCode] = $item->getData('group_price_'.$customerGroup->getId());
428
+ } else {
429
+ switch($code) {
430
+ case 'qty':
431
+ $product[$code] = $item->getQty();
432
+ break;
433
+ case 'stock_status':
434
+ $product[$code] = $item->getStockItem()->getIsInStock();
435
+ break;
436
+ case 'tax_class_id':
437
+ $product[$code] = $item->getData($code);
438
+ break;
439
+ default:
440
+ $attributeText = $item->getAttributeText($code);
441
+ if(is_array($attributeText)) {
442
+ $attributeText = implode(',',$attributeText);
443
+ }
444
+ $product[$code] = ($attributeText) ? html_entity_decode($attributeText) : html_entity_decode($item->getData($code));
445
+ }
446
+ }
447
+ }
448
+
449
+ if(!empty($this->_replaceFields) && !$isParent && $parentId !== null) {
450
+ $parent = Mage::getModel('catalog/product')->load($parentId);
451
+ foreach($this->_replaceFields as $field) {
452
+ $code = $field['productattribute'];
453
+ if(strpos($code, 'group_price') !== false) {
454
+ $groupId = substr($code, 12);
455
+ $customerGroup = Mage::getModel('customer/group')->load($groupId);
456
+ $groupPrices = $parent->getData('group_price');
457
+ foreach($groupPrices as $groupPrice) {
458
+ if($groupPrice['cust_group'] == $groupId) {
459
+ $groupCode = str_replace(' ', '_', $customerGroup->getCustomerGroupCode());
460
+ $product['group_price_'.$groupCode] = $groupPrice['price'];
461
+ }
462
+ }
463
+ } else {
464
+ switch($code) {
465
+ case 'qty':
466
+ $product[$code] = $parent->getStockItem->getQty();
467
+ break;
468
+ case 'stock_status':
469
+ $product[$code] = $parent->getStockItem()->getIsInStock();
470
+ break;
471
+ case 'tax_class_id':
472
+ $product[$code] = $parent->getData($code);
473
+ break;
474
+ default:
475
+ $attributeText = $parent->getAttributeText($code);
476
+ if(is_array($attributeText)) {
477
+ $attributeText = implode(',',$attributeText);
478
+ }
479
+ $product[$code] = ($attributeText) ? html_entity_decode($attributeText) : html_entity_decode($parent->getData($code));
480
+ }
481
+ }
482
+ }
483
+ }
484
+
485
+ return $product;
486
+ }
487
+
488
+ /**
489
+ * Get only the stock and price data for a product as array. Attributes: entity_id, sku, price, qty.
490
+ * Array(
491
+ * [ATTRIBUTE_CODE] => [VALUE]
492
+ * )
493
+ * @param Mage_Catalog_Model_Product $item
494
+ * @return array
495
+ */
496
+ private function _getOnlyStockAndPriceData(Mage_Catalog_Model_Product $item) {
497
+ $rulePrice = Mage::getModel('catalogrule/rule')->calcProductPriceRule($item->setStoreId($this->_storeId),$item->getPrice());
498
+ $price = ($rulePrice) ? $rulePrice : $item->getPrice();
499
+
500
+ $product['entity_id'] = $item->getId();
501
+ $product['sku'] = $item->getSku();
502
+ $product['price'] = $price;
503
+ if($this->_currencyChange) {
504
+ $product['price'] = round($product['price']*$this->_currencyChange, 2);
505
+ }
506
+
507
+ $product['qty'] = $item->getQty();
508
+
509
+ return $product;
510
+ }
511
+
512
+ /**
513
+ * Creates and shows an XML based on the values of the $productData array created by the export method.
514
+ * Sends a Content-Type header.
515
+ * @param array $productData
516
+ */
517
+ private function _toXml(array $productData) {
518
+ $xml = new SimpleXMLElement('<root></root>');
519
+ $xmlCatalog = $xml->addChild('catalog');
520
+ foreach($productData as $product) {
521
+ $xmlProduct = $xmlCatalog->addChild('product');
522
+ $this->_productToXml($product, $xmlProduct);
523
+ }
524
+ header('Content-Type: text/xml; charset=utf-8');
525
+ echo $xml->asXML();
526
+ exit();
527
+ }
528
+
529
+ /**
530
+ * Adds the values of the $product array to the $xml structure.
531
+ * @param array $product
532
+ * @param SimpleXMLElement $xml
533
+ */
534
+ private function _productToXml(array $product, SimpleXMLElement $xml) {
535
+ foreach($product as $code => $value) {
536
+ if(is_array($value)) {
537
+ $node = $xml->addChild($code);
538
+ $this->_productToXml($value, $node);
539
+ } else if (is_string($value) || is_numeric($value) || is_bool($value) || is_null($value)) {
540
+ $xml->addChild($code, htmlspecialchars($value));
541
+ }
542
+ }
543
+ }
544
+
545
+ /**
546
+ * Shows the content of $productData as JSON.
547
+ * @param array $productData
548
+ */
549
+ private function _toJson(array $productData) {
550
+ $hook = new CPHookResponse();
551
+ $hook->resultCode = CPResultCodes::SUCCESS;
552
+ $hook->products = $productData;
553
+ $hook->resultMessage = "ProductData of " . sizeof($hook->products) . " articles";
554
+ $hook->moreAvailable = true;
555
+ if (sizeof($hook->products) < $this->_limit) {
556
+ $hook->moreAvailable = false;
557
+ }
558
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
559
+ }
560
+
561
+ /**
562
+ * Get the category information for a product.
563
+ * @param Mage_Catalog_Model_Product $product
564
+ * @return string
565
+ */
566
+ private function _getCategoryInformation(Mage_Catalog_Model_Product $product) {
567
+ $categorieField = '';
568
+ $this->oldCatPath = '';
569
+
570
+ /** @var $category Mage_Catalog_Model_Category */
571
+ foreach($product->getCategoryCollection() as $category) {
572
+ if (($this->oldCatPath == '') || (strpos($category->getPath(), $this->oldCatPath) != 0)) {
573
+ // Start tree
574
+ if ($this->oldCatPath != '') {
575
+ if ($categorieField != '') {
576
+ $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
577
+ } else {
578
+ $categorieField = $this->_allCat[$this->oldCatPath];
579
+ }
580
+ }
581
+ $this->oldCatPath = $category->getPath();
582
+ } else {
583
+ // Add to tree
584
+ $this->oldCatPath = $category->getPath();
585
+ }
586
+
587
+ }
588
+
589
+ if ($categorieField != '') {
590
+ $categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
591
+ } else {
592
+ if ($this->oldCatPath != '') {
593
+ $categorieField = $this->_allCat[$this->oldCatPath];
594
+ }
595
+ }
596
+
597
+ return ltrim($categorieField, '>');
598
+ }
599
+ }
600
+
601
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php CHANGED
@@ -1,172 +1,172 @@
1
- <?php
2
-
3
- /**
4
- * an cp delivery handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPNewPriceHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle delivery hook.
12
- * @return type
13
- */
14
- public function handle() {
15
- $token = Mage::app()->getRequest()->getParam('token', false);
16
- $methodParam = Mage::app()->getRequest()->getParam('method', false);
17
- $priceId = Mage::app()->getRequest()->getParam('priceId', false);
18
- if ($token && self::isIpAllowedViaSecurityToken($token)) {
19
- if ($priceId) {
20
- $merchantId = self::getMerchantId($token);
21
-
22
- $filterFrom = self::getLastPriceUpdate($priceId);
23
- $method = "all";
24
- if (isset($filterFrom)) {
25
- $method = "update";
26
- }
27
- $filterArticles = null;
28
-
29
- $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
30
- $result = $api->getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom);
31
- $unknownArticles = array();
32
- $lastPriceUpdate = null;
33
-
34
- if (isset($result->managedArticlePrices)) {
35
- $lastPriceUpdate = $this->_manageArticlePrices($result, $token, $unknownArticles);
36
- }
37
-
38
- if (isset($lastPriceUpdate)) {
39
- $cpPrices = Mage::getModel('channelpilot/prices')->load($priceId);
40
- $cpPrices->setData('last_price_update', $lastPriceUpdate);
41
- try {
42
- $cpPrices->save();
43
- } catch (Exception $e) {
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
- }
51
- } else {
52
- if (empty($token)) {
53
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
54
- } else {
55
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
56
- }
57
- }
58
- }
59
-
60
- /**
61
- * @param mixed $result
62
- * @param string $token
63
- * @param array $unknownArticles
64
- * @return mixed
65
- */
66
- private function _manageArticlePrices($result, $token, &$unknownArticles) {
67
- $lastPriceUpdate = null;
68
-
69
- $shopId = self::getShopId($token);
70
- $store = Mage::getSingleton('core/store')->load($shopId);
71
-
72
- $useNet = false;
73
- if (Mage::getStoreConfig('channelpilot_pricecontrol/channelpilot_general/channelpilot_saveGrossOrNetPrices') === "net") {
74
- $useNet = true;
75
- }
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";
140
- $hook->moreAvailable = $moreAvailable;
141
- if (empty($errorArticles) || sizeof($errorArticles) == 0) {
142
- $hook->unknownArticles = null;
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()) {
153
- $date = new DateTime($cpPrices->getLastPriceUpdate());
154
- return date_format($date, 'Y-m-d') . "T" . date_format($date, 'H:i:s');
155
- } else {
156
- $cpPrices->unsetData()
157
- ->setPriceId($priceId);
158
- try {
159
- $cpPrices->save();
160
- return null;
161
- } catch (Exception $e) {
162
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update: " . $e->getMessage());
163
- }
164
- }
165
- } catch (Exception $e) {
166
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getLastPriceUpdate(): " . $e->getMessage(), "Exception in getLastPriceUpdate(): " . $e->getMessage());
167
- }
168
- }
169
-
170
- }
171
-
172
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp delivery handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPNewPriceHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle delivery hook.
12
+ * @return type
13
+ */
14
+ public function handle() {
15
+ $token = Mage::app()->getRequest()->getParam('token', false);
16
+ $methodParam = Mage::app()->getRequest()->getParam('method', false);
17
+ $priceId = Mage::app()->getRequest()->getParam('priceId', false);
18
+ if ($token && self::isIpAllowedViaSecurityToken($token)) {
19
+ if ($priceId) {
20
+ $merchantId = self::getMerchantId($token);
21
+
22
+ $filterFrom = self::getLastPriceUpdate($priceId);
23
+ $method = "all";
24
+ if (isset($filterFrom)) {
25
+ $method = "update";
26
+ }
27
+ $filterArticles = null;
28
+
29
+ $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
30
+ $result = $api->getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom);
31
+ $unknownArticles = array();
32
+ $lastPriceUpdate = null;
33
+
34
+ if (isset($result->managedArticlePrices)) {
35
+ $lastPriceUpdate = $this->_manageArticlePrices($result, $token, $unknownArticles);
36
+ }
37
+
38
+ if (isset($lastPriceUpdate)) {
39
+ $cpPrices = Mage::getModel('channelpilot/prices')->load($priceId);
40
+ $cpPrices->setData('last_price_update', $lastPriceUpdate);
41
+ try {
42
+ $cpPrices->save();
43
+ } catch (Exception $e) {
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
+ }
51
+ } else {
52
+ if (empty($token)) {
53
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
54
+ } else {
55
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
56
+ }
57
+ }
58
+ }
59
+
60
+ /**
61
+ * @param mixed $result
62
+ * @param string $token
63
+ * @param array $unknownArticles
64
+ * @return mixed
65
+ */
66
+ private function _manageArticlePrices($result, $token, &$unknownArticles) {
67
+ $lastPriceUpdate = null;
68
+
69
+ $shopId = self::getShopId($token);
70
+ $store = Mage::getSingleton('core/store')->load($shopId);
71
+
72
+ $useNet = false;
73
+ if (Mage::getStoreConfig('channelpilot_pricecontrol/channelpilot_general/channelpilot_saveGrossOrNetPrices') === "net") {
74
+ $useNet = true;
75
+ }
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";
140
+ $hook->moreAvailable = $moreAvailable;
141
+ if (empty($errorArticles) || sizeof($errorArticles) == 0) {
142
+ $hook->unknownArticles = null;
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()) {
153
+ $date = new DateTime($cpPrices->getLastPriceUpdate());
154
+ return date_format($date, 'Y-m-d') . "T" . date_format($date, 'H:i:s');
155
+ } else {
156
+ $cpPrices->unsetData()
157
+ ->setPriceId($priceId);
158
+ try {
159
+ $cpPrices->save();
160
+ return null;
161
+ } catch (Exception $e) {
162
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update: " . $e->getMessage());
163
+ }
164
+ }
165
+ } catch (Exception $e) {
166
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getLastPriceUpdate(): " . $e->getMessage(), "Exception in getLastPriceUpdate(): " . $e->getMessage());
167
+ }
168
+ }
169
+
170
+ }
171
+
172
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewsHandler.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
-
3
- /**
4
- * an cp status handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPNewsHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle status event
12
- */
13
- public function handle() {
14
- $priority = Mage::app()->getRequest()->getParam('priority', false);
15
- $date = Mage::app()->getRequest()->getParam('date', false);
16
- $title = Mage::app()->getRequest()->getParam('title', false);
17
- $description = Mage::app()->getRequest()->getParam('description', false);
18
- $url = Mage::app()->getRequest()->getParam('url', false);
19
- if ($priority && $date && $title && $description && $url) {
20
- $message = Mage::getModel('adminnotification/inbox')->parse(array(
21
- array(
22
- 'severity' => (int) $priority,
23
- 'date_added' => $date,
24
- 'title' => $title,
25
- 'description' => $description,
26
- 'url' => $url,
27
- 'internal' => true
28
- )
29
- ));
30
- $hook = new CPHookResponse();
31
- $hook->resultCode = CPResultCodes::SUCCESS;
32
- $hook->resultMessage = "News received";
33
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
34
- } else {
35
- $hook = new CPHookResponse();
36
- $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
37
- $hook->resultMessage = "Not enough parameter set";
38
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
39
- }
40
- }
41
-
42
- }
43
-
44
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp status handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPNewsHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle status event
12
+ */
13
+ public function handle() {
14
+ $priority = Mage::app()->getRequest()->getParam('priority', false);
15
+ $date = Mage::app()->getRequest()->getParam('date', false);
16
+ $title = Mage::app()->getRequest()->getParam('title', false);
17
+ $description = Mage::app()->getRequest()->getParam('description', false);
18
+ $url = Mage::app()->getRequest()->getParam('url', false);
19
+ if ($priority && $date && $title && $description && $url) {
20
+ $message = Mage::getModel('adminnotification/inbox')->parse(array(
21
+ array(
22
+ 'severity' => (int) $priority,
23
+ 'date_added' => $date,
24
+ 'title' => $title,
25
+ 'description' => $description,
26
+ 'url' => $url,
27
+ 'internal' => true
28
+ )
29
+ ));
30
+ $hook = new CPHookResponse();
31
+ $hook->resultCode = CPResultCodes::SUCCESS;
32
+ $hook->resultMessage = "News received";
33
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
34
+ } else {
35
+ $hook = new CPHookResponse();
36
+ $hook->resultCode = CPResultCodes::SYSTEM_ERROR;
37
+ $hook->resultMessage = "Not enough parameter set";
38
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
39
+ }
40
+ }
41
+
42
+ }
43
+
44
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPOrderHandler.php CHANGED
@@ -1,605 +1,604 @@
1
- <?php
2
-
3
- /**
4
- * an cp order handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
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
17
- */
18
- public function handle() {
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);
26
- $this->store = Mage::getModel('core/store')->load($this->shopId);
27
- $this->websiteId = $this->store->getWebsiteId();
28
- $oldOrders = self::getOrdersFromDb();
29
- ini_set('allow_url_fopen', 'On');
30
- $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
31
- $result = $api->getNewMarketplaceOrders();
32
- // Check ResultCode of getNewMarketplaceOrders Result
33
- if ($result->header->resultCode == CPResultCodes::SUCCESS) {
34
- $moreAvailable = (bool) $result->moreAvailable;
35
- $orders = self::importOrders($result->orders);
36
- foreach ($oldOrders as $oldOrder) {
37
- if (isset($oldOrder) && !in_array($oldOrder->orderHeader->orderId, $this->ordersImported)) {
38
- $orders[] = $oldOrder;
39
- }
40
- }
41
-
42
- if (sizeof($orders) == 0) {
43
- self::hookResult(false);
44
- }
45
- $result = $api->setImportedOrders($orders, true);
46
- // Check ResultCode of setImportedOrders Result
47
- if ($result->header->resultCode == CPResultCodes::SUCCESS) {
48
- self::changeStatusOrders($result->updateResults);
49
- self::hookResult($moreAvailable);
50
- } else {
51
- // Result from getNewMarketplaceOrders has no success
52
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request setImportedOrders() resultCode " . $result->header->resultCode, "request setImportedOrders() resultCode " . $result->header->resultCode);
53
- }
54
- } else {
55
- // Result from getNewMarketplaceOrders has no success
56
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode);
57
- }
58
- } catch (Exception $e) {
59
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage(), "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage() . "\n" . $e->getTraceAsString());
60
- }
61
- } else {
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";
74
- $hook->moreAvailable = $moreAvailable;
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);
82
- $orders[] = self::importOrder($apiOrder);
83
- }
84
- return $orders;
85
- }
86
-
87
- private function _getQuote($apiOrder) {
88
- try {
89
- $quote = Mage::getModel('sales/quote')->setStoreId($this->shopId);
90
- $customer = self::getCustomer($apiOrder);
91
- $quote->assignCustomer($customer);
92
-
93
- foreach ($apiOrder->itemsOrdered as $orderItem) {
94
- $product = $this->getProduct($orderItem->article->id);
95
- if ($product == null) {
96
- CPErrorHandler::logError("NO ARTICLE FOR IDENTIFIER: " . $orderItem->article->id);
97
- $apiOrder->orderHeader->status->hasError = true;
98
- $apiOrder->orderHeader->status->errorMessage = "Unknown article: " . $orderItem->article->id;
99
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SHOP_ERROR_ARTICLE_UNKNOWN;
100
- return false;
101
- }
102
- $quote->addProduct($product, (int) $orderItem->quantityOrdered);
103
- }
104
-
105
- $quote->getBillingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultBilling()));
106
-
107
- $shippingAddress = $quote->getShippingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultShipping()));
108
- if (substr(Mage::getVersion(), 2, 3) >= 9) {
109
- $quote->getBillingAddress()->setCompany($apiOrder->addressInvoice->company);
110
- $shippingAddress->setCompany($apiOrder->addressDelivery->company);
111
- }
112
-
113
- $shippingAddress
114
- ->setCollectShippingRates(true)
115
- ->collectShippingRates()
116
- ->setShippingMethod($apiOrder->shipping->typeId)
117
- ->setPaymentMethod($apiOrder->payment->typeId);
118
- $quote->setShippingAddress($shippingAddress);
119
-
120
-
121
- if (strpos($apiOrder->payment->typeId, 'cp_mp') === false) {
122
- $quote->getPayment()->importData(array('method' => $apiOrder->payment->typeId));
123
- } else {
124
- $quote->getPayment()->importData(array('method' => 'cp_mp',
125
- 'cc_type' => $apiOrder->payment->typeId
126
- )
127
- );
128
- }
129
-
130
- $quote->collectTotals()->save();
131
-
132
- return $quote;
133
- } catch(Exception $e) {
134
- CPErrorHandler::logError("Exception during _getQuote: " . $e->getMessage() . "\n" . $e->getTraceAsString());
135
- $apiOrder->orderHeader->status->hasError = true;
136
- $apiOrder->orderHeader->status->errorMessage = "Exception during _getQuote: " . $e->getMessage();
137
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
138
- return false;
139
- }
140
- }
141
-
142
- /**
143
- * Checks if an item has been ordered multiple times and this items uses more than one
144
- * row. In this case the additional rows will be removed and the quantity and totals will
145
- * be added to the first row. The order totals will be changed accordingly.
146
- * @param object $apiOrder
147
- * @return object
148
- */
149
- private function _cleanOrderOfMultipleRowsOfSameItem($apiOrder) {
150
- $orderItems = array();
151
-
152
- foreach ($apiOrder->itemsOrdered as $orderItem) {
153
- // check if an item uses more than one row
154
- if(array_key_exists($orderItem->article->id, $orderItems)) {
155
- // add the additonal row to the first one
156
- $orderItems[$orderItem->article->id]->quantityOrdered += $orderItem->quantityOrdered;
157
- $orderItems[$orderItem->article->id]->costsTotal->net = $orderItems[$orderItem->article->id]->costsSingle->net * $orderItems[$orderItem->article->id]->quantityOrdered;
158
- $orderItems[$orderItem->article->id]->costsTotal->gross = $orderItems[$orderItem->article->id]->costsSingle->gross * $orderItems[$orderItem->article->id]->quantityOrdered;
159
- $orderItems[$orderItem->article->id]->costsTotal->tax = $orderItems[$orderItem->article->id]->costsSingle->tax * $orderItems[$orderItem->article->id]->quantityOrdered;
160
-
161
- // calculate the totals for the current orderItem
162
- $costsNet = $orderItem->quantityOrdered * $orderItem->costsSingle->net;
163
- $costsGross = $orderItem->quantityOrdered * $orderItem->costsSingle->gross;
164
- $costsTax = $orderItem->quantityOrdered * $orderItem->costsSingle->tax;
165
-
166
- // add the calculated totals to the item summary
167
- $apiOrder->summary->totalSumItems->net = $apiOrder->summary->totalSumItems->net + $costsNet;
168
- $apiOrder->summary->totalSumItems->gross = $apiOrder->summary->totalSumItems->gross + $costsGross;
169
- $apiOrder->summary->totalSumItems->tax = $apiOrder->summary->totalSumItems->tax + $costsTax;
170
-
171
- // add the calculated totals to the order summary
172
- $apiOrder->summary->totalSumOrder->net = $apiOrder->summary->totalSumOrder->net + $costsNet;
173
- $apiOrder->summary->totalSumOrder->gross = $apiOrder->summary->totalSumOrder->gross + $costsGross;
174
- $apiOrder->summary->totalSumOrder->tax = $apiOrder->summary->totalSumOrder->tax + $costsTax;
175
- } else {
176
- $orderItems[$orderItem->article->id] = $orderItem;
177
- }
178
- }
179
-
180
- // save the cleaned order items
181
- $apiOrder->itemsOrdered = (object)$orderItems;
182
-
183
- return $apiOrder;
184
- }
185
-
186
- private function importOrder($apiOrder) {
187
- $orderId = self::getOrderId($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
188
- if (!empty($orderId)) {
189
- $order = Mage::getModel('sales/order')->load($orderId);
190
- $apiOrder->orderHeader->orderId = $order->getIncrementId();
191
- $apiOrder = self::getOrderItems($apiOrder);
192
- $this->ordersImported[] = $order->getIncrementId();
193
- return $apiOrder;
194
- }
195
- try {
196
- $quote = $this->_getQuote($apiOrder);
197
- if($quote === false) {
198
- return $apiOrder;
199
- }
200
-
201
- // disable any discount to be applied and recollect totals
202
- // has to be done after the quote has been created
203
- $quote->setTotalsCollectedFlag(false);
204
- foreach($quote->getAllItems() as $item) {
205
- $item->setNoDiscount(1);
206
- }
207
-
208
- $quote->collectTotals()->save();
209
-
210
- $service = Mage::getModel('sales/service_quote', $quote);
211
- $service->submitAll();
212
- $order = $service->getOrder();
213
- $apiOrder->orderHeader->orderId = $order->getIncrementId();
214
-
215
- try {
216
- Mage::getModel('channelpilot/order')
217
- ->unsetData()
218
- ->setData(array(
219
- 'order_id' => $order->getId(),
220
- 'order_nr' => $order->getIncrementId(),
221
- 'marketplace_order_id' => $apiOrder->orderHeader->orderIdExternal,
222
- 'marketplace' => $apiOrder->orderHeader->source,
223
- 'shop' => $this->shopId,
224
- 'status' => $apiOrder->orderHeader->status->identifier
225
- ))
226
- ->save();
227
- } catch (Exception $e) {
228
- Mage::register('isSecureArea', true);
229
- Mage::app('admin');
230
- $order->delete();
231
- CPErrorHandler::logError("Exception during insert order \n" . $e->getMessage() . "\n" . $e->getTraceAsString());
232
- $apiOrder->orderHeader->status->hasError = true;
233
- $apiOrder->orderHeader->status->errorMessage = "Exception during insert order: " . $e->getMessage();
234
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
235
- return $apiOrder;
236
- }
237
-
238
- $items = $order->getAllItems();
239
- $orderItemsResponse = array();
240
- try {
241
- foreach ($items as $item) {
242
- foreach ($apiOrder->itemsOrdered as $orderItem) {
243
- if ($orderItem->article->id == $item->getSku() || $orderItem->article->id == $item->getProductId()) {
244
- $item->setPrice($orderItem->costsSingle->net);
245
- $item->setCustomPrice($orderItem->costsSingle->net);
246
- $item->setBasePrice($orderItem->costsSingle->net);
247
- $item->setOriginalCustomPrice($orderItem->costsSingle->net);
248
- $item->setOriginalPrice($orderItem->costsSingle->net);
249
- $item->setTaxAmount($orderItem->costsTotal->tax);
250
- $item->setTaxPercent($orderItem->costsTotal->taxRate);
251
- $item->setRowTotal($orderItem->costsTotal->net);
252
- $item->setRowTotalInclTax($orderItem->costsTotal->gross);
253
- $item->setPriceInclTax($orderItem->costsSingle->gross);
254
- $item->setBaseOriginalPrice($orderItem->costsSingle->net);
255
- $item->setBaseRowTotal($orderItem->costsTotal->net);
256
- $item->setBasePriceInclTax($orderItem->costsSingle->gross);
257
- $item->setBaseRowTotalInclTax($orderItem->costsTotal->gross);
258
- $item->save();
259
- $orderItem->id = $item->getId();
260
- $orderItemsResponse[] = $orderItem;
261
- try {
262
- Mage::getModel('channelpilot/order_item')
263
- ->unsetData()
264
- ->setData(array(
265
- 'order_item_id' => $item->getId(),
266
- 'marketplace_order_item_id' => $orderItem->idExternal,
267
- 'order_id' => $order->getId(),
268
- 'amount' => $orderItem->quantityOrdered,
269
- ))
270
- ->save();
271
- } catch (Exception $e) {
272
- self::deleteCPOrder($order->getId());
273
- Mage::register('isSecureArea', true);
274
- Mage::app('admin');
275
- $order->delete();
276
- CPErrorHandler::logError("Exception during insert order item: " . $e->getMessage() . "\n" . $e->getTraceAsString());
277
- $apiOrder->orderHeader->status->hasError = true;
278
- $apiOrder->orderHeader->status->errorMessage = "Exception during insert into: " . $e->getMessage();
279
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
280
- return $apiOrder;
281
- }
282
- }
283
- }
284
- }
285
- } catch (Exception $e) {
286
- $collection = Mage::getModel('channelpilot/order_item')->getCollection()
287
- ->addFieldToFilter('order_id', array('eq' => $order->getId()));
288
- $collection->walk('delete');
289
- $marketplaceOrder = Mage::getModel('channelpilot/order')->load($order->getId());
290
- $$marketplaceOrder->delete();
291
- Mage::register('isSecureArea', true);
292
- Mage::app('admin');
293
- $order->delete();
294
- CPErrorHandler::logError("Exception during insert order" . $e->getMessage() . "\n" . $e->getTraceAsString());
295
- $apiOrder->orderHeader->status->hasError = true;
296
- $apiOrder->orderHeader->status->errorMessage = "Exception during insert order item: " . $e->getMessage();
297
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
298
- return $apiOrder;
299
- }
300
- $apiOrder->itemsOrdered = $orderItemsResponse;
301
- $order->setBaseSubtotal($apiOrder->summary->totalSumItems->net);
302
- $order->setBaseTaxAmount($apiOrder->summary->totalSumItems->tax);
303
- // $order->setBaseDiscountAmount(...);
304
- $order->setBaseShippingAmount($apiOrder->shipping->costs->gross);
305
- $order->setBaseGrandTotal($apiOrder->summary->totalSumOrder->gross);
306
-
307
- $order->setSubtotal($apiOrder->summary->totalSumItems->net);
308
- $order->setTaxAmount($apiOrder->summary->totalSumItems->tax);
309
- // $order->setDiscountAmount(...);
310
- $order->setShippingAmount($apiOrder->shipping->costs->gross);
311
- $order->setGrandTotal($apiOrder->summary->totalSumOrder->gross);
312
-
313
- $order->setCreatedAt($apiOrder->orderHeader->orderTime);
314
-
315
- $order->setBaseCurrencyCode($apiOrder->summary->currencyIso3);
316
- $order->setQuoteCurrencyCode($apiOrder->summary->currencyIso3);
317
-
318
- if(!empty($apiOrder->payment->paymentTime)) {
319
- $order->setData('state', Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedPayed'));
320
- $order->setStatus(Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedPayed'));
321
- } else {
322
- $order->setData('state', Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedUnpayed'));
323
- $order->setStatus(Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedUnpayed'));
324
- }
325
-
326
- $order->save();
327
- } catch (Exception $e) {
328
- CPErrorHandler::logError("Exception during importOrder: " . $e->getMessage() . "\n" . $e->getTraceAsString());
329
- $apiOrder->orderHeader->status->hasError = true;
330
- $apiOrder->orderHeader->status->errorMessage = "Exception during importOrder: " . $e->getMessage();
331
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
332
- }
333
- //$this->ordersImported[] = $order->getIncrementId();
334
- return $apiOrder;
335
- }
336
-
337
- /**
338
- *
339
- * @param type $id
340
- */
341
- private function getProduct($id) {
342
- $selectedArticleId = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
343
- $product = null;
344
- switch ($selectedArticleId) {
345
- case "product_id":
346
- $product = Mage::getModel('catalog/product')->load($id);
347
- if (!is_object($product)) {
348
- $product = null;
349
- }
350
- break;
351
- case "sku":
352
- $productId = Mage::getModel('catalog/product')->getIdBySku($id);
353
- if($productId) {
354
- $product = Mage::getModel('catalog/product')->load($productId);
355
- if (!is_object($product)) {
356
- $product = null;
357
- }
358
- }
359
- break;
360
- default:
361
- break;
362
- }
363
- return $product;
364
- }
365
-
366
- private function getCustomer($apiOrder) {
367
- $customer = Mage::getModel('customer/customer')
368
- ->setWebsiteId($this->websiteId)
369
- ->loadByEmail(CustomerFunctions::getUserName($apiOrder->customer->email));
370
- if ($customer->getId() == null) {
371
- $customer = Mage::getModel("customer/customer");
372
- $customer->website_id = $this->websiteId;
373
- $incrementId = Mage::getSingleton('eav/config')
374
- ->getEntityType('customer')
375
- ->fetchNewIncrementId($customer->getStoreId());
376
- $customer->setIncrementId($incrementId);
377
- $customer->setStore($this->store);
378
- $customer->firstname = $apiOrder->customer->nameFirst;
379
- $customer->lastname = $apiOrder->customer->nameLast;
380
- $customer->email = $apiOrder->customer->email;
381
- foreach ($apiOrder->customer->customerGroups as $userGroup) {
382
- $customer->setData('group_id', $userGroup->id);
383
- }
384
- if ($apiOrder->addressInvoice->genderId == 1) {
385
- $customer->setGender(
386
- Mage::getResourceModel('customer/customer')
387
- ->getAttribute('gender')
388
- ->getSource()
389
- ->getOptionId('Male')
390
- );
391
- } else {
392
- if ($apiOrder->addressInvoice->genderId == 2) {
393
- $customer->setGender(
394
- Mage::getResourceModel('customer/customer')
395
- ->getAttribute('gender')
396
- ->getSource()
397
- ->getOptionId('Female')
398
- );
399
- }
400
- }
401
- $customer->setCreatedAt($apiOrder->orderHeader->orderTime);
402
- $customer = CustomerFunctions::insertOrUpdateUser($customer, $apiOrder);
403
- $customer->save();
404
-
405
- $shippingAddress = Mage::getModel('customer/address');
406
- $shippingAddress->setCustomerId($customer->getId());
407
- $shippingAddress->setFirstname($apiOrder->addressDelivery->nameFirst);
408
- $shippingAddress->setLastname($apiOrder->addressDelivery->nameLast);
409
- $shippingAddress->setCountryId($apiOrder->addressDelivery->countryIso2);
410
- $shippingAddress->setStreet($apiOrder->addressDelivery->streetTitle . ' ' . $apiOrder->addressDelivery->streetNumber);
411
- $shippingAddress->setPostcode($apiOrder->addressDelivery->zip);
412
- $shippingAddress->setCity($apiOrder->addressDelivery->city);
413
- $shippingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressDelivery->state, $apiOrder->addressDelivery->countryIso2);
414
- $shippingAddress->setRegion($shippingRegion->getName());
415
- $shippingAddress->setRegionId($shippingRegion->getId());
416
- if (substr(Mage::getVersion(), 2, 3) < 9) {
417
- $shippingAddress->setCompany($apiOrder->addressDelivery->company);
418
- }
419
- if (isset($apiOrder->addressDelivery->phone)) {
420
- $shippingAddress->setTelephone($apiOrder->addressDelivery->phone);
421
- }
422
- $shippingAddress = CustomerFunctions::createAddress($shippingAddress, $apiOrder);
423
- $shippingAddress->setIsDefaultShipping(true);
424
- $shippingAddress->save();
425
- $customer->setDefaultShipping($shippingAddress->getId());
426
- $customer->addAddress($shippingAddress);
427
-
428
- $billingAddress = Mage::getModel('customer/address');
429
- $billingAddress->setCustomerId($customer->getId());
430
- $billingAddress->setFirstname($apiOrder->addressInvoice->nameFirst);
431
- $billingAddress->setLastname($apiOrder->addressInvoice->nameLast);
432
- $billingAddress->setCountryId($apiOrder->addressInvoice->countryIso2);
433
- $billingAddress->setStreet($apiOrder->addressInvoice->streetTitle . ' ' . $apiOrder->addressInvoice->streetNumber);
434
- $billingAddress->setPostcode($apiOrder->addressInvoice->zip);
435
- $billingAddress->setCity($apiOrder->addressInvoice->city);
436
- $billingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressInvoice->state, $apiOrder->addressInvoice->countryIso2);
437
- $billingAddress->setRegion($billingRegion->getName());
438
- $billingAddress->setRegionId($billingRegion->getId());
439
- if (substr(Mage::getVersion(), 2, 3) < 9) {
440
- $billingAddress->setCompany($apiOrder->addressInvoice->company);
441
- }
442
- if (isset($apiOrder->addressInvoice->phone)) {
443
- $billingAddress->setTelephone($apiOrder->addressInvoice->phone);
444
- }
445
- $billingAddress = CustomerFunctions::createAddress($billingAddress, $apiOrder);
446
- $billingAddress->setIsDefaultBilling(true);
447
- $billingAddress->save();
448
-
449
- $customer->setDefaultBilling($billingAddress->getId());
450
- $customer->addAddress($billingAddress);
451
- } else {
452
- $customer->firstname = $apiOrder->customer->nameFirst;
453
- $customer->lastname = $apiOrder->customer->nameLast;
454
- foreach ($apiOrder->customer->customerGroups as $userGroup) {
455
- $customer->setData('group_id', $userGroup->id);
456
- }
457
- if ($apiOrder->addressInvoice->genderId == 1) {
458
- $customer->setGender(
459
- Mage::getResourceModel('customer/customer')
460
- ->getAttribute('gender')
461
- ->getSource()
462
- ->getOptionId('Male')
463
- );
464
- } else {
465
- if ($apiOrder->addressInvoice->genderId == 2) {
466
- $customer->setGender(
467
- Mage::getResourceModel('customer/customer')
468
- ->getAttribute('gender')
469
- ->getSource()
470
- ->getOptionId('Female')
471
- );
472
- }
473
- }
474
- $customer->save();
475
-
476
- $shippingAddress = Mage::getModel('customer/address')->load($customer->getDefaultShipping());
477
- $shippingAddress->setCustomerId($customer->getId());
478
- $shippingAddress->setFirstname($apiOrder->addressDelivery->nameFirst);
479
- $shippingAddress->setLastname($apiOrder->addressDelivery->nameLast);
480
- $shippingAddress->setCountryId($apiOrder->addressDelivery->countryIso2);
481
- $shippingAddress->setStreet($apiOrder->addressDelivery->streetTitle . ' ' . $apiOrder->addressDelivery->streetNumber);
482
- $shippingAddress->setPostcode($apiOrder->addressDelivery->zip);
483
- $shippingAddress->setCity($apiOrder->addressDelivery->city);
484
- $shippingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressDelivery->state, $apiOrder->addressDelivery->countryIso2);
485
- $shippingAddress->setRegion($shippingRegion->getName());
486
- $shippingAddress->setRegionId($shippingRegion->getId());
487
- if (substr(Mage::getVersion(), 2, 3) < 9) {
488
- $shippingAddress->setCompany($apiOrder->addressDelivery->company);
489
- }
490
- if (isset($apiOrder->addressDelivery->phone)) {
491
- $shippingAddress->setTelephone($apiOrder->addressDelivery->phone);
492
- }
493
- $shippingAddress = CustomerFunctions::createAddress($shippingAddress, $apiOrder);
494
- $shippingAddress->setIsDefaultShipping(true);
495
- $shippingAddress->save();
496
-
497
- $billingAddress = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
498
- $billingAddress->setCustomerId($customer->getId());
499
- $billingAddress->setFirstname($apiOrder->addressInvoice->nameFirst);
500
- $billingAddress->setLastname($apiOrder->addressInvoice->nameLast);
501
- $billingAddress->setCountryId($apiOrder->addressInvoice->countryIso2);
502
- $billingAddress->setStreet($apiOrder->addressInvoice->streetTitle . ' ' . $apiOrder->addressInvoice->streetNumber);
503
- $billingAddress->setPostcode($apiOrder->addressInvoice->zip);
504
- $billingAddress->setCity($apiOrder->addressInvoice->city);
505
- $billingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressInvoice->state, $apiOrder->addressInvoice->countryIso2);
506
- $billingAddress->setRegion($billingRegion->getName());
507
- $billingAddress->setRegionId($billingRegion->getId());
508
- if (substr(Mage::getVersion(), 2, 3) < 9) {
509
- $billingAddress->setCompany($apiOrder->addressInvoice->company);
510
- }
511
- if (isset($apiOrder->addressInvoice->phone)) {
512
- $billingAddress->setTelephone($apiOrder->addressInvoice->phone);
513
- }
514
- $billingAddress = CustomerFunctions::createAddress($billingAddress, $apiOrder);
515
- $billingAddress->setIsDefaultBilling(true);
516
- $billingAddress->save();
517
- }
518
- return $customer;
519
- }
520
-
521
- /**
522
- *
523
- * @param type $apiOrder
524
- * @return boolean
525
- */
526
- private function getOrderItems($apiOrder) {
527
- $dbOrderItems = array();
528
-
529
- $itemCollection = Mage::getModel('channelpilot/order_item')->getCollection()
530
- ->addFieldToSelect(array('order_item_id', 'marketplace_order_item_id'))
531
- ->addMarketplaceOrderFilter($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
532
-
533
- foreach ($itemCollection->getData() AS $resultType) {
534
- $dbOrderItems[$resultType['marketplace_order_item_id']] = $resultType['order_item_id'];
535
- }
536
- $orderItemsResponse = array();
537
-
538
- foreach ($apiOrder->itemsOrdered as $orderItem) {
539
- if (empty($dbOrderItems[$orderItem->idExternal])) {
540
- $apiOrder->orderHeader->status->hasError = true;
541
- $apiOrder->orderHeader->status->errorMessage = "Can't find order article " . $orderItem->article->id . " from EXISTING order: " . $apiOrder->orderHeader->orderId;
542
- $apiOrder->orderHeader->status->errorCode = CPResultCodes::SHOP_ERROR_ARTICLE_UNKNOWN_EXISTING_ORDER;
543
- return $apiOrder;
544
- } else {
545
- $orderItem->id = $dbOrderItems[$orderItem->idExternal];
546
- $orderItemsResponse[] = $orderItem;
547
- }
548
- }
549
- $apiOrder->itemsOrdered = $orderItemsResponse;
550
- return $apiOrder;
551
- }
552
-
553
- private function getOrderId($externalOrderId, $source) {
554
- $order = Mage::getModel('channelpilot/order')->loadByMarketplaceOrderIdAndMarketplace($externalOrderId, $source);
555
- return ($order && $order->getId()) ? $order->getId() : null;
556
- }
557
-
558
- private function deleteCPOrder($orderId) {
559
- $collection = Mage::getModel('channelpilot/order_item')->getCollection()
560
- ->addFieldToFilter('order_id', array('eq' => $orderId));
561
- $collection->walk('delete');
562
-
563
- $collection = Mage::getModel('channelpilot/order')->getCollection()
564
- ->addFieldToFilter('order_id', array('eq' => $orderId));
565
- $collection->walk('delete');
566
- }
567
-
568
- private function getOrdersFromDb() {
569
- $orders = array();
570
-
571
- $collection = Mage::getModel('channelpilot/order_item')->getCollection()
572
- ->addFieldToSelect(array(
573
- 'orderItemId' => 'order_item_id',
574
- 'externalOrderItemId' => 'marketplace_order_item_id'
575
- ))
576
- ->addReadyForExportFilter($this->shopId);
577
-
578
- try {
579
- $sResult = $collection->getData();
580
- if (!empty($sResult)) {
581
- $order = null;
582
- $orderId = null;
583
- foreach ($sResult AS $resultType) {
584
- if (empty($orderId) || $orderId != $resultType['orderId']) {
585
- if (!empty($orderId)) {
586
- $orders[] = $order;
587
- self::logError("save order");
588
- }
589
- $order = new CPOrder();
590
- $order->orderHeader = new CPOrderHeader($resultType['externalOrderId'], $resultType['orderId'], $resultType['source'], $resultType['status'], null, false);
591
- $orderId = $resultType['orderId'];
592
- }
593
- $item = new CPOrderItem();
594
- $item->id = $resultType['orderItemId'];
595
- $item->idExternal = $resultType['externalOrderItemId'];
596
- $order->itemsOrdered[] = $item;
597
- }
598
- $orders[] = $order;
599
- }
600
- return $orders;
601
- } catch (Exception $e) {
602
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getOrdersFromDb(): " . $e->getMessage(), "Exception in getOrdersFromDb():" . $e->getMessage());
603
- }
604
- }
605
- }
1
+ <?php
2
+
3
+ /**
4
+ * an cp order handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
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
17
+ */
18
+ public function handle() {
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);
26
+ $this->store = Mage::getModel('core/store')->load($this->shopId);
27
+ $this->websiteId = $this->store->getWebsiteId();
28
+ $oldOrders = self::getOrdersFromDb();
29
+ ini_set('allow_url_fopen', 'On');
30
+ $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
31
+ $result = $api->getNewMarketplaceOrders();
32
+ // Check ResultCode of getNewMarketplaceOrders Result
33
+ if ($result->header->resultCode == CPResultCodes::SUCCESS) {
34
+ $moreAvailable = (bool) $result->moreAvailable;
35
+ $orders = self::importOrders($result->orders);
36
+ foreach ($oldOrders as $oldOrder) {
37
+ if (isset($oldOrder) && !in_array($oldOrder->orderHeader->orderId, $this->ordersImported)) {
38
+ $orders[] = $oldOrder;
39
+ }
40
+ }
41
+
42
+ if (sizeof($orders) == 0) {
43
+ self::hookResult(false);
44
+ }
45
+ $result = $api->setImportedOrders($orders, true);
46
+ // Check ResultCode of setImportedOrders Result
47
+ if ($result->header->resultCode == CPResultCodes::SUCCESS) {
48
+ self::changeStatusOrders($result->updateResults);
49
+ self::hookResult($moreAvailable);
50
+ } else {
51
+ // Result from getNewMarketplaceOrders has no success
52
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request setImportedOrders() resultCode " . $result->header->resultCode, "request setImportedOrders() resultCode " . $result->header->resultCode);
53
+ }
54
+ } else {
55
+ // Result from getNewMarketplaceOrders has no success
56
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode);
57
+ }
58
+ } catch (Exception $e) {
59
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage(), "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage() . "\n" . $e->getTraceAsString());
60
+ }
61
+ } else {
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";
74
+ $hook->moreAvailable = $moreAvailable;
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);
82
+ $orders[] = self::importOrder($apiOrder);
83
+ }
84
+ return $orders;
85
+ }
86
+
87
+ private function _getQuote($apiOrder) {
88
+ try {
89
+ $quote = Mage::getModel('sales/quote')->setStoreId($this->shopId);
90
+ $customer = self::getCustomer($apiOrder);
91
+ $quote->assignCustomer($customer);
92
+
93
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
94
+ $product = $this->getProduct($orderItem->article->id);
95
+ if ($product == null) {
96
+ CPErrorHandler::logError("NO ARTICLE FOR IDENTIFIER: " . $orderItem->article->id);
97
+ $apiOrder->orderHeader->status->hasError = true;
98
+ $apiOrder->orderHeader->status->errorMessage = "Unknown article: " . $orderItem->article->id;
99
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SHOP_ERROR_ARTICLE_UNKNOWN;
100
+ return false;
101
+ }
102
+ $quote->addProduct($product, (int) $orderItem->quantityOrdered);
103
+ }
104
+
105
+ $quote->getBillingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultBilling()));
106
+
107
+ $shippingAddress = $quote->getShippingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultShipping()));
108
+ if (substr(Mage::getVersion(), 2, 3) >= 9) {
109
+ $quote->getBillingAddress()->setCompany($apiOrder->addressInvoice->company);
110
+ $shippingAddress->setCompany($apiOrder->addressDelivery->company);
111
+ }
112
+
113
+ $shippingAddress
114
+ ->setCollectShippingRates(true)
115
+ ->collectShippingRates()
116
+ ->setShippingMethod($apiOrder->shipping->typeId)
117
+ ->setPaymentMethod($apiOrder->payment->typeId);
118
+ $quote->setShippingAddress($shippingAddress);
119
+
120
+
121
+ if (strpos($apiOrder->payment->typeId, 'cp_mp') === false) {
122
+ $quote->getPayment()->importData(array('method' => $apiOrder->payment->typeId));
123
+ } else {
124
+ $quote->getPayment()->importData(array('method' => 'cp_mp',
125
+ 'cc_type' => $apiOrder->payment->typeId
126
+ )
127
+ );
128
+ }
129
+
130
+ $quote->collectTotals()->save();
131
+
132
+ return $quote;
133
+ } catch(Exception $e) {
134
+ CPErrorHandler::logError("Exception during _getQuote: " . $e->getMessage() . "\n" . $e->getTraceAsString());
135
+ $apiOrder->orderHeader->status->hasError = true;
136
+ $apiOrder->orderHeader->status->errorMessage = "Exception during _getQuote: " . $e->getMessage();
137
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
138
+ return false;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Checks if an item has been ordered multiple times and this items uses more than one
144
+ * row. In this case the additional rows will be removed and the quantity and totals will
145
+ * be added to the first row. The order totals will be changed accordingly.
146
+ * @param object $apiOrder
147
+ * @return object
148
+ */
149
+ private function _cleanOrderOfMultipleRowsOfSameItem($apiOrder) {
150
+ $orderItems = array();
151
+
152
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
153
+ // check if an item uses more than one row
154
+ if(array_key_exists($orderItem->article->id, $orderItems)) {
155
+ // add the additonal row to the first one
156
+ $orderItems[$orderItem->article->id]->quantityOrdered += $orderItem->quantityOrdered;
157
+ $orderItems[$orderItem->article->id]->costsTotal->net = $orderItems[$orderItem->article->id]->costsSingle->net * $orderItems[$orderItem->article->id]->quantityOrdered;
158
+ $orderItems[$orderItem->article->id]->costsTotal->gross = $orderItems[$orderItem->article->id]->costsSingle->gross * $orderItems[$orderItem->article->id]->quantityOrdered;
159
+ $orderItems[$orderItem->article->id]->costsTotal->tax = $orderItems[$orderItem->article->id]->costsSingle->tax * $orderItems[$orderItem->article->id]->quantityOrdered;
160
+
161
+ // calculate the totals for the current orderItem
162
+ $costsNet = $orderItem->quantityOrdered * $orderItem->costsSingle->net;
163
+ $costsGross = $orderItem->quantityOrdered * $orderItem->costsSingle->gross;
164
+ $costsTax = $orderItem->quantityOrdered * $orderItem->costsSingle->tax;
165
+
166
+ // add the calculated totals to the item summary
167
+ $apiOrder->summary->totalSumItems->net = $apiOrder->summary->totalSumItems->net + $costsNet;
168
+ $apiOrder->summary->totalSumItems->gross = $apiOrder->summary->totalSumItems->gross + $costsGross;
169
+ $apiOrder->summary->totalSumItems->tax = $apiOrder->summary->totalSumItems->tax + $costsTax;
170
+
171
+ // add the calculated totals to the order summary
172
+ $apiOrder->summary->totalSumOrder->net = $apiOrder->summary->totalSumOrder->net + $costsNet;
173
+ $apiOrder->summary->totalSumOrder->gross = $apiOrder->summary->totalSumOrder->gross + $costsGross;
174
+ $apiOrder->summary->totalSumOrder->tax = $apiOrder->summary->totalSumOrder->tax + $costsTax;
175
+ } else {
176
+ $orderItems[$orderItem->article->id] = $orderItem;
177
+ }
178
+ }
179
+
180
+ // save the cleaned order items
181
+ $apiOrder->itemsOrdered = $orderItems;
182
+
183
+ return $apiOrder;
184
+ }
185
+
186
+ private function importOrder($apiOrder) {
187
+ $orderId = self::getOrderId($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
188
+ if (!empty($orderId)) {
189
+ $order = Mage::getModel('sales/order')->load($orderId);
190
+ $apiOrder->orderHeader->orderId = $order->getIncrementId();
191
+ $apiOrder = self::getOrderItems($apiOrder);
192
+ $this->ordersImported[] = $order->getIncrementId();
193
+ return $apiOrder;
194
+ }
195
+ try {
196
+ $quote = $this->_getQuote($apiOrder);
197
+ if($quote === false) {
198
+ return $apiOrder;
199
+ }
200
+
201
+ // disable any discount to be applied and recollect totals
202
+ // has to be done after the quote has been created
203
+ $quote->setTotalsCollectedFlag(false);
204
+ foreach($quote->getAllItems() as $item) {
205
+ $item->setNoDiscount(1);
206
+ }
207
+
208
+ $quote->collectTotals()->save();
209
+
210
+ $service = Mage::getModel('sales/service_quote', $quote);
211
+ $service->submitAll();
212
+ $order = $service->getOrder();
213
+ $apiOrder->orderHeader->orderId = $order->getIncrementId();
214
+
215
+ try {
216
+ Mage::getModel('channelpilot/order')
217
+ ->unsetData()
218
+ ->setData(array(
219
+ 'order_id' => $order->getId(),
220
+ 'order_nr' => $order->getIncrementId(),
221
+ 'marketplace_order_id' => $apiOrder->orderHeader->orderIdExternal,
222
+ 'marketplace' => $apiOrder->orderHeader->source,
223
+ 'shop' => $this->shopId,
224
+ 'status' => $apiOrder->orderHeader->status->identifier
225
+ ))
226
+ ->save();
227
+ } catch (Exception $e) {
228
+ Mage::register('isSecureArea', true);
229
+ Mage::app('admin');
230
+ $order->delete();
231
+ CPErrorHandler::logError("Exception during insert order \n" . $e->getMessage() . "\n" . $e->getTraceAsString());
232
+ $apiOrder->orderHeader->status->hasError = true;
233
+ $apiOrder->orderHeader->status->errorMessage = "Exception during insert order: " . $e->getMessage();
234
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
235
+ return $apiOrder;
236
+ }
237
+
238
+ $items = $order->getAllItems();
239
+ $orderItemsResponse = array();
240
+ try {
241
+ foreach ($items as $item) {
242
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
243
+ if ($orderItem->article->id == $item->getSku() || $orderItem->article->id == $item->getProductId()) {
244
+ $item->setPrice($orderItem->costsSingle->net);
245
+ $item->setCustomPrice($orderItem->costsSingle->net);
246
+ $item->setBasePrice($orderItem->costsSingle->net);
247
+ $item->setOriginalCustomPrice($orderItem->costsSingle->net);
248
+ $item->setOriginalPrice($orderItem->costsSingle->net);
249
+ $item->setTaxAmount($orderItem->costsTotal->tax);
250
+ $item->setTaxPercent($orderItem->costsTotal->taxRate);
251
+ $item->setRowTotal($orderItem->costsTotal->net);
252
+ $item->setRowTotalInclTax($orderItem->costsTotal->gross);
253
+ $item->setPriceInclTax($orderItem->costsSingle->gross);
254
+ $item->setBaseOriginalPrice($orderItem->costsSingle->net);
255
+ $item->setBaseRowTotal($orderItem->costsTotal->net);
256
+ $item->setBasePriceInclTax($orderItem->costsSingle->gross);
257
+ $item->setBaseRowTotalInclTax($orderItem->costsTotal->gross);
258
+ $item->save();
259
+ $orderItem->id = $item->getId();
260
+ $orderItemsResponse[] = $orderItem;
261
+ try {
262
+ Mage::getModel('channelpilot/order_item')
263
+ ->unsetData()
264
+ ->setData(array(
265
+ 'order_item_id' => $item->getId(),
266
+ 'marketplace_order_item_id' => $orderItem->idExternal,
267
+ 'order_id' => $order->getId(),
268
+ 'amount' => $orderItem->quantityOrdered,
269
+ ))
270
+ ->save();
271
+ } catch (Exception $e) {
272
+ self::deleteCPOrder($order->getId());
273
+ Mage::register('isSecureArea', true);
274
+ Mage::app('admin');
275
+ $order->delete();
276
+ CPErrorHandler::logError("Exception during insert order item: " . $e->getMessage() . "\n" . $e->getTraceAsString());
277
+ $apiOrder->orderHeader->status->hasError = true;
278
+ $apiOrder->orderHeader->status->errorMessage = "Exception during insert into: " . $e->getMessage();
279
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
280
+ return $apiOrder;
281
+ }
282
+ }
283
+ }
284
+ }
285
+ } catch (Exception $e) {
286
+ $collection = Mage::getModel('channelpilot/order_item')->getCollection()
287
+ ->addFieldToFilter('order_id', array('eq' => $order->getId()));
288
+ $collection->walk('delete');
289
+ $marketplaceOrder = Mage::getModel('channelpilot/order')->load($order->getId());
290
+ $$marketplaceOrder->delete();
291
+ Mage::register('isSecureArea', true);
292
+ Mage::app('admin');
293
+ $order->delete();
294
+ CPErrorHandler::logError("Exception during insert order" . $e->getMessage() . "\n" . $e->getTraceAsString());
295
+ $apiOrder->orderHeader->status->hasError = true;
296
+ $apiOrder->orderHeader->status->errorMessage = "Exception during insert order item: " . $e->getMessage();
297
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
298
+ return $apiOrder;
299
+ }
300
+ $apiOrder->itemsOrdered = $orderItemsResponse;
301
+ $order->setBaseSubtotal($apiOrder->summary->totalSumItems->net);
302
+ $order->setBaseTaxAmount($apiOrder->summary->totalSumItems->tax);
303
+ // $order->setBaseDiscountAmount(...);
304
+ $order->setBaseShippingAmount($apiOrder->shipping->costs->gross);
305
+ $order->setBaseGrandTotal($apiOrder->summary->totalSumOrder->gross);
306
+
307
+ $order->setSubtotal($apiOrder->summary->totalSumItems->net);
308
+ $order->setTaxAmount($apiOrder->summary->totalSumItems->tax);
309
+ // $order->setDiscountAmount(...);
310
+ $order->setShippingAmount($apiOrder->shipping->costs->gross);
311
+ $order->setGrandTotal($apiOrder->summary->totalSumOrder->gross);
312
+
313
+ $order->setCreatedAt($apiOrder->orderHeader->orderTime);
314
+
315
+ $order->setBaseCurrencyCode($apiOrder->summary->currencyIso3);
316
+ $order->setQuoteCurrencyCode($apiOrder->summary->currencyIso3);
317
+
318
+ if(!empty($apiOrder->payment->paymentTime)) {
319
+ $order->setData('state', Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedPayed'));
320
+ $order->setStatus(Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedPayed'));
321
+ } else {
322
+ $order->setData('state', Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedUnpayed'));
323
+ $order->setStatus(Mage::getStoreConfig('channelpilot_marketplace/channelpilot_marketplace/channelpilot_orderStatusImportedUnpayed'));
324
+ }
325
+
326
+ $order->save();
327
+ } catch (Exception $e) {
328
+ CPErrorHandler::logError("Exception during importOrder: " . $e->getMessage() . "\n" . $e->getTraceAsString());
329
+ $apiOrder->orderHeader->status->hasError = true;
330
+ $apiOrder->orderHeader->status->errorMessage = "Exception during importOrder: " . $e->getMessage();
331
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
332
+ }
333
+ //$this->ordersImported[] = $order->getIncrementId();
334
+ return $apiOrder;
335
+ }
336
+
337
+ /**
338
+ *
339
+ * @param type $id
340
+ */
341
+ private function getProduct($id) {
342
+ $selectedArticleId = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
343
+ $product = null;
344
+ switch ($selectedArticleId) {
345
+ case "product_id":
346
+ $product = Mage::getModel('catalog/product')->load($id);
347
+ if (!is_object($product)) {
348
+ $product = null;
349
+ }
350
+ break;
351
+ case "sku":
352
+ $productId = Mage::getModel('catalog/product')->getIdBySku($id);
353
+ if($productId) {
354
+ $product = Mage::getModel('catalog/product')->load($productId);
355
+ if (!is_object($product)) {
356
+ $product = null;
357
+ }
358
+ }
359
+ break;
360
+ default:
361
+ break;
362
+ }
363
+ return $product;
364
+ }
365
+
366
+ private function getCustomer($apiOrder) {
367
+ $customer = Mage::getModel('customer/customer')
368
+ ->setWebsiteId($this->websiteId)
369
+ ->loadByEmail(CustomerFunctions::getUserName($apiOrder->customer->email));
370
+ if ($customer->getId() == null) {
371
+ $customer = Mage::getModel("customer/customer");
372
+ $customer->website_id = $this->websiteId;
373
+ $incrementId = Mage::getSingleton('eav/config')
374
+ ->getEntityType('customer')
375
+ ->fetchNewIncrementId($customer->getStoreId());
376
+ $customer->setIncrementId($incrementId);
377
+ $customer->setStore($this->store);
378
+ $customer->firstname = $apiOrder->customer->nameFirst;
379
+ $customer->lastname = $apiOrder->customer->nameLast;
380
+ $customer->email = $apiOrder->customer->email;
381
+ foreach ($apiOrder->customer->customerGroups as $userGroup) {
382
+ $customer->setData('group_id', $userGroup->id);
383
+ }
384
+ if ($apiOrder->addressInvoice->genderId == 1) {
385
+ $customer->setGender(
386
+ Mage::getResourceModel('customer/customer')
387
+ ->getAttribute('gender')
388
+ ->getSource()
389
+ ->getOptionId('Male')
390
+ );
391
+ } else {
392
+ if ($apiOrder->addressInvoice->genderId == 2) {
393
+ $customer->setGender(
394
+ Mage::getResourceModel('customer/customer')
395
+ ->getAttribute('gender')
396
+ ->getSource()
397
+ ->getOptionId('Female')
398
+ );
399
+ }
400
+ }
401
+ $customer->setCreatedAt($apiOrder->orderHeader->orderTime);
402
+ $customer = CustomerFunctions::insertOrUpdateUser($customer, $apiOrder);
403
+ $customer->save();
404
+
405
+ $shippingAddress = Mage::getModel('customer/address');
406
+ $shippingAddress->setCustomerId($customer->getId());
407
+ $shippingAddress->setFirstname($apiOrder->addressDelivery->nameFirst);
408
+ $shippingAddress->setLastname($apiOrder->addressDelivery->nameLast);
409
+ $shippingAddress->setCountryId($apiOrder->addressDelivery->countryIso2);
410
+ $shippingAddress->setStreet($apiOrder->addressDelivery->streetTitle . ' ' . $apiOrder->addressDelivery->streetNumber);
411
+ $shippingAddress->setPostcode($apiOrder->addressDelivery->zip);
412
+ $shippingAddress->setCity($apiOrder->addressDelivery->city);
413
+ $shippingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressDelivery->state, $apiOrder->addressDelivery->countryIso2);
414
+ $shippingAddress->setRegion($shippingRegion->getName());
415
+ $shippingAddress->setRegionId($shippingRegion->getId());
416
+ if (substr(Mage::getVersion(), 2, 3) < 9) {
417
+ $shippingAddress->setCompany($apiOrder->addressDelivery->company);
418
+ }
419
+ if (isset($apiOrder->addressDelivery->phone)) {
420
+ $shippingAddress->setTelephone($apiOrder->addressDelivery->phone);
421
+ }
422
+ $shippingAddress = CustomerFunctions::createAddress($shippingAddress, $apiOrder);
423
+ $shippingAddress->setIsDefaultShipping(true);
424
+ $shippingAddress->save();
425
+ $customer->setDefaultShipping($shippingAddress->getId());
426
+ $customer->addAddress($shippingAddress);
427
+
428
+ $billingAddress = Mage::getModel('customer/address');
429
+ $billingAddress->setCustomerId($customer->getId());
430
+ $billingAddress->setFirstname($apiOrder->addressInvoice->nameFirst);
431
+ $billingAddress->setLastname($apiOrder->addressInvoice->nameLast);
432
+ $billingAddress->setCountryId($apiOrder->addressInvoice->countryIso2);
433
+ $billingAddress->setStreet($apiOrder->addressInvoice->streetTitle . ' ' . $apiOrder->addressInvoice->streetNumber);
434
+ $billingAddress->setPostcode($apiOrder->addressInvoice->zip);
435
+ $billingAddress->setCity($apiOrder->addressInvoice->city);
436
+ $billingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressInvoice->state, $apiOrder->addressInvoice->countryIso2);
437
+ $billingAddress->setRegion($billingRegion->getName());
438
+ $billingAddress->setRegionId($billingRegion->getId());
439
+ if (substr(Mage::getVersion(), 2, 3) < 9) {
440
+ $billingAddress->setCompany($apiOrder->addressInvoice->company);
441
+ }
442
+ if (isset($apiOrder->addressInvoice->phone)) {
443
+ $billingAddress->setTelephone($apiOrder->addressInvoice->phone);
444
+ }
445
+ $billingAddress = CustomerFunctions::createAddress($billingAddress, $apiOrder);
446
+ $billingAddress->setIsDefaultBilling(true);
447
+ $billingAddress->save();
448
+
449
+ $customer->setDefaultBilling($billingAddress->getId());
450
+ $customer->addAddress($billingAddress);
451
+ } else {
452
+ $customer->firstname = $apiOrder->customer->nameFirst;
453
+ $customer->lastname = $apiOrder->customer->nameLast;
454
+ foreach ($apiOrder->customer->customerGroups as $userGroup) {
455
+ $customer->setData('group_id', $userGroup->id);
456
+ }
457
+ if ($apiOrder->addressInvoice->genderId == 1) {
458
+ $customer->setGender(
459
+ Mage::getResourceModel('customer/customer')
460
+ ->getAttribute('gender')
461
+ ->getSource()
462
+ ->getOptionId('Male')
463
+ );
464
+ } else {
465
+ if ($apiOrder->addressInvoice->genderId == 2) {
466
+ $customer->setGender(
467
+ Mage::getResourceModel('customer/customer')
468
+ ->getAttribute('gender')
469
+ ->getSource()
470
+ ->getOptionId('Female')
471
+ );
472
+ }
473
+ }
474
+ $customer->save();
475
+
476
+ $shippingAddress = Mage::getModel('customer/address')->load($customer->getDefaultShipping());
477
+ $shippingAddress->setCustomerId($customer->getId());
478
+ $shippingAddress->setFirstname($apiOrder->addressDelivery->nameFirst);
479
+ $shippingAddress->setLastname($apiOrder->addressDelivery->nameLast);
480
+ $shippingAddress->setCountryId($apiOrder->addressDelivery->countryIso2);
481
+ $shippingAddress->setStreet($apiOrder->addressDelivery->streetTitle . ' ' . $apiOrder->addressDelivery->streetNumber);
482
+ $shippingAddress->setPostcode($apiOrder->addressDelivery->zip);
483
+ $shippingAddress->setCity($apiOrder->addressDelivery->city);
484
+ $shippingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressDelivery->state, $apiOrder->addressDelivery->countryIso2);
485
+ $shippingAddress->setRegion($shippingRegion->getName());
486
+ $shippingAddress->setRegionId($shippingRegion->getId());
487
+ if (substr(Mage::getVersion(), 2, 3) < 9) {
488
+ $shippingAddress->setCompany($apiOrder->addressDelivery->company);
489
+ }
490
+ if (isset($apiOrder->addressDelivery->phone)) {
491
+ $shippingAddress->setTelephone($apiOrder->addressDelivery->phone);
492
+ }
493
+ $shippingAddress = CustomerFunctions::createAddress($shippingAddress, $apiOrder);
494
+ $shippingAddress->setIsDefaultShipping(true);
495
+ $shippingAddress->save();
496
+
497
+ $billingAddress = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
498
+ $billingAddress->setCustomerId($customer->getId());
499
+ $billingAddress->setFirstname($apiOrder->addressInvoice->nameFirst);
500
+ $billingAddress->setLastname($apiOrder->addressInvoice->nameLast);
501
+ $billingAddress->setCountryId($apiOrder->addressInvoice->countryIso2);
502
+ $billingAddress->setStreet($apiOrder->addressInvoice->streetTitle . ' ' . $apiOrder->addressInvoice->streetNumber);
503
+ $billingAddress->setPostcode($apiOrder->addressInvoice->zip);
504
+ $billingAddress->setCity($apiOrder->addressInvoice->city);
505
+ $billingRegion = Mage::getModel('directory/region')->loadByName($apiOrder->addressInvoice->state, $apiOrder->addressInvoice->countryIso2);
506
+ $billingAddress->setRegion($billingRegion->getName());
507
+ $billingAddress->setRegionId($billingRegion->getId());
508
+ if (substr(Mage::getVersion(), 2, 3) < 9) {
509
+ $billingAddress->setCompany($apiOrder->addressInvoice->company);
510
+ }
511
+ if (isset($apiOrder->addressInvoice->phone)) {
512
+ $billingAddress->setTelephone($apiOrder->addressInvoice->phone);
513
+ }
514
+ $billingAddress = CustomerFunctions::createAddress($billingAddress, $apiOrder);
515
+ $billingAddress->setIsDefaultBilling(true);
516
+ $billingAddress->save();
517
+ }
518
+ return $customer;
519
+ }
520
+
521
+ /**
522
+ *
523
+ * @param type $apiOrder
524
+ * @return boolean
525
+ */
526
+ private function getOrderItems($apiOrder) {
527
+ $dbOrderItems = array();
528
+
529
+ $itemCollection = Mage::getModel('channelpilot/order_item')->getCollection()
530
+ ->addFieldToSelect(array('order_item_id', 'marketplace_order_item_id'))
531
+ ->addMarketplaceOrderFilter($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
532
+
533
+ foreach ($itemCollection->getData() AS $resultType) {
534
+ $dbOrderItems[$resultType['marketplace_order_item_id']] = $resultType['order_item_id'];
535
+ }
536
+ $orderItemsResponse = array();
537
+
538
+ foreach ($apiOrder->itemsOrdered as $orderItem) {
539
+ if (empty($dbOrderItems[$orderItem->idExternal])) {
540
+ $apiOrder->orderHeader->status->hasError = true;
541
+ $apiOrder->orderHeader->status->errorMessage = "Can't find order article " . $orderItem->article->id . " from EXISTING order: " . $apiOrder->orderHeader->orderId;
542
+ $apiOrder->orderHeader->status->errorCode = CPResultCodes::SHOP_ERROR_ARTICLE_UNKNOWN_EXISTING_ORDER;
543
+ return $apiOrder;
544
+ } else {
545
+ $orderItem->id = $dbOrderItems[$orderItem->idExternal];
546
+ $orderItemsResponse[] = $orderItem;
547
+ }
548
+ }
549
+ $apiOrder->itemsOrdered = $orderItemsResponse;
550
+ return $apiOrder;
551
+ }
552
+
553
+ private function getOrderId($externalOrderId, $source) {
554
+ $order = Mage::getModel('channelpilot/order')->loadByMarketplaceOrderIdAndMarketplace($externalOrderId, $source);
555
+ return ($order && $order->getId()) ? $order->getId() : null;
556
+ }
557
+
558
+ private function deleteCPOrder($orderId) {
559
+ $collection = Mage::getModel('channelpilot/order_item')->getCollection()
560
+ ->addFieldToFilter('order_id', array('eq' => $orderId));
561
+ $collection->walk('delete');
562
+
563
+ $collection = Mage::getModel('channelpilot/order')->getCollection()
564
+ ->addFieldToFilter('order_id', array('eq' => $orderId));
565
+ $collection->walk('delete');
566
+ }
567
+
568
+ private function getOrdersFromDb() {
569
+ $orders = array();
570
+
571
+ $collection = Mage::getModel('channelpilot/order_item')->getCollection()
572
+ ->addFieldToSelect(array(
573
+ 'orderItemId' => 'order_item_id',
574
+ 'externalOrderItemId' => 'marketplace_order_item_id'
575
+ ))
576
+ ->addReadyForExportFilter($this->shopId);
577
+
578
+ try {
579
+ $sResult = $collection->getData();
580
+ if (!empty($sResult)) {
581
+ $order = null;
582
+ $orderId = null;
583
+ foreach ($sResult AS $resultType) {
584
+ if (empty($orderId) || $orderId != $resultType['orderId']) {
585
+ if (!empty($orderId)) {
586
+ $orders[] = $order;
587
+ }
588
+ $order = new CPOrder();
589
+ $order->orderHeader = new CPOrderHeader($resultType['externalOrderId'], $resultType['orderId'], $resultType['source'], $resultType['status'], null, false);
590
+ $orderId = $resultType['orderId'];
591
+ }
592
+ $item = new CPOrderItem();
593
+ $item->id = $resultType['orderItemId'];
594
+ $item->idExternal = $resultType['externalOrderItemId'];
595
+ $order->itemsOrdered[] = $item;
596
+ }
597
+ $orders[] = $order;
598
+ }
599
+ return $orders;
600
+ } catch (Exception $e) {
601
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getOrdersFromDb(): " . $e->getMessage(), "Exception in getOrdersFromDb():" . $e->getMessage());
602
+ }
603
+ }
604
+ }
 
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php CHANGED
@@ -1,85 +1,85 @@
1
- <?php
2
-
3
-
4
- /**
5
- * an cp payment handler
6
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
7
- * @version 1.0
8
- */
9
- class CPPaymentHandler extends CPAbstractHandler {
10
- /**
11
- * Bestellung wurde bezahlt.
12
- * Handle Payment Hook
13
- * @return string
14
- */
15
- public function handle() {
16
- $token = Mage::app()->getRequest()->getParam('token', false);
17
- $method = Mage::app()->getRequest()->getParam('method', false);
18
- if ($token && self::isIpAllowedViaSecurityToken($token)) {
19
- $limit = Mage::app()->getRequest()->getParam('limit', false);
20
- if ($limit) {
21
- $sResult = Mage::getModel('channelpilot/order')->getCollection()
22
- ->addFieldToSelect(array('marketplace_order_id', 'marketplace', 'status'))
23
- ->addIsPaidFilter()
24
- ->addFieldToFilter('main_table.status', array('eq' => CPOrderStatus::ID_IMPORTED))
25
- ->addFieldToFilter('main_table.order_paid', array('eq' => Channelpilotsolutions_Channelpilot_Model_Order::CP_ORDER_UNPAID))
26
- ->setPageSize((int)$limit)
27
- ->getData();
28
-
29
- try {
30
- $orders = array();
31
- foreach ($sResult AS $order) {
32
- $paymentTimeFormatted = date("Y-m-d\TH:i:s");
33
- $cpOrder = new CPOrder();
34
- $cpOrder->orderHeader = new CPOrderHeader($order['marketplace_order_id'], $order['order_id'], $order['marketplace'], $order['status'], false, null);
35
- $cpOrder->payment = new CPPayment($paymentTimeFormatted);
36
- // unset($cpOrder->payment->$paymentTimeFormatted); // TODO mit Peter besprechen (???)
37
- $cpOrder->payment->paymentTime = $paymentTimeFormatted;
38
- $orders[] = $cpOrder;
39
- }
40
- $paidOrders = $orders;
41
-
42
- if (sizeof($paidOrders) == 0) {
43
- self::hookResult(false);
44
- }
45
- $merchantId = self::getMerchantId($token);
46
- $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
47
- $result = $api->setPaidOrders($paidOrders);
48
- if ($result->header->resultCode == CPResultCodes::SUCCESS) {
49
- $affectedRows = Mage::getModel('channelpilot/order')->massSetOrderPaid($paidOrders);
50
- } else {
51
- // Result from setPaidOrders has no success
52
- self::logError("request setPaidOrders() resultCode " . $result->header->resultCode);
53
- $hook = new CPHookResponse();
54
- $hook->resultCode = CPResultCodes::SUCCESS;
55
- $hook->resultMessage = "request setPaidOrders() resultCode " . $result->header->resultCode;
56
- $hook->moreAvailable = false;
57
- $hook->apiResultCode = $result->header->resultCode;
58
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
59
- }
60
- self::hookResult(true);
61
- } catch (Exception $e) {
62
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle PaymentsHook: " . $e->getMessage(), "Exception in handle PaymentsHook: " . $e->getMessage());
63
- }
64
- } else {
65
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
66
- }
67
- } else {
68
- if (empty($token)) {
69
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
70
- } else {
71
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
72
- }
73
- }
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";
81
- $hook->moreAvailable = $moreAvailable;
82
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
83
- }
84
- }
85
- ?>
1
+ <?php
2
+
3
+
4
+ /**
5
+ * an cp payment handler
6
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
7
+ * @version 1.0
8
+ */
9
+ class CPPaymentHandler extends CPAbstractHandler {
10
+ /**
11
+ * Bestellung wurde bezahlt.
12
+ * Handle Payment Hook
13
+ * @return string
14
+ */
15
+ public function handle() {
16
+ $token = Mage::app()->getRequest()->getParam('token', false);
17
+ $method = Mage::app()->getRequest()->getParam('method', false);
18
+ if ($token && self::isIpAllowedViaSecurityToken($token)) {
19
+ $limit = Mage::app()->getRequest()->getParam('limit', false);
20
+ if ($limit) {
21
+ $sResult = Mage::getModel('channelpilot/order')->getCollection()
22
+ ->addFieldToSelect(array('marketplace_order_id', 'marketplace', 'status'))
23
+ ->addIsPaidFilter()
24
+ ->addFieldToFilter('main_table.status', array('eq' => CPOrderStatus::ID_IMPORTED))
25
+ ->addFieldToFilter('main_table.order_paid', array('eq' => Channelpilotsolutions_Channelpilot_Model_Order::CP_ORDER_UNPAID))
26
+ ->setPageSize((int)$limit)
27
+ ->getData();
28
+
29
+ try {
30
+ $orders = array();
31
+ foreach ($sResult AS $order) {
32
+ $paymentTimeFormatted = date("Y-m-d\TH:i:s");
33
+ $cpOrder = new CPOrder();
34
+ $cpOrder->orderHeader = new CPOrderHeader($order['marketplace_order_id'], $order['order_id'], $order['marketplace'], $order['status'], false, null);
35
+ $cpOrder->payment = new CPPayment($paymentTimeFormatted);
36
+ // unset($cpOrder->payment->$paymentTimeFormatted); // TODO mit Peter besprechen (???)
37
+ $cpOrder->payment->paymentTime = $paymentTimeFormatted;
38
+ $orders[] = $cpOrder;
39
+ }
40
+ $paidOrders = $orders;
41
+
42
+ if (sizeof($paidOrders) == 0) {
43
+ self::hookResult(false);
44
+ }
45
+ $merchantId = self::getMerchantId($token);
46
+ $api = new ChannelPilotSellerAPI_v1_0($merchantId, $token);
47
+ $result = $api->setPaidOrders($paidOrders);
48
+ if ($result->header->resultCode == CPResultCodes::SUCCESS) {
49
+ $affectedRows = Mage::getModel('channelpilot/order')->massSetOrderPaid($paidOrders);
50
+ } else {
51
+ // Result from setPaidOrders has no success
52
+ self::logError("request setPaidOrders() resultCode " . $result->header->resultCode);
53
+ $hook = new CPHookResponse();
54
+ $hook->resultCode = CPResultCodes::SUCCESS;
55
+ $hook->resultMessage = "request setPaidOrders() resultCode " . $result->header->resultCode;
56
+ $hook->moreAvailable = false;
57
+ $hook->apiResultCode = $result->header->resultCode;
58
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
59
+ }
60
+ self::hookResult(true);
61
+ } catch (Exception $e) {
62
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle PaymentsHook: " . $e->getMessage(), "Exception in handle PaymentsHook: " . $e->getMessage());
63
+ }
64
+ } else {
65
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $method, "no limit set for method: " . $method);
66
+ }
67
+ } else {
68
+ if (empty($token)) {
69
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
70
+ } else {
71
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
72
+ }
73
+ }
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";
81
+ $hook->moreAvailable = $moreAvailable;
82
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
83
+ }
84
+ }
85
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php CHANGED
@@ -1,123 +1,123 @@
1
- <?php
2
-
3
- /**
4
- * an cp register handler
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPRegisterHandler extends CPAbstractHandler {
9
-
10
- /**
11
- * Handle register event
12
- */
13
- public function handle() {
14
- self::checkConfig();
15
- $new = false;
16
-
17
- $multishopId = Mage::app()->getRequest()->getParam('multishopid', false);
18
- $merchantId = Mage::app()->getRequest()->getParam('merchantid', false);
19
- $token = Mage::app()->getRequest()->getParam('token', false);
20
- $ips = Mage::app()->getRequest()->getParam('ips', false);
21
- $method = Mage::app()->getRequest()->getParam('method', false);
22
-
23
- if ($multishopId && $merchantId && $token && $ips) {
24
- if (self::existShop($multishopId)) {
25
-
26
- $registration = Mage::getModel('channelpilot/registration');
27
- $data = array(
28
- 'last_stock_update' => null,
29
- 'last_price_update' => null,
30
- 'last_catalog_update' => null,
31
- 'ips_authorized' => $ips,
32
- 'merchantId' => $merchantId,
33
- 'securityToken' => $token,
34
- );
35
-
36
- if (self::isShopRegistered($multishopId)) {
37
- if (self::isIpAllowedViaShopId($multishopId)) {
38
- if (self::reRegisterParameterSet(true) == true) {
39
- try {
40
- $registration->load($multishopId);
41
- $registration->addData($data)
42
- ->save();
43
- $new = false;
44
- } catch (Exception $e) {
45
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during reregister Shop: " . $e->getMessage(), "Exception during reregister Shop: " . $e->getMessage());
46
- }
47
- } else {
48
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $multishopId . "' not registered", "Shop '" . $multishopId . "' not registered");
49
- }
50
- } else {
51
- if (empty($token)) {
52
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
53
- } else {
54
- CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
55
- }
56
- }
57
- } else {
58
- if (self::reRegisterParameterSet(false) == false) {
59
- $data['shopId'] = $multishopId;
60
- try {
61
- $registration->setData($data)
62
- ->save();
63
- $new = true;
64
- } catch (Exception $e) {
65
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: " . $e->getMessage());
66
- }
67
- } else {
68
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $multishopId . "' already not registered", "Shop '" . $multishopId . "' already not registered");
69
- }
70
- }
71
- }
72
- } else {
73
- CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "not enough parameter for method: " . $method, "not enough parameter for method: " . $method);
74
- }
75
-
76
- $hook = new CPRegisterHookResponse();
77
- $hook->ipsAllowed = $_SERVER['SERVER_ADDR'];
78
- $hook->resultCode = CPResultCodes::SUCCESS;
79
- if ($new == true) {
80
- $hook->resultMessage = "Shop registered";
81
- } else {
82
- $hook->resultMessage = "Shop reregistered";
83
- }
84
- $hook->writeResponse(self::defaultHeader, json_encode($hook));
85
- }
86
-
87
- /**
88
- *
89
- * @param type $registered
90
- * @return boolean or error response
91
- */
92
- public function reRegisterParameterSet($registered) {
93
- $reregistration = Mage::app()->getRequest()->getParam('reregistration', false);
94
- if ($reregistration && $reregistration == 'true') {
95
- return true;
96
- } else {
97
- if ($registered == true) {
98
- CPErrorHandler::handle(CPErrors::RESULT_ALREADY_REGISTERED, "shop already registered", "shop '" . Mage::app()->getRequest()->getParam('multishopid', '') . "' already registered");
99
- }
100
- return false;
101
- }
102
- }
103
-
104
- /**
105
- *
106
- * @param type $shopId
107
- * @return boolean
108
- */
109
- public function existShop($shopId) {
110
- $storeCollection = Mage::getModel('core/store')->getCollection()
111
- ->addFieldToFilter('store_id', array('eq' => $shopId));
112
-
113
- if(count($storeCollection) > 0) {
114
- return true;
115
- }
116
-
117
- CPErrorHandler::handle(CPErrors::RESULT_SHOP_UNKNOWN, "shop '" . $shopId . "' unknown", "shop '" . $shopId . "' unknown");
118
- return false;
119
- }
120
-
121
- }
122
-
123
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp register handler
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPRegisterHandler extends CPAbstractHandler {
9
+
10
+ /**
11
+ * Handle register event
12
+ */
13
+ public function handle() {
14
+ self::checkConfig();
15
+ $new = false;
16
+
17
+ $multishopId = Mage::app()->getRequest()->getParam('multishopid', false);
18
+ $merchantId = Mage::app()->getRequest()->getParam('merchantid', false);
19
+ $token = Mage::app()->getRequest()->getParam('token', false);
20
+ $ips = Mage::app()->getRequest()->getParam('ips', false);
21
+ $method = Mage::app()->getRequest()->getParam('method', false);
22
+
23
+ if ($multishopId && $merchantId && $token && $ips) {
24
+ if (self::existShop($multishopId)) {
25
+
26
+ $registration = Mage::getModel('channelpilot/registration');
27
+ $data = array(
28
+ 'last_stock_update' => null,
29
+ 'last_price_update' => null,
30
+ 'last_catalog_update' => null,
31
+ 'ips_authorized' => $ips,
32
+ 'merchantId' => $merchantId,
33
+ 'securityToken' => $token,
34
+ );
35
+
36
+ if (self::isShopRegistered($multishopId)) {
37
+ if (self::isIpAllowedViaShopId($multishopId)) {
38
+ if (self::reRegisterParameterSet(true) == true) {
39
+ try {
40
+ $registration->load($multishopId);
41
+ $registration->addData($data)
42
+ ->save();
43
+ $new = false;
44
+ } catch (Exception $e) {
45
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during reregister Shop: " . $e->getMessage(), "Exception during reregister Shop: " . $e->getMessage());
46
+ }
47
+ } else {
48
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $multishopId . "' not registered", "Shop '" . $multishopId . "' not registered");
49
+ }
50
+ } else {
51
+ if (empty($token)) {
52
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
53
+ } else {
54
+ CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $token, "ip not allowed by token: " . $token);
55
+ }
56
+ }
57
+ } else {
58
+ if (self::reRegisterParameterSet(false) == false) {
59
+ $data['shopId'] = $multishopId;
60
+ try {
61
+ $registration->setData($data)
62
+ ->save();
63
+ $new = true;
64
+ } catch (Exception $e) {
65
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: " . $e->getMessage());
66
+ }
67
+ } else {
68
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $multishopId . "' already not registered", "Shop '" . $multishopId . "' already not registered");
69
+ }
70
+ }
71
+ }
72
+ } else {
73
+ CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "not enough parameter for method: " . $method, "not enough parameter for method: " . $method);
74
+ }
75
+
76
+ $hook = new CPRegisterHookResponse();
77
+ $hook->ipsAllowed = $_SERVER['SERVER_ADDR'];
78
+ $hook->resultCode = CPResultCodes::SUCCESS;
79
+ if ($new == true) {
80
+ $hook->resultMessage = "Shop registered";
81
+ } else {
82
+ $hook->resultMessage = "Shop reregistered";
83
+ }
84
+ $hook->writeResponse(self::defaultHeader, json_encode($hook));
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @param type $registered
90
+ * @return boolean or error response
91
+ */
92
+ public function reRegisterParameterSet($registered) {
93
+ $reregistration = Mage::app()->getRequest()->getParam('reregistration', false);
94
+ if ($reregistration && $reregistration == 'true') {
95
+ return true;
96
+ } else {
97
+ if ($registered == true) {
98
+ CPErrorHandler::handle(CPErrors::RESULT_ALREADY_REGISTERED, "shop already registered", "shop '" . Mage::app()->getRequest()->getParam('multishopid', '') . "' already registered");
99
+ }
100
+ return false;
101
+ }
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @param type $shopId
107
+ * @return boolean
108
+ */
109
+ public function existShop($shopId) {
110
+ $storeCollection = Mage::getModel('core/store')->getCollection()
111
+ ->addFieldToFilter('store_id', array('eq' => $shopId));
112
+
113
+ if(count($storeCollection) > 0) {
114
+ return true;
115
+ }
116
+
117
+ CPErrorHandler::handle(CPErrors::RESULT_SHOP_UNKNOWN, "shop '" . $shopId . "' unknown", "shop '" . $shopId . "' unknown");
118
+ return false;
119
+ }
120
+
121
+ }
122
+
123
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php CHANGED
@@ -1,172 +1,172 @@
1
- <?php
2
-
3
- /**
4
- * an cp shop
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPShop {
9
-
10
- public $title;
11
- public $id;
12
- public $active;
13
- public $isRegistered;
14
- public $deliveryTypes;
15
- public $paymentTypes;
16
-
17
- }
18
-
19
- /**
20
- * an cp payment type
21
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
22
- * @version 1.0
23
- */
24
- class CPPaymentType {
25
-
26
- public $title;
27
- public $id;
28
- public $active;
29
-
30
- }
31
-
32
- /**
33
- * an cp customer group type
34
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
35
- * @version 1.0
36
- */
37
- class CPCustomerGroupType {
38
-
39
- public $title;
40
- public $id;
41
- public $active;
42
-
43
- }
44
-
45
- /**
46
- * an cp delivery type
47
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
48
- * @version 1.0
49
- */
50
- class CPDeliveryType {
51
-
52
- public $title;
53
- public $id;
54
- public $active;
55
-
56
- }
57
-
58
- /**
59
- * an cp status handler
60
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
61
- * @version 1.0
62
- */
63
- class CPStatusHandler extends CPAbstractHandler {
64
-
65
- /**
66
- * Handle status event
67
- */
68
- public function handle() {
69
- $hook = new CPGetStatusHookResponse();
70
- $hook->shops = self::getShops();
71
- $hook->resultCode = CPResultCodes::SUCCESS;
72
- $hook->resultMessage = "ok";
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) {
80
- $shop = new CPShop();
81
- $shop->id = Mage::app()->getStore($_eachStoreId)->getId();
82
- $shop->title = Mage::app()->getStore($_eachStoreId)->getName();
83
- $shop->active = (bool) Mage::app()->getStore()->getIsActive();
84
- $shop->isRegistered = self::isShopRegistered($shop->id);
85
- $shop->deliveryTypes = self::getDeliveryTypes($shop->id);
86
- $shop->paymentTypes = self::getPaymentTypes($shop->id);
87
- $shop->customerGroups = self::getCustomerGroups();
88
- $shops[] = $shop;
89
- }
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();
97
- foreach ($methods as $_ccode => $_carrier) {
98
- if ($carrierMethods = $_carrier->getAllowedMethods()) {
99
- if (!$_title = Mage::getStoreConfig("carriers/$_ccode/title", $shopId)) {
100
- $_title = $_ccode;
101
- }
102
- foreach ($carrierMethods as $_mcode => $_method) {
103
- $_code = $_ccode . '_' . $_mcode;
104
- $deliveryType = new CPDeliveryType();
105
- $deliveryType->id = $_code;
106
- $deliveryType->title = $_title . ' - ' . $_method;
107
- $deliveryType->active = (bool) $carriers[$_ccode]['active'];
108
- $deliveryTypes[] = $deliveryType;
109
- }
110
- }
111
- }
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) {
119
- if ($paymentCode === Mage::getSingleton('channelpilot/payment')->getCode()) {
120
- $types = Mage::getStoreConfig('payment/' . $paymentCode . '/types', $shopId);
121
- $cpmp_types = Mage::getSingleton('channelpilot/payment')->getCcTypes();
122
- foreach (explode(',', $types) as $type) {
123
- if (isset($cpmp_types[$type])) {
124
- $paymentType = new CPPaymentType();
125
- $paymentType->id = $type;
126
- $paymentType->title = $cpmp_types[$type];
127
- $paymentType->active = true;
128
- $paymentTypes[] = $paymentType;
129
- }
130
- }
131
- } else {
132
-
133
- $paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title', $shopId);
134
- $paymentType = new CPPaymentType();
135
- $paymentType->id = $paymentCode;
136
- if (empty($paymentTitle)) {
137
- $paymentType->title = $paymentCode;
138
- } else {
139
- $paymentType->title = $paymentTitle;
140
- }
141
- $status = $paymentModel->canUseCheckout();
142
- if ($status == 1 && $paymentCode != 'free') {
143
- $paymentType->active = true;
144
- } else {
145
- $paymentType->active = false;
146
- }
147
- $paymentTypes[] = $paymentType;
148
- }
149
- }
150
- return $paymentTypes;
151
- }
152
-
153
- private function getCustomerGroups() {
154
- $customerGroups = array();
155
- $customerGroupCollection = Mage::getModel('customer/group')->getCollection();
156
- try {
157
- foreach ($customerGroupCollection AS $resultType) {
158
- $customerGroup = new CPCustomerGroupType();
159
- $customerGroup->id = $resultType->getId();
160
- $customerGroup->title = $resultType->getCustomerGroupCode();
161
- $customerGroup->active = true;
162
- $customerGroups[] = $customerGroup;
163
- }
164
- } catch (Exception $e) {
165
- CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: " . $e->getMessage());
166
- }
167
- return $customerGroups;
168
- }
169
-
170
- }
171
-
172
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp shop
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPShop {
9
+
10
+ public $title;
11
+ public $id;
12
+ public $active;
13
+ public $isRegistered;
14
+ public $deliveryTypes;
15
+ public $paymentTypes;
16
+
17
+ }
18
+
19
+ /**
20
+ * an cp payment type
21
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
22
+ * @version 1.0
23
+ */
24
+ class CPPaymentType {
25
+
26
+ public $title;
27
+ public $id;
28
+ public $active;
29
+
30
+ }
31
+
32
+ /**
33
+ * an cp customer group type
34
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
35
+ * @version 1.0
36
+ */
37
+ class CPCustomerGroupType {
38
+
39
+ public $title;
40
+ public $id;
41
+ public $active;
42
+
43
+ }
44
+
45
+ /**
46
+ * an cp delivery type
47
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
48
+ * @version 1.0
49
+ */
50
+ class CPDeliveryType {
51
+
52
+ public $title;
53
+ public $id;
54
+ public $active;
55
+
56
+ }
57
+
58
+ /**
59
+ * an cp status handler
60
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
61
+ * @version 1.0
62
+ */
63
+ class CPStatusHandler extends CPAbstractHandler {
64
+
65
+ /**
66
+ * Handle status event
67
+ */
68
+ public function handle() {
69
+ $hook = new CPGetStatusHookResponse();
70
+ $hook->shops = self::getShops();
71
+ $hook->resultCode = CPResultCodes::SUCCESS;
72
+ $hook->resultMessage = "ok";
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) {
80
+ $shop = new CPShop();
81
+ $shop->id = Mage::app()->getStore($_eachStoreId)->getId();
82
+ $shop->title = Mage::app()->getStore($_eachStoreId)->getName();
83
+ $shop->active = (bool) Mage::app()->getStore()->getIsActive();
84
+ $shop->isRegistered = self::isShopRegistered($shop->id);
85
+ $shop->deliveryTypes = self::getDeliveryTypes($shop->id);
86
+ $shop->paymentTypes = self::getPaymentTypes($shop->id);
87
+ $shop->customerGroups = self::getCustomerGroups();
88
+ $shops[] = $shop;
89
+ }
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();
97
+ foreach ($methods as $_ccode => $_carrier) {
98
+ if ($carrierMethods = $_carrier->getAllowedMethods()) {
99
+ if (!$_title = Mage::getStoreConfig("carriers/$_ccode/title", $shopId)) {
100
+ $_title = $_ccode;
101
+ }
102
+ foreach ($carrierMethods as $_mcode => $_method) {
103
+ $_code = $_ccode . '_' . $_mcode;
104
+ $deliveryType = new CPDeliveryType();
105
+ $deliveryType->id = $_code;
106
+ $deliveryType->title = $_title . ' - ' . $_method;
107
+ $deliveryType->active = (bool) $carriers[$_ccode]['active'];
108
+ $deliveryTypes[] = $deliveryType;
109
+ }
110
+ }
111
+ }
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) {
119
+ if ($paymentCode === Mage::getSingleton('channelpilot/payment')->getCode()) {
120
+ $types = Mage::getStoreConfig('payment/' . $paymentCode . '/types', $shopId);
121
+ $cpmp_types = Mage::getSingleton('channelpilot/payment')->getCcTypes();
122
+ foreach (explode(',', $types) as $type) {
123
+ if (isset($cpmp_types[$type])) {
124
+ $paymentType = new CPPaymentType();
125
+ $paymentType->id = $type;
126
+ $paymentType->title = $cpmp_types[$type];
127
+ $paymentType->active = true;
128
+ $paymentTypes[] = $paymentType;
129
+ }
130
+ }
131
+ } else {
132
+
133
+ $paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title', $shopId);
134
+ $paymentType = new CPPaymentType();
135
+ $paymentType->id = $paymentCode;
136
+ if (empty($paymentTitle)) {
137
+ $paymentType->title = $paymentCode;
138
+ } else {
139
+ $paymentType->title = $paymentTitle;
140
+ }
141
+ $status = $paymentModel->canUseCheckout();
142
+ if ($status == 1 && $paymentCode != 'free') {
143
+ $paymentType->active = true;
144
+ } else {
145
+ $paymentType->active = false;
146
+ }
147
+ $paymentTypes[] = $paymentType;
148
+ }
149
+ }
150
+ return $paymentTypes;
151
+ }
152
+
153
+ private function getCustomerGroups() {
154
+ $customerGroups = array();
155
+ $customerGroupCollection = Mage::getModel('customer/group')->getCollection();
156
+ try {
157
+ foreach ($customerGroupCollection AS $resultType) {
158
+ $customerGroup = new CPCustomerGroupType();
159
+ $customerGroup->id = $resultType->getId();
160
+ $customerGroup->title = $resultType->getCustomerGroupCode();
161
+ $customerGroup->active = true;
162
+ $customerGroups[] = $customerGroup;
163
+ }
164
+ } catch (Exception $e) {
165
+ CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: " . $e->getMessage());
166
+ }
167
+ return $customerGroups;
168
+ }
169
+
170
+ }
171
+
172
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
-
3
- /**
4
- * an cp hook response
5
- * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
- * @version 1.0
7
- */
8
- class CPHookResponse {
9
-
10
- public $resultCode;
11
- public $resultMessage;
12
- public $signaturePlugin;
13
- public $signatureShop;
14
- public $signaturePhp;
15
- public $moreAvailable;
16
- public $apiResultCode;
17
- public static $dbConnection;
18
-
19
- const shopsystem = 'Magento_';
20
-
21
- function __construct() {
22
- Mage::app('admin');
23
-
24
- $this->signaturePlugin = self::getModuleVersion();
25
- $this->signatureShop = self::getSignatureShop();
26
- $this->signaturePhp = phpversion();
27
- }
28
-
29
- public static function getSignatureShop() {
30
- $signature = 'Magento_';
31
- $mage = new Mage();
32
- if(method_exists($mage,'getEdition')){
33
- $signature .= Mage::getEdition() . '_';
34
- }
35
- if(method_exists($mage,'getVersion')){
36
- $signature .= Mage::getVersion();
37
- }
38
- return $signature;
39
- }
40
-
41
- public static function getModuleVersion(){
42
- $version = (string)Mage::getConfig()->getNode('modules/Channelpilotsolutions_Channelpilot/version');
43
- return self::shopsystem . $version;
44
- }
45
-
46
- public function writeResponse($header, $response) {
47
- header($header);
48
- print_r($response);
49
- exit();
50
- }
51
-
52
- }
53
-
54
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * an cp hook response
5
+ * @author Channel Pilot Solutions GmbH <api@channelpilot.com>
6
+ * @version 1.0
7
+ */
8
+ class CPHookResponse {
9
+
10
+ public $resultCode;
11
+ public $resultMessage;
12
+ public $signaturePlugin;
13
+ public $signatureShop;
14
+ public $signaturePhp;
15
+ public $moreAvailable;
16
+ public $apiResultCode;
17
+ public static $dbConnection;
18
+
19
+ const shopsystem = 'Magento_';
20
+
21
+ function __construct() {
22
+ Mage::app('admin');
23
+
24
+ $this->signaturePlugin = self::getModuleVersion();
25
+ $this->signatureShop = self::getSignatureShop();
26
+ $this->signaturePhp = phpversion();
27
+ }
28
+
29
+ public static function getSignatureShop() {
30
+ $signature = 'Magento_';
31
+ $mage = new Mage();
32
+ if(method_exists($mage,'getEdition')){
33
+ $signature .= Mage::getEdition() . '_';
34
+ }
35
+ if(method_exists($mage,'getVersion')){
36
+ $signature .= Mage::getVersion();
37
+ }
38
+ return $signature;
39
+ }
40
+
41
+ public static function getModuleVersion(){
42
+ $version = (string)Mage::getConfig()->getNode('modules/Channelpilotsolutions_Channelpilot/version');
43
+ return self::shopsystem . $version;
44
+ }
45
+
46
+ public function writeResponse($header, $response) {
47
+ header($header);
48
+ print_r($response);
49
+ exit();
50
+ }
51
+
52
+ }
53
+
54
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Model/Abstract.php CHANGED
@@ -1,201 +1,201 @@
1
- <?php
2
-
3
- class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Model_Method_Abstract {
4
-
5
- protected $_formBlockType = 'payment/form_cc';
6
- protected $_infoBlockType = 'payment/info_cc';
7
- protected $_canSaveCc = false;
8
-
9
- public function assignData($data) {
10
- if (!($data instanceof Varien_Object)) {
11
- $data = new Varien_Object($data);
12
- }
13
- $info = $this->getInfoInstance();
14
- $info->setCcType($data->getCcType())
15
- ->setCcOwner($data->getCcOwner())
16
- ->setCcLast4(substr($data->getCcNumber(), -4))
17
- ->setCcNumber($data->getCcNumber())
18
- ->setCcCid($data->getCcCid())
19
- ->setCcExpMonth($data->getCcExpMonth())
20
- ->setCcExpYear($data->getCcExpYear())
21
- ->setCcSsIssue($data->getCcSsIssue())
22
- ->setCcSsStartMonth($data->getCcSsStartMonth())
23
- ->setCcSsStartYear($data->getCcSsStartYear())
24
- ;
25
- return $this;
26
- }
27
-
28
- public function prepareSave() {
29
- $info = $this->getInfoInstance();
30
- if ($this->_canSaveCc) {
31
- $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
32
- }
33
- //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
34
- $info->setCcNumber(null)
35
- ->setCcCid(null);
36
- return $this;
37
- }
38
-
39
- public function validate() {
40
- $info = $this->getInfoInstance();
41
- $errorMsg = false;
42
- $availableTypes = explode(',', $this->getConfigData('cctypes'));
43
-
44
- $ccNumber = $info->getCcNumber();
45
-
46
- // remove credit card number delimiters such as "-" and space
47
- $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
48
- $info->setCcNumber($ccNumber);
49
-
50
- $ccType = '';
51
- $specifiedCCType = $info->getCcType();
52
-
53
- return $this;
54
- }
55
-
56
- public function hasVerification() {
57
- Mage::log("hasVerification\n", null, 'cp_plugincc.log');
58
- $configData = $this->getConfigData('useccv');
59
- if (is_null($configData)) {
60
- return true;
61
- }
62
- return (bool) $configData;
63
- }
64
-
65
- public function getVerificationRegEx() {
66
- Mage::log("getVerificationRegEx\n", null, 'cp_plugincc.log');
67
- $verificationExpList = array(
68
- 'VI' => '/^[0-9]{3}$/', // Visa
69
- 'MC' => '/^[0-9]{3}$/', // Master Card
70
- 'AE' => '/^[0-9]{4}$/', // American Express
71
- 'DI' => '/^[0-9]{3}$/', // Discovery
72
- 'SS' => '/^[0-9]{3,4}$/',
73
- 'SM' => '/^[0-9]{3,4}$/', // Switch or Maestro
74
- 'SO' => '/^[0-9]{3,4}$/', // Solo
75
- 'OT' => '/^[0-9]{3,4}$/',
76
- 'JCB' => '/^[0-9]{3,4}$/' //JCB
77
- );
78
- return $verificationExpList;
79
- }
80
-
81
- public function validateCcNum($ccNumber) {
82
-
83
-
84
- $cardNumber = strrev($ccNumber);
85
- $numSum = 0;
86
-
87
- for ($i = 0; $i < strlen($cardNumber); $i++) {
88
- $currentNum = substr($cardNumber, $i, 1);
89
-
90
- /**
91
- * Double every second digit
92
- */
93
- if ($i % 2 == 1) {
94
- $currentNum *= 2;
95
- }
96
-
97
- /**
98
- * Add digits of 2-digit numbers together
99
- */
100
- if ($currentNum > 9) {
101
- $firstNum = $currentNum % 10;
102
- $secondNum = ($currentNum - $firstNum) / 10;
103
- $currentNum = $firstNum + $secondNum;
104
- }
105
-
106
- $numSum += $currentNum;
107
- }
108
-
109
- /**
110
- * If the total has no remainder it's OK
111
- */
112
- Mage::log("validateCcNum: " . ($numSum % 10 == 0) . "\n", null, 'cp_plugincc.log');
113
- return ($numSum % 10 == 0);
114
- }
115
-
116
- public function validateCcNumOther($ccNumber) {
117
-
118
- return preg_match('/^\\d+$/', $ccNumber);
119
- }
120
-
121
- public function isAvailable($quote = null) {
122
- Mage::log($this->getConfigData('cctypes', ($quote ? $quote->getStoreId() : null)) && parent::isAvailable($quote) . " isAvailable\n", null, 'cp_plugincc.log');
123
- return $this->getConfigData('cctypes', ($quote ? $quote->getStoreId() : null)) && parent::isAvailable($quote);
124
- }
125
-
126
- public function getIsCentinelValidationEnabled() {
127
- return false !== Mage::getConfig()->getNode('modules/Mage_Centinel') && 1 == $this->getConfigData('centinel');
128
- }
129
-
130
- public function getCentinelValidator() {
131
- $validator = Mage::getSingleton('centinel/service');
132
- $validator
133
- ->setIsModeStrict($this->getConfigData('centinel_is_mode_strict'))
134
- ->setCustomApiEndpointUrl($this->getConfigData('centinel_api_url'))
135
- ->setStore($this->getStore())
136
- ->setIsPlaceOrder($this->_isPlaceOrder());
137
- return $validator;
138
- }
139
-
140
- public function getCentinelValidationData() {
141
- $info = $this->getInfoInstance();
142
- $params = new Varien_Object();
143
- $params
144
- ->setPaymentMethodCode($this->getCode())
145
- ->setCardType($info->getCcType())
146
- ->setCardNumber($info->getCcNumber())
147
- ->setCardExpMonth($info->getCcExpMonth())
148
- ->setCardExpYear($info->getCcExpYear())
149
- ->setAmount($this->_getAmount())
150
- ->setCurrencyCode($this->_getCurrencyCode())
151
- ->setOrderNumber($this->_getOrderId());
152
- return $params;
153
- }
154
-
155
- private function _getOrderId() {
156
- $info = $this->getInfoInstance();
157
-
158
- if ($this->_isPlaceOrder()) {
159
- return $info->getOrder()->getIncrementId();
160
- } else {
161
- if (!$info->getQuote()->getReservedOrderId()) {
162
- $info->getQuote()->reserveOrderId();
163
- }
164
- return $info->getQuote()->getReservedOrderId();
165
- }
166
- }
167
-
168
- private function _getAmount() {
169
- $info = $this->getInfoInstance();
170
- if ($this->_isPlaceOrder()) {
171
- return (double) $info->getOrder()->getQuoteBaseGrandTotal();
172
- } else {
173
- return (double) $info->getQuote()->getBaseGrandTotal();
174
- }
175
- }
176
-
177
- private function _getCurrencyCode() {
178
- $info = $this->getInfoInstance();
179
-
180
- if ($this->_isPlaceOrder()) {
181
- return $info->getOrder()->getBaseCurrencyCode();
182
- } else {
183
- return $info->getQuote()->getBaseCurrencyCode();
184
- }
185
- }
186
-
187
- private function _isPlaceOrder() {
188
- $info = $this->getInfoInstance();
189
- if ($info instanceof Mage_Sales_Model_Quote_Payment) {
190
- return false;
191
- } elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
192
- return true;
193
- }
194
- }
195
-
196
- public function getInfoInstance() {
197
- $instance = Mage::getSingleton('channelpilot/payment');
198
- return $instance;
199
- }
200
-
201
- }
1
+ <?php
2
+
3
+ class Channelpilotsolutions_Channelpilot_Model_Abstract extends Mage_Payment_Model_Method_Abstract {
4
+
5
+ protected $_formBlockType = 'payment/form_cc';
6
+ protected $_infoBlockType = 'payment/info_cc';
7
+ protected $_canSaveCc = false;
8
+
9
+ public function assignData($data) {
10
+ if (!($data instanceof Varien_Object)) {
11
+ $data = new Varien_Object($data);
12
+ }
13
+ $info = $this->getInfoInstance();
14
+ $info->setCcType($data->getCcType())
15
+ ->setCcOwner($data->getCcOwner())
16
+ ->setCcLast4(substr($data->getCcNumber(), -4))
17
+ ->setCcNumber($data->getCcNumber())
18
+ ->setCcCid($data->getCcCid())
19
+ ->setCcExpMonth($data->getCcExpMonth())
20
+ ->setCcExpYear($data->getCcExpYear())
21
+ ->setCcSsIssue($data->getCcSsIssue())
22
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
23
+ ->setCcSsStartYear($data->getCcSsStartYear())
24
+ ;
25
+ return $this;
26
+ }
27
+
28
+ public function prepareSave() {
29
+ $info = $this->getInfoInstance();
30
+ if ($this->_canSaveCc) {
31
+ $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
32
+ }
33
+ //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
34
+ $info->setCcNumber(null)
35
+ ->setCcCid(null);
36
+ return $this;
37
+ }
38
+
39
+ public function validate() {
40
+ $info = $this->getInfoInstance();
41
+ $errorMsg = false;
42
+ $availableTypes = explode(',', $this->getConfigData('cctypes'));
43
+
44
+ $ccNumber = $info->getCcNumber();
45
+
46
+ // remove credit card number delimiters such as "-" and space
47
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
48
+ $info->setCcNumber($ccNumber);
49
+
50
+ $ccType = '';
51
+ $specifiedCCType = $info->getCcType();
52
+
53
+ return $this;
54
+ }
55
+
56
+ public function hasVerification() {
57
+ Mage::log("hasVerification\n", null, 'cp_plugincc.log');
58
+ $configData = $this->getConfigData('useccv');
59
+ if (is_null($configData)) {
60
+ return true;
61
+ }
62
+ return (bool) $configData;
63
+ }
64
+
65
+ public function getVerificationRegEx() {
66
+ Mage::log("getVerificationRegEx\n", null, 'cp_plugincc.log');
67
+ $verificationExpList = array(
68
+ 'VI' => '/^[0-9]{3}$/', // Visa
69
+ 'MC' => '/^[0-9]{3}$/', // Master Card
70
+ 'AE' => '/^[0-9]{4}$/', // American Express
71
+ 'DI' => '/^[0-9]{3}$/', // Discovery
72
+ 'SS' => '/^[0-9]{3,4}$/',
73
+ 'SM' => '/^[0-9]{3,4}$/', // Switch or Maestro
74
+ 'SO' => '/^[0-9]{3,4}$/', // Solo
75
+ 'OT' => '/^[0-9]{3,4}$/',
76
+ 'JCB' => '/^[0-9]{3,4}$/' //JCB
77
+ );
78
+ return $verificationExpList;
79
+ }
80
+
81
+ public function validateCcNum($ccNumber) {
82
+
83
+
84
+ $cardNumber = strrev($ccNumber);
85
+ $numSum = 0;
86
+
87
+ for ($i = 0; $i < strlen($cardNumber); $i++) {
88
+ $currentNum = substr($cardNumber, $i, 1);
89
+
90
+ /**
91
+ * Double every second digit
92
+ */
93
+ if ($i % 2 == 1) {
94
+ $currentNum *= 2;
95
+ }
96
+
97
+ /**
98
+ * Add digits of 2-digit numbers together
99
+ */
100
+ if ($currentNum > 9) {
101
+ $firstNum = $currentNum % 10;
102
+ $secondNum = ($currentNum - $firstNum) / 10;
103
+ $currentNum = $firstNum + $secondNum;
104
+ }
105
+
106
+ $numSum += $currentNum;
107
+ }
108
+
109
+ /**
110
+ * If the total has no remainder it's OK
111
+ */
112
+ Mage::log("validateCcNum: " . ($numSum % 10 == 0) . "\n", null, 'cp_plugincc.log');
113
+ return ($numSum % 10 == 0);
114
+ }
115
+
116
+ public function validateCcNumOther($ccNumber) {
117
+
118
+ return preg_match('/^\\d+$/', $ccNumber);
119
+ }
120
+
121
+ public function isAvailable($quote = null) {
122
+ Mage::log($this->getConfigData('cctypes', ($quote ? $quote->getStoreId() : null)) && parent::isAvailable($quote) . " isAvailable\n", null, 'cp_plugincc.log');
123
+ return $this->getConfigData('cctypes', ($quote ? $quote->getStoreId() : null)) && parent::isAvailable($quote);
124
+ }
125
+
126
+ public function getIsCentinelValidationEnabled() {
127
+ return false !== Mage::getConfig()->getNode('modules/Mage_Centinel') && 1 == $this->getConfigData('centinel');
128
+ }
129
+
130
+ public function getCentinelValidator() {
131
+ $validator = Mage::getSingleton('centinel/service');
132
+ $validator
133
+ ->setIsModeStrict($this->getConfigData('centinel_is_mode_strict'))
134
+ ->setCustomApiEndpointUrl($this->getConfigData('centinel_api_url'))
135
+ ->setStore($this->getStore())
136
+ ->setIsPlaceOrder($this->_isPlaceOrder());
137
+ return $validator;
138
+ }
139
+
140
+ public function getCentinelValidationData() {
141
+ $info = $this->getInfoInstance();
142
+ $params = new Varien_Object();
143
+ $params
144
+ ->setPaymentMethodCode($this->getCode())
145
+ ->setCardType($info->getCcType())
146
+ ->setCardNumber($info->getCcNumber())
147
+ ->setCardExpMonth($info->getCcExpMonth())
148
+ ->setCardExpYear($info->getCcExpYear())
149
+ ->setAmount($this->_getAmount())
150
+ ->setCurrencyCode($this->_getCurrencyCode())
151
+ ->setOrderNumber($this->_getOrderId());
152
+ return $params;
153
+ }
154
+
155
+ private function _getOrderId() {
156
+ $info = $this->getInfoInstance();
157
+
158
+ if ($this->_isPlaceOrder()) {
159
+ return $info->getOrder()->getIncrementId();
160
+ } else {
161
+ if (!$info->getQuote()->getReservedOrderId()) {
162
+ $info->getQuote()->reserveOrderId();
163
+ }
164
+ return $info->getQuote()->getReservedOrderId();
165
+ }
166
+ }
167
+
168
+ private function _getAmount() {
169
+ $info = $this->getInfoInstance();
170
+ if ($this->_isPlaceOrder()) {
171
+ return (double) $info->getOrder()->getQuoteBaseGrandTotal();
172
+ } else {
173
+ return (double) $info->getQuote()->getBaseGrandTotal();
174
+ }
175
+ }
176
+
177
+ private function _getCurrencyCode() {
178
+ $info = $this->getInfoInstance();
179
+
180
+ if ($this->_isPlaceOrder()) {
181
+ return $info->getOrder()->getBaseCurrencyCode();
182
+ } else {
183
+ return $info->getQuote()->getBaseCurrencyCode();
184
+ }
185
+ }
186
+
187
+ private function _isPlaceOrder() {
188
+ $info = $this->getInfoInstance();
189
+ if ($info instanceof Mage_Sales_Model_Quote_Payment) {
190
+ return false;
191
+ } elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
192
+ return true;
193
+ }
194
+ }
195
+
196
+ public function getInfoInstance() {
197
+ $instance = Mage::getSingleton('channelpilot/payment');
198
+ return $instance;
199
+ }
200
+
201
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Trackingmethod.php CHANGED
@@ -1,34 +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_Trackingmethod
24
- {
25
- const TRACKING_METHOD_IMAGE = 1;
26
- const TRACKING_METHOD_JS = 2;
27
-
28
- public function toOptionArray() {
29
- return array(
30
- array('value' => self::TRACKING_METHOD_IMAGE, 'label' => Mage::helper('channelpilot')->__('CP Image')),
31
- array('value' => self::TRACKING_METHOD_JS, 'label' => Mage::helper('channelpilot')->__('CP JavaScript')),
32
- );
33
- }
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_Trackingmethod
24
+ {
25
+ const TRACKING_METHOD_IMAGE = 1;
26
+ const TRACKING_METHOD_JS = 2;
27
+
28
+ public function toOptionArray() {
29
+ return array(
30
+ array('value' => self::TRACKING_METHOD_IMAGE, 'label' => Mage::helper('channelpilot')->__('CP Image')),
31
+ array('value' => self::TRACKING_METHOD_JS, 'label' => Mage::helper('channelpilot')->__('CP JavaScript')),
32
+ );
33
+ }
34
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Carrier/Cpshipping.php CHANGED
@@ -1,87 +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
-
24
- // getModuleDir does not return Helper directory for some Magento Versions ...
25
- require_once Mage::getModuleDir('','Channelpilotsolutions_Channelpilot').DS.'Helper'.DS.'handler'.DS.'CPAbstractHandler.php';
26
-
27
- class Channelpilotsolutions_Channelpilot_Model_Carrier_Cpshipping
28
- extends Mage_Shipping_Model_Carrier_Abstract
29
- implements Mage_Shipping_Model_Carrier_Interface
30
- {
31
- protected $_code = 'cpshipping';
32
- protected $_isFixed = true;
33
-
34
- /**
35
- * Checks if user is logged in as admin
36
- *
37
- * @return bool
38
- */
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
- }
46
-
47
- $currentSessionName = Mage::getSingleton('core/session')->getSessionName();
48
-
49
- /* set admin session */
50
- Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
51
- $isLoggedIn = Mage::getSingleton('admin/session', array('name' => Mage_Adminhtml_Controller_Action::SESSION_NAMESPACE))->isLoggedIn();
52
- /* set original session */
53
- Mage::getSingleton('core/session', array('name' => $currentSessionName))->start();
54
- return $isLoggedIn;
55
- }
56
-
57
- /**
58
- * Returns the shipping rate for 'cpshipping'.
59
- *
60
- * @param Mage_Shipping_Model_Rate_Request $request
61
- * @return Mage_Shipping_Model_Rate_Result
62
- */
63
- public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
64
- if(!$this->getConfigFlag('active')) {
65
- return false;
66
- }
67
-
68
- if ($this->getConfigFlag('backend_only') && !$this->isAdmin()) {
69
- return false;
70
- }
71
-
72
- $method = Mage::getModel('shipping/rate_result_method')
73
- ->setCarrier('cpshipping')
74
- ->setCarrierTitle($this->getConfigData('title'))
75
- ->setMethod('cpshipping')
76
- ->setMethodTitle($this->getConfigData('name'))
77
- ->setPrice($this->getConfigData('price'))
78
- ->setCost($this->getConfigData('price'));
79
-
80
- return Mage::getModel('shipping/rate_result')
81
- ->append($method);
82
- }
83
-
84
- public function getAllowedMethods() {
85
- return array('cpshipping'=>$this->getConfigData('name'));
86
- }
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
+
24
+ // getModuleDir does not return Helper directory for some Magento Versions ...
25
+ require_once Mage::getModuleDir('','Channelpilotsolutions_Channelpilot').DS.'Helper'.DS.'handler'.DS.'CPAbstractHandler.php';
26
+
27
+ class Channelpilotsolutions_Channelpilot_Model_Carrier_Cpshipping
28
+ extends Mage_Shipping_Model_Carrier_Abstract
29
+ implements Mage_Shipping_Model_Carrier_Interface
30
+ {
31
+ protected $_code = 'cpshipping';
32
+ protected $_isFixed = true;
33
+
34
+ /**
35
+ * Checks if user is logged in as admin
36
+ *
37
+ * @return bool
38
+ */
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
+ }
46
+
47
+ $currentSessionName = Mage::getSingleton('core/session')->getSessionName();
48
+
49
+ /* set admin session */
50
+ Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
51
+ $isLoggedIn = Mage::getSingleton('admin/session', array('name' => Mage_Adminhtml_Controller_Action::SESSION_NAMESPACE))->isLoggedIn();
52
+ /* set original session */
53
+ Mage::getSingleton('core/session', array('name' => $currentSessionName))->start();
54
+ return $isLoggedIn;
55
+ }
56
+
57
+ /**
58
+ * Returns the shipping rate for 'cpshipping'.
59
+ *
60
+ * @param Mage_Shipping_Model_Rate_Request $request
61
+ * @return Mage_Shipping_Model_Rate_Result
62
+ */
63
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
64
+ if(!$this->getConfigFlag('active')) {
65
+ return false;
66
+ }
67
+
68
+ if ($this->getConfigFlag('backend_only') && !$this->isAdmin()) {
69
+ return false;
70
+ }
71
+
72
+ $method = Mage::getModel('shipping/rate_result_method')
73
+ ->setCarrier('cpshipping')
74
+ ->setCarrierTitle($this->getConfigData('title'))
75
+ ->setMethod('cpshipping')
76
+ ->setMethodTitle($this->getConfigData('name'))
77
+ ->setPrice($this->getConfigData('price'))
78
+ ->setCost($this->getConfigData('price'));
79
+
80
+ return Mage::getModel('shipping/rate_result')
81
+ ->append($method);
82
+ }
83
+
84
+ public function getAllowedMethods() {
85
+ return array('cpshipping'=>$this->getConfigData('name'));
86
+ }
87
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Logs.php CHANGED
@@ -1,39 +1,39 @@
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
- /**
24
- * Class Channelpilotsolutions_Channelpilot_Model_Logs
25
- *
26
- * @method int getId()
27
- * @method string getCreated()
28
- * @method string getContent()
29
- */
30
-
31
- class Channelpilotsolutions_Channelpilot_Model_Logs extends Mage_Core_Model_Abstract {
32
-
33
- /**
34
- * Initialize resource model
35
- */
36
- protected function _construct() {
37
- $this->_init('channelpilot/logs');
38
- }
39
  }
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
+ /**
24
+ * Class Channelpilotsolutions_Channelpilot_Model_Logs
25
+ *
26
+ * @method int getId()
27
+ * @method string getCreated()
28
+ * @method string getContent()
29
+ */
30
+
31
+ class Channelpilotsolutions_Channelpilot_Model_Logs extends Mage_Core_Model_Abstract {
32
+
33
+ /**
34
+ * Initialize resource model
35
+ */
36
+ protected function _construct() {
37
+ $this->_init('channelpilot/logs');
38
+ }
39
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order.php CHANGED
@@ -1,66 +1,75 @@
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
- /**
24
- * Class Channelpilotsolutions_Channelpilot_Model_Order
25
- *
26
- * @method string getId()
27
- * @method string getOrderId()
28
- * @method string getOrderNr()
29
- * @method string getMarketplaceOrderId()
30
- * @method string getShop()
31
- * @method int getCreated()
32
- * @method int getStatus()
33
- */
34
-
35
- class Channelpilotsolutions_Channelpilot_Model_Order extends Mage_Core_Model_Abstract {
36
-
37
- const CP_ORDER_UNPAID = 0;
38
- const CP_ORDER_PAID = 1;
39
-
40
- /**
41
- * Initialize resource model
42
- */
43
- protected function _construct() {
44
- $this->_init('channelpilot/order');
45
- }
46
-
47
- /**
48
- * Set the order_paid status for marketplace orders to "paid". Returns the number of affected rows
49
- * or boolean false in case the update query could not be executed.
50
- * @param array $orders
51
- * @return int | bool
52
- */
53
- public function loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace) {
54
- return $this->_getResource()->loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace, $this);
55
- }
56
-
57
- /**
58
- * Set the order_paid status for marketplace orders. Returns the number of affected rows
59
- * or boolean false in case the update query could not be executed.
60
- * @param array $orders
61
- * @return int | bool
62
- */
63
- public function massSetOrderPaid(array $orders) {
64
- return $this->getResource()->massSetOrderPaid($orders);
65
- }
 
 
 
 
 
 
 
 
 
66
  }
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
+ /**
24
+ * Class Channelpilotsolutions_Channelpilot_Model_Order
25
+ *
26
+ * @method string getId()
27
+ * @method string getOrderId()
28
+ * @method string getOrderNr()
29
+ * @method string getMarketplaceOrderId()
30
+ * @method string getShop()
31
+ * @method int getCreated()
32
+ * @method int getStatus()
33
+ */
34
+
35
+ class Channelpilotsolutions_Channelpilot_Model_Order extends Mage_Core_Model_Abstract {
36
+
37
+ const CP_ORDER_UNPAID = 0;
38
+ const CP_ORDER_PAID = 1;
39
+
40
+ /**
41
+ * Initialize resource model
42
+ */
43
+ protected function _construct() {
44
+ $this->_init('channelpilot/order');
45
+ }
46
+
47
+ /**
48
+ * Set the order_paid status for marketplace orders to "paid". Returns the number of affected rows
49
+ * or boolean false in case the update query could not be executed.
50
+ * @param array $orders
51
+ * @return int | bool
52
+ */
53
+ public function loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace) {
54
+ return $this->_getResource()->loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace, $this);
55
+ }
56
+
57
+ /**
58
+ * Set the order_paid status for marketplace orders. Returns the number of affected rows
59
+ * or boolean false in case the update query could not be executed.
60
+ * @param array $orders
61
+ * @return int | bool
62
+ */
63
+ public function massSetOrderPaid(array $orders) {
64
+ return $this->getResource()->massSetOrderPaid($orders);
65
+ }
66
+
67
+ /**
68
+ * Load by field order_nr
69
+ * @param $orderNr
70
+ * @return mixed
71
+ */
72
+ public function loadByOrderNr($orderNr) {
73
+ return $this->_getResource()->loadByOrderNr($orderNr, $this);
74
+ }
75
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Item.php CHANGED
@@ -1,53 +1,53 @@
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
- /**
24
- * Class Channelpilotsolutions_Channelpilot_Model_Order_Item
25
- *
26
- * @method int getId()
27
- * @method string getOrderItemId()
28
- * @method string getMarketplaceOrderItemId()
29
- * @method string getOrderId()
30
- * @method int getCancelled()
31
- * @method int getAmount()
32
- * @method int getAmountDelivered()
33
- */
34
-
35
- class Channelpilotsolutions_Channelpilot_Model_Order_Item extends Mage_Core_Model_Abstract {
36
-
37
- /**
38
- * Initialize resource model
39
- */
40
- protected function _construct() {
41
- $this->_init('channelpilot/order_item');
42
- }
43
-
44
- /**
45
- * Updates all cancelled items in a single transaction.
46
- * @param array $cpCancellation
47
- * @throws Exception
48
- */
49
- public function updateCancelledQty(array $cpCancellation) {
50
- $this->getResource()->updateCancelledQty($cpCancellation, $this);
51
- return $this;
52
- }
53
  }
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
+ /**
24
+ * Class Channelpilotsolutions_Channelpilot_Model_Order_Item
25
+ *
26
+ * @method int getId()
27
+ * @method string getOrderItemId()
28
+ * @method string getMarketplaceOrderItemId()
29
+ * @method string getOrderId()
30
+ * @method int getCancelled()
31
+ * @method int getAmount()
32
+ * @method int getAmountDelivered()
33
+ */
34
+
35
+ class Channelpilotsolutions_Channelpilot_Model_Order_Item extends Mage_Core_Model_Abstract {
36
+
37
+ /**
38
+ * Initialize resource model
39
+ */
40
+ protected function _construct() {
41
+ $this->_init('channelpilot/order_item');
42
+ }
43
+
44
+ /**
45
+ * Updates all cancelled items in a single transaction.
46
+ * @param array $cpCancellation
47
+ * @throws Exception
48
+ */
49
+ public function updateCancelledQty(array $cpCancellation) {
50
+ $this->getResource()->updateCancelledQty($cpCancellation, $this);
51
+ return $this;
52
+ }
53
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Shipment.php CHANGED
@@ -1,45 +1,45 @@
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_Order_Shipment extends Mage_Core_Model_Abstract
24
- {
25
- /**
26
- * Initialize resource model
27
- */
28
- protected function _construct() {
29
- $this->_init('channelpilot/order_shipment');
30
- }
31
- /**
32
- * Adds multiple rows to channelpilot/order_shipment.
33
- * Returns the amount of affected rows or boolean false if no read connection is present.
34
- * @param array $shipments structure: Array(
35
- * [0] => Array(
36
- * 'order_id' => SALES_ORDER_ID,
37
- * 'shipment_id' => SALES_SHIPMENT_ID
38
- * )
39
- * )
40
- * @return bool|int
41
- */
42
- public function addMultipleShipments(array $shipments) {
43
- return $this->_getResource()->addMultipleShipments($shipments);
44
- }
45
  }
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_Order_Shipment extends Mage_Core_Model_Abstract
24
+ {
25
+ /**
26
+ * Initialize resource model
27
+ */
28
+ protected function _construct() {
29
+ $this->_init('channelpilot/order_shipment');
30
+ }
31
+ /**
32
+ * Adds multiple rows to channelpilot/order_shipment.
33
+ * Returns the amount of affected rows or boolean false if no read connection is present.
34
+ * @param array $shipments structure: Array(
35
+ * [0] => Array(
36
+ * 'order_id' => SALES_ORDER_ID,
37
+ * 'shipment_id' => SALES_SHIPMENT_ID
38
+ * )
39
+ * )
40
+ * @return bool|int
41
+ */
42
+ public function addMultipleShipments(array $shipments) {
43
+ return $this->_getResource()->addMultipleShipments($shipments);
44
+ }
45
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Payment.php CHANGED
@@ -1,112 +1,112 @@
1
- <?php
2
-
3
- class Channelpilotsolutions_Channelpilot_Model_Payment extends Mage_Payment_Model_Method_Abstract {
4
-
5
- /**
6
- * unique internal payment method identifier
7
- *
8
- * @var string [a-z0-9_]
9
- */
10
- protected $_code = 'cp_mp';
11
-
12
- /**
13
- * Is this payment method a gateway (online auth/charge) ?
14
- */
15
- protected $_isGateway = false;
16
-
17
- /**
18
- * Can authorize online?
19
- */
20
- protected $_canAuthorize = true;
21
-
22
- /**
23
- * Can capture funds online?
24
- */
25
- protected $_canCapture = true;
26
-
27
- /**
28
- * Can capture partial amounts online?
29
- */
30
- protected $_canCapturePartial = false;
31
-
32
- /**
33
- * Can refund online?
34
- */
35
- protected $_canRefund = false;
36
-
37
- /**
38
- * Can void transactions online?
39
- */
40
- protected $_canVoid = true;
41
-
42
- /**
43
- * Can use this payment method in administration panel?
44
- */
45
- protected $_canUseInternal = true;
46
-
47
- /**
48
- * Can show this payment method as an option on checkout payment page?
49
- */
50
- protected $_canUseCheckout = false;
51
-
52
- /**
53
- * Is this payment method suitable for multi-shipping checkout?
54
- */
55
- protected $_canUseForMultishipping = true;
56
-
57
- /**
58
- * Can save credit card information for future processing?
59
- */
60
- protected $_canSaveCc = false;
61
-
62
- public function getCode() {
63
- return $this->_code;
64
- }
65
-
66
- public function getCcTypes() {
67
- $types = array();
68
- $types["cp_mp_default"] = "ChannelPilot Marketplace Payment Default";
69
- $types["cp_mp_amazon"] = "ChannelPilot Marketplace Payment Amazon";
70
- $types["cp_mp_ebay"] = "ChannelPilot Marketplace Payment Ebay";
71
- // $types["cp_mp_rakuten"] = "ChannelPilot Marketplace Payment Rakuten";
72
- // $types["cp_mp_cdiscount"] = "ChannelPilot Marketplace Payment CDiscount";
73
- return $types;
74
- }
75
-
76
- protected $_formBlockType = 'payment/form_cc';
77
- protected $_infoBlockType = 'payment/info_cc';
78
-
79
- public function assignData($data) {
80
- if (!($data instanceof Varien_Object)) {
81
- $data = new Varien_Object($data);
82
- }
83
- $info = $this->getInfoInstance();
84
- $tmp = $this->getCCTypes();
85
- $info->setCcType($tmp[$data->getCcType()]);
86
- return $this;
87
- }
88
-
89
- public function prepareSave() {
90
- $info = $this->getInfoInstance();
91
- $info->setCcNumber(null)
92
- ->setCcCid(null);
93
- return $this;
94
- }
95
-
96
- public function validate() {
97
- parent::validate();
98
-
99
- $info = $this->getInfoInstance();
100
- $tmp = $this->getCCTypes();
101
- $activeTypes = explode(',', Mage::getStoreConfig('payment/' . $this->_code . '/types', Mage::app()->getStore()->getStoreId()));
102
- foreach ($activeTypes as $value) {
103
- if ($tmp[$value] === $info->getCcType()) {
104
- return $this;
105
- }
106
- }
107
- Mage::throwException('unknown type for ' . $this->_code);
108
- }
109
-
110
- }
111
-
112
  ?>
1
+ <?php
2
+
3
+ class Channelpilotsolutions_Channelpilot_Model_Payment extends Mage_Payment_Model_Method_Abstract {
4
+
5
+ /**
6
+ * unique internal payment method identifier
7
+ *
8
+ * @var string [a-z0-9_]
9
+ */
10
+ protected $_code = 'cp_mp';
11
+
12
+ /**
13
+ * Is this payment method a gateway (online auth/charge) ?
14
+ */
15
+ protected $_isGateway = false;
16
+
17
+ /**
18
+ * Can authorize online?
19
+ */
20
+ protected $_canAuthorize = true;
21
+
22
+ /**
23
+ * Can capture funds online?
24
+ */
25
+ protected $_canCapture = true;
26
+
27
+ /**
28
+ * Can capture partial amounts online?
29
+ */
30
+ protected $_canCapturePartial = false;
31
+
32
+ /**
33
+ * Can refund online?
34
+ */
35
+ protected $_canRefund = false;
36
+
37
+ /**
38
+ * Can void transactions online?
39
+ */
40
+ protected $_canVoid = true;
41
+
42
+ /**
43
+ * Can use this payment method in administration panel?
44
+ */
45
+ protected $_canUseInternal = true;
46
+
47
+ /**
48
+ * Can show this payment method as an option on checkout payment page?
49
+ */
50
+ protected $_canUseCheckout = false;
51
+
52
+ /**
53
+ * Is this payment method suitable for multi-shipping checkout?
54
+ */
55
+ protected $_canUseForMultishipping = true;
56
+
57
+ /**
58
+ * Can save credit card information for future processing?
59
+ */
60
+ protected $_canSaveCc = false;
61
+
62
+ public function getCode() {
63
+ return $this->_code;
64
+ }
65
+
66
+ public function getCcTypes() {
67
+ $types = array();
68
+ $types["cp_mp_default"] = "ChannelPilot Marketplace Payment Default";
69
+ $types["cp_mp_amazon"] = "ChannelPilot Marketplace Payment Amazon";
70
+ $types["cp_mp_ebay"] = "ChannelPilot Marketplace Payment Ebay";
71
+ // $types["cp_mp_rakuten"] = "ChannelPilot Marketplace Payment Rakuten";
72
+ // $types["cp_mp_cdiscount"] = "ChannelPilot Marketplace Payment CDiscount";
73
+ return $types;
74
+ }
75
+
76
+ protected $_formBlockType = 'payment/form_cc';
77
+ protected $_infoBlockType = 'payment/info_cc';
78
+
79
+ public function assignData($data) {
80
+ if (!($data instanceof Varien_Object)) {
81
+ $data = new Varien_Object($data);
82
+ }
83
+ $info = $this->getInfoInstance();
84
+ $tmp = $this->getCCTypes();
85
+ $info->setCcType($tmp[$data->getCcType()]);
86
+ return $this;
87
+ }
88
+
89
+ public function prepareSave() {
90
+ $info = $this->getInfoInstance();
91
+ $info->setCcNumber(null)
92
+ ->setCcCid(null);
93
+ return $this;
94
+ }
95
+
96
+ public function validate() {
97
+ parent::validate();
98
+
99
+ $info = $this->getInfoInstance();
100
+ $tmp = $this->getCCTypes();
101
+ $activeTypes = explode(',', Mage::getStoreConfig('payment/' . $this->_code . '/types', Mage::app()->getStore()->getStoreId()));
102
+ foreach ($activeTypes as $value) {
103
+ if ($tmp[$value] === $info->getCcType()) {
104
+ return $this;
105
+ }
106
+ }
107
+ Mage::throwException('unknown type for ' . $this->_code);
108
+ }
109
+
110
+ }
111
+
112
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/Model/PaymentTypes.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- class Channelpilotsolutions_Channelpilot_Model_Paymenttypes {
4
-
5
- public function toOptionArray() {
6
- $options = array();
7
-
8
- foreach (Mage::getSingleton('channelpilot/payment')->getCcTypes() as $code => $name) {
9
- $options[] = array(
10
- 'value' => $code,
11
- 'label' => $name
12
- );
13
- }
14
-
15
- return $options;
16
- }
17
-
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Channelpilotsolutions/Channelpilot/Model/Paymenttypes.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- class Channelpilotsolutions_Channelpilot_Model_Paymenttypes {
4
-
5
- public function toOptionArray() {
6
- $options = array();
7
-
8
- foreach (Mage::getSingleton('channelpilot/payment')->getCcTypes() as $code => $name) {
9
- $options[] = array(
10
- 'value' => $code,
11
- 'label' => $name
12
- );
13
- }
14
-
15
- return $options;
16
- }
17
-
18
- }
1
+ <?php
2
+
3
+ class Channelpilotsolutions_Channelpilot_Model_Paymenttypes {
4
+
5
+ public function toOptionArray() {
6
+ $options = array();
7
+
8
+ foreach (Mage::getSingleton('channelpilot/payment')->getCcTypes() as $code => $name) {
9
+ $options[] = array(
10
+ 'value' => $code,
11
+ 'label' => $name
12
+ );
13
+ }
14
+
15
+ return $options;
16
+ }
17
+
18
+ }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Prices.php CHANGED
@@ -1,39 +1,39 @@
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
- /**
24
- * Class Channelpilotsolutions_Channelpilot_Model_Prices
25
- *
26
- * @method string getId()
27
- * @method string getPriceId()
28
- * @method int getLastPriceUpdate()
29
- */
30
-
31
- class Channelpilotsolutions_Channelpilot_Model_Prices extends Mage_Core_Model_Abstract {
32
-
33
- /**
34
- * Initialize resource model
35
- */
36
- protected function _construct() {
37
- $this->_init('channelpilot/prices');
38
- }
39
  }
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
+ /**
24
+ * Class Channelpilotsolutions_Channelpilot_Model_Prices
25
+ *
26
+ * @method string getId()
27
+ * @method string getPriceId()
28
+ * @method int getLastPriceUpdate()
29
+ */
30
+
31
+ class Channelpilotsolutions_Channelpilot_Model_Prices extends Mage_Core_Model_Abstract {
32
+
33
+ /**
34
+ * Initialize resource model
35
+ */
36
+ protected function _construct() {
37
+ $this->_init('channelpilot/prices');
38
+ }
39
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Registration.php CHANGED
@@ -1,74 +1,74 @@
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
- /**
24
- * Class Channelpilotsolutions_Channelpilot_Model_Registration
25
- *
26
- * @method string getId()
27
- * @method string getShopId()
28
- * @method string getIpsAuthorized()
29
- * @method string getMerchantId()
30
- * @method string getSecurityToken()
31
- * @method int getLastStockUpdate()
32
- * @method int getLastPriceUpdate()
33
- * @method int getLastCatalogUpdate()
34
- */
35
-
36
- class Channelpilotsolutions_Channelpilot_Model_Registration extends Mage_Core_Model_Abstract {
37
-
38
- /**
39
- * Initialize resource model
40
- */
41
- protected function _construct() {
42
- $this->_init('channelpilot/registration');
43
- }
44
-
45
- /**
46
- * Get all ips_authorized via a given security token.
47
- * @param string $securityToken
48
- * @return array
49
- */
50
- public function getAllowedIpsViaSecurityToken($securityToken) {
51
- return $this->_getResource()->getAllowedIpsViaSecurityToken($securityToken);
52
- }
53
-
54
- /**
55
- * Get all ips_authorized via a shopId.
56
- * @param string $securityToken
57
- * @return array
58
- */
59
- public function getAllowedIpsViaShopId($shopId) {
60
- return $this->_getResource()->getAllowedIpsViaShopId($shopId);
61
- }
62
-
63
- /**
64
- * Checks if the given $ip is authorized.
65
- * @param string $ip
66
- * @return bool
67
- */
68
- public function isIpAuthorized($ip) {
69
- if(CPAbstractHandler::ChannelPilot_IP == $ip) {
70
- return true;
71
- }
72
- return $this->_getResource()->isIpAuthorized($ip);
73
- }
74
  }
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
+ /**
24
+ * Class Channelpilotsolutions_Channelpilot_Model_Registration
25
+ *
26
+ * @method string getId()
27
+ * @method string getShopId()
28
+ * @method string getIpsAuthorized()
29
+ * @method string getMerchantId()
30
+ * @method string getSecurityToken()
31
+ * @method int getLastStockUpdate()
32
+ * @method int getLastPriceUpdate()
33
+ * @method int getLastCatalogUpdate()
34
+ */
35
+
36
+ class Channelpilotsolutions_Channelpilot_Model_Registration extends Mage_Core_Model_Abstract {
37
+
38
+ /**
39
+ * Initialize resource model
40
+ */
41
+ protected function _construct() {
42
+ $this->_init('channelpilot/registration');
43
+ }
44
+
45
+ /**
46
+ * Get all ips_authorized via a given security token.
47
+ * @param string $securityToken
48
+ * @return array
49
+ */
50
+ public function getAllowedIpsViaSecurityToken($securityToken) {
51
+ return $this->_getResource()->getAllowedIpsViaSecurityToken($securityToken);
52
+ }
53
+
54
+ /**
55
+ * Get all ips_authorized via a shopId.
56
+ * @param string $securityToken
57
+ * @return array
58
+ */
59
+ public function getAllowedIpsViaShopId($shopId) {
60
+ return $this->_getResource()->getAllowedIpsViaShopId($shopId);
61
+ }
62
+
63
+ /**
64
+ * Checks if the given $ip is authorized.
65
+ * @param string $ip
66
+ * @return bool
67
+ */
68
+ public function isIpAuthorized($ip) {
69
+ if(CPAbstractHandler::ChannelPilot_IP == $ip) {
70
+ return true;
71
+ }
72
+ return $this->_getResource()->isIpAuthorized($ip);
73
+ }
74
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs.php CHANGED
@@ -1,32 +1,32 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Logs extends Mage_Core_Model_Resource_Db_Abstract {
24
-
25
- /**
26
- * Model Initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/logs', 'id');
31
- }
32
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Logs extends Mage_Core_Model_Resource_Db_Abstract {
24
+
25
+ /**
26
+ * Model Initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/logs', 'id');
31
+ }
32
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs/Collection.php CHANGED
@@ -1,32 +1,32 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Logs_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
-
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/logs');
31
- }
32
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Logs_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
+
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/logs');
31
+ }
32
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order.php CHANGED
@@ -1,82 +1,104 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract {
24
-
25
- /**
26
- * Model Initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order', 'order_id');
31
- $this->_isPkAutoIncrement = false;
32
- }
33
-
34
- /**
35
- * Load model by marketplace_order_id and marketplace.
36
- * @param string $marketplaceOrderId
37
- * @param string $marketplace
38
- * @param Channelpilotsolutions_Channelpilot_Model_Order $order
39
- * @return Channelpilotsolutions_Channelpilot_Model_Order
40
- */
41
- public function loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace, Channelpilotsolutions_Channelpilot_Model_Order $order) {
42
- $read = $this->_getReadAdapter();
43
- if($read) {
44
- $select = $read->select()
45
- ->from(array('order' => $this->getMainTable()))
46
- ->where('order.marketplace_order_id = ?', $marketplaceOrderId)
47
- ->where('order.marketplace = ?', $marketplace);
48
-
49
- $result = $read->fetchRow($select);
50
- if(!empty($result)) {
51
- $order->setData($result);
52
- }
53
- }
54
-
55
- return $order;
56
- }
57
-
58
- /**
59
- * Set the order_paid status for marketplace orders to "paid". Returns the number of affected rows
60
- * or boolean false in case the update query could not be executed.
61
- * @param array $orders
62
- * @return int | bool
63
- */
64
- public function massSetOrderPaid(array $orders) {
65
- $write = $this->_getWriteAdapter();
66
- if($write) {
67
- $orderIds = array();
68
-
69
- foreach($orders as $order) {
70
- $orderIds[] = $write->quote($order->orderHeader->orderId);
71
- }
72
-
73
- $sOrderIds = implode(',', $orderIds);
74
- return $write->update($this->getMainTable(),
75
- array('order_paid' => Channelpilotsolutions_Channelpilot_Model_Order::CP_ORDER_PAID),
76
- 'order_id IN('.$sOrderIds.')'
77
- );
78
- }
79
-
80
- return false;
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract {
24
+
25
+ /**
26
+ * Model Initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order', 'order_id');
31
+ $this->_isPkAutoIncrement = false;
32
+ }
33
+
34
+ /**
35
+ * Load model by marketplace_order_id and marketplace.
36
+ * @param string $marketplaceOrderId
37
+ * @param string $marketplace
38
+ * @param Channelpilotsolutions_Channelpilot_Model_Order $order
39
+ * @return Channelpilotsolutions_Channelpilot_Model_Order
40
+ */
41
+ public function loadByMarketplaceOrderIdAndMarketplace($marketplaceOrderId, $marketplace, Channelpilotsolutions_Channelpilot_Model_Order $order) {
42
+ $read = $this->_getReadAdapter();
43
+ if($read) {
44
+ $select = $read->select()
45
+ ->from(array('order' => $this->getMainTable()))
46
+ ->where('order.marketplace_order_id = ?', $marketplaceOrderId)
47
+ ->where('order.marketplace = ?', $marketplace);
48
+
49
+ $result = $read->fetchRow($select);
50
+ if(!empty($result)) {
51
+ $order->setData($result);
52
+ }
53
+ }
54
+
55
+ return $order;
56
+ }
57
+
58
+ /**
59
+ * Set the order_paid status for marketplace orders to "paid". Returns the number of affected rows
60
+ * or boolean false in case the update query could not be executed.
61
+ * @param array $orders
62
+ * @return int | bool
63
+ */
64
+ public function massSetOrderPaid(array $orders) {
65
+ $write = $this->_getWriteAdapter();
66
+ if($write) {
67
+ $orderIds = array();
68
+
69
+ foreach($orders as $order) {
70
+ $orderIds[] = $write->quote($order->orderHeader->orderId);
71
+ }
72
+
73
+ $sOrderIds = implode(',', $orderIds);
74
+ return $write->update($this->getMainTable(),
75
+ array('order_paid' => Channelpilotsolutions_Channelpilot_Model_Order::CP_ORDER_PAID),
76
+ 'order_id IN('.$sOrderIds.')'
77
+ );
78
+ }
79
+
80
+ return false;
81
+ }
82
+
83
+ /**
84
+ * Load order by field order_nr
85
+ * @param $orderNr
86
+ * @param Channelpilotsolutions_Channelpilot_Model_Order $order
87
+ * @return Channelpilotsolutions_Channelpilot_Model_Order
88
+ */
89
+ public function loadByOrderNr($orderNr, Channelpilotsolutions_Channelpilot_Model_Order $order) {
90
+ $read = $this->_getReadAdapter();
91
+ if($read) {
92
+ $select = $read->select()
93
+ ->from(array('order' => $this->getMainTable()))
94
+ ->where('order.order_nr = ?', $orderNr);
95
+
96
+ $result = $read->fetchRow($select);
97
+ if(!empty($result)) {
98
+ $order->setData($result);
99
+ }
100
+ }
101
+
102
+ return $order;
103
+ }
104
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Collection.php CHANGED
@@ -1,98 +1,98 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
-
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order');
31
- }
32
-
33
- /**
34
- * Add a "sales order has shipment" filter to the collection.
35
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
36
- */
37
- public function addHasShipmentFilter() {
38
- $read = $this->getResource()->getReadConnection();
39
-
40
- if($read) {
41
- $select = $read->select()
42
- ->from($this->getTable('channelpilot/order_shipment'), array('shipment_id'));
43
-
44
- $quotedShipmentEntityId = $read->quoteIdentifier('shipment.entity_id');
45
-
46
- $this->getSelect()
47
- ->joinLeft(array('shipment' => $this->getTable('sales/shipment')),
48
- 'shipment.order_id = main_table.order_id AND shipment.entity_id NOT IN('.$select->__toString().')',
49
- array(
50
- 'shipment_created_at' => 'shipment.created_at',
51
- 'shipment_ids' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$quotedShipmentEntityId.' ORDER BY '.$quotedShipmentEntityId.')')
52
- )
53
- )
54
- ->joinLeft(array('track' => $this->getTable('sales/shipment_track')),
55
- 'track.order_id = main_table.order_id',
56
- array('track.track_number', 'track.title')
57
- )
58
- ->joinLeft(array('order' => $this->getTable('sales/order')),
59
- 'order.entity_id = main_table.order_id',
60
- array('order.shipping_method')
61
- )
62
- ->where('shipment.created_at IS NOT NULL')
63
- ->group('main_table.order_id');
64
- }
65
-
66
- return $this;
67
- }
68
-
69
- /**
70
- * Add a cancelled sales orders filter to the collection.
71
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
72
- */
73
- public function addCancelledSalesOrderFilter() {
74
- $this->getSelect()
75
- ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
76
- 'sales_order.entity_id = main_table.order_id',
77
- null
78
- )
79
- ->where('sales_order.status = ?', Mage_Sales_Model_Order::STATE_CANCELED);
80
-
81
- return $this;
82
- }
83
-
84
- /**
85
- * Add an "order is paid" filter to the collection.
86
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
87
- */
88
- public function addIsPaidFilter() {
89
- $this->getSelect()
90
- ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
91
- 'main_table.order_id = sales_order.entity_id',
92
- array('total_due' => new Zend_Db_Expr('(sales_order.grand_total - IFNULL(sales_order.total_paid, 0))'))
93
- )
94
- ->where('total_due = 0')
95
- ->group('main_table.order_id');
96
- return $this;
97
- }
98
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
+
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order');
31
+ }
32
+
33
+ /**
34
+ * Add a "sales order has shipment" filter to the collection.
35
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
36
+ */
37
+ public function addHasShipmentFilter() {
38
+ $read = $this->getResource()->getReadConnection();
39
+
40
+ if($read) {
41
+ $select = $read->select()
42
+ ->from($this->getTable('channelpilot/order_shipment'), array('shipment_id'));
43
+
44
+ $quotedShipmentEntityId = $read->quoteIdentifier('shipment.entity_id');
45
+
46
+ $this->getSelect()
47
+ ->joinLeft(array('shipment' => $this->getTable('sales/shipment')),
48
+ 'shipment.order_id = main_table.order_id AND shipment.entity_id NOT IN('.$select->__toString().')',
49
+ array(
50
+ 'shipment_created_at' => 'shipment.created_at',
51
+ 'shipment_ids' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$quotedShipmentEntityId.' ORDER BY '.$quotedShipmentEntityId.')')
52
+ )
53
+ )
54
+ ->joinLeft(array('track' => $this->getTable('sales/shipment_track')),
55
+ 'track.order_id = main_table.order_id',
56
+ array('track.track_number', 'track.title')
57
+ )
58
+ ->joinLeft(array('order' => $this->getTable('sales/order')),
59
+ 'order.entity_id = main_table.order_id',
60
+ array('order.shipping_method')
61
+ )
62
+ ->where('shipment.created_at IS NOT NULL')
63
+ ->group('main_table.order_id');
64
+ }
65
+
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Add a cancelled sales orders filter to the collection.
71
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
72
+ */
73
+ public function addCancelledSalesOrderFilter() {
74
+ $this->getSelect()
75
+ ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
76
+ 'sales_order.entity_id = main_table.order_id',
77
+ null
78
+ )
79
+ ->where('sales_order.status = ?', Mage_Sales_Model_Order::STATE_CANCELED);
80
+
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Add an "order is paid" filter to the collection.
86
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Collection
87
+ */
88
+ public function addIsPaidFilter() {
89
+ $this->getSelect()
90
+ ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
91
+ 'main_table.order_id = sales_order.entity_id',
92
+ array('total_due' => new Zend_Db_Expr('(sales_order.grand_total - IFNULL(sales_order.total_paid, 0))'))
93
+ )
94
+ ->where('total_due = 0')
95
+ ->group('main_table.order_id');
96
+ return $this;
97
+ }
98
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item.php CHANGED
@@ -1,60 +1,60 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item extends Mage_Core_Model_Resource_Db_Abstract {
24
-
25
- /**
26
- * Model Initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order_item', 'id');
31
- }
32
-
33
- /**
34
- * Updates all cancelled items in a single transaction.
35
- * @param array $cpCancellation
36
- * @throws Exception
37
- */
38
- public function updateCancelledQty(array $cpCancellation) {
39
- $write = $this->_getWriteAdapter();
40
- if($write) {
41
- $write->beginTransaction();
42
- try {
43
- foreach($cpCancellation as $cpCancellationItem) {
44
- foreach($cpCancellationItem->cancelledItems as $cpOrderItem) {
45
- if($cpOrderItem->quantityCancelled > 0) {
46
- $ret = $write->update($this->getMainTable(),
47
- array('cancelled' => $cpOrderItem->quantityCancelled),
48
- sprintf('order_item_id = %s', $cpOrderItem->id)
49
- );
50
- }
51
- }
52
- }
53
- $write->commit();
54
- } catch(Exception $e) {
55
- $write->rollBack();
56
- throw $e;
57
- }
58
- }
59
- }
60
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item extends Mage_Core_Model_Resource_Db_Abstract {
24
+
25
+ /**
26
+ * Model Initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order_item', 'id');
31
+ }
32
+
33
+ /**
34
+ * Updates all cancelled items in a single transaction.
35
+ * @param array $cpCancellation
36
+ * @throws Exception
37
+ */
38
+ public function updateCancelledQty(array $cpCancellation) {
39
+ $write = $this->_getWriteAdapter();
40
+ if($write) {
41
+ $write->beginTransaction();
42
+ try {
43
+ foreach($cpCancellation as $cpCancellationItem) {
44
+ foreach($cpCancellationItem->cancelledItems as $cpOrderItem) {
45
+ if($cpOrderItem->quantityCancelled > 0) {
46
+ $ret = $write->update($this->getMainTable(),
47
+ array('cancelled' => $cpOrderItem->quantityCancelled),
48
+ sprintf('order_item_id = %s', $cpOrderItem->id)
49
+ );
50
+ }
51
+ }
52
+ }
53
+ $write->commit();
54
+ } catch(Exception $e) {
55
+ $write->rollBack();
56
+ throw $e;
57
+ }
58
+ }
59
+ }
60
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item/Collection.php CHANGED
@@ -1,98 +1,98 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
-
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order_item');
31
- }
32
-
33
- /**
34
- * Add a canceled sales order item filter to the collection.
35
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
36
- */
37
- public function addCanceledSalesOrderItemsFilter() {
38
- $this->getSelect()
39
- ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
40
- 'cp_orders.order_id = main_table.order_id',
41
- array('cp_orders.order_nr', 'cp_orders.marketplace', 'cp_orders.status')
42
- )
43
- ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
44
- 'sales_order.entity_id = cp_orders.order_id',
45
- array('sales_order_state' => 'sales_order.state')
46
- )
47
- ->joinLeft(array('sales_order_item' => $this->getTable('sales/order_item')),
48
- 'sales_order_item.item_id = main_table.order_item_id',
49
- array('sales_order_item.qty_refunded')
50
- )
51
- ->where('sales_order_item.qty_refunded > 0')
52
- ->where('sales_order.status != ?', Mage_Sales_Model_Order::STATE_CANCELED)
53
- ->where('main_table.cancelled != sales_order_item.qty_refunded')
54
- ->order('sales_order_item.order_id');
55
-
56
- return $this;
57
- }
58
-
59
- /**
60
- * Add a marketplace order filter
61
- * @param string $marketplaceOrderId
62
- * @param string $marketplace
63
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
64
- */
65
- public function addMarketplaceOrderFilter($marketplaceOrderId, $marketplace) {
66
- $this->getSelect()
67
- ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
68
- 'main_table.order_id = cp_orders.order_id',
69
- null
70
- )
71
- ->where('cp_orders.marketplace_order_id = ?', $marketplaceOrderId)
72
- ->where('cp_orders.marketplace = ?', $marketplace);
73
-
74
- return $this;
75
- }
76
-
77
- /**
78
- * @param int $shopId
79
- * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
80
- */
81
- public function addReadyForExportFilter($shopId) {
82
- $this->getSelect()
83
- ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
84
- 'cp_orders.order_id = main_table.order_id',
85
- array(
86
- 'orderId' => 'cp_orders.order_nr',
87
- 'externalOrderId' => 'cp_orders.marketplace_order_id',
88
- 'source' => 'cp_orders.marketplace',
89
- 'cp_orders.status'
90
- )
91
- )
92
- ->where('cp_orders.status = ?', CPOrderStatus::ID_READY_FOR_EXPORT)
93
- ->where('cp_orders.shop = ?', $shopId)
94
- ->order('cp_orders.order_nr');
95
-
96
- return $this;
97
- }
98
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
+
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order_item');
31
+ }
32
+
33
+ /**
34
+ * Add a canceled sales order item filter to the collection.
35
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
36
+ */
37
+ public function addCanceledSalesOrderItemsFilter() {
38
+ $this->getSelect()
39
+ ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
40
+ 'cp_orders.order_id = main_table.order_id',
41
+ array('cp_orders.order_nr', 'cp_orders.marketplace', 'cp_orders.status')
42
+ )
43
+ ->joinLeft(array('sales_order' => $this->getTable('sales/order')),
44
+ 'sales_order.entity_id = cp_orders.order_id',
45
+ array('sales_order_state' => 'sales_order.state')
46
+ )
47
+ ->joinLeft(array('sales_order_item' => $this->getTable('sales/order_item')),
48
+ 'sales_order_item.item_id = main_table.order_item_id',
49
+ array('sales_order_item.qty_refunded')
50
+ )
51
+ ->where('sales_order_item.qty_refunded > 0')
52
+ ->where('sales_order.status != ?', Mage_Sales_Model_Order::STATE_CANCELED)
53
+ ->where('main_table.cancelled != sales_order_item.qty_refunded')
54
+ ->order('sales_order_item.order_id');
55
+
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Add a marketplace order filter
61
+ * @param string $marketplaceOrderId
62
+ * @param string $marketplace
63
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
64
+ */
65
+ public function addMarketplaceOrderFilter($marketplaceOrderId, $marketplace) {
66
+ $this->getSelect()
67
+ ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
68
+ 'main_table.order_id = cp_orders.order_id',
69
+ null
70
+ )
71
+ ->where('cp_orders.marketplace_order_id = ?', $marketplaceOrderId)
72
+ ->where('cp_orders.marketplace = ?', $marketplace);
73
+
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * @param int $shopId
79
+ * @return Channelpilotsolutions_Channelpilot_Model_Resource_Order_Item_Collection
80
+ */
81
+ public function addReadyForExportFilter($shopId) {
82
+ $this->getSelect()
83
+ ->joinLeft(array('cp_orders' => $this->getTable('channelpilot/order')),
84
+ 'cp_orders.order_id = main_table.order_id',
85
+ array(
86
+ 'orderId' => 'cp_orders.order_nr',
87
+ 'externalOrderId' => 'cp_orders.marketplace_order_id',
88
+ 'source' => 'cp_orders.marketplace',
89
+ 'cp_orders.status'
90
+ )
91
+ )
92
+ ->where('cp_orders.status = ?', CPOrderStatus::ID_READY_FOR_EXPORT)
93
+ ->where('cp_orders.shop = ?', $shopId)
94
+ ->order('cp_orders.order_nr');
95
+
96
+ return $this;
97
+ }
98
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment.php CHANGED
@@ -1,52 +1,52 @@
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_Order_Shipment extends Mage_Core_Model_Resource_Db_Abstract
24
- {
25
- /**
26
- * Model Initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order_shipment', 'id');
31
- }
32
-
33
- /**
34
- * Adds multiple rows to channelpilot/order_shipment.
35
- * Returns the amount of affected rows or boolean false if no read connection is present.
36
- * @param array $shipments structure: Array(
37
- * [0] => Array(
38
- * 'order_id' => SALES_ORDER_ID,
39
- * 'shipment_id' => SALES_SHIPMENT_ID
40
- * )
41
- * )
42
- * @return bool|int
43
- */
44
- public function addMultipleShipments(array $shipments) {
45
- $read = $this->getReadConnection();
46
- if($read) {
47
- return $read->insertMultiple($this->getMainTable(), $shipments);
48
- }
49
-
50
- return false;
51
- }
52
  }
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_Order_Shipment extends Mage_Core_Model_Resource_Db_Abstract
24
+ {
25
+ /**
26
+ * Model Initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order_shipment', 'id');
31
+ }
32
+
33
+ /**
34
+ * Adds multiple rows to channelpilot/order_shipment.
35
+ * Returns the amount of affected rows or boolean false if no read connection is present.
36
+ * @param array $shipments structure: Array(
37
+ * [0] => Array(
38
+ * 'order_id' => SALES_ORDER_ID,
39
+ * 'shipment_id' => SALES_SHIPMENT_ID
40
+ * )
41
+ * )
42
+ * @return bool|int
43
+ */
44
+ public function addMultipleShipments(array $shipments) {
45
+ $read = $this->getReadConnection();
46
+ if($read) {
47
+ return $read->insertMultiple($this->getMainTable(), $shipments);
48
+ }
49
+
50
+ return false;
51
+ }
52
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment/Collection.php CHANGED
@@ -1,32 +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_Order_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
24
- {
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/order_shipment');
31
- }
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_Order_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
24
+ {
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/order_shipment');
31
+ }
32
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices.php CHANGED
@@ -1,33 +1,33 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Prices extends Mage_Core_Model_Resource_Db_Abstract {
24
-
25
- /**
26
- * Model Initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/prices', 'price_id');
31
- $this->_isPkAutoIncrement = false;
32
- }
33
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Prices extends Mage_Core_Model_Resource_Db_Abstract {
24
+
25
+ /**
26
+ * Model Initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/prices', 'price_id');
31
+ $this->_isPkAutoIncrement = false;
32
+ }
33
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices/Collection.php CHANGED
@@ -1,32 +1,32 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Prices_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
-
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/prices');
31
- }
32
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Prices_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
+
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/prices');
31
+ }
32
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration.php CHANGED
@@ -1,98 +1,98 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Registration extends Mage_Core_Model_Resource_Db_Abstract {
24
-
25
- const SECURITY_TOKEN = 'securityToken';
26
- const SHOP_ID = 'shopId';
27
-
28
- /**
29
- * Model Initialization
30
- *
31
- */
32
- protected function _construct() {
33
- $this->_init('channelpilot/registration', 'shopId');
34
- $this->_isPkAutoIncrement = false;
35
- }
36
-
37
- /**
38
- * Get the exploded value from ips_authorized for a value via a given field.
39
- * @param string $value
40
- * @param string $field
41
- * @return array
42
- */
43
- protected function _getAllowedIpsViaField($value, $field = self::SECURITY_TOKEN) {
44
- if($field == self::SECURITY_TOKEN || $field == self::SHOP_ID) {
45
- $read = $this->getReadConnection();
46
- if($read) {
47
- $query = $read->select()
48
- ->from($this->getMainTable(), array('ips_authorized'))
49
- ->where($read->quoteIdentifier($field). ' = ?', $value);
50
-
51
- $result = $read->fetchRow($query);
52
-
53
- if(!empty($result)) {
54
- return explode(';', $result['ips_authorized']);
55
- }
56
- }
57
- }
58
- return array();
59
- }
60
-
61
- /**
62
- * Get all ips_authorized via a given security token.
63
- * @param string $securityToken
64
- * @return array
65
- */
66
- public function getAllowedIpsViaSecurityToken($securityToken) {
67
- return $this->_getAllowedIpsViaField($securityToken);
68
- }
69
-
70
- /**
71
- * Get all ips_authorized via a shopId.
72
- * @param string $securityToken
73
- * @return array
74
- */
75
- public function getAllowedIpsViaShopId($shopId) {
76
- return $this->_getAllowedIpsViaField($shopId, self::SHOP_ID);
77
- }
78
-
79
- /**
80
- * Checks if the given $ip is authorized.
81
- * @param string $ip
82
- * @return bool
83
- */
84
- public function isIpAuthorized($ip) {
85
- $read = $this->getReadConnection();
86
- if($read) {
87
- $select = $read->select()
88
- ->from($this->getMainTable())
89
- ->where('ips_authorized LIKE ' .$read->quote('%'.$ip.'%'));
90
-
91
- $result = $read->fetchAll($select);
92
- if(!empty($result)) {
93
- return true;
94
- }
95
- }
96
- return false;
97
- }
98
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Registration extends Mage_Core_Model_Resource_Db_Abstract {
24
+
25
+ const SECURITY_TOKEN = 'securityToken';
26
+ const SHOP_ID = 'shopId';
27
+
28
+ /**
29
+ * Model Initialization
30
+ *
31
+ */
32
+ protected function _construct() {
33
+ $this->_init('channelpilot/registration', 'shopId');
34
+ $this->_isPkAutoIncrement = false;
35
+ }
36
+
37
+ /**
38
+ * Get the exploded value from ips_authorized for a value via a given field.
39
+ * @param string $value
40
+ * @param string $field
41
+ * @return array
42
+ */
43
+ protected function _getAllowedIpsViaField($value, $field = self::SECURITY_TOKEN) {
44
+ if($field == self::SECURITY_TOKEN || $field == self::SHOP_ID) {
45
+ $read = $this->getReadConnection();
46
+ if($read) {
47
+ $query = $read->select()
48
+ ->from($this->getMainTable(), array('ips_authorized'))
49
+ ->where($read->quoteIdentifier($field). ' = ?', $value);
50
+
51
+ $result = $read->fetchRow($query);
52
+
53
+ if(!empty($result)) {
54
+ return explode(';', $result['ips_authorized']);
55
+ }
56
+ }
57
+ }
58
+ return array();
59
+ }
60
+
61
+ /**
62
+ * Get all ips_authorized via a given security token.
63
+ * @param string $securityToken
64
+ * @return array
65
+ */
66
+ public function getAllowedIpsViaSecurityToken($securityToken) {
67
+ return $this->_getAllowedIpsViaField($securityToken);
68
+ }
69
+
70
+ /**
71
+ * Get all ips_authorized via a shopId.
72
+ * @param string $securityToken
73
+ * @return array
74
+ */
75
+ public function getAllowedIpsViaShopId($shopId) {
76
+ return $this->_getAllowedIpsViaField($shopId, self::SHOP_ID);
77
+ }
78
+
79
+ /**
80
+ * Checks if the given $ip is authorized.
81
+ * @param string $ip
82
+ * @return bool
83
+ */
84
+ public function isIpAuthorized($ip) {
85
+ $read = $this->getReadConnection();
86
+ if($read) {
87
+ $select = $read->select()
88
+ ->from($this->getMainTable())
89
+ ->where('ips_authorized LIKE ' .$read->quote('%'.$ip.'%'));
90
+
91
+ $result = $read->fetchAll($select);
92
+ if(!empty($result)) {
93
+ return true;
94
+ }
95
+ }
96
+ return false;
97
+ }
98
  }
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration/Collection.php CHANGED
@@ -1,32 +1,32 @@
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
- class Channelpilotsolutions_Channelpilot_Model_Resource_Registration_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
-
25
- /**
26
- * Model initialization
27
- *
28
- */
29
- protected function _construct() {
30
- $this->_init('channelpilot/registration');
31
- }
32
  }
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
+ class Channelpilotsolutions_Channelpilot_Model_Resource_Registration_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
24
+
25
+ /**
26
+ * Model initialization
27
+ *
28
+ */
29
+ protected function _construct() {
30
+ $this->_init('channelpilot/registration');
31
+ }
32
  }
app/code/community/Channelpilotsolutions/Channelpilot/controllers/IndexController.php CHANGED
@@ -1,37 +1,37 @@
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
- * @subpackage controllers
19
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
- * @author Peter Hoffmann <info@channelpilot.com>
21
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
- * @link http://www.channelpilot.com
23
- */
24
- class Channelpilotsolutions_Channelpilot_IndexController extends Mage_Core_Controller_Front_Action {
25
-
26
- public function indexAction() {
27
- if ($this->getRequest()->getParam('method', false)) {
28
- Mage::helper('channelpilot')->api();
29
- } else {
30
- Mage::helper('channelpilot')->createXml();
31
- }
32
- $this->getResponse()->setRedirect(Mage::app()->getStore()->getBaseUrl());
33
- }
34
-
35
- }
36
-
37
  ?>
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
+ * @subpackage controllers
19
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
20
+ * @author Peter Hoffmann <info@channelpilot.com>
21
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
22
+ * @link http://www.channelpilot.com
23
+ */
24
+ class Channelpilotsolutions_Channelpilot_IndexController extends Mage_Core_Controller_Front_Action {
25
+
26
+ public function indexAction() {
27
+ if ($this->getRequest()->getParam('method', false)) {
28
+ Mage::helper('channelpilot')->api();
29
+ } else {
30
+ Mage::helper('channelpilot')->createXml();
31
+ }
32
+ $this->getResponse()->setRedirect(Mage::app()->getStore()->getBaseUrl());
33
+ }
34
+
35
+ }
36
+
37
  ?>
app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml CHANGED
@@ -1,61 +1,61 @@
1
- <?xml version="1.0"?><!--
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
- * @subpackage etc
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
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">
34
- <title>channelpilot_general Section</title>
35
- <sort_order>100</sort_order>
36
- </channelpilot_general>
37
- <channelpilot_tracking translate="title" module="channelpilot">
38
- <title>channelpilot_tracking Section</title>
39
- <sort_order>200</sort_order>
40
- </channelpilot_tracking>
41
- <channelpilot_export translate="title" module="channelpilot">
42
- <title>channelpilot_export Section</title>
43
- <sort_order>300</sort_order>
44
- </channelpilot_export>
45
- <channelpilot_marketplace translate="title" module="channelpilot">
46
- <title>channelpilot_marketplace Section</title>
47
- <sort_order>400</sort_order>
48
- </channelpilot_marketplace>
49
- <channelpilot_pricecontrol translate="title" module="channelpilot">
50
- <title>channelpilot_pricecontrol Section</title>
51
- <sort_order>500</sort_order>
52
- </channelpilot_pricecontrol>
53
- </children>
54
- </config>
55
- </children>
56
- </system>
57
- </children>
58
- </admin>
59
- </resources>
60
- </acl>
61
  </config>
1
+ <?xml version="1.0"?><!--
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
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
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">
34
+ <title>channelpilot_general Section</title>
35
+ <sort_order>100</sort_order>
36
+ </channelpilot_general>
37
+ <channelpilot_tracking translate="title" module="channelpilot">
38
+ <title>channelpilot_tracking Section</title>
39
+ <sort_order>200</sort_order>
40
+ </channelpilot_tracking>
41
+ <channelpilot_export translate="title" module="channelpilot">
42
+ <title>channelpilot_export Section</title>
43
+ <sort_order>300</sort_order>
44
+ </channelpilot_export>
45
+ <channelpilot_marketplace translate="title" module="channelpilot">
46
+ <title>channelpilot_marketplace Section</title>
47
+ <sort_order>400</sort_order>
48
+ </channelpilot_marketplace>
49
+ <channelpilot_pricecontrol translate="title" module="channelpilot">
50
+ <title>channelpilot_pricecontrol Section</title>
51
+ <sort_order>500</sort_order>
52
+ </channelpilot_pricecontrol>
53
+ </children>
54
+ </config>
55
+ </children>
56
+ </system>
57
+ </children>
58
+ </admin>
59
+ </resources>
60
+ </acl>
61
  </config>
app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml CHANGED
@@ -1,183 +1,183 @@
1
- <?xml version="1.0"?><!--
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
- * @subpackage etc
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
22
- */
23
- -->
24
- <config>
25
- <modules>
26
- <Channelpilotsolutions_Channelpilot>
27
- <version>2.2.2</version>
28
- </Channelpilotsolutions_Channelpilot>
29
- </modules>
30
- <global>
31
- <models>
32
- <channelpilot_adminhtml>
33
- <class>Channelpilotsolutions_Channelpilot_Adminhtml_Model</class>
34
- </channelpilot_adminhtml>
35
- <channelpilot>
36
- <class>Channelpilotsolutions_Channelpilot_Model</class>
37
- <resourceModel>channelpilot_resource</resourceModel>
38
- </channelpilot>
39
- <channelpilot_resource>
40
- <class>Channelpilotsolutions_Channelpilot_Model_Resource</class>
41
- <entities>
42
- <registration>
43
- <table>cp_registration</table>
44
- </registration>
45
- <order>
46
- <table>cp_marketplace_orders</table>
47
- </order>
48
- <order_item>
49
- <table>cp_marketplace_order_items</table>
50
- </order_item>
51
- <order_shipment>
52
- <table>cp_marketplace_order_shipment</table>
53
- </order_shipment>
54
- <prices>
55
- <table>cp_prices</table>
56
- </prices>
57
- <logs>
58
- <table>cp_logging</table>
59
- </logs>
60
- </entities>
61
- </channelpilot_resource>
62
- </models>
63
- <resources>
64
- <default_setup>
65
- <connection>
66
- <charset>utf8</charset>
67
- </connection>
68
- </default_setup>
69
- <channelpilot_setup>
70
- <setup>
71
- <module>Channelpilotsolutions_Channelpilot</module>
72
- </setup>
73
- <connection>
74
- <charset>utf8</charset>
75
- <use>core_setup</use>
76
- </connection>
77
- </channelpilot_setup>
78
- </resources>
79
- <extraconfig />
80
- <blocks>
81
- <channelpilot_core>
82
- <class>Channelpilotsolutions_Channelpilot_Block</class>
83
- </channelpilot_core>
84
- </blocks>
85
- <helpers>
86
- <channelpilot>
87
- <class>Channelpilotsolutions_Channelpilot_Helper</class>
88
- </channelpilot>
89
- </helpers>
90
- </global>
91
- <adminhtml>
92
- <translate>
93
- <modules>
94
- <Channelpilotsolutions_Channelpilot>
95
- <files>
96
- <default>Channelpilotsolutions_Channelpilot.csv</default>
97
- </files>
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>
111
- <channelpilot>
112
- <use>standard</use>
113
- <args>
114
- <module>Channelpilotsolutions_Channelpilot</module>
115
- <frontName>channelpilot</frontName>
116
- </args>
117
- </channelpilot>
118
- </routers>
119
- <layout>
120
- <updates>
121
- <channelpilotsolutions_channelpilot>
122
- <file>Channelpilotsolutions/channelpilot.xml</file>
123
- </channelpilotsolutions_channelpilot>
124
- </updates>
125
- </layout>
126
- </frontend>
127
- <default>
128
- <payment>
129
- <cp_mp>
130
- <active>0</active>
131
- <model>channelpilot/payment</model>
132
- <order_status>processing</order_status>
133
- <payment_action>authorize</payment_action>
134
- <allowspecific>0</allowspecific>
135
- <email_customer>0</email_customer>
136
- <title>ChannelPilot Marketplace Payment</title>
137
- </cp_mp>
138
- </payment>
139
- <carriers>
140
- <cpshipping>
141
- <active>0</active>
142
- <backend_only>1</backend_only>
143
- <price>0.0</price>
144
- <sallowspecific>0</sallowspecific>
145
- <model>channelpilot/carrier_cpshipping</model>
146
- <name>ChannelPilot Shipping</name>
147
- <title>ChannelPilot Shipping</title>
148
- <specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>
149
- </cpshipping>
150
- </carriers>
151
- <channelpilot_general>
152
- <channelpilot_general>
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>
159
- <channelpilot_tracking>
160
- <channelpilot_useTracking>0</channelpilot_useTracking>
161
- <method>2</method>
162
- <channelpilot_cookiemode>last</channelpilot_cookiemode>
163
- </channelpilot_tracking>
164
- </channelpilot_tracking>
165
- <channelpilot_export>
166
- <channelpilot_productfeed>
167
- <channelpilot_useExport>0</channelpilot_useExport>
168
- </channelpilot_productfeed>
169
- </channelpilot_export>
170
- <channelpilot_marketplace>
171
- <channelpilot_marketplace>
172
- <channelpilot_useMarketplaces>0</channelpilot_useMarketplaces>
173
- </channelpilot_marketplace>
174
- </channelpilot_marketplace>
175
- <channelpilot_pricecontrol>
176
- <channelpilot_general>
177
- <channelpilot_usePricecontrol>0</channelpilot_usePricecontrol>
178
- <channelpilot_saveGrossOrNetPrices>gross</channelpilot_saveGrossOrNetPrices>
179
- <channelpilot_generalPriceField>price</channelpilot_generalPriceField>
180
- </channelpilot_general>
181
- </channelpilot_pricecontrol>
182
- </default>
183
  </config>
1
+ <?xml version="1.0"?><!--
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
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Channelpilot>
27
+ <version>2.2.3</version>
28
+ </Channelpilotsolutions_Channelpilot>
29
+ </modules>
30
+ <global>
31
+ <models>
32
+ <channelpilot_adminhtml>
33
+ <class>Channelpilotsolutions_Channelpilot_Adminhtml_Model</class>
34
+ </channelpilot_adminhtml>
35
+ <channelpilot>
36
+ <class>Channelpilotsolutions_Channelpilot_Model</class>
37
+ <resourceModel>channelpilot_resource</resourceModel>
38
+ </channelpilot>
39
+ <channelpilot_resource>
40
+ <class>Channelpilotsolutions_Channelpilot_Model_Resource</class>
41
+ <entities>
42
+ <registration>
43
+ <table>cp_registration</table>
44
+ </registration>
45
+ <order>
46
+ <table>cp_marketplace_orders</table>
47
+ </order>
48
+ <order_item>
49
+ <table>cp_marketplace_order_items</table>
50
+ </order_item>
51
+ <order_shipment>
52
+ <table>cp_marketplace_order_shipment</table>
53
+ </order_shipment>
54
+ <prices>
55
+ <table>cp_prices</table>
56
+ </prices>
57
+ <logs>
58
+ <table>cp_logging</table>
59
+ </logs>
60
+ </entities>
61
+ </channelpilot_resource>
62
+ </models>
63
+ <resources>
64
+ <default_setup>
65
+ <connection>
66
+ <charset>utf8</charset>
67
+ </connection>
68
+ </default_setup>
69
+ <channelpilot_setup>
70
+ <setup>
71
+ <module>Channelpilotsolutions_Channelpilot</module>
72
+ </setup>
73
+ <connection>
74
+ <charset>utf8</charset>
75
+ <use>core_setup</use>
76
+ </connection>
77
+ </channelpilot_setup>
78
+ </resources>
79
+ <extraconfig />
80
+ <blocks>
81
+ <channelpilot_core>
82
+ <class>Channelpilotsolutions_Channelpilot_Block</class>
83
+ </channelpilot_core>
84
+ </blocks>
85
+ <helpers>
86
+ <channelpilot>
87
+ <class>Channelpilotsolutions_Channelpilot_Helper</class>
88
+ </channelpilot>
89
+ </helpers>
90
+ </global>
91
+ <adminhtml>
92
+ <translate>
93
+ <modules>
94
+ <Channelpilotsolutions_Channelpilot>
95
+ <files>
96
+ <default>Channelpilotsolutions_Channelpilot.csv</default>
97
+ </files>
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>
111
+ <channelpilot>
112
+ <use>standard</use>
113
+ <args>
114
+ <module>Channelpilotsolutions_Channelpilot</module>
115
+ <frontName>channelpilot</frontName>
116
+ </args>
117
+ </channelpilot>
118
+ </routers>
119
+ <layout>
120
+ <updates>
121
+ <channelpilotsolutions_channelpilot>
122
+ <file>Channelpilotsolutions/channelpilot.xml</file>
123
+ </channelpilotsolutions_channelpilot>
124
+ </updates>
125
+ </layout>
126
+ </frontend>
127
+ <default>
128
+ <payment>
129
+ <cp_mp>
130
+ <active>0</active>
131
+ <model>channelpilot/payment</model>
132
+ <order_status>processing</order_status>
133
+ <payment_action>authorize</payment_action>
134
+ <allowspecific>0</allowspecific>
135
+ <email_customer>0</email_customer>
136
+ <title>ChannelPilot Marketplace Payment</title>
137
+ </cp_mp>
138
+ </payment>
139
+ <carriers>
140
+ <cpshipping>
141
+ <active>0</active>
142
+ <backend_only>1</backend_only>
143
+ <price>0.0</price>
144
+ <sallowspecific>0</sallowspecific>
145
+ <model>channelpilot/carrier_cpshipping</model>
146
+ <name>ChannelPilot Shipping</name>
147
+ <title>ChannelPilot Shipping</title>
148
+ <specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>
149
+ </cpshipping>
150
+ </carriers>
151
+ <channelpilot_general>
152
+ <channelpilot_general>
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>
159
+ <channelpilot_tracking>
160
+ <channelpilot_useTracking>0</channelpilot_useTracking>
161
+ <method>2</method>
162
+ <channelpilot_cookiemode>last</channelpilot_cookiemode>
163
+ </channelpilot_tracking>
164
+ </channelpilot_tracking>
165
+ <channelpilot_export>
166
+ <channelpilot_productfeed>
167
+ <channelpilot_useExport>0</channelpilot_useExport>
168
+ </channelpilot_productfeed>
169
+ </channelpilot_export>
170
+ <channelpilot_marketplace>
171
+ <channelpilot_marketplace>
172
+ <channelpilot_useMarketplaces>0</channelpilot_useMarketplaces>
173
+ </channelpilot_marketplace>
174
+ </channelpilot_marketplace>
175
+ <channelpilot_pricecontrol>
176
+ <channelpilot_general>
177
+ <channelpilot_usePricecontrol>0</channelpilot_usePricecontrol>
178
+ <channelpilot_saveGrossOrNetPrices>gross</channelpilot_saveGrossOrNetPrices>
179
+ <channelpilot_generalPriceField>price</channelpilot_generalPriceField>
180
+ </channelpilot_general>
181
+ </channelpilot_pricecontrol>
182
+ </default>
183
  </config>
app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml CHANGED
@@ -1,576 +1,576 @@
1
- <?xml version="1.0"?><!--
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
- * @subpackage etc
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
22
- */
23
- -->
24
- <config>
25
- <tabs>
26
- <channelpilot_config translate="label" module="channelpilot">
27
- <!--<label>Channelpilot</label>-->
28
- <label><![CDATA[<div style="overflow:hidden; background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');background-size: 150px; background-repeat: no-repeat; background-position: -4px -9px;"><div style="display:block; height: 20px;"></div></div>]]></label>
29
- <class>tab-channelpilot</class>
30
- <sort_order>401</sort_order>
31
- </channelpilot_config>
32
- </tabs>
33
- <sections>
34
- <channelpilot_general translate="label" module="channelpilot">
35
- <label>CP General</label>
36
- <tab>channelpilot_config</tab>
37
- <frontend_type>text</frontend_type>
38
- <sort_order>1000</sort_order>
39
- <show_in_default>1</show_in_default>
40
- <show_in_website>1</show_in_website>
41
- <show_in_store>1</show_in_store>
42
- <groups>
43
- <hint>
44
- <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
45
- <sort_order>0</sort_order>
46
- <show_in_default>1</show_in_default>
47
- <show_in_website>1</show_in_website>
48
- <show_in_store>1</show_in_store>
49
- </hint>
50
- <channelpilot_general translate="label">
51
- <label>CP General Settings</label>
52
- <frontend_type>text</frontend_type>
53
- <expanded>1</expanded>
54
- <sort_order>1</sort_order>
55
- <show_in_default>1</show_in_default>
56
- <show_in_website>1</show_in_website>
57
- <show_in_store>1</show_in_store>
58
- <fields>
59
- <channelpilot_useNews>
60
- <label>CP Activate backendnews?</label>
61
- <frontend_type>select</frontend_type>
62
- <source_model>adminhtml/system_config_source_yesno</source_model>
63
- <sort_order>1</sort_order>
64
- <show_in_default>1</show_in_default>
65
- <show_in_website>1</show_in_website>
66
- <show_in_store>1</show_in_store>
67
- </channelpilot_useNews>
68
- <channelpilot_checkIp>
69
- <label>CP Should the IP for API access be checked?</label>
70
- <frontend_type>select</frontend_type>
71
- <source_model>adminhtml/system_config_source_yesno</source_model>
72
- <sort_order>2</sort_order>
73
- <show_in_default>1</show_in_default>
74
- <show_in_website>1</show_in_website>
75
- <show_in_store>1</show_in_store>
76
- </channelpilot_checkIp>
77
- <channelpilot_articlenumber>
78
- <label>CP Articlenumber</label>
79
- <comment>CP This applies to the tracking as well as the marketplace integration or the repricing.</comment>
80
- <frontend_type>select</frontend_type>
81
- <source_model>channelpilot_adminhtml/articlenumber_values</source_model>
82
- <sort_order>3</sort_order>
83
- <show_in_default>1</show_in_default>
84
- <show_in_website>1</show_in_website>
85
- <show_in_store>1</show_in_store>
86
- </channelpilot_articlenumber>
87
- </fields>
88
- </channelpilot_general>
89
- </groups>
90
- </channelpilot_general>
91
- <channelpilot_tracking translate="label" module="channelpilot">
92
- <label>CP Tracking</label>
93
- <tab>channelpilot_config</tab>
94
- <frontend_type>text</frontend_type>
95
- <sort_order>2000</sort_order>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>1</show_in_website>
98
- <show_in_store>1</show_in_store>
99
- <groups>
100
- <hint>
101
- <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
102
- <sort_order>0</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <show_in_website>1</show_in_website>
105
- <show_in_store>1</show_in_store>
106
- </hint>
107
- <channelpilot_tracking translate="label">
108
- <label>CP Tracking Settings</label>
109
- <frontend_type>text</frontend_type>
110
- <expanded>1</expanded>
111
- <sort_order>2</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>1</show_in_store>
115
- <fields>
116
- <channelpilot_useTracking>
117
- <label>CP Activate?</label>
118
- <frontend_type>select</frontend_type>
119
- <source_model>adminhtml/system_config_source_yesno</source_model>
120
- <sort_order>0</sort_order>
121
- <show_in_default>1</show_in_default>
122
- <show_in_website>1</show_in_website>
123
- <show_in_store>1</show_in_store>
124
- </channelpilot_useTracking>
125
- <method>
126
- <label>CP Tracking Method</label>
127
- <frontend_type>select</frontend_type>
128
- <source_model>channelpilot/adminhtml_source_trackingmethod</source_model>
129
- <sort_order>5</sort_order>
130
- <show_in_default>1</show_in_default>
131
- <show_in_website>1</show_in_website>
132
- <show_in_store>1</show_in_store>
133
- </method>
134
- <channelpilot_cookiemode>
135
- <label>CP Cookiemode</label>
136
- <frontend_type>select</frontend_type>
137
- <source_model>channelpilot_adminhtml/cookiemode_values</source_model>
138
- <sort_order>10</sort_order>
139
- <show_in_default>1</show_in_default>
140
- <show_in_website>1</show_in_website>
141
- <show_in_store>1</show_in_store>
142
- </channelpilot_cookiemode>
143
- <channelpilot_trackingkeys>
144
- <label>CP Trackingkeys</label>
145
- <frontend_model>channelpilot_core/adminhtml_field_trackingkeys</frontend_model>
146
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
147
- <sort_order>20</sort_order>
148
- <show_in_default>1</show_in_default>
149
- <show_in_website>1</show_in_website>
150
- <show_in_store>1</show_in_store>
151
- </channelpilot_trackingkeys>
152
- </fields>
153
- </channelpilot_tracking>
154
- </groups>
155
- </channelpilot_tracking>
156
- <channelpilot_export translate="label" module="channelpilot">
157
- <label>CP Data Feed Export</label>
158
- <tab>channelpilot_config</tab>
159
- <frontend_type>text</frontend_type>
160
- <sort_order>3000</sort_order>
161
- <show_in_default>1</show_in_default>
162
- <show_in_website>1</show_in_website>
163
- <show_in_store>1</show_in_store>
164
- <groups>
165
- <hint>
166
- <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
167
- <sort_order>0</sort_order>
168
- <show_in_default>1</show_in_default>
169
- <show_in_website>1</show_in_website>
170
- <show_in_store>1</show_in_store>
171
- </hint>
172
- <channelpilot_productfeed translate="label">
173
- <label>CP Export Settings</label>
174
- <frontend_type>text</frontend_type>
175
- <expanded>1</expanded>
176
- <sort_order>1</sort_order>
177
- <show_in_default>1</show_in_default>
178
- <show_in_website>1</show_in_website>
179
- <show_in_store>1</show_in_store>
180
- <fields>
181
- <channelpilot_useExport>
182
- <label>CP Activate?</label>
183
- <frontend_type>select</frontend_type>
184
- <source_model>adminhtml/system_config_source_yesno</source_model>
185
- <sort_order>0</sort_order>
186
- <show_in_default>1</show_in_default>
187
- <show_in_website>1</show_in_website>
188
- <show_in_store>1</show_in_store>
189
- </channelpilot_useExport>
190
- <channelpilot_password translate="label">
191
- <label>CP Password</label>
192
- <comment>CP Protect your data feed with a password. For example: 'www.testshop.com/channelpilot?password=12345'</comment>
193
- <frontend_type>password</frontend_type>
194
- <sort_order>1</sort_order>
195
- <show_in_default>1</show_in_default>
196
- <show_in_website>1</show_in_website>
197
- <show_in_store>1</show_in_store>
198
- </channelpilot_password>
199
- <channelpilot_exportfields>
200
- <label>CP Select data fields</label>
201
- <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>
202
- <frontend_model>channelpilot_core/adminhtml_field_exportfields</frontend_model>
203
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
204
- <sort_order>2</sort_order>
205
- <show_in_default>1</show_in_default>
206
- <show_in_website>1</show_in_website>
207
- <show_in_store>1</show_in_store>
208
- </channelpilot_exportfields>
209
- <channelpilot_specialexportfields>
210
- <label>CP Create static data fields</label>
211
- <comment>CP Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.</comment>
212
- <frontend_model>channelpilot_core/adminhtml_field_specialfields</frontend_model>
213
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
214
- <sort_order>3</sort_order>
215
- <show_in_default>1</show_in_default>
216
- <show_in_website>1</show_in_website>
217
- <show_in_store>1</show_in_store>
218
- </channelpilot_specialexportfields>
219
- <channelpilot_replacefields>
220
- <label>CP Product variant data fields</label>
221
- <comment>CP Select the data fields you want to be overwritten by the respective value of the parent article.</comment>
222
- <frontend_model>channelpilot_core/adminhtml_field_replacefields</frontend_model>
223
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
224
- <sort_order>4</sort_order>
225
- <show_in_default>1</show_in_default>
226
- <show_in_website>1</show_in_website>
227
- <show_in_store>1</show_in_store>
228
- </channelpilot_replacefields>
229
- <channelpilot_imagenumber>
230
- <label>CP Number additional productimages</label>
231
- <comment>CP How many additional productimages should be exported?</comment>
232
- <frontend_type>select</frontend_type>
233
- <source_model>channelpilot_adminhtml/imagenumber_values</source_model>
234
- <sort_order>5</sort_order>
235
- <show_in_default>1</show_in_default>
236
- <show_in_website>1</show_in_website>
237
- <show_in_store>1</show_in_store>
238
- </channelpilot_imagenumber>
239
- </fields>
240
- </channelpilot_productfeed>
241
- </groups>
242
- </channelpilot_export>
243
- <channelpilot_marketplace translate="label" module="channelpilot">
244
- <label>CP Marketplace Integration</label>
245
- <tab>channelpilot_config</tab>
246
- <frontend_type>text</frontend_type>
247
- <sort_order>4000</sort_order>
248
- <show_in_default>1</show_in_default>
249
- <show_in_website>1</show_in_website>
250
- <show_in_store>1</show_in_store>
251
- <groups>
252
- <hint>
253
- <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
254
- <sort_order>0</sort_order>
255
- <show_in_default>1</show_in_default>
256
- <show_in_website>1</show_in_website>
257
- <show_in_store>1</show_in_store>
258
- </hint>
259
- <channelpilot_marketplace translate="label">
260
- <label>CP Marketplace Integration Settings</label>
261
- <frontend_type>text</frontend_type>
262
- <expanded>1</expanded>
263
- <sort_order>3</sort_order>
264
- <show_in_default>1</show_in_default>
265
- <show_in_website>1</show_in_website>
266
- <show_in_store>1</show_in_store>
267
- <fields>
268
- <channelpilot_useMarketplaces>
269
- <label>CP Activate?</label>
270
- <frontend_type>select</frontend_type>
271
- <source_model>adminhtml/system_config_source_yesno</source_model>
272
- <sort_order>0</sort_order>
273
- <show_in_default>1</show_in_default>
274
- <show_in_website>1</show_in_website>
275
- <show_in_store>1</show_in_store>
276
- </channelpilot_useMarketplaces>
277
- <channelpilot_orderStatusImportedPayed>
278
- <label>CP OrderStatus Imported (payed)?</label>
279
- <frontend_type>select</frontend_type>
280
- <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
281
- <sort_order>1</sort_order>
282
- <show_in_default>1</show_in_default>
283
- <show_in_website>1</show_in_website>
284
- <show_in_store>1</show_in_store>
285
- </channelpilot_orderStatusImportedPayed>
286
- <channelpilot_orderStatusImportedUnpayed>
287
- <label>CP OrderStatus Imported (unpayed)?</label>
288
- <frontend_type>select</frontend_type>
289
- <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
290
- <sort_order>2</sort_order>
291
- <show_in_default>1</show_in_default>
292
- <show_in_website>1</show_in_website>
293
- <show_in_store>1</show_in_store>
294
- </channelpilot_orderStatusImportedUnpayed>
295
- <!-- <channelpilot_orderStatusPayed>
296
- <label>CP OrderStatus Payed?</label>
297
- <frontend_type>select</frontend_type>
298
- <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
299
- <sort_order>3</sort_order>
300
- <show_in_default>1</show_in_default>
301
- <show_in_website>1</show_in_website>
302
- <show_in_store>1</show_in_store>
303
- </channelpilot_orderStatusPayed>
304
- <channelpilot_orderStatusCancelled>
305
- <label>CP OrderStatus Cancelled?</label>
306
- <frontend_type>select</frontend_type>
307
- <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
308
- <sort_order>4</sort_order>
309
- <show_in_default>1</show_in_default>
310
- <show_in_website>1</show_in_website>
311
- <show_in_store>1</show_in_store>
312
- </channelpilot_orderStatusCancelled>
313
- <channelpilot_orderStatusDeliveried>
314
- <label>CP OrderStatus Deliveried?</label>
315
- <frontend_type>select</frontend_type>
316
- <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
317
- <sort_order>5</sort_order>
318
- <show_in_default>1</show_in_default>
319
- <show_in_website>1</show_in_website>
320
- <show_in_store>1</show_in_store>
321
- </channelpilot_orderStatusDeliveried>-->
322
- </fields>
323
- </channelpilot_marketplace>
324
- </groups>
325
- </channelpilot_marketplace>
326
- <channelpilot_pricecontrol translate="label" module="channelpilot">
327
- <label>CP Repricing</label>
328
- <tab>channelpilot_config</tab>
329
- <frontend_type>text</frontend_type>
330
- <sort_order>5000</sort_order>
331
- <show_in_default>1</show_in_default>
332
- <show_in_website>1</show_in_website>
333
- <show_in_store>1</show_in_store>
334
- <groups>
335
- <hint>
336
- <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
337
- <sort_order>0</sort_order>
338
- <show_in_default>1</show_in_default>
339
- <show_in_website>1</show_in_website>
340
- <show_in_store>1</show_in_store>
341
- </hint>
342
- <channelpilot_general translate="label">
343
- <label>CP Repricing Settings</label>
344
- <frontend_type>text</frontend_type>
345
- <expanded>1</expanded>
346
- <sort_order>1</sort_order>
347
- <show_in_default>1</show_in_default>
348
- <show_in_website>1</show_in_website>
349
- <show_in_store>1</show_in_store>
350
- <fields>
351
- <channelpilot_usePricecontrol>
352
- <label>CP Activate?</label>
353
- <frontend_type>select</frontend_type>
354
- <source_model>adminhtml/system_config_source_yesno</source_model>
355
- <sort_order>0</sort_order>
356
- <show_in_default>1</show_in_default>
357
- <show_in_website>1</show_in_website>
358
- <show_in_store>1</show_in_store>
359
- </channelpilot_usePricecontrol>
360
- <channelpilot_saveGrossOrNetPrices>
361
- <label>CP Save prices net or gross?</label>
362
- <frontend_type>select</frontend_type>
363
- <source_model>channelpilot_adminhtml/grossnet_values</source_model>
364
- <sort_order>1</sort_order>
365
- <show_in_default>1</show_in_default>
366
- <show_in_website>1</show_in_website>
367
- <show_in_store>1</show_in_store>
368
- </channelpilot_saveGrossOrNetPrices>
369
- </fields>
370
- </channelpilot_general>
371
- <general_prices translate="label">
372
- <label>CP General Repricing</label>
373
- <frontend_type>text</frontend_type>
374
- <expanded>1</expanded>
375
- <sort_order>2</sort_order>
376
- <show_in_default>1</show_in_default>
377
- <show_in_website>1</show_in_website>
378
- <show_in_store>1</show_in_store>
379
- <fields>
380
- <!-- <channelpilot_usePricecontrol>
381
- <label>Active</label>
382
- <frontend_type>select</frontend_type>
383
- <source_model>channelpilot_adminhtml/truefalse_values</source_model>
384
- <sort_order>0</sort_order>
385
- <show_in_default>1</show_in_default>
386
- <show_in_website>1</show_in_website>
387
- <show_in_store>1</show_in_store>
388
- </channelpilot_usePricecontrol>-->
389
- <channelpilot_generalPriceField>
390
- <label>CP Field for price</label>
391
- <comment>CP This field would be overwritten by the new product price.</comment>
392
- <frontend_type>select</frontend_type>
393
- <source_model>channelpilot_adminhtml/pricefield_values</source_model>
394
- <sort_order>1</sort_order>
395
- <show_in_default>1</show_in_default>
396
- <show_in_website>1</show_in_website>
397
- <show_in_store>1</show_in_store>
398
- </channelpilot_generalPriceField>
399
- </fields>
400
- </general_prices>
401
- <!-- <campaign_prices translate="label">
402
- <label>Campaign Price Control</label>
403
- <frontend_type>text</frontend_type>
404
- <sort_order>3</sort_order>
405
- <show_in_default>1</show_in_default>
406
- <show_in_website>1</show_in_website>
407
- <show_in_store>1</show_in_store>
408
- <fields>
409
- <channelpilot_usePricecontrol>
410
- <label>Active</label>
411
- <frontend_type>select</frontend_type>
412
- <source_model>channelpilot_adminhtml/truefalse_values</source_model>
413
- <sort_order>0</sort_order>
414
- <show_in_default>1</show_in_default>
415
- <show_in_website>1</show_in_website>
416
- <show_in_store>1</show_in_store>
417
- </channelpilot_usePricecontrol>
418
- </fields>
419
- </campaign_prices>-->
420
- </groups>
421
- </channelpilot_pricecontrol>
422
- <payment>
423
- <groups>
424
- <cp_mp translate="label comment" module="channelpilot">
425
- <label>CP ChannelPilot-Payment</label>
426
- <expanded>1</expanded>
427
- <sort_order>670</sort_order>
428
- <show_in_default>1</show_in_default>
429
- <show_in_website>1</show_in_website>
430
- <show_in_store>0</show_in_store>
431
- <comment>CP !!!This is no real payment method!!!</comment>
432
- <fields>
433
- <title translate="label">
434
- <label>CP Title</label>
435
- <frontend_type>text</frontend_type>
436
- <sort_order>1</sort_order>
437
- <show_in_default>1</show_in_default>
438
- <show_in_website>1</show_in_website>
439
- <show_in_store>0</show_in_store>
440
- </title>
441
- <active translate="label">
442
- <label>CP Activate?</label>
443
- <frontend_type>select</frontend_type>
444
- <source_model>adminhtml/system_config_source_yesno</source_model>
445
- <sort_order>2</sort_order>
446
- <show_in_default>1</show_in_default>
447
- <show_in_website>1</show_in_website>
448
- <show_in_store>0</show_in_store>
449
- </active>
450
- <order_status translate="label">
451
- <label>CP Order Status</label>
452
- <frontend_type>select</frontend_type>
453
- <source_model>adminhtml/system_config_source_order_status_processing</source_model>
454
- <sort_order>3</sort_order>
455
- <show_in_default>1</show_in_default>
456
- <show_in_website>1</show_in_website>
457
- <show_in_store>0</show_in_store>
458
- </order_status>
459
- <types translate="label">
460
- <label>CP Payment Types</label>
461
- <frontend_type>multiselect</frontend_type>
462
- <source_model>channelpilot/paymenttypes</source_model>
463
- <sort_order>4</sort_order>
464
- <show_in_default>1</show_in_default>
465
- <show_in_website>1</show_in_website>
466
- <show_in_store>0</show_in_store>
467
- <can_be_empty>1</can_be_empty>
468
- </types>
469
- </fields>
470
- </cp_mp>
471
- </groups>
472
- </payment>
473
- <carriers>
474
- <groups>
475
- <cpshipping translate="label">
476
- <label>CP ChannelPilot - Shipping Method</label>
477
- <frontend_type>text</frontend_type>
478
- <sort_order>50</sort_order>
479
- <show_in_default>1</show_in_default>
480
- <show_in_website>1</show_in_website>
481
- <show_in_store>1</show_in_store>
482
- <fields>
483
- <active translate="label">
484
- <label>CP Enabled</label>
485
- <frontend_type>select</frontend_type>
486
- <source_model>adminhtml/system_config_source_yesno</source_model>
487
- <sort_order>10</sort_order>
488
- <show_in_default>1</show_in_default>
489
- <show_in_website>1</show_in_website>
490
- <show_in_store>1</show_in_store>
491
- </active>
492
- <backend_only translate="label">
493
- <label>CP Use for backend only</label>
494
- <frontend_type>select</frontend_type>
495
- <source_model>adminhtml/system_config_source_yesno</source_model>
496
- <sort_order>15</sort_order>
497
- <show_in_default>1</show_in_default>
498
- <show_in_website>1</show_in_website>
499
- <show_in_store>1</show_in_store>
500
- </backend_only>
501
- <title translate="label">
502
- <label>CP Title</label>
503
- <frontend_type>text</frontend_type>
504
- <sort_order>20</sort_order>
505
- <show_in_default>1</show_in_default>
506
- <show_in_website>1</show_in_website>
507
- <show_in_store>1</show_in_store>
508
- </title>
509
- <name translate="label">
510
- <label>CP Method Name</label>
511
- <frontend_type>text</frontend_type>
512
- <sort_order>30</sort_order>
513
- <show_in_default>1</show_in_default>
514
- <show_in_website>1</show_in_website>
515
- <show_in_store>1</show_in_store>
516
- </name>
517
- <price translate="label">
518
- <label>CP Price</label>
519
- <frontend_type>text</frontend_type>
520
- <validate>validate-number validate-zero-or-greater input-text</validate>
521
- <sort_order>35</sort_order>
522
- <show_in_default>1</show_in_default>
523
- <show_in_website>1</show_in_website>
524
- <show_in_store>1</show_in_store>
525
- </price>
526
- <sallowspecific translate="label">
527
- <label>CP Ship to Applicable Countries</label>
528
- <frontend_type>select</frontend_type>
529
- <sort_order>40</sort_order>
530
- <frontend_class>shipping-applicable-country</frontend_class>
531
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
532
- <show_in_default>1</show_in_default>
533
- <show_in_website>1</show_in_website>
534
- <show_in_store>1</show_in_store>
535
- </sallowspecific>
536
- <showmethod translate="label">
537
- <label>CP Show Method if Not Applicable</label>
538
- <frontend_type>select</frontend_type>
539
- <sort_order>41</sort_order>
540
- <source_model>adminhtml/system_config_source_yesno</source_model>
541
- <show_in_default>1</show_in_default>
542
- <show_in_website>1</show_in_website>
543
- <show_in_store>1</show_in_store>
544
- </showmethod>
545
- <specificcountry translate="label">
546
- <label>CP Ship to Specific Countries</label>
547
- <frontend_type>multiselect</frontend_type>
548
- <sort_order>42</sort_order>
549
- <source_model>adminhtml/system_config_source_country</source_model>
550
- <show_in_default>1</show_in_default>
551
- <show_in_website>1</show_in_website>
552
- <show_in_store>1</show_in_store>
553
- <can_be_empty>1</can_be_empty>
554
- </specificcountry>
555
- <specificerrmsg translate="label">
556
- <label>CP Displayed Error Message</label>
557
- <frontend_type>textarea</frontend_type>
558
- <sort_order>43</sort_order>
559
- <show_in_default>1</show_in_default>
560
- <show_in_website>1</show_in_website>
561
- <show_in_store>1</show_in_store>
562
- </specificerrmsg>
563
- <sort_order translate="label">
564
- <label>CP Sort Order</label>
565
- <frontend_type>text</frontend_type>
566
- <sort_order>50</sort_order>
567
- <show_in_default>1</show_in_default>
568
- <show_in_website>1</show_in_website>
569
- <show_in_store>1</show_in_store>
570
- </sort_order>
571
- </fields>
572
- </cpshipping>
573
- </groups>
574
- </carriers>
575
- </sections>
576
  </config>
1
+ <?xml version="1.0"?><!--
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
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <tabs>
26
+ <channelpilot_config translate="label" module="channelpilot">
27
+ <!--<label>Channelpilot</label>-->
28
+ <label><![CDATA[<div style="overflow:hidden; background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');background-size: 150px; background-repeat: no-repeat; background-position: -4px -9px;"><div style="display:block; height: 20px;"></div></div>]]></label>
29
+ <class>tab-channelpilot</class>
30
+ <sort_order>401</sort_order>
31
+ </channelpilot_config>
32
+ </tabs>
33
+ <sections>
34
+ <channelpilot_general translate="label" module="channelpilot">
35
+ <label>CP General</label>
36
+ <tab>channelpilot_config</tab>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>1000</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ <groups>
43
+ <hint>
44
+ <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
45
+ <sort_order>0</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </hint>
50
+ <channelpilot_general translate="label">
51
+ <label>CP General Settings</label>
52
+ <frontend_type>text</frontend_type>
53
+ <expanded>1</expanded>
54
+ <sort_order>1</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ <fields>
59
+ <channelpilot_useNews>
60
+ <label>CP Activate backendnews?</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <sort_order>1</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </channelpilot_useNews>
68
+ <channelpilot_checkIp>
69
+ <label>CP Should the IP for API access be checked?</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>2</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </channelpilot_checkIp>
77
+ <channelpilot_articlenumber>
78
+ <label>CP Articlenumber</label>
79
+ <comment>CP This applies to the tracking as well as the marketplace integration or the repricing.</comment>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>channelpilot_adminhtml/articlenumber_values</source_model>
82
+ <sort_order>3</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </channelpilot_articlenumber>
87
+ </fields>
88
+ </channelpilot_general>
89
+ </groups>
90
+ </channelpilot_general>
91
+ <channelpilot_tracking translate="label" module="channelpilot">
92
+ <label>CP Tracking</label>
93
+ <tab>channelpilot_config</tab>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>2000</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <groups>
100
+ <hint>
101
+ <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
102
+ <sort_order>0</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </hint>
107
+ <channelpilot_tracking translate="label">
108
+ <label>CP Tracking Settings</label>
109
+ <frontend_type>text</frontend_type>
110
+ <expanded>1</expanded>
111
+ <sort_order>2</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ <fields>
116
+ <channelpilot_useTracking>
117
+ <label>CP Activate?</label>
118
+ <frontend_type>select</frontend_type>
119
+ <source_model>adminhtml/system_config_source_yesno</source_model>
120
+ <sort_order>0</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </channelpilot_useTracking>
125
+ <method>
126
+ <label>CP Tracking Method</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>channelpilot/adminhtml_source_trackingmethod</source_model>
129
+ <sort_order>5</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ </method>
134
+ <channelpilot_cookiemode>
135
+ <label>CP Cookiemode</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>channelpilot_adminhtml/cookiemode_values</source_model>
138
+ <sort_order>10</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </channelpilot_cookiemode>
143
+ <channelpilot_trackingkeys>
144
+ <label>CP Trackingkeys</label>
145
+ <frontend_model>channelpilot_core/adminhtml_field_trackingkeys</frontend_model>
146
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
147
+ <sort_order>20</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </channelpilot_trackingkeys>
152
+ </fields>
153
+ </channelpilot_tracking>
154
+ </groups>
155
+ </channelpilot_tracking>
156
+ <channelpilot_export translate="label" module="channelpilot">
157
+ <label>CP Data Feed Export</label>
158
+ <tab>channelpilot_config</tab>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>3000</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ <groups>
165
+ <hint>
166
+ <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
167
+ <sort_order>0</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </hint>
172
+ <channelpilot_productfeed translate="label">
173
+ <label>CP Export Settings</label>
174
+ <frontend_type>text</frontend_type>
175
+ <expanded>1</expanded>
176
+ <sort_order>1</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ <fields>
181
+ <channelpilot_useExport>
182
+ <label>CP Activate?</label>
183
+ <frontend_type>select</frontend_type>
184
+ <source_model>adminhtml/system_config_source_yesno</source_model>
185
+ <sort_order>0</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ </channelpilot_useExport>
190
+ <channelpilot_password translate="label">
191
+ <label>CP Password</label>
192
+ <comment>CP Protect your data feed with a password. For example: 'www.testshop.com/channelpilot?password=12345'</comment>
193
+ <frontend_type>password</frontend_type>
194
+ <sort_order>1</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ </channelpilot_password>
199
+ <channelpilot_exportfields>
200
+ <label>CP Select data fields</label>
201
+ <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>
202
+ <frontend_model>channelpilot_core/adminhtml_field_exportfields</frontend_model>
203
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
204
+ <sort_order>2</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ </channelpilot_exportfields>
209
+ <channelpilot_specialexportfields>
210
+ <label>CP Create static data fields</label>
211
+ <comment>CP Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.</comment>
212
+ <frontend_model>channelpilot_core/adminhtml_field_specialfields</frontend_model>
213
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
214
+ <sort_order>3</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ </channelpilot_specialexportfields>
219
+ <channelpilot_replacefields>
220
+ <label>CP Product variant data fields</label>
221
+ <comment>CP Select the data fields you want to be overwritten by the respective value of the parent article.</comment>
222
+ <frontend_model>channelpilot_core/adminhtml_field_replacefields</frontend_model>
223
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
224
+ <sort_order>4</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ <show_in_store>1</show_in_store>
228
+ </channelpilot_replacefields>
229
+ <channelpilot_imagenumber>
230
+ <label>CP Number additional productimages</label>
231
+ <comment>CP How many additional productimages should be exported?</comment>
232
+ <frontend_type>select</frontend_type>
233
+ <source_model>channelpilot_adminhtml/imagenumber_values</source_model>
234
+ <sort_order>5</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </channelpilot_imagenumber>
239
+ </fields>
240
+ </channelpilot_productfeed>
241
+ </groups>
242
+ </channelpilot_export>
243
+ <channelpilot_marketplace translate="label" module="channelpilot">
244
+ <label>CP Marketplace Integration</label>
245
+ <tab>channelpilot_config</tab>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>4000</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ <groups>
252
+ <hint>
253
+ <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
254
+ <sort_order>0</sort_order>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>1</show_in_store>
258
+ </hint>
259
+ <channelpilot_marketplace translate="label">
260
+ <label>CP Marketplace Integration Settings</label>
261
+ <frontend_type>text</frontend_type>
262
+ <expanded>1</expanded>
263
+ <sort_order>3</sort_order>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ <fields>
268
+ <channelpilot_useMarketplaces>
269
+ <label>CP Activate?</label>
270
+ <frontend_type>select</frontend_type>
271
+ <source_model>adminhtml/system_config_source_yesno</source_model>
272
+ <sort_order>0</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ </channelpilot_useMarketplaces>
277
+ <channelpilot_orderStatusImportedPayed>
278
+ <label>CP OrderStatus Imported (payed)?</label>
279
+ <frontend_type>select</frontend_type>
280
+ <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
281
+ <sort_order>1</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ </channelpilot_orderStatusImportedPayed>
286
+ <channelpilot_orderStatusImportedUnpayed>
287
+ <label>CP OrderStatus Imported (unpayed)?</label>
288
+ <frontend_type>select</frontend_type>
289
+ <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
290
+ <sort_order>2</sort_order>
291
+ <show_in_default>1</show_in_default>
292
+ <show_in_website>1</show_in_website>
293
+ <show_in_store>1</show_in_store>
294
+ </channelpilot_orderStatusImportedUnpayed>
295
+ <!-- <channelpilot_orderStatusPayed>
296
+ <label>CP OrderStatus Payed?</label>
297
+ <frontend_type>select</frontend_type>
298
+ <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
299
+ <sort_order>3</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ <show_in_store>1</show_in_store>
303
+ </channelpilot_orderStatusPayed>
304
+ <channelpilot_orderStatusCancelled>
305
+ <label>CP OrderStatus Cancelled?</label>
306
+ <frontend_type>select</frontend_type>
307
+ <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
308
+ <sort_order>4</sort_order>
309
+ <show_in_default>1</show_in_default>
310
+ <show_in_website>1</show_in_website>
311
+ <show_in_store>1</show_in_store>
312
+ </channelpilot_orderStatusCancelled>
313
+ <channelpilot_orderStatusDeliveried>
314
+ <label>CP OrderStatus Deliveried?</label>
315
+ <frontend_type>select</frontend_type>
316
+ <source_model>channelpilot_adminhtml/orderstatus_values</source_model>
317
+ <sort_order>5</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ </channelpilot_orderStatusDeliveried>-->
322
+ </fields>
323
+ </channelpilot_marketplace>
324
+ </groups>
325
+ </channelpilot_marketplace>
326
+ <channelpilot_pricecontrol translate="label" module="channelpilot">
327
+ <label>CP Repricing</label>
328
+ <tab>channelpilot_config</tab>
329
+ <frontend_type>text</frontend_type>
330
+ <sort_order>5000</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <show_in_store>1</show_in_store>
334
+ <groups>
335
+ <hint>
336
+ <frontend_model>channelpilot_core/adminhtml_hintlogo</frontend_model>
337
+ <sort_order>0</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </hint>
342
+ <channelpilot_general translate="label">
343
+ <label>CP Repricing Settings</label>
344
+ <frontend_type>text</frontend_type>
345
+ <expanded>1</expanded>
346
+ <sort_order>1</sort_order>
347
+ <show_in_default>1</show_in_default>
348
+ <show_in_website>1</show_in_website>
349
+ <show_in_store>1</show_in_store>
350
+ <fields>
351
+ <channelpilot_usePricecontrol>
352
+ <label>CP Activate?</label>
353
+ <frontend_type>select</frontend_type>
354
+ <source_model>adminhtml/system_config_source_yesno</source_model>
355
+ <sort_order>0</sort_order>
356
+ <show_in_default>1</show_in_default>
357
+ <show_in_website>1</show_in_website>
358
+ <show_in_store>1</show_in_store>
359
+ </channelpilot_usePricecontrol>
360
+ <channelpilot_saveGrossOrNetPrices>
361
+ <label>CP Save prices net or gross?</label>
362
+ <frontend_type>select</frontend_type>
363
+ <source_model>channelpilot_adminhtml/grossnet_values</source_model>
364
+ <sort_order>1</sort_order>
365
+ <show_in_default>1</show_in_default>
366
+ <show_in_website>1</show_in_website>
367
+ <show_in_store>1</show_in_store>
368
+ </channelpilot_saveGrossOrNetPrices>
369
+ </fields>
370
+ </channelpilot_general>
371
+ <general_prices translate="label">
372
+ <label>CP General Repricing</label>
373
+ <frontend_type>text</frontend_type>
374
+ <expanded>1</expanded>
375
+ <sort_order>2</sort_order>
376
+ <show_in_default>1</show_in_default>
377
+ <show_in_website>1</show_in_website>
378
+ <show_in_store>1</show_in_store>
379
+ <fields>
380
+ <!-- <channelpilot_usePricecontrol>
381
+ <label>Active</label>
382
+ <frontend_type>select</frontend_type>
383
+ <source_model>channelpilot_adminhtml/truefalse_values</source_model>
384
+ <sort_order>0</sort_order>
385
+ <show_in_default>1</show_in_default>
386
+ <show_in_website>1</show_in_website>
387
+ <show_in_store>1</show_in_store>
388
+ </channelpilot_usePricecontrol>-->
389
+ <channelpilot_generalPriceField>
390
+ <label>CP Field for price</label>
391
+ <comment>CP This field would be overwritten by the new product price.</comment>
392
+ <frontend_type>select</frontend_type>
393
+ <source_model>channelpilot_adminhtml/pricefield_values</source_model>
394
+ <sort_order>1</sort_order>
395
+ <show_in_default>1</show_in_default>
396
+ <show_in_website>1</show_in_website>
397
+ <show_in_store>1</show_in_store>
398
+ </channelpilot_generalPriceField>
399
+ </fields>
400
+ </general_prices>
401
+ <!-- <campaign_prices translate="label">
402
+ <label>Campaign Price Control</label>
403
+ <frontend_type>text</frontend_type>
404
+ <sort_order>3</sort_order>
405
+ <show_in_default>1</show_in_default>
406
+ <show_in_website>1</show_in_website>
407
+ <show_in_store>1</show_in_store>
408
+ <fields>
409
+ <channelpilot_usePricecontrol>
410
+ <label>Active</label>
411
+ <frontend_type>select</frontend_type>
412
+ <source_model>channelpilot_adminhtml/truefalse_values</source_model>
413
+ <sort_order>0</sort_order>
414
+ <show_in_default>1</show_in_default>
415
+ <show_in_website>1</show_in_website>
416
+ <show_in_store>1</show_in_store>
417
+ </channelpilot_usePricecontrol>
418
+ </fields>
419
+ </campaign_prices>-->
420
+ </groups>
421
+ </channelpilot_pricecontrol>
422
+ <payment>
423
+ <groups>
424
+ <cp_mp translate="label comment" module="channelpilot">
425
+ <label>CP ChannelPilot-Payment</label>
426
+ <expanded>1</expanded>
427
+ <sort_order>670</sort_order>
428
+ <show_in_default>1</show_in_default>
429
+ <show_in_website>1</show_in_website>
430
+ <show_in_store>0</show_in_store>
431
+ <comment>CP !!!This is no real payment method!!!</comment>
432
+ <fields>
433
+ <title translate="label">
434
+ <label>CP Title</label>
435
+ <frontend_type>text</frontend_type>
436
+ <sort_order>1</sort_order>
437
+ <show_in_default>1</show_in_default>
438
+ <show_in_website>1</show_in_website>
439
+ <show_in_store>0</show_in_store>
440
+ </title>
441
+ <active translate="label">
442
+ <label>CP Activate?</label>
443
+ <frontend_type>select</frontend_type>
444
+ <source_model>adminhtml/system_config_source_yesno</source_model>
445
+ <sort_order>2</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>0</show_in_store>
449
+ </active>
450
+ <order_status translate="label">
451
+ <label>CP Order Status</label>
452
+ <frontend_type>select</frontend_type>
453
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
454
+ <sort_order>3</sort_order>
455
+ <show_in_default>1</show_in_default>
456
+ <show_in_website>1</show_in_website>
457
+ <show_in_store>0</show_in_store>
458
+ </order_status>
459
+ <types translate="label">
460
+ <label>CP Payment Types</label>
461
+ <frontend_type>multiselect</frontend_type>
462
+ <source_model>channelpilot/paymenttypes</source_model>
463
+ <sort_order>4</sort_order>
464
+ <show_in_default>1</show_in_default>
465
+ <show_in_website>1</show_in_website>
466
+ <show_in_store>0</show_in_store>
467
+ <can_be_empty>1</can_be_empty>
468
+ </types>
469
+ </fields>
470
+ </cp_mp>
471
+ </groups>
472
+ </payment>
473
+ <carriers>
474
+ <groups>
475
+ <cpshipping translate="label">
476
+ <label>CP ChannelPilot - Shipping Method</label>
477
+ <frontend_type>text</frontend_type>
478
+ <sort_order>50</sort_order>
479
+ <show_in_default>1</show_in_default>
480
+ <show_in_website>1</show_in_website>
481
+ <show_in_store>1</show_in_store>
482
+ <fields>
483
+ <active translate="label">
484
+ <label>CP Enabled</label>
485
+ <frontend_type>select</frontend_type>
486
+ <source_model>adminhtml/system_config_source_yesno</source_model>
487
+ <sort_order>10</sort_order>
488
+ <show_in_default>1</show_in_default>
489
+ <show_in_website>1</show_in_website>
490
+ <show_in_store>1</show_in_store>
491
+ </active>
492
+ <backend_only translate="label">
493
+ <label>CP Use for backend only</label>
494
+ <frontend_type>select</frontend_type>
495
+ <source_model>adminhtml/system_config_source_yesno</source_model>
496
+ <sort_order>15</sort_order>
497
+ <show_in_default>1</show_in_default>
498
+ <show_in_website>1</show_in_website>
499
+ <show_in_store>1</show_in_store>
500
+ </backend_only>
501
+ <title translate="label">
502
+ <label>CP Title</label>
503
+ <frontend_type>text</frontend_type>
504
+ <sort_order>20</sort_order>
505
+ <show_in_default>1</show_in_default>
506
+ <show_in_website>1</show_in_website>
507
+ <show_in_store>1</show_in_store>
508
+ </title>
509
+ <name translate="label">
510
+ <label>CP Method Name</label>
511
+ <frontend_type>text</frontend_type>
512
+ <sort_order>30</sort_order>
513
+ <show_in_default>1</show_in_default>
514
+ <show_in_website>1</show_in_website>
515
+ <show_in_store>1</show_in_store>
516
+ </name>
517
+ <price translate="label">
518
+ <label>CP Price</label>
519
+ <frontend_type>text</frontend_type>
520
+ <validate>validate-number validate-zero-or-greater input-text</validate>
521
+ <sort_order>35</sort_order>
522
+ <show_in_default>1</show_in_default>
523
+ <show_in_website>1</show_in_website>
524
+ <show_in_store>1</show_in_store>
525
+ </price>
526
+ <sallowspecific translate="label">
527
+ <label>CP Ship to Applicable Countries</label>
528
+ <frontend_type>select</frontend_type>
529
+ <sort_order>40</sort_order>
530
+ <frontend_class>shipping-applicable-country</frontend_class>
531
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
532
+ <show_in_default>1</show_in_default>
533
+ <show_in_website>1</show_in_website>
534
+ <show_in_store>1</show_in_store>
535
+ </sallowspecific>
536
+ <showmethod translate="label">
537
+ <label>CP Show Method if Not Applicable</label>
538
+ <frontend_type>select</frontend_type>
539
+ <sort_order>41</sort_order>
540
+ <source_model>adminhtml/system_config_source_yesno</source_model>
541
+ <show_in_default>1</show_in_default>
542
+ <show_in_website>1</show_in_website>
543
+ <show_in_store>1</show_in_store>
544
+ </showmethod>
545
+ <specificcountry translate="label">
546
+ <label>CP Ship to Specific Countries</label>
547
+ <frontend_type>multiselect</frontend_type>
548
+ <sort_order>42</sort_order>
549
+ <source_model>adminhtml/system_config_source_country</source_model>
550
+ <show_in_default>1</show_in_default>
551
+ <show_in_website>1</show_in_website>
552
+ <show_in_store>1</show_in_store>
553
+ <can_be_empty>1</can_be_empty>
554
+ </specificcountry>
555
+ <specificerrmsg translate="label">
556
+ <label>CP Displayed Error Message</label>
557
+ <frontend_type>textarea</frontend_type>
558
+ <sort_order>43</sort_order>
559
+ <show_in_default>1</show_in_default>
560
+ <show_in_website>1</show_in_website>
561
+ <show_in_store>1</show_in_store>
562
+ </specificerrmsg>
563
+ <sort_order translate="label">
564
+ <label>CP Sort Order</label>
565
+ <frontend_type>text</frontend_type>
566
+ <sort_order>50</sort_order>
567
+ <show_in_default>1</show_in_default>
568
+ <show_in_website>1</show_in_website>
569
+ <show_in_store>1</show_in_store>
570
+ </sort_order>
571
+ </fields>
572
+ </cpshipping>
573
+ </groups>
574
+ </carriers>
575
+ </sections>
576
  </config>
app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-install-2.0.0.php CHANGED
@@ -1,207 +1,207 @@
1
- <?php
2
-
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
-
7
- /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
8
- $adapter = $installer->getConnection();
9
-
10
- /**
11
- * Create table 'channelpilot/registration'
12
- */
13
- $table = $adapter->newTable($installer->getTable('channelpilot/registration'))
14
- ->addColumn('shopId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
15
- 'nullable' => false,
16
- 'primary' => true
17
- ), 'shopId')
18
- ->addColumn('ips_authorized', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
19
- 'nullable' => false
20
- ), 'ips_authorized')
21
- ->addColumn('merchantId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
22
- 'nullable' => false
23
- ), 'merchantId')
24
- ->addColumn('securityToken', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
25
- 'nullable' => false
26
- ), 'securityToken')
27
- ->addColumn('last_stock_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
28
- 'nullable' => true
29
- ), 'last_stock_update')
30
- ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
31
- 'nullable' => true
32
- ), 'last_price_update')
33
- ->addColumn('last_catalog_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
34
- 'nullable' => true
35
- ), 'last_catalog_update')
36
- ->addIndex(
37
- $installer->getIdxName(
38
- $installer->getTable('channelpilot/registration'), array('merchantId', 'securityToken'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
39
- ), array('merchantId', 'securityToken'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
40
- );
41
- $adapter->createTable($table);
42
-
43
- /**
44
- * Create table 'channelpilot/order'
45
- */
46
- $table = $adapter->newTable($installer->getTable('channelpilot/order'))
47
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
48
- 'nullable' => false,
49
- 'primary' => true
50
- ), 'order_id')
51
- ->addColumn('order_nr', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
52
- 'nullable' => false
53
- ), 'order_nr')
54
- ->addColumn('marketplace_order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
55
- 'nullable' => false
56
- ), 'marketplace_order_id')
57
- ->addColumn('marketplace', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
58
- 'nullable' => false
59
- ), 'marketplace')
60
- ->addColumn('shop', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
61
- 'nullable' => false
62
- ), 'shop')
63
- ->addColumn('created', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
64
- 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
65
- 'nullable' => false
66
- ), 'created')
67
- ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
68
- 'nullable' => true
69
- ), 'status')
70
- ->addIndex($installer->getIdxName(
71
- 'channelpilot/order', array('order_nr'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
72
- ), array('order_nr'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
73
- )
74
- ->addIndex(
75
- $installer->getIdxName(
76
- $installer->getTable('channelpilot/order'), array('marketplace_order_id', 'marketplace'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
77
- ), array('marketplace_order_id', 'marketplace'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
78
- );
79
- $adapter->createTable($table);
80
-
81
- /**
82
- * Create table 'channelpilot/order_item'
83
- */
84
- $table = $adapter->newTable($installer->getTable('channelpilot/order_item'))
85
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
86
- 'auto_increment' => true,
87
- 'unsigned' => true,
88
- 'nullable' => false,
89
- 'primary' => true,
90
- ), 'id')
91
- ->addColumn('order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
92
- 'nullable' => false,
93
- ), 'order_item_id')
94
- ->addColumn('marketplace_order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
95
- 'nullable' => false
96
- ), 'marketplace_order_item_id')
97
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
98
- 'nullable' => false
99
- ), 'order_id')
100
- ->addColumn('cancelled', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
101
- 'default' => 0,
102
- 'nullable' => false
103
- ), 'cancelled')
104
- ->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
105
- 'default' => 0,
106
- 'nullable' => false
107
- ), 'amount')
108
- ->addColumn('amount_delivered', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
109
- 'default' => 0,
110
- 'nullable' => false
111
- ), 'amount_delivered')
112
- ->addIndex($installer->getIdxName(
113
- 'channelpilot/order_item', array('order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
114
- ), array('order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
115
- )
116
- ->addIndex($installer->getIdxName(
117
- 'channelpilot/order_item', array('marketplace_order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
118
- ), array('marketplace_order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
119
- )
120
- ->addIndex($installer->getIdxName(
121
- $installer->getTable('channelpilot/order_item'), array('marketplace_order_item_id', 'order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
122
- ), array('marketplace_order_item_id', 'order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
123
- );
124
- $adapter->createTable($table);
125
-
126
- /**
127
- * Create table 'channelpilot/prices'
128
- */
129
- $table = $adapter->newTable($installer->getTable('channelpilot/prices'))
130
- ->addColumn('price_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
131
- 'nullable' => false,
132
- 'primary' => true
133
- ), 'price_id')
134
- ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
135
- 'nullable' => true
136
- ), 'last_price_update');
137
- $adapter->createTable($table);
138
-
139
- /**
140
- * Create table 'channelpilot/logs'
141
- */
142
- $table = $adapter->newTable($installer->getTable('channelpilot/logs'))
143
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
144
- 'auto_increment' => true,
145
- 'nullable' => false,
146
- 'primary' => true
147
- ), 'id')
148
- ->addColumn('created', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
149
- 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
150
- 'nullable' => false
151
- ), 'created')
152
- ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
153
- 'nullable' => false
154
- ), 'content')
155
- ->addIndex($installer->getIdxName(
156
- 'channelpilot/logs', array('created')
157
- ), array('created'));
158
- $adapter->createTable($table);
159
-
160
- $installer->endSetup();
161
-
162
-
163
- /**
164
- CREATE TABLE IF NOT EXISTS `cp_registration` (
165
- `shopId` varchar(255) NOT NULL,
166
- `ips_authorized` varchar(255) DEFAULT NULL,
167
- `merchantId` varchar(150) DEFAULT NULL,
168
- `securityToken` varchar(150) DEFAULT NULL,
169
- `last_stock_update` timestamp NULL DEFAULT NULL,
170
- `last_price_update` timestamp NULL DEFAULT NULL,
171
- `last_catalog_update` timestamp NULL DEFAULT NULL,
172
- PRIMARY KEY (`shopId`),
173
- UNIQUE KEY `cp_registration_merchantId_securityToken` (`merchantId`,`securityToken`)
174
- );
175
-
176
- CREATE TABLE IF NOT EXISTS `cp_marketplace_orders` (
177
- `order_id` varchar(255) NOT NULL,
178
- `order_nr` varchar(255) NOT NULL,
179
- `marketplace_order_id` varchar(150) NOT NULL,
180
- `marketplace` varchar(150) NOT NULL,
181
- `shop` varchar(255) NOT NULL,
182
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
183
- `status` int(10) DEFAULT NULL,
184
- PRIMARY KEY (`order_id`),
185
- UNIQUE KEY `cp_marketplace_orders_marketplace_order_id_marketplace` (`marketplace_order_id`,`marketplace`),
186
- UNIQUE KEY `cp_marketplace_orders_order_nr` (`order_nr`)
187
- );
188
-
189
- CREATE TABLE IF NOT EXISTS `cp_marketplace_order_items` (
190
- `order_item_id` varchar(255) NOT NULL,
191
- `marketplace_order_item_id` varchar(255) NOT NULL,
192
- `order_id` varchar(255) NOT NULL,
193
- `cancelled` int(11) NOT NULL DEFAULT '0',
194
- `amount` int(11) NOT NULL DEFAULT '0',
195
- `amount_delivered` int(11) NOT NULL DEFAULT '0',
196
- UNIQUE KEY `cp_marketplace_order_items_order_item_id` (`order_item_id`),
197
- UNIQUE KEY `cp_marketplace_order_items_marketplace_order_item_id` (`marketplace_order_item_id`)
198
- );
199
-
200
- CREATE TABLE IF NOT EXISTS `cp_logging` (
201
- `id` int(11) NOT NULL AUTO_INCREMENT,
202
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
203
- `content` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
204
- PRIMARY KEY (`id`),
205
- KEY `cp_logging_created` (`created`)
206
- );
207
  */
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
8
+ $adapter = $installer->getConnection();
9
+
10
+ /**
11
+ * Create table 'channelpilot/registration'
12
+ */
13
+ $table = $adapter->newTable($installer->getTable('channelpilot/registration'))
14
+ ->addColumn('shopId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
15
+ 'nullable' => false,
16
+ 'primary' => true
17
+ ), 'shopId')
18
+ ->addColumn('ips_authorized', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
19
+ 'nullable' => false
20
+ ), 'ips_authorized')
21
+ ->addColumn('merchantId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
22
+ 'nullable' => false
23
+ ), 'merchantId')
24
+ ->addColumn('securityToken', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
25
+ 'nullable' => false
26
+ ), 'securityToken')
27
+ ->addColumn('last_stock_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
28
+ 'nullable' => true
29
+ ), 'last_stock_update')
30
+ ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
31
+ 'nullable' => true
32
+ ), 'last_price_update')
33
+ ->addColumn('last_catalog_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
34
+ 'nullable' => true
35
+ ), 'last_catalog_update')
36
+ ->addIndex(
37
+ $installer->getIdxName(
38
+ $installer->getTable('channelpilot/registration'), array('merchantId', 'securityToken'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
39
+ ), array('merchantId', 'securityToken'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
40
+ );
41
+ $adapter->createTable($table);
42
+
43
+ /**
44
+ * Create table 'channelpilot/order'
45
+ */
46
+ $table = $adapter->newTable($installer->getTable('channelpilot/order'))
47
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
48
+ 'nullable' => false,
49
+ 'primary' => true
50
+ ), 'order_id')
51
+ ->addColumn('order_nr', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
52
+ 'nullable' => false
53
+ ), 'order_nr')
54
+ ->addColumn('marketplace_order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
55
+ 'nullable' => false
56
+ ), 'marketplace_order_id')
57
+ ->addColumn('marketplace', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
58
+ 'nullable' => false
59
+ ), 'marketplace')
60
+ ->addColumn('shop', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
61
+ 'nullable' => false
62
+ ), 'shop')
63
+ ->addColumn('created', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
64
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
65
+ 'nullable' => false
66
+ ), 'created')
67
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
68
+ 'nullable' => true
69
+ ), 'status')
70
+ ->addIndex($installer->getIdxName(
71
+ 'channelpilot/order', array('order_nr'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
72
+ ), array('order_nr'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
73
+ )
74
+ ->addIndex(
75
+ $installer->getIdxName(
76
+ $installer->getTable('channelpilot/order'), array('marketplace_order_id', 'marketplace'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
77
+ ), array('marketplace_order_id', 'marketplace'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
78
+ );
79
+ $adapter->createTable($table);
80
+
81
+ /**
82
+ * Create table 'channelpilot/order_item'
83
+ */
84
+ $table = $adapter->newTable($installer->getTable('channelpilot/order_item'))
85
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
86
+ 'auto_increment' => true,
87
+ 'unsigned' => true,
88
+ 'nullable' => false,
89
+ 'primary' => true,
90
+ ), 'id')
91
+ ->addColumn('order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
92
+ 'nullable' => false,
93
+ ), 'order_item_id')
94
+ ->addColumn('marketplace_order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
95
+ 'nullable' => false
96
+ ), 'marketplace_order_item_id')
97
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
98
+ 'nullable' => false
99
+ ), 'order_id')
100
+ ->addColumn('cancelled', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
101
+ 'default' => 0,
102
+ 'nullable' => false
103
+ ), 'cancelled')
104
+ ->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
105
+ 'default' => 0,
106
+ 'nullable' => false
107
+ ), 'amount')
108
+ ->addColumn('amount_delivered', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
109
+ 'default' => 0,
110
+ 'nullable' => false
111
+ ), 'amount_delivered')
112
+ ->addIndex($installer->getIdxName(
113
+ 'channelpilot/order_item', array('order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
114
+ ), array('order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
115
+ )
116
+ ->addIndex($installer->getIdxName(
117
+ 'channelpilot/order_item', array('marketplace_order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
118
+ ), array('marketplace_order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
119
+ )
120
+ ->addIndex($installer->getIdxName(
121
+ $installer->getTable('channelpilot/order_item'), array('marketplace_order_item_id', 'order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
122
+ ), array('marketplace_order_item_id', 'order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
123
+ );
124
+ $adapter->createTable($table);
125
+
126
+ /**
127
+ * Create table 'channelpilot/prices'
128
+ */
129
+ $table = $adapter->newTable($installer->getTable('channelpilot/prices'))
130
+ ->addColumn('price_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
131
+ 'nullable' => false,
132
+ 'primary' => true
133
+ ), 'price_id')
134
+ ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
135
+ 'nullable' => true
136
+ ), 'last_price_update');
137
+ $adapter->createTable($table);
138
+
139
+ /**
140
+ * Create table 'channelpilot/logs'
141
+ */
142
+ $table = $adapter->newTable($installer->getTable('channelpilot/logs'))
143
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
144
+ 'auto_increment' => true,
145
+ 'nullable' => false,
146
+ 'primary' => true
147
+ ), 'id')
148
+ ->addColumn('created', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
149
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
150
+ 'nullable' => false
151
+ ), 'created')
152
+ ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
153
+ 'nullable' => false
154
+ ), 'content')
155
+ ->addIndex($installer->getIdxName(
156
+ 'channelpilot/logs', array('created')
157
+ ), array('created'));
158
+ $adapter->createTable($table);
159
+
160
+ $installer->endSetup();
161
+
162
+
163
+ /**
164
+ CREATE TABLE IF NOT EXISTS `cp_registration` (
165
+ `shopId` varchar(255) NOT NULL,
166
+ `ips_authorized` varchar(255) DEFAULT NULL,
167
+ `merchantId` varchar(150) DEFAULT NULL,
168
+ `securityToken` varchar(150) DEFAULT NULL,
169
+ `last_stock_update` timestamp NULL DEFAULT NULL,
170
+ `last_price_update` timestamp NULL DEFAULT NULL,
171
+ `last_catalog_update` timestamp NULL DEFAULT NULL,
172
+ PRIMARY KEY (`shopId`),
173
+ UNIQUE KEY `cp_registration_merchantId_securityToken` (`merchantId`,`securityToken`)
174
+ );
175
+
176
+ CREATE TABLE IF NOT EXISTS `cp_marketplace_orders` (
177
+ `order_id` varchar(255) NOT NULL,
178
+ `order_nr` varchar(255) NOT NULL,
179
+ `marketplace_order_id` varchar(150) NOT NULL,
180
+ `marketplace` varchar(150) NOT NULL,
181
+ `shop` varchar(255) NOT NULL,
182
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
183
+ `status` int(10) DEFAULT NULL,
184
+ PRIMARY KEY (`order_id`),
185
+ UNIQUE KEY `cp_marketplace_orders_marketplace_order_id_marketplace` (`marketplace_order_id`,`marketplace`),
186
+ UNIQUE KEY `cp_marketplace_orders_order_nr` (`order_nr`)
187
+ );
188
+
189
+ CREATE TABLE IF NOT EXISTS `cp_marketplace_order_items` (
190
+ `order_item_id` varchar(255) NOT NULL,
191
+ `marketplace_order_item_id` varchar(255) NOT NULL,
192
+ `order_id` varchar(255) NOT NULL,
193
+ `cancelled` int(11) NOT NULL DEFAULT '0',
194
+ `amount` int(11) NOT NULL DEFAULT '0',
195
+ `amount_delivered` int(11) NOT NULL DEFAULT '0',
196
+ UNIQUE KEY `cp_marketplace_order_items_order_item_id` (`order_item_id`),
197
+ UNIQUE KEY `cp_marketplace_order_items_marketplace_order_item_id` (`marketplace_order_item_id`)
198
+ );
199
+
200
+ CREATE TABLE IF NOT EXISTS `cp_logging` (
201
+ `id` int(11) NOT NULL AUTO_INCREMENT,
202
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
203
+ `content` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
204
+ PRIMARY KEY (`id`),
205
+ KEY `cp_logging_created` (`created`)
206
+ );
207
  */
app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-1.0.0-2.0.0.php CHANGED
@@ -1,180 +1,180 @@
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
- /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
28
- $adapter = $installer->getConnection();
29
-
30
- /**
31
- * Create table 'channelpilot/registration'
32
- */
33
- $table = $adapter->newTable($installer->getTable('channelpilot/registration'))
34
- ->addColumn('shopId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
35
- 'nullable' => false,
36
- 'primary' => true
37
- ), 'shopId')
38
- ->addColumn('ips_authorized', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
39
- 'nullable' => false
40
- ), 'ips_authorized')
41
- ->addColumn('merchantId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
42
- 'nullable' => false
43
- ), 'merchantId')
44
- ->addColumn('securityToken', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
45
- 'nullable' => false
46
- ), 'securityToken')
47
- ->addColumn('last_stock_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
48
- 'nullable' => true
49
- ), 'last_stock_update')
50
- ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
51
- 'nullable' => true
52
- ), 'last_price_update')
53
- ->addColumn('last_catalog_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
54
- 'nullable' => true
55
- ), 'last_catalog_update')
56
- ->addIndex(
57
- $installer->getIdxName(
58
- $installer->getTable('channelpilot/registration'), array('merchantId', 'securityToken'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
59
- ), array('merchantId', 'securityToken'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
60
- );
61
- $adapter->createTable($table);
62
-
63
- /**
64
- * Create table 'channelpilot/order'
65
- */
66
- $table = $adapter->newTable($installer->getTable('channelpilot/order'))
67
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
68
- 'nullable' => false,
69
- 'primary' => true
70
- ), 'order_id')
71
- ->addColumn('order_nr', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
72
- 'nullable' => false
73
- ), 'order_nr')
74
- ->addColumn('marketplace_order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
75
- 'nullable' => false
76
- ), 'marketplace_order_id')
77
- ->addColumn('marketplace', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
78
- 'nullable' => false
79
- ), 'marketplace')
80
- ->addColumn('shop', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
81
- 'nullable' => false
82
- ), 'shop')
83
- ->addColumn('created', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
84
- 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
85
- 'nullable' => false
86
- ), 'created')
87
- ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
88
- 'nullable' => true
89
- ), 'status')
90
- ->addIndex($installer->getIdxName(
91
- 'channelpilot/order', array('order_nr'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
92
- ), array('order_nr'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
93
- )
94
- ->addIndex(
95
- $installer->getIdxName(
96
- $installer->getTable('channelpilot/order'), array('marketplace_order_id', 'marketplace'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
97
- ), array('marketplace_order_id', 'marketplace'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
98
- );
99
- $adapter->createTable($table);
100
-
101
- /**
102
- * Create table 'channelpilot/order_item'
103
- */
104
- $table = $adapter->newTable($installer->getTable('channelpilot/order_item'))
105
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
106
- 'auto_increment' => true,
107
- 'unsigned' => true,
108
- 'nullable' => false,
109
- 'primary' => true,
110
- ), 'id')
111
- ->addColumn('order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
112
- 'nullable' => false,
113
- ), 'order_item_id')
114
- ->addColumn('marketplace_order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
115
- 'nullable' => false
116
- ), 'marketplace_order_item_id')
117
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
118
- 'nullable' => false
119
- ), 'order_id')
120
- ->addColumn('cancelled', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
121
- 'default' => 0,
122
- 'nullable' => false
123
- ), 'cancelled')
124
- ->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
125
- 'default' => 0,
126
- 'nullable' => false
127
- ), 'amount')
128
- ->addColumn('amount_delivered', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
129
- 'default' => 0,
130
- 'nullable' => false
131
- ), 'amount_delivered')
132
- ->addIndex($installer->getIdxName(
133
- 'channelpilot/order_item', array('order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
134
- ), array('order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
135
- )
136
- ->addIndex($installer->getIdxName(
137
- 'channelpilot/order_item', array('marketplace_order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
138
- ), array('marketplace_order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
139
- )
140
- ->addIndex($installer->getIdxName(
141
- $installer->getTable('channelpilot/order_item'), array('marketplace_order_item_id', 'order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
142
- ), array('marketplace_order_item_id', 'order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
143
- );
144
- $adapter->createTable($table);
145
-
146
- /**
147
- * Create table 'channelpilot/prices'
148
- */
149
- $table = $adapter->newTable($installer->getTable('channelpilot/prices'))
150
- ->addColumn('price_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
151
- 'nullable' => false,
152
- 'primary' => true
153
- ), 'price_id')
154
- ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
155
- 'nullable' => true
156
- ), 'last_price_update');
157
- $adapter->createTable($table);
158
-
159
- /**
160
- * Create table 'channelpilot/logs'
161
- */
162
- $table = $adapter->newTable($installer->getTable('channelpilot/logs'))
163
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
164
- 'auto_increment' => true,
165
- 'nullable' => false,
166
- 'primary' => true
167
- ), 'id')
168
- ->addColumn('created', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
169
- 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
170
- 'nullable' => false
171
- ), 'created')
172
- ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
173
- 'nullable' => false
174
- ), 'content')
175
- ->addIndex($installer->getIdxName(
176
- 'channelpilot/logs', array('created')
177
- ), array('created'));
178
- $adapter->createTable($table);
179
-
180
  $installer->endSetup();
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
+ /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
28
+ $adapter = $installer->getConnection();
29
+
30
+ /**
31
+ * Create table 'channelpilot/registration'
32
+ */
33
+ $table = $adapter->newTable($installer->getTable('channelpilot/registration'))
34
+ ->addColumn('shopId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
35
+ 'nullable' => false,
36
+ 'primary' => true
37
+ ), 'shopId')
38
+ ->addColumn('ips_authorized', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
39
+ 'nullable' => false
40
+ ), 'ips_authorized')
41
+ ->addColumn('merchantId', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
42
+ 'nullable' => false
43
+ ), 'merchantId')
44
+ ->addColumn('securityToken', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
45
+ 'nullable' => false
46
+ ), 'securityToken')
47
+ ->addColumn('last_stock_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
48
+ 'nullable' => true
49
+ ), 'last_stock_update')
50
+ ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
51
+ 'nullable' => true
52
+ ), 'last_price_update')
53
+ ->addColumn('last_catalog_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
54
+ 'nullable' => true
55
+ ), 'last_catalog_update')
56
+ ->addIndex(
57
+ $installer->getIdxName(
58
+ $installer->getTable('channelpilot/registration'), array('merchantId', 'securityToken'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
59
+ ), array('merchantId', 'securityToken'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
60
+ );
61
+ $adapter->createTable($table);
62
+
63
+ /**
64
+ * Create table 'channelpilot/order'
65
+ */
66
+ $table = $adapter->newTable($installer->getTable('channelpilot/order'))
67
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
68
+ 'nullable' => false,
69
+ 'primary' => true
70
+ ), 'order_id')
71
+ ->addColumn('order_nr', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
72
+ 'nullable' => false
73
+ ), 'order_nr')
74
+ ->addColumn('marketplace_order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
75
+ 'nullable' => false
76
+ ), 'marketplace_order_id')
77
+ ->addColumn('marketplace', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
78
+ 'nullable' => false
79
+ ), 'marketplace')
80
+ ->addColumn('shop', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
81
+ 'nullable' => false
82
+ ), 'shop')
83
+ ->addColumn('created', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
84
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
85
+ 'nullable' => false
86
+ ), 'created')
87
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
88
+ 'nullable' => true
89
+ ), 'status')
90
+ ->addIndex($installer->getIdxName(
91
+ 'channelpilot/order', array('order_nr'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
92
+ ), array('order_nr'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
93
+ )
94
+ ->addIndex(
95
+ $installer->getIdxName(
96
+ $installer->getTable('channelpilot/order'), array('marketplace_order_id', 'marketplace'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
97
+ ), array('marketplace_order_id', 'marketplace'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
98
+ );
99
+ $adapter->createTable($table);
100
+
101
+ /**
102
+ * Create table 'channelpilot/order_item'
103
+ */
104
+ $table = $adapter->newTable($installer->getTable('channelpilot/order_item'))
105
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
106
+ 'auto_increment' => true,
107
+ 'unsigned' => true,
108
+ 'nullable' => false,
109
+ 'primary' => true,
110
+ ), 'id')
111
+ ->addColumn('order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
112
+ 'nullable' => false,
113
+ ), 'order_item_id')
114
+ ->addColumn('marketplace_order_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
115
+ 'nullable' => false
116
+ ), 'marketplace_order_item_id')
117
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
118
+ 'nullable' => false
119
+ ), 'order_id')
120
+ ->addColumn('cancelled', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
121
+ 'default' => 0,
122
+ 'nullable' => false
123
+ ), 'cancelled')
124
+ ->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
125
+ 'default' => 0,
126
+ 'nullable' => false
127
+ ), 'amount')
128
+ ->addColumn('amount_delivered', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
129
+ 'default' => 0,
130
+ 'nullable' => false
131
+ ), 'amount_delivered')
132
+ ->addIndex($installer->getIdxName(
133
+ 'channelpilot/order_item', array('order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
134
+ ), array('order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
135
+ )
136
+ ->addIndex($installer->getIdxName(
137
+ 'channelpilot/order_item', array('marketplace_order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
138
+ ), array('marketplace_order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
139
+ )
140
+ ->addIndex($installer->getIdxName(
141
+ $installer->getTable('channelpilot/order_item'), array('marketplace_order_item_id', 'order_item_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
142
+ ), array('marketplace_order_item_id', 'order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
143
+ );
144
+ $adapter->createTable($table);
145
+
146
+ /**
147
+ * Create table 'channelpilot/prices'
148
+ */
149
+ $table = $adapter->newTable($installer->getTable('channelpilot/prices'))
150
+ ->addColumn('price_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
151
+ 'nullable' => false,
152
+ 'primary' => true
153
+ ), 'price_id')
154
+ ->addColumn('last_price_update', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
155
+ 'nullable' => true
156
+ ), 'last_price_update');
157
+ $adapter->createTable($table);
158
+
159
+ /**
160
+ * Create table 'channelpilot/logs'
161
+ */
162
+ $table = $adapter->newTable($installer->getTable('channelpilot/logs'))
163
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
164
+ 'auto_increment' => true,
165
+ 'nullable' => false,
166
+ 'primary' => true
167
+ ), 'id')
168
+ ->addColumn('created', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
169
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
170
+ 'nullable' => false
171
+ ), 'created')
172
+ ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
173
+ 'nullable' => false
174
+ ), 'content')
175
+ ->addIndex($installer->getIdxName(
176
+ 'channelpilot/logs', array('created')
177
+ ), array('created'));
178
+ $adapter->createTable($table);
179
+
180
  $installer->endSetup();
app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.1.6-2.2.0.php CHANGED
@@ -1,58 +1,58 @@
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
- /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
28
- $adapter = $installer->getConnection();
29
- $tableName = Mage::getSingleton('core/resource')->getTableName('channelpilot/order');
30
- $adapter->addColumn($tableName, 'order_paid', array(
31
- 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
32
- 'UNSIGNED' => true,
33
- 'DEFAULT' => 0,
34
- 'NULLABLE' => false,
35
- 'COMMENT' => 'order is paid status flag',
36
- ));
37
-
38
- /**
39
- * Create table 'channelpilot/order_shipment'
40
- */
41
- $table = $adapter->newTable($installer->getTable('channelpilot/order_shipment'))
42
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
43
- 'auto_increment' => true,
44
- 'unsigned' => true,
45
- 'nullable' => false,
46
- 'primary' => true,
47
- ), 'id')
48
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
49
- 'nullable' => false,
50
- 'unsigned' => true,
51
- ), 'order_id')
52
- ->addColumn('shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
53
- 'nullable' => false,
54
- 'unsigned' => true,
55
- ), 'shipment_id');
56
- $adapter->createTable($table);
57
-
58
  $installer->endSetup();
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
+ /** @var $adapter Varien_Db_Adapter_Pdo_Mysql */
28
+ $adapter = $installer->getConnection();
29
+ $tableName = Mage::getSingleton('core/resource')->getTableName('channelpilot/order');
30
+ $adapter->addColumn($tableName, 'order_paid', array(
31
+ 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
32
+ 'UNSIGNED' => true,
33
+ 'DEFAULT' => 0,
34
+ 'NULLABLE' => false,
35
+ 'COMMENT' => 'order is paid status flag',
36
+ ));
37
+
38
+ /**
39
+ * Create table 'channelpilot/order_shipment'
40
+ */
41
+ $table = $adapter->newTable($installer->getTable('channelpilot/order_shipment'))
42
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
43
+ 'auto_increment' => true,
44
+ 'unsigned' => true,
45
+ 'nullable' => false,
46
+ 'primary' => true,
47
+ ), 'id')
48
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
49
+ 'nullable' => false,
50
+ 'unsigned' => true,
51
+ ), 'order_id')
52
+ ->addColumn('shipment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
53
+ 'nullable' => false,
54
+ 'unsigned' => true,
55
+ ), 'shipment_id');
56
+ $adapter->createTable($table);
57
+
58
  $installer->endSetup();
app/design/adminhtml/base/default/template/channelpilotsolutions/array_dropdown.phtml CHANGED
@@ -1,174 +1,174 @@
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 design_adminhtml_base_default
17
- * @subpackage template_channelpilotsolutions
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
22
- */
23
- ?>
24
-
25
- <?php
26
- $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
27
-
28
- $_colspan = 2;
29
- if (!$this->_addAfter) {
30
- $_colspan -= 1;
31
- }
32
- $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
33
- ?>
34
-
35
- <div class="grid" id="grid<?php echo $_htmlId ?>">
36
- <table cellpadding="0" cellspacing="0" class="border">
37
- <tbody>
38
-
39
- <tr class="headings" id="headings<?php echo $_htmlId ?>">
40
- <?php foreach ($this->_columns as $columnName => $column):?>
41
- <th><?php echo $column['label'] ?></th>
42
- <?php endforeach;?>
43
- <th <?php echo $_colspan?>></th>
44
- </tr>
45
-
46
- <tr id="addRow<?php echo $_htmlId ?>">
47
- <td colspan="<?php echo count($this->_columns) ?>"></td>
48
- <td <?php echo $_colspan?>>
49
- <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
50
- <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
51
- </button>
52
- </td>
53
- </tr>
54
-
55
- </tbody>
56
- </table>
57
- <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
58
- </div>
59
- <div id="empty<?php echo $_htmlId ?>">
60
- <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
61
- <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
62
- </button>
63
- </div>
64
-
65
- <script type="text/javascript">
66
- //<![CDATA[
67
- // create row creator
68
- var arrayRow<?php echo $_htmlId ?> = {
69
- // define row prototypeJS template
70
- template : new Template(
71
- '<tr id="#{_id}">'
72
- <?php foreach ($this->_columns as $columnName => $column):?>
73
- +'<td class="#{_id}-<?php echo $columnName?>">'
74
- +'<?php echo $this->_renderCellTemplate($columnName)?>'
75
- +'<\/td>'
76
- <?php endforeach;?>
77
- <?php if ($this->_addAfter):?>
78
- +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
79
- <?php endif;?>
80
- +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
81
- +'<\/tr>'
82
- ),
83
-
84
- rowsCount : 0,
85
-
86
- add : function(templateData, insertAfterId)
87
- {
88
- // generate default template data
89
- if ('' == templateData) {
90
- var d = new Date();
91
- var templateData = {
92
- <?php foreach ($this->_columns as $columnName => $column):?>
93
- <?php echo $columnName ?> : '',
94
- <?php endforeach;?>
95
- _id : '_' + d.getTime() + '_' + d.getMilliseconds()
96
- };
97
- }
98
-
99
- // insert before last row
100
- if ('' == insertAfterId) {
101
- Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
102
- }
103
- // insert after specified row
104
- else {
105
- Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
106
- }
107
-
108
- // set the selected drop-down list item
109
- <?php foreach ($this->_columns as $columnName => $column):?>
110
- var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName?>' + ' option')
111
- for(var index = 0; index < options.length; ++index)
112
- {
113
- var option = options[index]
114
- if(option.getAttribute('value') == templateData.<?php echo $columnName?>)
115
- {
116
- option.selected = true
117
- }
118
- }
119
- <?php endforeach;?>
120
-
121
- <?php if ($this->_addAfter):?>
122
- Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
123
- <?php endif;?>
124
-
125
- this.rowsCount += 1;
126
- },
127
-
128
- del : function(rowId)
129
- {
130
- $(rowId).remove();
131
- this.rowsCount -= 1;
132
- if (0 == this.rowsCount) {
133
- this.showButtonOnly();
134
- }
135
- },
136
-
137
- showButtonOnly : function()
138
- {
139
- $('grid<?php echo $_htmlId ?>').hide();
140
- $('empty<?php echo $_htmlId ?>').show();
141
- }
142
- }
143
-
144
- // bind add action to "Add" button in last row
145
- Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
146
-
147
- // add existing rows
148
- <?php
149
- $_addAfterId = "headings{$_htmlId}";
150
- foreach ($this->getArrayRows() as $_rowId => $_row) {
151
- echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
152
- $_addAfterId = $_rowId;
153
- }
154
- ?>
155
-
156
- // initialize standalone button
157
- $('empty<?php echo $_htmlId ?>').hide();
158
- Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
159
- $('grid<?php echo $_htmlId ?>').show();
160
- $('empty<?php echo $_htmlId ?>').hide();
161
- arrayRow<?php echo $_htmlId ?>.add('', '');
162
- });
163
-
164
- // if no rows, hide grid and show button only
165
- <?php if (!$this->getArrayRows()):?>
166
- arrayRow<?php echo $_htmlId ?>.showButtonOnly();
167
- <?php endif;?>
168
-
169
- // toggle the grid, if element is disabled (depending on scope)
170
- <?php if ($this->getElement()->getDisabled()):?>
171
- toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
172
- <?php endif;?>
173
- //]]>
174
- </script>
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 design_adminhtml_base_default
17
+ * @subpackage template_channelpilotsolutions
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ ?>
24
+
25
+ <?php
26
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
27
+
28
+ $_colspan = 2;
29
+ if (!$this->_addAfter) {
30
+ $_colspan -= 1;
31
+ }
32
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
33
+ ?>
34
+
35
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
36
+ <table cellpadding="0" cellspacing="0" class="border">
37
+ <tbody>
38
+
39
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
40
+ <?php foreach ($this->_columns as $columnName => $column):?>
41
+ <th><?php echo $column['label'] ?></th>
42
+ <?php endforeach;?>
43
+ <th <?php echo $_colspan?>></th>
44
+ </tr>
45
+
46
+ <tr id="addRow<?php echo $_htmlId ?>">
47
+ <td colspan="<?php echo count($this->_columns) ?>"></td>
48
+ <td <?php echo $_colspan?>>
49
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
50
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
51
+ </button>
52
+ </td>
53
+ </tr>
54
+
55
+ </tbody>
56
+ </table>
57
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
58
+ </div>
59
+ <div id="empty<?php echo $_htmlId ?>">
60
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
61
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
62
+ </button>
63
+ </div>
64
+
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ // create row creator
68
+ var arrayRow<?php echo $_htmlId ?> = {
69
+ // define row prototypeJS template
70
+ template : new Template(
71
+ '<tr id="#{_id}">'
72
+ <?php foreach ($this->_columns as $columnName => $column):?>
73
+ +'<td class="#{_id}-<?php echo $columnName?>">'
74
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
75
+ +'<\/td>'
76
+ <?php endforeach;?>
77
+ <?php if ($this->_addAfter):?>
78
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
79
+ <?php endif;?>
80
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
81
+ +'<\/tr>'
82
+ ),
83
+
84
+ rowsCount : 0,
85
+
86
+ add : function(templateData, insertAfterId)
87
+ {
88
+ // generate default template data
89
+ if ('' == templateData) {
90
+ var d = new Date();
91
+ var templateData = {
92
+ <?php foreach ($this->_columns as $columnName => $column):?>
93
+ <?php echo $columnName ?> : '',
94
+ <?php endforeach;?>
95
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
96
+ };
97
+ }
98
+
99
+ // insert before last row
100
+ if ('' == insertAfterId) {
101
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
102
+ }
103
+ // insert after specified row
104
+ else {
105
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
106
+ }
107
+
108
+ // set the selected drop-down list item
109
+ <?php foreach ($this->_columns as $columnName => $column):?>
110
+ var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName?>' + ' option')
111
+ for(var index = 0; index < options.length; ++index)
112
+ {
113
+ var option = options[index]
114
+ if(option.getAttribute('value') == templateData.<?php echo $columnName?>)
115
+ {
116
+ option.selected = true
117
+ }
118
+ }
119
+ <?php endforeach;?>
120
+
121
+ <?php if ($this->_addAfter):?>
122
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
123
+ <?php endif;?>
124
+
125
+ this.rowsCount += 1;
126
+ },
127
+
128
+ del : function(rowId)
129
+ {
130
+ $(rowId).remove();
131
+ this.rowsCount -= 1;
132
+ if (0 == this.rowsCount) {
133
+ this.showButtonOnly();
134
+ }
135
+ },
136
+
137
+ showButtonOnly : function()
138
+ {
139
+ $('grid<?php echo $_htmlId ?>').hide();
140
+ $('empty<?php echo $_htmlId ?>').show();
141
+ }
142
+ }
143
+
144
+ // bind add action to "Add" button in last row
145
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
146
+
147
+ // add existing rows
148
+ <?php
149
+ $_addAfterId = "headings{$_htmlId}";
150
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
151
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
152
+ $_addAfterId = $_rowId;
153
+ }
154
+ ?>
155
+
156
+ // initialize standalone button
157
+ $('empty<?php echo $_htmlId ?>').hide();
158
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
159
+ $('grid<?php echo $_htmlId ?>').show();
160
+ $('empty<?php echo $_htmlId ?>').hide();
161
+ arrayRow<?php echo $_htmlId ?>.add('', '');
162
+ });
163
+
164
+ // if no rows, hide grid and show button only
165
+ <?php if (!$this->getArrayRows()):?>
166
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
167
+ <?php endif;?>
168
+
169
+ // toggle the grid, if element is disabled (depending on scope)
170
+ <?php if ($this->getElement()->getDisabled()):?>
171
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
172
+ <?php endif;?>
173
+ //]]>
174
+ </script>
app/design/adminhtml/base/default/template/channelpilotsolutions/config_hint.phtml CHANGED
@@ -1,146 +1,146 @@
1
- <?php
2
- $config = $_SERVER['REQUEST_URI'];
3
-
4
- $background_position = "0px";
5
- $background_gradient = "linear-gradient(-25deg, #d5e700 15%, #bad700 50%) repeat scroll 0 0 #cce100";
6
- if (strpos($config, "channelpilot_tracking") !== false) {
7
- $background_position = "-66px";
8
- $background_gradient = "linear-gradient(-25deg, #fb671a 15%, #f8390e 50%) repeat scroll 0 0 #fa5716";
9
- } else {
10
- if (strpos($config, "channelpilot_marketplace") !== false) {
11
- $background_position = "-132px";
12
- $background_gradient = "linear-gradient(-25deg, #ffc11e 15%, #ff9810 50%) repeat scroll 0 0 #ffb319";
13
- } else {
14
- if (strpos($config, "channelpilot_pricecontrol") !== false) {
15
- $background_position = "-198px";
16
- $background_gradient = "linear-gradient(-25deg, #61bcd5 15%, #3590ba 50%) repeat scroll 0 0 #3590ba";
17
- }
18
- }
19
- }
20
- ?>
21
- <style>
22
- .content-header {
23
- background: <?= $background_gradient ?>;
24
- margin-bottom: 0;
25
- border-bottom: 0;
26
- padding-bottom: 0;
27
- }
28
- .content-header table{
29
- padding: 5px 20px 5px 10px;
30
- background-color: #3e352c;
31
- }
32
- .main-col-inner .content-header tbody{
33
- height: 66px;
34
- background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');
35
- background-repeat: no-repeat;
36
- background-position: 0 <?= $background_position ?>;
37
- background-size: 264px;
38
- }
39
-
40
- .content-header-floating .content-header td{
41
- height: 66px;
42
- background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');
43
- background-repeat: no-repeat;
44
- background-position: 0 <?= $background_position ?>;
45
- background-size: 264px;
46
- min-width: 264px;
47
- }
48
-
49
- .content-header-floating .content-header tbody .form-buttons {
50
- height: 55px;
51
- background: none !important;
52
- }
53
- .content-header h3 {
54
- display: none;
55
- }
56
- .content-header button{
57
- margin-top: 23px;
58
- margin-bottom: 22px !important;
59
- }
60
-
61
- .section-config:first-of-type .entry-edit-head {
62
- padding-top: 10px;
63
- padding-bottom: 0px;
64
- margin-top: 0;
65
- background: <?= $background_gradient ?>;
66
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
67
- border-top: 2px solid rgba(0, 0, 0, 0.1);
68
- }
69
-
70
- .section-config:first-of-type {
71
- margin-top: 0px;
72
- }
73
-
74
- .section-config {
75
- margin-top: 25px;
76
- }
77
-
78
- .section-config .entry-edit-head {
79
- padding-top: 7px;
80
- padding-bottom: 0px;
81
- margin-top: 0;
82
- background: none;
83
- }
84
-
85
- .section-config:first-of-type .entry-edit-head a{
86
- font-weight: 600;
87
- color: #fa5716;
88
- margin-bottom: -2px;
89
- border-top: 2px solid rgba(0, 0, 0, 0.1);
90
- border-left: 2px solid rgba(0, 0, 0, 0.1);
91
- border-right: 2px solid rgba(0, 0, 0, 0.1);
92
- }
93
-
94
- .section-config .entry-edit-head a{
95
- font-family: "Open Sans";
96
- font-weight: 300;
97
- font-size: 13px;
98
- float:left;
99
- padding: 5px 20px 2px;
100
- color: #53473b;
101
- text-transform: uppercase;
102
- background: #FFFFFF !important;
103
- }
104
-
105
- .section-config .entry-edit-head a:hover{
106
- color: #fa5716;
107
- }
108
-
109
- .section-config:first-of-type fieldset {
110
- padding-top: 25px;
111
- }
112
- .section-config fieldset {
113
- font-size: 12px;
114
- font-weight: 400;
115
- font-family: "Open Sans";
116
- border: 0px;
117
- background: #FFFFFF !important;
118
- }
119
-
120
- .section-config fieldset select, .section-config fieldset input{
121
- font-family: "Open Sans";
122
- background: -moz-linear-gradient(center top , #d6cec6 0px, #ebe8e4 2em) repeat scroll 0 0 #e1dbd5;
123
- padding: 3px 3px;
124
- }
125
-
126
- .form-list .label label {
127
- margin-left: 10px;
128
- }
129
-
130
- .form-list .value .grid .headings{
131
- background: #5c4f41;
132
- }
133
- .form-list .value .grid th, .form-list .value .grid td {
134
- border: 0;
135
- }
136
- .form-list .value .grid th {
137
- font-family: "Open Sans";
138
- color: #ffffff;
139
- font-size: 12px;
140
- text-align: center;
141
- }
142
- .form-list .value .grid table{
143
- border: 1px solid #3e352c;
144
- background: rgba(62, 53, 44, 0.02);
145
- }
146
  </style>
1
+ <?php
2
+ $config = $_SERVER['REQUEST_URI'];
3
+
4
+ $background_position = "0px";
5
+ $background_gradient = "linear-gradient(-25deg, #d5e700 15%, #bad700 50%) repeat scroll 0 0 #cce100";
6
+ if (strpos($config, "channelpilot_tracking") !== false) {
7
+ $background_position = "-66px";
8
+ $background_gradient = "linear-gradient(-25deg, #fb671a 15%, #f8390e 50%) repeat scroll 0 0 #fa5716";
9
+ } else {
10
+ if (strpos($config, "channelpilot_marketplace") !== false) {
11
+ $background_position = "-132px";
12
+ $background_gradient = "linear-gradient(-25deg, #ffc11e 15%, #ff9810 50%) repeat scroll 0 0 #ffb319";
13
+ } else {
14
+ if (strpos($config, "channelpilot_pricecontrol") !== false) {
15
+ $background_position = "-198px";
16
+ $background_gradient = "linear-gradient(-25deg, #61bcd5 15%, #3590ba 50%) repeat scroll 0 0 #3590ba";
17
+ }
18
+ }
19
+ }
20
+ ?>
21
+ <style>
22
+ .content-header {
23
+ background: <?= $background_gradient ?>;
24
+ margin-bottom: 0;
25
+ border-bottom: 0;
26
+ padding-bottom: 0;
27
+ }
28
+ .content-header table{
29
+ padding: 5px 20px 5px 10px;
30
+ background-color: #3e352c;
31
+ }
32
+ .main-col-inner .content-header tbody{
33
+ height: 66px;
34
+ background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');
35
+ background-repeat: no-repeat;
36
+ background-position: 0 <?= $background_position ?>;
37
+ background-size: 264px;
38
+ }
39
+
40
+ .content-header-floating .content-header td{
41
+ height: 66px;
42
+ background-image: url('https://go.channelpilot.com/css/gfx/logo.channelPilot.png');
43
+ background-repeat: no-repeat;
44
+ background-position: 0 <?= $background_position ?>;
45
+ background-size: 264px;
46
+ min-width: 264px;
47
+ }
48
+
49
+ .content-header-floating .content-header tbody .form-buttons {
50
+ height: 55px;
51
+ background: none !important;
52
+ }
53
+ .content-header h3 {
54
+ display: none;
55
+ }
56
+ .content-header button{
57
+ margin-top: 23px;
58
+ margin-bottom: 22px !important;
59
+ }
60
+
61
+ .section-config:first-of-type .entry-edit-head {
62
+ padding-top: 10px;
63
+ padding-bottom: 0px;
64
+ margin-top: 0;
65
+ background: <?= $background_gradient ?>;
66
+ border-bottom: 2px solid rgba(0, 0, 0, 0.1);
67
+ border-top: 2px solid rgba(0, 0, 0, 0.1);
68
+ }
69
+
70
+ .section-config:first-of-type {
71
+ margin-top: 0px;
72
+ }
73
+
74
+ .section-config {
75
+ margin-top: 25px;
76
+ }
77
+
78
+ .section-config .entry-edit-head {
79
+ padding-top: 7px;
80
+ padding-bottom: 0px;
81
+ margin-top: 0;
82
+ background: none;
83
+ }
84
+
85
+ .section-config:first-of-type .entry-edit-head a{
86
+ font-weight: 600;
87
+ color: #fa5716;
88
+ margin-bottom: -2px;
89
+ border-top: 2px solid rgba(0, 0, 0, 0.1);
90
+ border-left: 2px solid rgba(0, 0, 0, 0.1);
91
+ border-right: 2px solid rgba(0, 0, 0, 0.1);
92
+ }
93
+
94
+ .section-config .entry-edit-head a{
95
+ font-family: "Open Sans";
96
+ font-weight: 300;
97
+ font-size: 13px;
98
+ float:left;
99
+ padding: 5px 20px 2px;
100
+ color: #53473b;
101
+ text-transform: uppercase;
102
+ background: #FFFFFF !important;
103
+ }
104
+
105
+ .section-config .entry-edit-head a:hover{
106
+ color: #fa5716;
107
+ }
108
+
109
+ .section-config:first-of-type fieldset {
110
+ padding-top: 25px;
111
+ }
112
+ .section-config fieldset {
113
+ font-size: 12px;
114
+ font-weight: 400;
115
+ font-family: "Open Sans";
116
+ border: 0px;
117
+ background: #FFFFFF !important;
118
+ }
119
+
120
+ .section-config fieldset select, .section-config fieldset input{
121
+ font-family: "Open Sans";
122
+ background: -moz-linear-gradient(center top , #d6cec6 0px, #ebe8e4 2em) repeat scroll 0 0 #e1dbd5;
123
+ padding: 3px 3px;
124
+ }
125
+
126
+ .form-list .label label {
127
+ margin-left: 10px;
128
+ }
129
+
130
+ .form-list .value .grid .headings{
131
+ background: #5c4f41;
132
+ }
133
+ .form-list .value .grid th, .form-list .value .grid td {
134
+ border: 0;
135
+ }
136
+ .form-list .value .grid th {
137
+ font-family: "Open Sans";
138
+ color: #ffffff;
139
+ font-size: 12px;
140
+ text-align: center;
141
+ }
142
+ .form-list .value .grid table{
143
+ border: 1px solid #3e352c;
144
+ background: rgba(62, 53, 44, 0.02);
145
+ }
146
  </style>
app/design/frontend/base/default/layout/Channelpilotsolutions/channelpilot.xml CHANGED
@@ -1,43 +1,43 @@
1
- <?xml version="1.0"?><!--
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_Clicktracking to newer
12
- * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
- * needs please refer to http://www.channelpilot.com for more information.
14
- *
15
- * @category Channelpilotsolutions
16
- * @package design_frontend_base_default
17
- * @subpackage layout_Channelpilotsolutions
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
22
- */
23
- -->
24
- <layout version="0.1.0">
25
- <default>
26
- <reference name="after_body_start">
27
- <block type="channelpilot_core/tracking_tracking" name="cptracking" as="cptracking" template="Channelpilotsolutions/tracking_image.phtml" />
28
- </reference>
29
- <reference name="head">
30
- <block type="channelpilot_core/tracking_tracking" name="clicktracking" as="clicktracking" template="Channelpilotsolutions/clicktracking_js.phtml" />
31
- </reference>
32
- </default>
33
-
34
- <checkout_onepage_success>
35
- <reference name="cptracking">
36
- <action method="setIsSale"><param>1</param></action>
37
- </reference>
38
- <reference name="head">
39
- <remove name="clicktracking" />
40
- <block type="channelpilot_core/tracking_tracking" name="salestracking" as="salestracking" template="Channelpilotsolutions/salestracking_js.phtml" />
41
- </reference>
42
- </checkout_onepage_success>
43
  </layout>
1
+ <?xml version="1.0"?><!--
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_Clicktracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage layout_Channelpilotsolutions
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <layout version="0.1.0">
25
+ <default>
26
+ <reference name="after_body_start">
27
+ <block type="channelpilot_core/tracking_tracking" name="cptracking" as="cptracking" template="Channelpilotsolutions/tracking_image.phtml" />
28
+ </reference>
29
+ <reference name="head">
30
+ <block type="channelpilot_core/tracking_tracking" name="clicktracking" as="clicktracking" template="Channelpilotsolutions/clicktracking_js.phtml" />
31
+ </reference>
32
+ </default>
33
+
34
+ <checkout_onepage_success>
35
+ <reference name="cptracking">
36
+ <action method="setIsSale"><param>1</param></action>
37
+ </reference>
38
+ <reference name="head">
39
+ <remove name="clicktracking" />
40
+ <block type="channelpilot_core/tracking_tracking" name="salestracking" as="salestracking" template="Channelpilotsolutions/salestracking_js.phtml" />
41
+ </reference>
42
+ </checkout_onepage_success>
43
  </layout>
app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking_js.phtml CHANGED
@@ -1,26 +1,26 @@
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_Clicktracking to newer
12
- * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
- * needs please refer to http://www.channelpilot.com for more information.
14
- *
15
- * @category Channelpilotsolutions
16
- * @package design_frontend_base_default
17
- * @subpackage template_Channelpilotsolutions
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
- ?>
24
- <?php if($this->isEnabled() && !$this->isTrackingModeImage()): ?>
25
- <script type="text/javascript" src="//content.cptrack.de/clicks.js"></script>
26
- <?php endif; ?>
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_Clicktracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage template_Channelpilotsolutions
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
+ ?>
24
+ <?php if($this->isEnabled() && !$this->isTrackingModeImage()): ?>
25
+ <script type="text/javascript" src="//content.cptrack.de/clicks.js"></script>
26
+ <?php endif; ?>
app/design/frontend/base/default/template/Channelpilotsolutions/gtm.phtml DELETED
@@ -1,44 +0,0 @@
1
- <?php if($this->isEnabled() && !$this->isTrackingModeImage() && strpos(Mage::app()->getRequest()->getRequestString(), 'checkout/success') !== false): ?>
2
- <script type="text/javascript" src="//content.cptrack.de/clicks.js"></script>
3
- <?php else: ?>
4
- <?php $_order = $this->getOrder(); ?>
5
-
6
- <script type="text/javascript">
7
- var products = new Array();
8
-
9
- <?php $_productIdField = $this->getProductIdField(); ?>
10
- <?php foreach($_order->getItemsCollection(array(), true) as $_item): ?>
11
- products.push({id: "<?php echo $_item->getData($_productIdField); ?>", price: <?php echo $_item->getPrice(); ?>, amount: <?php echo $_item->getQtyOrdered(); ?>})
12
- <?php endforeach; ?>
13
-
14
- dataLayer = [{
15
- 'cp_trackingkey': '<?php echo $this->getTrackingKey(); ?>',
16
- 'transactionId': '<?php echo $_order->getId(); ?>',
17
- 'transactionValueNumber': '<?php echo ($_order->getGrandTotal() - $_order->getTaxAmount()); ?>',
18
- 'pruchaseProductArray': products,
19
- }];
20
- </script>
21
- <!-- Google Tag Manager -->
22
- <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-TF8T67"
23
- height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
24
- <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
25
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
26
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
27
- '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
28
- })(window,document,'script','dataLayer','GTM-TF8T67');</script>
29
- <!-- End Google Tag Manager -->
30
- <?php endif; ?>
31
-
32
-
33
- var cpSale = {
34
- trackingKey: "<?php echo $this->getTrackingKey();; ?>",
35
- orderId: "<?php echo $_order->getId(); ?>",
36
- orderTotal: <?php echo ($_order->getGrandTotal() - $_order->getTaxAmount()); ?>,
37
- cookie: "<?php echo $this->getCookieMode(); ?>",
38
- shoppingCart: new Array()
39
- };
40
-
41
- <?php $_productIdField = $this->getProductIdField(); ?>
42
- <?php foreach($_order->getItemsCollection(array(), true) as $_item): ?>
43
- cpSale.shoppingCart.push({id: "<?php echo $_item->getData($_productIdField); ?>", price: <?php echo $_item->getPrice(); ?>, amount: <?php echo $_item->getQtyOrdered(); ?>});
44
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/Channelpilotsolutions/salestracking_js.phtml CHANGED
@@ -1,46 +1,46 @@
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_Clicktracking to newer
12
- * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
- * needs please refer to http://www.channelpilot.com for more information.
14
- *
15
- * @category Channelpilotsolutions
16
- * @package design_frontend_base_default
17
- * @subpackage template_Channelpilotsolutions
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
- ?>
24
- <?php if($this->isEnabled() && !$this->isTrackingModeImage()): ?>
25
- <?php $_order = $this->getOrder(); ?>
26
-
27
- <?php if($_order): ?>
28
- <script type="text/javascript">
29
- var cpSale = {
30
- trackingKey: "<?php echo $this->getTrackingKey(); ?>",
31
- orderId: "<?php echo $_order->getId(); ?>",
32
- orderTotal: <?php echo ($_order->getGrandTotal() - $_order->getTaxAmount()); ?>,
33
- cookie: "<?php echo $this->getCookieMode(); ?>",
34
- shoppingCart: new Array()
35
- };
36
-
37
- <?php $_productIdField = $this->getProductIdField(); ?>
38
- <?php foreach($_order->getItemsCollection(array(), true) as $_item): ?>
39
- cpSale.shoppingCart.push({id: "<?php echo $_item->getData($_productIdField); ?>", price: <?php echo $_item->getPrice(); ?>, amount: <?php echo $_item->getQtyOrdered(); ?>});
40
- <?php endforeach; ?>
41
- </script>
42
-
43
- <script type="text/javascript" src="//content.cptrack.de/sales.js"></script>
44
- <?php endif; ?>
45
- <?php endif; ?>
46
-
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_Clicktracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage template_Channelpilotsolutions
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
+ ?>
24
+ <?php if($this->isEnabled() && !$this->isTrackingModeImage()): ?>
25
+ <?php $_order = $this->getOrder(); ?>
26
+
27
+ <?php if($_order): ?>
28
+ <script type="text/javascript">
29
+ var cpSale = {
30
+ trackingKey: "<?php echo $this->getTrackingKey(); ?>",
31
+ orderId: "<?php echo $_order->getId(); ?>",
32
+ orderTotal: <?php echo ($_order->getGrandTotal() - $_order->getTaxAmount()); ?>,
33
+ cookie: "<?php echo $this->getCookieMode(); ?>",
34
+ shoppingCart: new Array()
35
+ };
36
+
37
+ <?php $_productIdField = $this->getProductIdField(); ?>
38
+ <?php foreach($_order->getItemsCollection(array(), true) as $_item): ?>
39
+ cpSale.shoppingCart.push({id: "<?php echo $_item->getData($_productIdField); ?>", price: <?php echo $_item->getPrice(); ?>, amount: <?php echo $_item->getQtyOrdered(); ?>});
40
+ <?php endforeach; ?>
41
+ </script>
42
+
43
+ <script type="text/javascript" src="//content.cptrack.de/sales.js"></script>
44
+ <?php endif; ?>
45
+ <?php endif; ?>
46
+
app/design/frontend/base/default/template/Channelpilotsolutions/tracking_image.phtml CHANGED
@@ -1,26 +1,26 @@
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_Clicktracking to newer
12
- * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
- * needs please refer to http://www.channelpilot.com for more information.
14
- *
15
- * @category Channelpilotsolutions
16
- * @package design_frontend_base_default
17
- * @subpackage template_Channelpilotsolutions
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
- ?>
24
- <?php if($this->isEnabled() && $this->isTrackingModeImage()): ?>
25
- <img src="<?php echo $this->getImageUrl(); ?>" width="0" height="0" alt="" style="display: none">
26
- <?php endif; ?>
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_Clicktracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage template_Channelpilotsolutions
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
+ ?>
24
+ <?php if($this->isEnabled() && $this->isTrackingModeImage()): ?>
25
+ <img src="<?php echo $this->getImageUrl(); ?>" width="0" height="0" alt="" style="display: none">
26
+ <?php endif; ?>
app/etc/modules/Channelpilotsolutions_Channelpilot.xml CHANGED
@@ -1,34 +1,34 @@
1
- <?xml version="1.0"?><!--
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 etc
17
- * @subpackage
18
- * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
- * @author Peter Hoffmann <info@channelpilot.com>
20
- * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
- * @link http://www.channelpilot.com
22
- */
23
- -->
24
- <config>
25
- <modules>
26
- <Channelpilotsolutions_Channelpilot>
27
- <active>true</active>
28
- <codePool>community</codePool>
29
- <depends>
30
- <Mage_Payment/>
31
- </depends>
32
- </Channelpilotsolutions_Channelpilot>
33
- </modules>
34
  </config>
1
+ <?xml version="1.0"?><!--
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 etc
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Channelpilot>
27
+ <active>true</active>
28
+ <codePool>community</codePool>
29
+ <depends>
30
+ <Mage_Payment/>
31
+ </depends>
32
+ </Channelpilotsolutions_Channelpilot>
33
+ </modules>
34
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Channelpilotsolutions_Channelpilot</name>
4
- <version>2.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
@@ -27,10 +27,10 @@
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</notes>
30
- <authors><author><name>ChannelPilot Solutions GmbH</name><user>auto-converted</user><email>info@channelpilot.com</email></author></authors>
31
- <date>2015-09-03</date>
32
- <time>10:00:16</time>
33
- <contents><target name="magecommunity"><dir name="Channelpilotsolutions"><dir name="Channelpilot"><dir name="Adminhtml"><dir name="Model"><dir name="Articlenumber"><file name="Values.php" hash="4a920f99cf9443aaa2f8841d853cebec"/></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="ca2eae99b1a05738fcd60ee79f1e5267"/></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="a59d8aa3b55a773f94de2593bde9713c"/><file name="Exportfields.php" hash="dc986d5971fa58cddf104a77225bc8f1"/><file name="Replacefields.php" hash="13ebad7efc8c4c88d1d4890806db133d"/><file name="Specialfields.php" hash="760716a50151f930d5be83b2442f1781"/><file name="Trackingkeys.php" hash="e32b2adc09b99df6d9fc12ca2c908e20"/></dir><file name="Hintlogo.php" hash="be78974a79e7cc59601254a8df0dc48b"/></dir><dir name="Tracking"><file name="Tracking.php" hash="8ca7432e620ed0b75219d67e093bfd84"/></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="5d94e7262cdddd8415d668e6e4a18e04"/><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="194e0639f634c621cff0719bd0f09620"/><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="ba60c5a18962caeed46480e178114d8c"/></dir></dir><dir name="handler"><file name="CPAbstractHandler.php" hash="ec299185e2a47a86251244130478c4eb"/><file name="CPCancellationHandler.php" hash="b4dd4b167a99c44000173bda98b4f91a"/><file name="CPDebugHandler.php" hash="4e1404f02bddf16683f20e25d3488d31"/><file name="CPDeliveryHandler.php" hash="33edfdb1717ae82b5b45d7bdaf829b70"/><file name="CPErrorHandler.php" hash="5d728c064c068fdf8354fa87882e4dba"/><file name="CPExportHandler.php" hash="78730873d2498140f0a2e885db7e3772"/><file name="CPNewPriceHandler.php" hash="06e8b36560fec6bbe849fa8759238e54"/><file name="CPNewsHandler.php" hash="2c05c335f9d2396d592dffe90860d7f5"/><file name="CPOrderHandler.php" hash="1cec61079aa81ef9aac9074b737d3db3"/><file name="CPPaymentHandler.php" hash="e1acf2241a22210ad67a4f822e17fcf3"/><file name="CPRegisterHandler.php" hash="928fc47221ad4d11f550d4f696a69686"/><file name="CPStatusHandler.php" hash="9fb5001b993f411841e16a3a051b9675"/></dir><dir name="responses"><file name="CPGetStatusHookResponse.php" hash="672609ebcaa23aa0de85aed04c7662d8"/><file name="CPHookResponse.php" hash="3728a311e8e19572e3974e1d7187fc8f"/><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="2712029262ac439ca669a6fbf134584a"/><file name="Export.php" hash="e153154e3264fc3596e647bb87641fe0"/><file name="ExportData.php" hash="e8a12fe60dac3e35052e94969d95a572"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Source"><file name="Trackingmethod.php" hash="e3870e7f6897f88e6b6ac33dfffeb24a"/></dir></dir><dir name="Carrier"><file name="Cpshipping.php" hash="1595183cc57cda1c4f7abc75cc27933e"/></dir><dir name="Order"><file name="Item.php" hash="758099c29d9ec88b31f9f8d065f0ff18"/><file name="Shipment.php" hash="248010c4dbc7484de1ce3a9d99685e0f"/></dir><dir name="Resource"><dir name="Logs"><file name="Collection.php" hash="b552fa82d554eb8752ec94854c361a66"/></dir><dir name="Order"><dir name="Item"><file name="Collection.php" hash="ef17a696f0c8f49a8460541eb27f2d48"/></dir><dir name="Shipment"><file name="Collection.php" hash="bf5e880e16ad27da504873b07d06d1a5"/></dir><file name="Collection.php" hash="655a3a4dd24548485dbad6df8abfe249"/><file name="Item.php" hash="d9a3333dc0f6bad9afc6f23bca2897ea"/><file name="Shipment.php" hash="b3b33498200c9ddef0a028fcad4bd3cd"/></dir><dir name="Prices"><file name="Collection.php" hash="824ef9dca87c5c2a8a1502465f46b39d"/></dir><dir name="Registration"><file name="Collection.php" hash="ab135100c983dc514e70136f5966779d"/></dir><file name="Logs.php" hash="f01f3cbb33aba58d58cf831d68f84dcc"/><file name="Order.php" hash="6cdce0a2dccfec7410d3616c939fb7bf"/><file name="Prices.php" hash="e5555bd0233bbf7f5b22fc155996966a"/><file name="Registration.php" hash="85f8af50ab8771f82ec20818e29ef5c8"/></dir><file name="Abstract.php" hash="0e9349f1023527a77e59742dfdb21308"/><file name="Logs.php" hash="54604a639a93b1312fb46582ae023741"/><file name="Order.php" hash="b3a41a11b4cc6e8027ff0652721187c2"/><file name="Payment.php" hash="49742cfa63c4101b41a3901455180f82"/><file name="PaymentTypes.php" hash="b217cdabf427beadb8d74acff069af4d"/><file name="Paymenttypes.php" hash="b217cdabf427beadb8d74acff069af4d"/><file name="Prices.php" hash="65b65db0ad2f89e1d62663c26729bb6b"/><file name="Registration.php" hash="ee98f0e95b4a9abd40496518bc127501"/></dir><dir name="controllers"><file name="IndexController.php" hash="3f991e3399f18fc276c9e625313e0f51"/></dir><dir name="etc"><file name="adminhtml.xml" hash="62fad9ef0e77e858b74d2a7bdd6a6879"/><file name="config.xml" hash="229e23369a352eaaffe998a62347f26f"/><file name="system.xml" hash="1b40ae5290f8cd3f81f9740a8ff98d28"/></dir><dir name="sql"><dir name="channelpilot_setup"><file name="mysql4-install-2.0.0.php" hash="d9f8715479855e4e9a255b61dbad48e7"/><file name="mysql4-upgrade-1.0.0-2.0.0.php" hash="4fbbdd3a913e15920fa70d74e9fe57f8"/><file name="mysql4-upgrade-2.1.6-2.2.0.php" hash="ce14ffa26e1d414c032822797ad10214"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Channelpilotsolutions_Channelpilot.xml" hash="4cc80daa0c7f8dda239e41a6b17321bf"/></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="ebc6b830d7a7ff2813ce621c2a4719e8"/></dir></dir><dir name="template"><dir name="Channelpilotsolutions"><file name="clicktracking_js.phtml" hash="8ab6a6c98301985878c2c24e3caab7fe"/><file name="gtm.phtml" hash="6e7c02091279257bdc5b2137bd5ab6ed"/><file name="salestracking_js.phtml" hash="69f7fdef776194f26e208fa0ed80ce7b"/><file name="tracking_image.phtml" hash="1e5bc29c73df11a3b08d43c77c6f3989"/></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="cb1230cd8a92ce0a0961f71b396736ec"/><file name="config_hint.phtml" hash="bab45579386a99fe4ccbfb1972ed08fc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></dir><dir name="de_CH"><file name="Channelpilotsolutions_Channelpilot.csv" hash="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></dir><dir name="de_AT"><file name="Channelpilotsolutions_Channelpilot.csv" hash="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></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="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_GB"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_IE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_NZ"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_US"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></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>
34
  <compatible/>
35
- <dependencies/>
36
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Channelpilotsolutions_Channelpilot</name>
4
+ <version>2.2.3</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</notes>
30
+ <authors><author><name>ChannelPilot Solutions GmbH</name><user>channelpilot</user><email>info@channelpilot.com</email></author></authors>
31
+ <date>2015-09-11</date>
32
+ <time>10:10:51</time>
33
+ <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="1db2b1b5e56f9e2ea8a0d688b9faa801"/><file name="Replacefields.php" hash="db29c6ffaf9f4abe394b8981d031969f"/><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"><file name="CPErrors.php" hash="3659c38a1ed3be4aa4ec03d93e68a84e"/><file name="Data.php" hash="ab518fc37c2d152fc03b23ffbb317022"/><dir name="api"><dir name="1_0"><file name="CPResultCodes.php" hash="955180ee33f14b4afa93f6eb1b5df53f"/><file name="ChannelPilotSellerAPI_v1_0.php" hash="76f458bece7e3344d0ffa788370e2026"/><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></dir></dir><dir name="handler"><file name="CPAbstractHandler.php" hash="4435012e2b64d9541892516ec18179d3"/><file name="CPCancellationHandler.php" hash="e7470edc465be2a3608102549efc436f"/><file name="CPDebugHandler.php" hash="51845f353b8e3d94ec324c3a750d9cc7"/><file name="CPDeliveryHandler.php" hash="33d1febe4d683f52da397a5fc995bb85"/><file name="CPErrorHandler.php" hash="5d728c064c068fdf8354fa87882e4dba"/><file name="CPExportHandler.php" hash="a68f19af4f2811ba88cc24b96eaf4167"/><file name="CPNewPriceHandler.php" hash="e0c1be684439c2336dd240aff9d8647e"/><file name="CPNewsHandler.php" hash="10757d4bbb3d10a3090dab9587c86132"/><file name="CPOrderHandler.php" hash="6082da877c5c214721fe0c8d6a3fdf15"/><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="c84f63d310318a07a7db2a8d953fbe66"/><file name="CPRegisterHookResponse.php" hash="206de6433d0795ebdabff98129cc2fb7"/></dir><dir name="special"><file name="CustomerFunctions.php" hash="0d343d3c9c3cb87232c833e0772f730e"/></dir></dir><dir name="Model"><file name="Abstract.php" hash="26580a64f5ae3d005b68e4563dbb1aea"/><dir name="Adminhtml"><dir name="Source"><file name="Trackingmethod.php" hash="e32ab184b05377af38e4d912022cb889"/></dir></dir><dir name="Carrier"><file name="Cpshipping.php" hash="689b093872e690a9b1b1b5173365e7f8"/></dir><file name="Logs.php" hash="85c27d3b47cbd97fc197a1ba8ae60dc6"/><dir name="Order"><file name="Item.php" hash="7e64ca596a4a66e7c5052d0981745cf8"/><file name="Shipment.php" hash="71651ad5489eca654f47e41fd12e79a6"/></dir><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 name="Resource"><dir name="Logs"><file name="Collection.php" hash="d02494433e6369ddd552e04db867e9d5"/></dir><file name="Logs.php" hash="b406da96412148256028b8c73444b0d9"/><dir name="Order"><file name="Collection.php" hash="00423726d837a71042527c588cfc4b11"/><dir name="Item"><file name="Collection.php" hash="954e3889a8b8f93510a36be1a13c2fb8"/></dir><file name="Item.php" hash="485669b3f6dd7646ae9299547dc3a88f"/><dir name="Shipment"><file name="Collection.php" hash="6aa1fd002807916effa760169a2e769d"/></dir><file name="Shipment.php" hash="5d1514d5721b501fda7e71e6a15f931d"/></dir><file name="Order.php" hash="be971d53867fafbbf7c582dbe860e107"/><dir name="Prices"><file name="Collection.php" hash="6d49bf71e50a0d2b0e087d52036a08ef"/></dir><file name="Prices.php" hash="30275edca721b6986ff6bd39648bf4eb"/><dir name="Registration"><file name="Collection.php" hash="81423be65cf2ee706203ac03b5e83236"/></dir><file name="Registration.php" hash="a9f4190c21762c3f39c9647291e8e194"/></dir></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="4ad301497ad7545f52df49af57046bf1"/><file name="system.xml" hash="98c3360f19c9eaf1bf3ff0c61e63fbb8"/></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"/></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="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></dir><dir name="de_CH"><file name="Channelpilotsolutions_Channelpilot.csv" hash="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></dir><dir name="de_AT"><file name="Channelpilotsolutions_Channelpilot.csv" hash="14e19cf146fdc5fd2d0f0e9b8d66ae0c"/></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="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_GB"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_IE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_NZ"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></dir><dir name="en_US"><file name="Channelpilotsolutions_Channelpilot.csv" hash="d0c9795eb2cc5c9c8fd9387bee78126c"/></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>
34
  <compatible/>
35
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
36
  </package>