Version Notes
- general bugfixes
- tracking method selection added
- sellerAPI payment added
- sellerAPI partial cancellation added
Download this release
Release Info
Developer | Magento Core Team |
Extension | Channelpilotsolutions_Channelpilot |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.6 to 2.2.0
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Abstract.php +45 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php +4 -18
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Replacefields.php +72 -87
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Specialfields.php +54 -55
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Trackingkeys.php +66 -67
- app/code/community/Channelpilotsolutions/Channelpilot/Block/Tracking/Tracking.php +140 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php +22 -29
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php +296 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/ExportData.php +398 -580
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php +29 -16
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/thin/CPPayment.php +37 -10
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPAbstractHandler.php +42 -103
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php +75 -71
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDebugHandler.php +29 -30
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php +46 -37
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php +324 -503
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php +99 -91
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewsHandler.php +44 -39
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPOrderHandler.php +182 -124
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php +85 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php +47 -48
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php +5 -9
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/todoCPPaymentHandler.php +0 -12
- app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php +54 -65
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Adminhtml/Source/Trackingmethod.php +34 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Carrier/Cpshipping.php +15 -5
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Logs.php +39 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Order.php +66 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Item.php +53 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Shipment.php +45 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Prices.php +39 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Registration.php +74 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs.php +32 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs/Collection.php +32 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order.php +82 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Collection.php +98 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item.php +60 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item/Collection.php +98 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment.php +52 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment/Collection.php +32 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices.php +33 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices/Collection.php +32 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration.php +98 -0
- app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration/Collection.php +32 -0
- app/code/community/Channelpilotsolutions/Channelpilot/controllers/IndexController.php +36 -36
- app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml +41 -6
- app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml +12 -3
- app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-install-2.0.0.php +206 -206
- app/code/community/Channelpilotsolutions/Channelpilot/sql/channelpilot_setup/mysql4-upgrade-2.1.6-2.2.0.php +58 -0
- app/design/frontend/base/default/layout/Channelpilotsolutions/channelpilot.xml +15 -3
- app/design/frontend/base/default/template/Channelpilotsolutions/channelpilot.phtml +0 -118
- app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking_js.phtml +26 -0
- app/design/frontend/base/default/template/Channelpilotsolutions/salestracking_js.phtml +46 -0
- app/design/frontend/base/default/template/Channelpilotsolutions/tracking_image.phtml +26 -0
- app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/de_CH/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/de_DE/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_AU/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_CA/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_GB/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_IE/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_NZ/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/en_US/Channelpilotsolutions_Channelpilot.csv +6 -1
- app/locale/es_AR/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_CL/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_CO/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_CR/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_ES/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_MX/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_PA/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_PE/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/es_VE/Channelpilotsolutions_Channelpilot.csv +1 -0
- app/locale/fr_CA/Channelpilotsolutions_Channelpilot.csv +3 -2
- app/locale/fr_FR/Channelpilotsolutions_Channelpilot.csv +3 -2
- package.xml +8 -6
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Abstract.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php
CHANGED
@@ -21,9 +21,7 @@
|
|
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
|
25 |
-
|
26 |
-
private $_standardattributes;
|
27 |
|
28 |
public function __construct() {
|
29 |
$this->addColumn('productattribute', array(
|
@@ -37,35 +35,23 @@ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Exportfields exte
|
|
37 |
}
|
38 |
|
39 |
protected function _renderCellTemplate($columnName) {
|
40 |
-
$this->_standardattributes = "('sku','price','name','description','manufacturer','color','weight', 'parent_id')";
|
41 |
if (empty($this->_columns[$columnName])) {
|
42 |
throw new Exception('Wrong column name specified.');
|
43 |
}
|
44 |
-
$column = $this->_columns[$columnName];
|
45 |
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
46 |
|
47 |
if ($columnName == 'productattribute') {
|
48 |
$rendered = '<select name="' . $inputName . '">';
|
49 |
|
50 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
|
51 |
-
$tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
|
52 |
-
$dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
53 |
-
|
54 |
// Get attribute codes and types
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
ChannelPilotSolutions_ChannelPilot_eav_entity_type WHERE entity_type_code = 'catalog_product') AND
|
59 |
-
attribute_code NOT IN $this->_standardattributes
|
60 |
-
";
|
61 |
-
$query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
|
62 |
-
$attributes = $dbConnection->FetchAssoc($query);
|
63 |
|
64 |
$attributes[]['attribute_code'] = 'qty';
|
65 |
$attributes[]['attribute_code'] = 'stock_status';
|
66 |
$attributes[]['attribute_code'] = 'cp_color_attribute_id';
|
67 |
$attributes[]['attribute_code'] = 'type_id';
|
68 |
-
// $attributes[]['attribute_code'] = 'parent_id';
|
69 |
asort($attributes);
|
70 |
foreach ($attributes as $attribute) {
|
71 |
$rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
|
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(
|
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 |
asort($attributes);
|
56 |
foreach ($attributes as $attribute) {
|
57 |
$rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
|
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Replacefields.php
CHANGED
@@ -1,88 +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
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
$
|
52 |
-
$
|
53 |
-
|
54 |
-
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$
|
65 |
-
$
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$attributes[]['attribute_code'] = 'cp_additional_image_2';
|
74 |
-
$attributes[]['attribute_code'] = 'cp_additional_image_3';
|
75 |
-
asort($attributes);
|
76 |
-
foreach ($attributes as $attribute) {
|
77 |
-
$rendered .= '<option value="' . $attribute['attribute_code'] . '">' . $attribute['attribute_code'] . '</option>';
|
78 |
-
}
|
79 |
-
$rendered .= '</select>';
|
80 |
-
return $rendered;
|
81 |
-
}
|
82 |
-
|
83 |
-
return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}"/>';
|
84 |
-
}
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
?>
|
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,56 +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 |
-
$
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
?>
|
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,68 +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 |
-
$
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$rendered
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
?>
|
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/Tracking/Tracking.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php
CHANGED
@@ -35,6 +35,7 @@ require_once 'handler/CPDeliveryHandler.php';
|
|
35 |
require_once 'handler/CPCancellationHandler.php';
|
36 |
require_once 'handler/CPNewsHandler.php';
|
37 |
require_once 'handler/CPDebugHandler.php';
|
|
|
38 |
|
39 |
// RESPONSES
|
40 |
require_once 'responses/CPHookResponse.php';
|
@@ -60,6 +61,7 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
60 |
const GET_NEWS = "news";
|
61 |
const GET_NEWPRICES = "prices";
|
62 |
const GET_DEBUG = "debug";
|
|
|
63 |
|
64 |
public function __construct($root = 'root') {
|
65 |
|
@@ -68,7 +70,8 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
68 |
public function createXml() {
|
69 |
if (Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_useExport')) {
|
70 |
$password = Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_password');
|
71 |
-
|
|
|
72 |
header('Content-Type: text/xml; charset=utf-8');
|
73 |
include 'ExportData.php';
|
74 |
$exporter = new ExportData();
|
@@ -109,8 +112,8 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
109 |
$exportActive = true;
|
110 |
}
|
111 |
|
112 |
-
|
113 |
-
switch ($
|
114 |
// Send method
|
115 |
case self::GET_STATUS:
|
116 |
$this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
|
@@ -177,11 +180,18 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
177 |
case self::GET_DEBUG:
|
178 |
$this->checkSignature();
|
179 |
$handler = new CPDebugHandler();
|
180 |
-
$hook = $handler->handle();
|
181 |
break;
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
default:
|
184 |
-
$hook = "not supported method: " . $
|
185 |
break;
|
186 |
}
|
187 |
header("Content-Type: application/json;");
|
@@ -190,11 +200,14 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
190 |
}
|
191 |
|
192 |
private function checkSignature() {
|
193 |
-
|
194 |
-
|
|
|
|
|
|
|
195 |
return true;
|
196 |
}
|
197 |
-
CPErrorHandler::handle(CPErrors::RESULT_SIGNATURE_MISMATCH, "Signature changed", "Signature changed \n" . $
|
198 |
} else {
|
199 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "Missing params for signature check", "Missing params for signature check");
|
200 |
}
|
@@ -211,30 +224,10 @@ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Ab
|
|
211 |
|
212 |
private function checkIp() {
|
213 |
if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
|
214 |
-
|
215 |
-
$allIps[] = CPAbstractHandler::ChannelPilot_IP;
|
216 |
-
$sQuery = "SELECT ips_authorized FROM " . CPAbstractHandler::DB_REGISTRATION;
|
217 |
-
$dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
218 |
-
try {
|
219 |
-
$sResult = $dbConnection->fetchAll($sQuery);
|
220 |
-
foreach ($sResult as $resultType) {
|
221 |
-
$ips = explode(";", $resultType['ips_authorized']);
|
222 |
-
foreach ($ips as $ip) {
|
223 |
-
$allIps[] = $ip;
|
224 |
-
}
|
225 |
-
}
|
226 |
-
} catch (Exception $e) {
|
227 |
-
$dbConnection->closeConnection();
|
228 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getAllowedIpsViaSecurityToken(): " . $e->getMessage(), "Exception in getAllowedIpsViaSecurityToken(): '$sQuery'\n" . $e->getMessage());
|
229 |
-
}
|
230 |
-
|
231 |
-
if (!in_array($_SERVER['REMOTE_ADDR'], $allIps)) {
|
232 |
-
return false;
|
233 |
-
}
|
234 |
}
|
235 |
return true;
|
236 |
}
|
237 |
-
|
238 |
}
|
239 |
|
240 |
?>
|
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';
|
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 |
|
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 |
header('Content-Type: text/xml; charset=utf-8');
|
76 |
include 'ExportData.php';
|
77 |
$exporter = new ExportData();
|
112 |
$exportActive = true;
|
113 |
}
|
114 |
|
115 |
+
$method = Mage::app()->getRequest()->getParam('method', '');
|
116 |
+
switch ($method) {
|
117 |
// Send method
|
118 |
case self::GET_STATUS:
|
119 |
$this->checkActivation(array($marketplaceActive, $pricecontrolActive), 'marketplace OR pricecontrol');
|
180 |
case self::GET_DEBUG:
|
181 |
$this->checkSignature();
|
182 |
$handler = new CPDebugHandler();
|
183 |
+
$hook = $handler->handle();
|
184 |
break;
|
185 |
|
186 |
+
case self::GET_PAYMENTS:
|
187 |
+
$this->checkSignature();
|
188 |
+
$this->checkActivation(array($marketplaceActive), 'marketplace');
|
189 |
+
$handler = new CPPaymentHandler();
|
190 |
+
$handler->handle();
|
191 |
+
break;
|
192 |
+
|
193 |
default:
|
194 |
+
$hook = "not supported method: " . $method;
|
195 |
break;
|
196 |
}
|
197 |
header("Content-Type: application/json;");
|
200 |
}
|
201 |
|
202 |
private function checkSignature() {
|
203 |
+
$php = Mage::app()->getRequest()->getParam('php', false);
|
204 |
+
$shop = Mage::app()->getRequest()->getParam('shop', false);
|
205 |
+
$plugin = Mage::app()->getRequest()->getParam('plugin', false);
|
206 |
+
IF ($php && $shop && $plugin) {
|
207 |
+
if ($php == phpversion() && $shop == CPHookResponse::getSignatureShop() && $plugin == CPHookResponse::getModuleVersion()) {
|
208 |
return true;
|
209 |
}
|
210 |
+
CPErrorHandler::handle(CPErrors::RESULT_SIGNATURE_MISMATCH, "Signature changed", "Signature changed \n" . $php . " -> " . phpversion() . "\n" . $shop . " -> " . CPHookResponse::getSignatureShop() . "\n" . $plugin . " -> " . CPHookResponse::getModuleVersion());
|
211 |
} else {
|
212 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "Missing params for signature check", "Missing params for signature check");
|
213 |
}
|
224 |
|
225 |
private function checkIp() {
|
226 |
if (Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_checkIp')) {
|
227 |
+
return Mage::getModel('channelpilot/registration')->isIpAuthorized($_SERVER['REMOTE_ADDR']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
229 |
return true;
|
230 |
}
|
|
|
231 |
}
|
232 |
|
233 |
?>
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Export.php
ADDED
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
CHANGED
@@ -33,6 +33,11 @@ class ExportData {
|
|
33 |
private $_storeCode;
|
34 |
private $oldCatPath;
|
35 |
private $xml;
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
function __construct() {
|
38 |
|
@@ -44,10 +49,28 @@ class ExportData {
|
|
44 |
Mage::app('admin');
|
45 |
|
46 |
// Get the table prefix
|
47 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
|
48 |
|
49 |
// Get database connection
|
50 |
$this->_dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
// Run the main application and call the appropriate function
|
@@ -64,15 +87,12 @@ class ExportData {
|
|
64 |
|
65 |
$currencyCode = Mage::app()->getRequest()->getParam('currency', false);
|
66 |
if ($currencyCode && $currencyCode != '') {
|
67 |
-
$
|
68 |
-
|
69 |
-
$query->where('currency_to = ?', $currencyCode);
|
70 |
-
$result = $this->_dbConnection->fetchAll($query);
|
71 |
-
if(sizeof($result) === 0){
|
72 |
echo "<error>wrong currency</error>";
|
73 |
return;
|
74 |
}
|
75 |
-
$this->_currencyChange = $result[
|
76 |
|
77 |
}
|
78 |
// Validate store and get information
|
@@ -82,636 +102,434 @@ class ExportData {
|
|
82 |
return $this->_extractFromMySQL();
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$return = $this->getCategory($tmpKey);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
return $return;
|
96 |
-
}
|
97 |
-
|
98 |
-
// Extract natively directly from the database
|
99 |
-
private function _extractFromMySQL() {
|
100 |
-
$selectLimit = 100;
|
101 |
-
|
102 |
-
// Increase maximium length for group_concat (for additional image URLs field)
|
103 |
-
$query = "SET SESSION group_concat_max_len = 1000000;";
|
104 |
-
$this->_dbConnection->query($query);
|
105 |
-
|
106 |
-
// Get category information
|
107 |
-
$query = '';
|
108 |
-
if (substr(Mage::getVersion(), 2, 3) >= 6) {
|
109 |
$query = new Zend_Db_Select($this->_dbConnection);
|
110 |
$query->distinct();
|
111 |
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
112 |
array('fs.entity_id', 'fs.path', 'fs.name')
|
113 |
);
|
114 |
-
$query->join(
|
115 |
-
array('fs' => Mage::getSingleton('core/resource')->getTableName(array('catalog/category_flat','store_'.$this->_storeId))),
|
116 |
'pi.category_id = fs.entity_id',
|
117 |
null
|
118 |
);
|
|
|
|
|
119 |
$query->order('fs.path ASC');
|
120 |
-
|
121 |
$query = new Zend_Db_Select($this->_dbConnection);
|
122 |
-
$query->
|
123 |
-
|
124 |
-
array('ev.entity_id', 'ce.path', 'ev.value')
|
125 |
);
|
126 |
-
$query->join(
|
127 |
-
|
128 |
-
'ev.entity_id = ce.entity_id',
|
129 |
null
|
130 |
);
|
131 |
-
|
132 |
-
$
|
133 |
-
$
|
134 |
-
$subquery->where('att.entity_type_id = ev.entity_type_id AND att.attribute_code = \'name\'');
|
135 |
-
|
136 |
-
$query->where('ev.attribute_id = ('.$subquery->__toString().')');
|
137 |
$query->order('ce.path ASC');
|
138 |
-
|
139 |
-
|
140 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
141 |
-
|
142 |
-
$categoriesTable = $this->_dbConnection->fetchAll($query);
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
// Start tree
|
151 |
-
$path = $this->getCategory($categorie[1]);
|
152 |
-
if ($path !== 0) {
|
153 |
-
$this->_allCat[$categorie[1]] = str_replace('Root Catalog', 'Home', $path . '>' . $categorie[2]);
|
154 |
-
$oldCatTree = $path . '>' . $categorie[2];
|
155 |
-
} else {
|
156 |
-
$this->_allCat[$categorie[1]] = str_replace('Root Catalog', 'Home', $categorie[2]);
|
157 |
-
$oldCatTree = $categorie[2];
|
158 |
-
}
|
159 |
-
} else {
|
160 |
-
// continue tree
|
161 |
-
$this->_allCat[$categorie[1]] = str_replace('Root Catalog', 'Home', $oldCatTree . '>' . $categorie[2]);
|
162 |
-
$oldCatTree = $this->_allCat[$categorie[1]];
|
163 |
-
}
|
164 |
-
$oldCatPath = $categorie[1];
|
165 |
-
}
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
$query = new Zend_Db_Select($this->_dbConnection);
|
173 |
-
$query->from(Mage::getSingleton('core/resource')->getTableName('
|
174 |
-
|
175 |
-
|
176 |
-
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
$query = new Zend_Db_Select($this->_dbConnection);
|
180 |
-
$query->from(Mage::getSingleton('core/resource')->getTableName('eav/attribute'),
|
181 |
-
array('attribute_id', 'attribute_code', 'backend_type', 'frontend_input'));
|
182 |
-
$query->where('entity_type_id = ?', $PRODUCT_ENTITY_TYPE_ID);
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
$blankProduct['sku'] = '';
|
189 |
-
$blankProduct['parent_id'] = '';
|
190 |
-
$blankProduct['variationTheme'] = '';
|
191 |
-
$blankProduct['name'] = '';
|
192 |
-
$blankProduct['description'] = '';
|
193 |
-
$blankProduct['price'] = '';
|
194 |
-
$blankProduct['categories'] = '';
|
195 |
-
$blankProduct['manufacturer'] = '';
|
196 |
-
$blankProduct['cp_product_url'] = '';
|
197 |
-
$blankProduct['cp_image_url'] = '';
|
198 |
-
$blankProduct['color'] = '';
|
199 |
-
$blankProduct['weight'] = '';
|
200 |
-
for($i = 1; $i <= Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
|
201 |
-
$blankProduct['cp_additional_image_'.$i] = '';
|
202 |
-
}
|
203 |
|
204 |
-
|
205 |
-
if (!empty($special_export_fields)) {
|
206 |
-
foreach ($special_export_fields as $element) {
|
207 |
-
if (!empty($element['name'])) {
|
208 |
-
$blankProduct[preg_replace('/\W/', '', $element['name'])] = $element['value'];
|
209 |
-
}
|
210 |
-
}
|
211 |
-
}
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
218 |
|
219 |
-
|
220 |
-
case 'datetime':
|
221 |
-
case 'decimal':
|
222 |
-
case 'int':
|
223 |
-
case 'text':
|
224 |
-
case 'varchar':
|
225 |
-
$attributeCodes[$row['attribute_id']] = $row['attribute_code'];
|
226 |
-
//$blankProduct[$row['attribute_code']] = '';
|
227 |
-
break;
|
228 |
-
case 'static':
|
229 |
-
// ignore columns in entity table
|
230 |
-
// print("Skipping static attribute: ".$row['attribute_code']."\n");
|
231 |
-
break;
|
232 |
-
default:
|
233 |
-
// print("Unsupported backend_type: ".$row['backend_type']."\n");
|
234 |
-
break;
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
array(
|
244 |
-
new Zend_Db_Expr($this->_dbConnection->quoteInto(
|
245 |
-
'CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.option_id) ELSE
|
246 |
-
MAX(CASE WHEN aov.store_id = ? THEN aov.option_id ELSE NULL END)
|
247 |
-
END AS \'option_id\'
|
248 |
-
,CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.value) ELSE
|
249 |
-
MAX(CASE WHEN aov.store_id = ? THEN aov.value ELSE NULL END)
|
250 |
-
END AS \'value\'',
|
251 |
-
$this->_storeId
|
252 |
-
))
|
253 |
-
)
|
254 |
-
);
|
255 |
-
$query->join(array('aov' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_option_value')),
|
256 |
-
'ao.option_id = aov.option_id',
|
257 |
-
null
|
258 |
-
);
|
259 |
-
$query->where('aov.store_id IN (0, ?)', $this->_storeId);
|
260 |
-
$query->where('ao.attribute_id = ?', $row['attribute_id']);
|
261 |
-
$query->group('aov.option_id');
|
262 |
|
263 |
-
|
264 |
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
}
|
272 |
-
$result = null;
|
273 |
-
}
|
274 |
-
}
|
275 |
|
276 |
-
|
277 |
-
$export_data_fields_ids = array();
|
278 |
-
foreach (array_keys($blankProduct) as $key) {
|
279 |
-
$export_data_fields_codes = $export_data_fields_codes . "'" . $key . "',";
|
280 |
-
$tmpid = array_search($key, $attributeCodes);
|
281 |
-
if (!empty($tmpid)) {
|
282 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
283 |
-
}
|
284 |
-
}
|
285 |
|
286 |
-
|
287 |
-
$
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$export_data_fields_codes = $export_data_fields_codes . "'" . $element['productattribute'] . "',";
|
293 |
-
if($element['productattribute'] == 'type_id') {
|
294 |
-
$useTypeId = true;
|
295 |
-
} else {
|
296 |
-
$tmpid = array_search($element['productattribute'], $attributeCodes);
|
297 |
-
if (!empty($tmpid)) {
|
298 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
299 |
-
}
|
300 |
-
}
|
301 |
-
}
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
$tmpid = array_search('status', $attributeCodes);
|
306 |
-
if (!empty($tmpid)) {
|
307 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
308 |
-
}
|
309 |
-
$tmpid = array_search('url_path', $attributeCodes);
|
310 |
-
if (!empty($tmpid)) {
|
311 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
312 |
-
}
|
313 |
-
$tmpid = array_search('image', $attributeCodes);
|
314 |
-
if (!empty($tmpid)) {
|
315 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
316 |
-
}
|
317 |
-
$export_data_fields_ids = implode(',',$export_data_fields_ids);
|
318 |
-
|
319 |
-
|
320 |
-
// Build queries for each attribute type
|
321 |
-
$backendTypes = array(
|
322 |
-
'datetime',
|
323 |
-
'decimal',
|
324 |
-
'int',
|
325 |
-
'text',
|
326 |
-
'varchar',
|
327 |
-
);
|
328 |
-
$queries = array();
|
329 |
-
foreach ($backendTypes as $backendType) {
|
330 |
-
// Get store value if there is one, otherwise, global value
|
331 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
332 |
-
$query->from(array('cpe' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
|
333 |
-
array(new Zend_Db_Expr($this->_dbConnection->quoteInto('
|
334 |
-
CASE WHEN SUM(ev.store_id) = 0 THEN MAX(ev.value) ELSE
|
335 |
-
MAX(CASE WHEN ev.store_id = ? THEN ev.value ELSE NULL END)
|
336 |
-
END AS \'value\'
|
337 |
-
', $this->_storeId)), 'ev.attribute_id')
|
338 |
-
);
|
339 |
-
$query->join(array('ev' => Mage::getSingleton('core/resource')->getTableName(array('catalog/product', $backendType))),
|
340 |
-
'cpe.entity_id = ev.entity_id',
|
341 |
-
null
|
342 |
-
);
|
343 |
-
$query->where('ev.store_id IN (0, ?)', $this->_storeId);
|
344 |
-
$query->where('ev.entity_type_id = ?', $PRODUCT_ENTITY_TYPE_ID);
|
345 |
-
$query->where('ev.entity_id = @ENTITY_ID');
|
346 |
-
$query->where('ev.attribute_id IN ('.$export_data_fields_ids.')');
|
347 |
-
$query->group(array('ev.attribute_id', 'ev.entity_id'));
|
348 |
|
349 |
-
|
350 |
-
}
|
351 |
-
$query = implode(" UNION ALL ", $queries);
|
352 |
-
$MasterProductQuery = $query;
|
353 |
|
354 |
-
|
355 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
356 |
-
$query->from(array('cpe' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
|
357 |
-
new Zend_Db_Expr('count(*)')
|
358 |
-
);
|
359 |
$query->join(array('cpw' => Mage::getSingleton('core/resource')->getTableName('catalog/product_website')),
|
360 |
'cpw.product_id = cpe.entity_id',
|
361 |
null
|
362 |
);
|
363 |
$query->where('cpw.website_id = ?', $this->_siteId);
|
364 |
$query->where("IFNULL(cpe.sku, '') != ''");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
368 |
|
369 |
-
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
|
376 |
-
|
377 |
-
$replace_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
// Get all entity_ids for all products in the selected store
|
382 |
-
$columns = array('cpe.entity_id', 'cpe.sku');
|
383 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
384 |
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
$
|
398 |
-
|
399 |
-
$columns['is_parent'] = new Zend_Db_Expr('('.$subquery.')');
|
400 |
-
|
401 |
-
$subquery = new Zend_Db_Select($this->_dbConnection);
|
402 |
-
$subquery->from(Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_status'), array('qty'));
|
403 |
-
$subquery->where('product_id = cpe.entity_id');
|
404 |
-
$subquery->where('website_id = ?', $this->_siteId);
|
405 |
-
$subquery->where('stock_id = 1');
|
406 |
-
$subquery->limit(1);
|
407 |
-
|
408 |
-
$columns['qty'] = new Zend_Db_Expr('('.$subquery.')');
|
409 |
-
|
410 |
-
$subquery = new Zend_Db_Select($this->_dbConnection);
|
411 |
-
$subquery->from(Mage::getSingleton('core/resource')->getTableName('cataloginventory/stock_status'), array('stock_status'));
|
412 |
-
$subquery->where('product_id = cpe.entity_id');
|
413 |
-
$subquery->where('website_id = ?', $this->_siteId);
|
414 |
-
$subquery->where('stock_id = 1');
|
415 |
-
$subquery->limit(1);
|
416 |
-
|
417 |
-
$columns['stock_status'] = new Zend_Db_Expr('('.$subquery.')');
|
418 |
-
|
419 |
-
$subquery = new Zend_Db_Select($this->_dbConnection);
|
420 |
-
$subquery->from(array('crpp' => Mage::getSingleton('core/resource')->getTableName('catalogrule/rule_product_price')), array('crpp.rule_price'));
|
421 |
-
$subquery->where('crpp.rule_date = CURDATE()');
|
422 |
-
$subquery->where('crpp.product_id = cpe.entity_id');
|
423 |
-
$subquery->where('crpp.customer_group_id = 1');
|
424 |
-
$subquery->where('crpp.website_id = ?', $this->_siteId);
|
425 |
-
|
426 |
-
$columns['cat_price'] = new Zend_Db_Expr('('.$subquery.')');
|
427 |
-
$columns[] = 'cpe.type_id';
|
428 |
-
|
429 |
-
$query->from(array('cpe' => Mage::getSingleton('core/resource')->getTableName('catalog/product')), $columns);
|
430 |
-
$query->join(array('cpw' => Mage::getSingleton('core/resource')->getTableName('catalog/product_website')),
|
431 |
-
'cpw.product_id = cpe.entity_id',
|
432 |
-
null
|
433 |
-
);
|
434 |
-
$query->where('cpw.website_id = ?', $this->_siteId);
|
435 |
-
$query->where("IFNULL(cpe.sku, '') != ''");
|
436 |
-
$query->order(array('is_parent DESC', 'entity_id DESC'));
|
437 |
-
$query->limit($selectLimit, $counter);
|
438 |
-
|
439 |
-
// Set fetch mode to numeric to save memory
|
440 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
441 |
-
$EntityIds = $this->_dbConnection->fetchAll($query);
|
442 |
-
// Loop through each product and output the data
|
443 |
-
foreach ($EntityIds as $entity) {
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
// Fill the master query with the entity ID
|
448 |
-
// $entity[0] = entity_id
|
449 |
-
// $entity[1] = sku
|
450 |
-
$query = str_replace('@ENTITY_ID', $entity[0], $MasterProductQuery);
|
451 |
-
$result = $this->_dbConnection->query($query);
|
452 |
-
|
453 |
-
|
454 |
-
// Create a new product record
|
455 |
-
$product = $blankProduct;
|
456 |
-
|
457 |
-
if (intval($entity[3]) > 0) {
|
458 |
-
$varQuery = new Zend_Db_Select($this->_dbConnection);
|
459 |
-
$varQuery->from(array('cpsa' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_attribute')),
|
460 |
-
array('ea.attribute_code')
|
461 |
-
);
|
462 |
-
$varQuery->joinLeft(array('ea' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
|
463 |
-
'ea.attribute_id = cpsa.attribute_id',
|
464 |
-
null
|
465 |
-
);
|
466 |
-
$varQuery->where('cpsa.product_id = ?', $entity[0]);
|
467 |
-
$varQuery->order('ea.attribute_id');
|
468 |
-
|
469 |
-
$varresults = $this->_dbConnection->fetchAll($varQuery);
|
470 |
-
$variationTheme = "";
|
471 |
-
foreach ($varresults as $varresult) {
|
472 |
-
$variationTheme = $variationTheme . "|" . $varresult[0];
|
473 |
-
}
|
474 |
-
$product['variationTheme'] = ltrim($variationTheme, "|");
|
475 |
-
$variationThemes[$entity[0]] = ltrim($variationTheme, "|");
|
476 |
-
} else {
|
477 |
-
if (empty($entity[2]) != true) {
|
478 |
-
$product['variationTheme'] = $variationThemes[$entity[2]];
|
479 |
-
}
|
480 |
-
}
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
if ($attributeCodes[$column[1]] == 'url_path') {
|
535 |
-
$product_url = $column[0];
|
536 |
-
}
|
537 |
-
if ($attributeCodes[$column[1]] == 'image') {
|
538 |
-
$product_image = $column[0];
|
539 |
-
}
|
540 |
-
}
|
541 |
-
$result = null;
|
542 |
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
}
|
547 |
-
// Get category information
|
548 |
-
if (substr(Mage::getVersion(), 2, 3) >= 6) {
|
549 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
550 |
-
$query->distinct();
|
551 |
-
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
552 |
-
array('fs.entity_id', 'fs.path', 'fs.name')
|
553 |
-
);
|
554 |
-
$query->join(array('fs' => Mage::getSingleton('core/resource')->getTableName(array('catalog/category_flat', 'store_'.$this->_storeId))),
|
555 |
-
'pi.category_id = fs.entity_id',
|
556 |
-
null
|
557 |
-
);
|
558 |
-
$query->where('pi.product_id = ?', $entity[0]);
|
559 |
-
$query->where('pi.store_id = ?', $this->_storeId);
|
560 |
-
$query->order('fs.path ASC');
|
561 |
-
} else {
|
562 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
563 |
-
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
564 |
-
array('pi.category_id', 'ce.path')
|
565 |
-
);
|
566 |
-
$query->join(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/category')),
|
567 |
-
'pi.category_id = ce.entity_id',
|
568 |
-
null
|
569 |
-
);
|
570 |
-
$query->where('pi.product_id = ?', $entity[0]);
|
571 |
-
$query->where('pi.is_parent = 1');
|
572 |
-
$query->where('pi.store_id = ?', $this->_storeId);
|
573 |
-
$query->order('ce.path ASC');
|
574 |
-
}
|
575 |
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
if ($categorieField !== '') {
|
587 |
-
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
588 |
-
} else {
|
589 |
-
$categorieField = $this->_allCat[$this->oldCatPath];
|
590 |
-
}
|
591 |
-
}
|
592 |
-
$this->oldCatPath = $categorie[1];
|
593 |
-
} else {
|
594 |
-
// Add to tree
|
595 |
-
$this->oldCatPath = $categorie[1];
|
596 |
-
}
|
597 |
-
}
|
598 |
-
if ($categorieField !== '') {
|
599 |
-
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
600 |
-
} else {
|
601 |
-
if ($this->oldCatPath !== '') {
|
602 |
-
$categorieField = $this->_allCat[$this->oldCatPath];
|
603 |
-
}
|
604 |
-
}
|
605 |
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
$query->join(array('gallery_value' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery_value')),
|
639 |
-
'gallery.value_id = gallery_value.value_id',
|
640 |
-
null
|
641 |
);
|
642 |
-
$query->where('gallery_value.store_id IN (0, ?)', $this->_storeId);
|
643 |
-
$query->where('gallery_value.disabled = 0');
|
644 |
-
$query->where('gallery.entity_id = ?',$entity[0]);
|
645 |
-
$query->where('gallery.attribute_id = ?', $MEDIA_GALLERY_ATTRIBUTE_ID);
|
646 |
-
$query->order('gallery_value.position ASC');
|
647 |
-
|
648 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
649 |
-
$galleryValues = $this->_dbConnection->fetchAll($query);
|
650 |
-
if (empty($galleryValues) != true) {
|
651 |
-
$additional_images = explode(',', $galleryValues[0][1]);
|
652 |
-
for($i = 0; $i < Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_imagenumber'); $i++) {
|
653 |
-
if (isset($additional_images[$i])) {
|
654 |
-
$product['cp_additional_image_' . ($i + 1)] = $additional_images[$i];
|
655 |
-
}
|
656 |
-
}
|
657 |
-
}
|
658 |
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
|
|
|
|
|
|
|
|
663 |
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
}
|
669 |
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
|
|
674 |
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
|
|
|
|
|
|
702 |
|
703 |
-
if($
|
704 |
-
$product['type_id'] = $entity[
|
705 |
}
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
|
|
|
|
|
|
715 |
|
716 |
// Join two URL paths and handle forward slashes
|
717 |
private function _urlPathJoin($part1, $part2) {
|
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 |
|
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
|
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
|
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) {
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/api/1_0/ChannelPilotSellerAPI_v1_0.php
CHANGED
@@ -38,8 +38,7 @@ require_once 'responses/GetManagedArticlePricesResponse.php';
|
|
38 |
class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
39 |
|
40 |
private $auth;
|
41 |
-
private $wsdlUrl = '
|
42 |
-
private $uri = 'http://seller.api.channelpilot.com/1_0';
|
43 |
private $soapOptions = array(
|
44 |
'connection_timeout' => 20,
|
45 |
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
|
@@ -87,7 +86,7 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
87 |
*/
|
88 |
public function getServerTime() {
|
89 |
return $this->__call(
|
90 |
-
'getServerTime',
|
91 |
array(
|
92 |
new SoapParam($this->auth, 'auth')
|
93 |
)
|
@@ -100,34 +99,34 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
100 |
*/
|
101 |
public function updateArticles(array $articles) {
|
102 |
return $this->__call(
|
103 |
-
'updateArticles',
|
104 |
array(
|
105 |
new SoapParam($this->auth, 'auth'),
|
106 |
new SoapParam($articles, 'articles')
|
107 |
)
|
108 |
);
|
109 |
}
|
110 |
-
|
111 |
/**
|
112 |
* retrieves new marketplace orders
|
113 |
* @return GetNewMarketplaceOrdersResponse
|
114 |
*/
|
115 |
public function getNewMarketplaceOrders() {
|
116 |
return $this->__call(
|
117 |
-
'getNewMarketplaceOrders',
|
118 |
array(
|
119 |
new SoapParam($this->auth, 'auth')
|
120 |
)
|
121 |
);
|
122 |
}
|
123 |
-
|
124 |
/**
|
125 |
* update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
|
126 |
* q
|
127 |
* @return GetNewMarketplaceOrdersResponse
|
128 |
*/
|
129 |
-
|
130 |
-
|
131 |
/**
|
132 |
* update orders in ChannelPilot to "imported", generates the matching between externalOrderId and the shop-internal orderId
|
133 |
* @param array $orders array of CPOrders
|
@@ -136,7 +135,7 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
136 |
*/
|
137 |
public function setImportedOrders(array $orders, $mapOrderItemIds) {
|
138 |
return $this->__call(
|
139 |
-
'setImportedOrders',
|
140 |
array(
|
141 |
new SoapParam($this->auth, 'auth'),
|
142 |
new SoapParam($orders, 'importedOrders'),
|
@@ -144,11 +143,11 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
144 |
)
|
145 |
);
|
146 |
}
|
147 |
-
|
148 |
-
|
149 |
public function registerDeliveries(array $deliveries) {
|
150 |
return $this->__call(
|
151 |
-
'registerDeliveries',
|
152 |
array(
|
153 |
new SoapParam($this->auth, 'auth'),
|
154 |
new SoapParam($deliveries, 'deliveries')
|
@@ -158,17 +157,17 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
158 |
|
159 |
public function registerCancellations(array $cancellations) {
|
160 |
return $this->__call(
|
161 |
-
'registerCancellations',
|
162 |
array(
|
163 |
new SoapParam($this->auth, 'auth'),
|
164 |
new SoapParam($cancellations, 'cancellations')
|
165 |
)
|
166 |
);
|
167 |
}
|
168 |
-
|
169 |
public function getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom) {
|
170 |
return $this->__call(
|
171 |
-
'getDynamicArticlePrices',
|
172 |
array(
|
173 |
new SoapParam($this->auth, 'auth'),
|
174 |
new SoapParam($priceId, 'priceId'),
|
@@ -180,6 +179,20 @@ class ChannelPilotSellerAPI_v1_0 extends SoapClient {
|
|
180 |
);
|
181 |
}
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
?>
|
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
|
86 |
*/
|
87 |
public function getServerTime() {
|
88 |
return $this->__call(
|
89 |
+
'getServerTime',
|
90 |
array(
|
91 |
new SoapParam($this->auth, 'auth')
|
92 |
)
|
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
|
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'),
|
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')
|
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'),
|
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/CPPayment.php
CHANGED
@@ -1,10 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class CPPayment {
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
@@ -21,11 +21,11 @@ class CPAbstractHandler {
|
|
21 |
* @param type $shopId
|
22 |
* @return boolean
|
23 |
*/
|
24 |
-
public static function isIpAllowedViaShopId($shopId
|
25 |
-
if (self::ChannelPilot_IP == $_SERVER['REMOTE_ADDR'] ||
|
26 |
return true;
|
27 |
} else {
|
28 |
-
return in_array($_SERVER['REMOTE_ADDR'],
|
29 |
}
|
30 |
}
|
31 |
|
@@ -36,55 +36,13 @@ class CPAbstractHandler {
|
|
36 |
* @return boolean
|
37 |
*/
|
38 |
public static function isIpAllowedViaSecurityToken($token) {
|
39 |
-
if (self::ChannelPilot_IP == $_SERVER['REMOTE_ADDR'] ||
|
40 |
return true;
|
41 |
} else {
|
42 |
-
return in_array($_SERVER['REMOTE_ADDR'],
|
43 |
}
|
44 |
}
|
45 |
|
46 |
-
/**
|
47 |
-
* Get allowed ips for the shop via securityToken
|
48 |
-
*
|
49 |
-
* @param type $token
|
50 |
-
* @return array with allowed ips
|
51 |
-
*/
|
52 |
-
public static function getAllowedIpsViaSecurityToken($token) {
|
53 |
-
$dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
54 |
-
$sQuery = "SELECT ips_authorized FROM " . (string)Mage::getConfig()->getTablePrefix().self::DB_REGISTRATION . " WHERE securityToken = ?;";
|
55 |
-
$array = array($token);
|
56 |
-
try {
|
57 |
-
$sResult = $dbConnection->fetchOne($sQuery, $array);
|
58 |
-
$dbConnection->closeConnection();
|
59 |
-
return explode(";", $sResult);
|
60 |
-
} catch (Exception $e) {
|
61 |
-
$dbConnection->closeConnection();
|
62 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getAllowedIpsViaSecurityToken(): " . $e->getMessage(), "Exception in getAllowedIpsViaSecurityToken(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
63 |
-
}
|
64 |
-
return null;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Get allowed ips for the shop via shopId
|
69 |
-
*
|
70 |
-
* @param type $shopId
|
71 |
-
* @return array with allowed ips
|
72 |
-
*/
|
73 |
-
public static function getAllowedIpsViaShopId($shopId) {
|
74 |
-
$dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
75 |
-
$sQuery = "SELECT ips_authorized FROM " . (string)Mage::getConfig()->getTablePrefix().self::DB_REGISTRATION . " WHERE shopId = ?;";
|
76 |
-
$array = array($shopId);
|
77 |
-
try {
|
78 |
-
$sResult = $dbConnection->fetchOne($sQuery, $array);
|
79 |
-
$dbConnection->closeConnection();
|
80 |
-
return explode(";", $sResult);
|
81 |
-
} catch (Exception $e) {
|
82 |
-
$dbConnection->closeConnection();
|
83 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getAllowedIpsViaShopId(): " . $e->getMessage(), "Exception in getAllowedIpsViaShopId(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
84 |
-
}
|
85 |
-
return null;
|
86 |
-
}
|
87 |
-
|
88 |
/**
|
89 |
* Is the shop still registered?
|
90 |
*
|
@@ -92,90 +50,71 @@ class CPAbstractHandler {
|
|
92 |
* @return boolean
|
93 |
*/
|
94 |
public static function isShopRegistered($shopId) {
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$dbConnection->closeConnection();
|
101 |
-
if (empty($sResult)) {
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
} catch (Exception $e) {
|
105 |
-
$dbConnection->closeConnection();
|
106 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in isShopRegistered(): " . $e->getMessage(), "Exception in isShopRegistered(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
107 |
-
}
|
108 |
-
return true;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
public static function getMerchantId($token) {
|
112 |
-
|
113 |
-
|
114 |
-
$array = array($token);
|
115 |
-
try {
|
116 |
-
$sResult = $dbConnection->fetchOne($sQuery, $array);
|
117 |
-
$dbConnection->closeConnection();
|
118 |
-
} catch (Exception $e) {
|
119 |
-
$dbConnection->closeConnection();
|
120 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getMerchantId(): " . $e->getMessage(), "Exception in getMerchantId(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
121 |
-
}
|
122 |
-
return $sResult;
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
-
* Get shopId by token for registered shop
|
|
|
127 |
*
|
128 |
-
* @param
|
129 |
-
* @
|
130 |
-
* @return type
|
131 |
*/
|
132 |
-
public static function getShopId($token
|
133 |
-
|
134 |
-
|
135 |
-
try {
|
136 |
-
$sResult = $dbConnection->fetchOne($sQuery, $array);
|
137 |
-
} catch (Exception $e) {
|
138 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getShopId(): " . $e->getMessage(), "Exception in getShopId(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
139 |
-
$dbConnection->closeConnection();
|
140 |
-
}
|
141 |
-
return $sResult;
|
142 |
}
|
143 |
|
144 |
-
public static function changeStatusOrders($apiOrders
|
145 |
foreach ($apiOrders as $apiOrder) {
|
146 |
if ($apiOrder->header->resultCode == CPResultCodes::SUCCESS) {
|
147 |
-
self::changeStatusOrder($apiOrder->orderHeader
|
148 |
} else {
|
149 |
self::logError("Cannot change orderstatus from order (id: '" . $apiOrder->orderHeader->orderId . "', status: '" . $apiOrder->orderHeader->status->identifier . "')");
|
150 |
}
|
151 |
}
|
152 |
}
|
153 |
|
154 |
-
public static function changeStatusOrder($apiOrderHeader
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
163 |
}
|
164 |
|
165 |
/**
|
166 |
* log the error in the cp_marketplace - log file
|
167 |
*
|
168 |
-
* @param
|
169 |
*/
|
170 |
public static function logError($msg) {
|
171 |
$msg = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] by IP: {$_SERVER['REMOTE_ADDR']}\n$msg";
|
172 |
|
173 |
Mage::log("$msg\n\n", null, 'cp_plugin.log');
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
$dbWriteConnection->closeConnection();
|
179 |
}
|
180 |
|
181 |
public static function checkConfig() {
|
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 |
|
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 |
*
|
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() {
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPCancellationHandler.php
CHANGED
@@ -12,56 +12,56 @@ class CPCancellationHandler extends CPAbstractHandler {
|
|
12 |
* @return type
|
13 |
*/
|
14 |
public function handle() {
|
15 |
-
|
|
|
|
|
16 |
self::checkConfig();
|
17 |
-
|
18 |
-
$cancelled = array();
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
}
|
25 |
-
}
|
26 |
-
$cancelledOrderItems = self::getCancelledItems();
|
27 |
-
|
28 |
-
foreach ($cancelledOrderItems as $orders) {
|
29 |
-
if (isset($orders)) {
|
30 |
-
$cancelled[] = $orders;
|
31 |
-
}
|
32 |
}
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
|
|
36 |
}
|
37 |
-
|
38 |
-
$api = new ChannelPilotSellerAPI_v1_0($merchantId, $_GET['token']);
|
39 |
-
$result = $api->registerCancellations($cancelled);
|
40 |
-
if ($result->header->resultCode == CPResultCodes::SUCCESS) {
|
41 |
-
// return $result;
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
self::hookResult(true);
|
57 |
} else {
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
|
|
60 |
} else {
|
61 |
-
if (empty($
|
|
|
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: " . $
|
65 |
}
|
66 |
}
|
67 |
}
|
@@ -74,18 +74,13 @@ class CPCancellationHandler extends CPAbstractHandler {
|
|
74 |
$hook->writeResponse(self::defaultHeader, json_encode($hook));
|
75 |
}
|
76 |
|
77 |
-
private
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
WHERE sales_flat_order_item.qty_canceled > 0 AND sales_flat_order.status != 'canceled' ORDER BY sales_flat_order_item.order_id;";
|
84 |
-
$dbReadConnection = null;
|
85 |
try {
|
86 |
-
$dbReadConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
87 |
-
$sResult = $dbReadConnection->fetchAll($sQuery);
|
88 |
-
$dbReadConnection->closeConnection();
|
89 |
$order = null;
|
90 |
$orderId = null;
|
91 |
$orders = array();
|
@@ -94,49 +89,58 @@ class CPCancellationHandler extends CPAbstractHandler {
|
|
94 |
if ($orderId != null) {
|
95 |
$orders[] = $order;
|
96 |
}
|
97 |
-
|
|
|
98 |
$orderId = $result['order_nr'];
|
99 |
}
|
100 |
$item = new CPOrderItem();
|
101 |
$item->id = $result['order_item_id'];
|
102 |
$item->idExternal = $result['marketplace_order_item_id'];
|
103 |
-
$item->quantityCancelled = $result['
|
104 |
$order->cancelledItems[] = $item;
|
105 |
}
|
106 |
$orders[] = $order;
|
107 |
return $orders;
|
108 |
} catch (Exception $e) {
|
109 |
-
|
110 |
-
$dbReadConnection->closeConnection();
|
111 |
-
}
|
112 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: '$sQuery'\n" . $e->getMessage());
|
113 |
}
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
try {
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
126 |
$orders = array();
|
127 |
-
foreach ($
|
128 |
$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);
|
129 |
$orders[] = $cancelled;
|
130 |
}
|
131 |
return $orders;
|
132 |
} catch (Exception $e) {
|
133 |
-
|
134 |
-
$dbReadConnection->closeConnection();
|
135 |
-
}
|
136 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle CancellationHook: " . $e->getMessage(), "Exception in handle CancellationHook: '$sQuery'\n" . $e->getMessage());
|
137 |
}
|
138 |
}
|
139 |
-
|
140 |
}
|
141 |
|
142 |
?>
|
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 |
}
|
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();
|
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
@@ -12,37 +12,36 @@ class CPDebugHandler extends CPAbstractHandler {
|
|
12 |
*
|
13 |
*/
|
14 |
public function handle() {
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
foreach ($logEntries as $logEntry) {
|
23 |
-
$log = array();
|
24 |
-
$log['id'] = $logEntry['id'];
|
25 |
-
$log['created'] = $logEntry['created'];
|
26 |
-
$log['content'] = $logEntry['content'];
|
27 |
-
$entries[] = $log;
|
28 |
-
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
}
|
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 |
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPDeliveryHandler.php
CHANGED
@@ -12,42 +12,57 @@ class CPDeliveryHandler extends CPAbstractHandler {
|
|
12 |
* @return type
|
13 |
*/
|
14 |
public function handle() {
|
15 |
-
|
|
|
|
|
16 |
self::checkConfig();
|
17 |
-
|
18 |
-
|
19 |
-
$dbWriteConnection = null;
|
20 |
-
$query = "SELECT @CP_ORDERS.order_id, @CP_ORDERS.order_nr, @CP_ORDERS.marketplace, sales_flat_shipment_track.track_number, sales_flat_shipment.created_at, sales_flat_shipment_track.title, sales_flat_order.shipping_method
|
21 |
-
FROM @CP_ORDERS
|
22 |
-
LEFT JOIN sales_flat_shipment ON sales_flat_shipment.order_id = @CP_ORDERS.order_id
|
23 |
-
LEFT JOIN sales_flat_shipment_track ON sales_flat_shipment_track.order_id = @CP_ORDERS.order_id
|
24 |
-
LEFT JOIN sales_flat_order ON sales_flat_order.entity_id = @CP_ORDERS.order_id
|
25 |
-
WHERE @CP_ORDERS.status = '" . CPOrderStatus::ID_IMPORTED . "' AND sales_flat_shipment.created_at IS NOT NULL GROUP BY @CP_ORDERS.order_id LIMIT " . intval($_GET['limit']) . ";";
|
26 |
try {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
foreach ($sResult AS $order) {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
-
$deliveries = $orders;
|
41 |
if (sizeof($deliveries) == 0) {
|
42 |
self::hookResult(false);
|
43 |
}
|
44 |
-
|
45 |
-
$
|
|
|
46 |
$result = $api->registerDeliveries($deliveries);
|
47 |
if ($result->header->resultCode == CPResultCodes::SUCCESS) {
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
} else {
|
52 |
// Result from registerDeliveries has no success
|
53 |
self::logError("request registerDeliveries() resultCode " . $result->header->resultCode);
|
@@ -56,26 +71,20 @@ class CPDeliveryHandler extends CPAbstractHandler {
|
|
56 |
$hook->resultMessage = "request registerDeliveries() resultCode " . $result->header->resultCode;
|
57 |
$hook->moreAvailable = false;
|
58 |
$hook->apiResultCode = $result->header->resultCode;
|
59 |
-
$hook->writeResponse(self::defaultHeader,
|
60 |
}
|
61 |
self::hookResult(true);
|
62 |
} catch (Exception $e) {
|
63 |
-
|
64 |
-
$dbReadConnection->closeConnection();
|
65 |
-
}
|
66 |
-
if (isset($dbWriteConnection)) {
|
67 |
-
$dbWriteConnection->closeConnection();
|
68 |
-
}
|
69 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in handle DeliveryHook: " . $e->getMessage(), "Exception in handle DeliveryHook: '$query'\n" . $e->getMessage());
|
70 |
}
|
71 |
} else {
|
72 |
-
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no limit set for method: " . $
|
73 |
}
|
74 |
} else {
|
75 |
if (empty($_GET['token'])) {
|
76 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
|
77 |
} else {
|
78 |
-
CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $
|
79 |
}
|
80 |
}
|
81 |
return "Error during handle deliveryHook";
|
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);
|
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";
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPExportHandler.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
*/
|
8 |
class CPExportHandler extends CPAbstractHandler {
|
9 |
|
10 |
-
private $_tablePrefix;
|
11 |
private $_storeId;
|
12 |
private $_siteId;
|
13 |
private $_mediaUrl;
|
@@ -18,6 +17,10 @@ class CPExportHandler extends CPAbstractHandler {
|
|
18 |
private $limit;
|
19 |
private $last;
|
20 |
private $productId;
|
|
|
|
|
|
|
|
|
21 |
|
22 |
/**
|
23 |
* Handle status event
|
@@ -59,9 +62,29 @@ class CPExportHandler extends CPAbstractHandler {
|
|
59 |
ini_set('max_execution_time', 150);
|
60 |
Mage::app('admin');
|
61 |
|
62 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
|
63 |
-
$this->_tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
|
64 |
$this->_dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
try {
|
67 |
$store = Mage::app()->getStore($this->_storeId);
|
@@ -71,13 +94,14 @@ class CPExportHandler extends CPAbstractHandler {
|
|
71 |
} catch (Exception $e) {
|
72 |
die('Store=' . $this->_storeId . " probably does not exist.");
|
73 |
}
|
74 |
-
$this->buildCategoryTree();
|
|
|
75 |
}
|
76 |
|
77 |
private function getStockAndPriceData() {
|
78 |
$selectProductIdsQuery = new Zend_Db_Select($this->_dbConnection);
|
79 |
$selectProductIdsQuery->from(array('p' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
|
80 |
-
array('p.entity_id'
|
81 |
);
|
82 |
$selectProductIdsQuery->joinLeft(array('l' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link')),
|
83 |
'l.product_id = p.entity_id',
|
@@ -191,201 +215,11 @@ class CPExportHandler extends CPAbstractHandler {
|
|
191 |
return $productData;
|
192 |
}
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
// By default, set media gallery attribute id to 703
|
200 |
-
// Look it up later
|
201 |
-
$MEDIA_GALLERY_ATTRIBUTE_ID = 703;
|
202 |
-
|
203 |
-
// Get the entity type for products
|
204 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
205 |
-
$query->from(Mage::getSingleton('core/resource')->getTableName('eav/entity_type'), array('entity_type_id'));
|
206 |
-
$query->where("entity_type_code = 'catalog_product'");
|
207 |
-
|
208 |
-
$PRODUCT_ENTITY_TYPE_ID = $this->_dbConnection->fetchOne($query);
|
209 |
-
|
210 |
-
// Get attribute codes and types
|
211 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
212 |
-
$query->from(Mage::getSingleton('core/resource')->getTableName('eav/attribute'),
|
213 |
-
array('attribute_id', 'attribute_code', 'backend_type', 'frontend_input')
|
214 |
-
);
|
215 |
-
$query->where('entity_type_id = ?', $PRODUCT_ENTITY_TYPE_ID);
|
216 |
-
|
217 |
-
$attributes = $this->_dbConnection->FetchAssoc($query);
|
218 |
-
$attributeCodes = array();
|
219 |
-
$blankProduct = array();
|
220 |
-
$blankProduct['id'] = '';
|
221 |
-
$blankProduct['sku'] = '';
|
222 |
-
$blankProduct['name'] = '';
|
223 |
-
$blankProduct['description'] = '';
|
224 |
-
$blankProduct['price'] = '';
|
225 |
-
$blankProduct['categories'] = '';
|
226 |
-
$blankProduct['manufacturer'] = '';
|
227 |
-
$blankProduct['cp_product_url'] = '';
|
228 |
-
$blankProduct['cp_image_url'] = '';
|
229 |
-
$blankProduct['color'] = '';
|
230 |
-
$blankProduct['weight'] = '';
|
231 |
-
|
232 |
-
$blankProduct['cp_additional_image_1'] = '';
|
233 |
-
$blankProduct['cp_additional_image_2'] = '';
|
234 |
-
$blankProduct['cp_additional_image_3'] = '';
|
235 |
-
|
236 |
-
$special_export_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_specialexportfields'));
|
237 |
-
if (!empty($special_export_fields)) {
|
238 |
-
foreach ($special_export_fields as $element) {
|
239 |
-
if (!empty($element['name'])) {
|
240 |
-
$blankProduct[preg_replace('/\W/', '', $element['name'])] = $element['value'];
|
241 |
-
}
|
242 |
-
}
|
243 |
-
}
|
244 |
-
|
245 |
-
foreach ($attributes as $row) {
|
246 |
-
// Save attribute ID for media gallery
|
247 |
-
if ($row['attribute_code'] == 'media_gallery') {
|
248 |
-
$MEDIA_GALLERY_ATTRIBUTE_ID = $row['attribute_id'];
|
249 |
-
}
|
250 |
-
|
251 |
-
switch ($row['backend_type']) {
|
252 |
-
case 'datetime':
|
253 |
-
case 'decimal':
|
254 |
-
case 'int':
|
255 |
-
case 'text':
|
256 |
-
case 'varchar':
|
257 |
-
$attributeCodes[$row['attribute_id']] = $row['attribute_code'];
|
258 |
-
//$blankProduct[$row['attribute_code']] = '';
|
259 |
-
break;
|
260 |
-
case 'static':
|
261 |
-
// ignore columns in entity table
|
262 |
-
// print("Skipping static attribute: ".$row['attribute_code']."\n");
|
263 |
-
break;
|
264 |
-
default:
|
265 |
-
// print("Unsupported backend_type: ".$row['backend_type']."\n");
|
266 |
-
break;
|
267 |
-
}
|
268 |
-
|
269 |
-
// If the type is multiple choice, cache the option values
|
270 |
-
// in a lookup array for performance (avoids several joins/aggregations)
|
271 |
-
if ($row['frontend_input'] == 'select' || $row['frontend_input'] == 'multiselect') {
|
272 |
-
// Get the option_id => value from the attribute options
|
273 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
274 |
-
$query->from(array('ao' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_option')),
|
275 |
-
array(
|
276 |
-
'option_id' => new Zend_Db_Expr($this->_dbConnection->quoteInto(
|
277 |
-
'CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.option_id) ELSE
|
278 |
-
MAX(CASE WHEN aov.store_id = ? THEN aov.option_id ELSE NULL END)
|
279 |
-
END', $this->_storeId
|
280 |
-
)),
|
281 |
-
'value' => new Zend_Db_Expr($this->_dbConnection->quoteInto(
|
282 |
-
'CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.value) ELSE
|
283 |
-
MAX(CASE WHEN aov.store_id = ? THEN aov.value ELSE NULL END)
|
284 |
-
END', $this->_storeId
|
285 |
-
))
|
286 |
-
)
|
287 |
-
);
|
288 |
-
$query->join(array('aov' => Mage::getSingleton('core/resource')->getTableName('eav/attribute_option_value')),
|
289 |
-
'ao.option_id = aov.option_id',
|
290 |
-
null
|
291 |
-
);
|
292 |
-
$query->where('aov.store_id IN(0, ?)', $this->_storeId);
|
293 |
-
$query->where('ao.attribute_id = ?', $row['attribute_id']);
|
294 |
-
$query->group(array('aov.option_id'));
|
295 |
-
|
296 |
-
$result = $this->_dbConnection->fetchPairs($query);
|
297 |
-
|
298 |
-
// If found, then save the lookup table in the attributeOptions array
|
299 |
-
if (is_array($result)) {
|
300 |
-
$attributeOptions[$row['attribute_id']] = $result;
|
301 |
-
} else {
|
302 |
-
// Otherwise, leave a blank array
|
303 |
-
$attributeOptions[$row['attribute_id']] = array();
|
304 |
-
}
|
305 |
-
$result = null;
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
$export_data_fields_codes = '';
|
310 |
-
$export_data_fields_ids = array();
|
311 |
-
foreach (array_keys($blankProduct) as $key) {
|
312 |
-
$export_data_fields_codes = $export_data_fields_codes . "'" . $key . "',";
|
313 |
-
$tmpid = array_search($key, $attributeCodes);
|
314 |
-
if (!empty($tmpid)) {
|
315 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
$export_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_exportfields'));
|
320 |
-
$useTypeId = false;
|
321 |
-
if (!empty($export_fields)) {
|
322 |
-
foreach ($export_fields as $element) {
|
323 |
-
if (!empty($element['productattribute'])) {
|
324 |
-
$blankProduct[preg_replace('/\W/', '', $element['productattribute'])] = '';
|
325 |
-
$export_data_fields_codes = $export_data_fields_codes . "'" . $element['productattribute'] . "',";
|
326 |
-
if($element['productattribute'] == 'type_id') {
|
327 |
-
$useTypeId = true;
|
328 |
-
} else {
|
329 |
-
$tmpid = array_search($element['productattribute'], $attributeCodes);
|
330 |
-
if (!empty($tmpid)) {
|
331 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);
|
332 |
-
}
|
333 |
-
}
|
334 |
-
}
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
-
$tmpid = array_search('status', $attributeCodes);
|
339 |
-
if (!empty($tmpid)) {
|
340 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);;
|
341 |
-
}
|
342 |
-
$tmpid = array_search('url_path', $attributeCodes);
|
343 |
-
if (!empty($tmpid)) {
|
344 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);;
|
345 |
-
}
|
346 |
-
$tmpid = array_search('image', $attributeCodes);
|
347 |
-
if (!empty($tmpid)) {
|
348 |
-
$export_data_fields_ids[] = $this->_dbConnection->quote($tmpid);;
|
349 |
-
}
|
350 |
-
$export_data_fields_ids = implode(',', $export_data_fields_ids);
|
351 |
-
|
352 |
-
// Build queries for each attribute type
|
353 |
-
$backendTypes = array(
|
354 |
-
'datetime',
|
355 |
-
'decimal',
|
356 |
-
'int',
|
357 |
-
'text',
|
358 |
-
'varchar',
|
359 |
-
);
|
360 |
-
$queries = array();
|
361 |
-
foreach ($backendTypes as $backendType) {
|
362 |
-
// Get store value if there is one, otherwise, global value
|
363 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
364 |
-
$query->from(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
|
365 |
-
array('value' => new Zend_Db_Expr($this->_dbConnection->quoteInto(
|
366 |
-
'CASE WHEN SUM(ev.store_id) = 0 THEN MAX(ev.value) ELSE
|
367 |
-
MAX(CASE WHEN ev.store_id = ? THEN ev.value ELSE NULL END)
|
368 |
-
END', $this->_storeId
|
369 |
-
)), 'ev.attribute_id')
|
370 |
-
);
|
371 |
-
$query->join(array('ev' => Mage::getSingleton('core/resource')->getTableName(array('catalog/product', $backendType))),
|
372 |
-
'ce.entity_id = ev.entity_id',
|
373 |
-
null
|
374 |
-
);
|
375 |
-
$query->where('ev.store_id IN(0, ?)', $this->_storeId);
|
376 |
-
$query->where('ev.entity_type_id = ?', $PRODUCT_ENTITY_TYPE_ID);
|
377 |
-
$query->where('ev.entity_id = @ENTITY_ID');
|
378 |
-
$query->where('ev.attribute_id IN('.$export_data_fields_ids.')');
|
379 |
-
$query->group(array('ev.attribute_id', 'ev.entity_id'));
|
380 |
-
|
381 |
-
$queries[] = $query->__toString();
|
382 |
-
}
|
383 |
-
$query = implode(" UNION ALL ", $queries);
|
384 |
-
$MasterProductQuery = $query;
|
385 |
-
|
386 |
-
$parentProductArray = array();
|
387 |
-
$replace_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
|
388 |
-
|
389 |
$subquery = new Zend_Db_Select($this->_dbConnection);
|
390 |
$subquery->from(Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link'), array('parent_id'));
|
391 |
|
@@ -399,25 +233,25 @@ class CPExportHandler extends CPAbstractHandler {
|
|
399 |
);
|
400 |
$selectProductIdsQuery->where('p.entity_id NOT IN(?)', $subquery);
|
401 |
|
402 |
-
|
403 |
$selectProductIdsQuery->where('p.entity_id > ?', $this->last);
|
404 |
-
|
405 |
$selectProductIdsQuery->group('p.entity_id');
|
406 |
$selectProductIdsQuery->order('p.entity_id ASC');
|
407 |
$selectProductIdsQuery->limit($this->limit);
|
408 |
|
409 |
-
|
410 |
-
|
411 |
$productIds = array();
|
412 |
-
|
413 |
$productIds[] = $this->_dbConnection->quote($productId[0]);
|
414 |
-
|
415 |
$productIds[] = $this->_dbConnection->quote($productId[1]);
|
416 |
-
|
417 |
-
|
418 |
$productIds = implode(',', $productIds);
|
419 |
|
420 |
-
|
421 |
$columns = array('cpe.entity_id', 'cpe.sku');
|
422 |
|
423 |
$subquery = new Zend_Db_Select($this->_dbConnection);
|
@@ -483,329 +317,316 @@ class CPExportHandler extends CPAbstractHandler {
|
|
483 |
$query->where('cpe.entity_id IN ('.$productIds.')');
|
484 |
$query->order(array('is_parent DESC', 'entity_id ASC'));
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
while (true) {
|
511 |
-
// Get next column
|
512 |
-
// $column[0] = value
|
513 |
-
// $column[1] = attribute_id
|
514 |
-
$column = $result->fetch(Zend_Db::FETCH_NUM);
|
515 |
-
// Break if no more rows
|
516 |
-
if (empty($column)) {
|
517 |
-
break;
|
518 |
-
}
|
519 |
-
// Skip attributes that don't exist in eav_attribute
|
520 |
-
if (!isset($attributeCodes[$column[1]])) {
|
521 |
-
continue;
|
522 |
-
}
|
523 |
|
524 |
-
|
525 |
-
|
526 |
-
// Convert all option values
|
527 |
-
$optionValues = explode(',', $column[0]);
|
528 |
-
$convertedOptionValues = array();
|
529 |
-
foreach ($optionValues as $optionValue) {
|
530 |
-
if (isset($attributeOptions[$column[1]][$optionValue]) == true) {
|
531 |
-
// If a option_id is found, translate it
|
532 |
-
$convertedOptionValues[] = $attributeOptions[$column[1]][$optionValue];
|
533 |
-
}
|
534 |
-
}
|
535 |
-
// Erase values that are set to zero
|
536 |
-
if ($column[0] == '0') {
|
537 |
-
$column[0] = '';
|
538 |
-
} elseif (empty($convertedOptionValues) == false) {
|
539 |
-
// Use convert values if any conversions exist
|
540 |
-
$column[0] = implode(',', $convertedOptionValues);
|
541 |
-
}
|
542 |
-
// Otherwise, leave value as-is
|
543 |
-
}
|
544 |
|
|
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
if ($attributeCodes[$column[1]] == 'url_path') {
|
553 |
-
$product_url = $column[0];
|
554 |
-
}
|
555 |
-
if ($attributeCodes[$column[1]] == 'image') {
|
556 |
-
$product_image = $column[0];
|
557 |
-
}
|
558 |
}
|
559 |
-
$result = null;
|
560 |
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
}
|
565 |
-
// Get category information
|
566 |
-
$query = '';
|
567 |
-
if (substr(Mage::getVersion(), 2, 3) >= 6) {
|
568 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
569 |
-
$query->distinct();
|
570 |
-
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
571 |
-
array('fs.entity_id', 'fs.path', 'fs.name')
|
572 |
-
);
|
573 |
-
$query->join(array('fs' => Mage::getSingleton('core/resource')
|
574 |
-
->getTableName(array('catalog/category_flat', 'store_'.$this->_storeId))),
|
575 |
-
'pi.category_id = fs.entity_id',
|
576 |
-
null
|
577 |
-
);
|
578 |
-
$query->where('pi.product_id = ?', $entity[0]);
|
579 |
-
$query->order('fs.path ASC');
|
580 |
-
} else {
|
581 |
-
$query = new Zend_Db_Select($this->_dbConnection);
|
582 |
-
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
583 |
-
array('pi.category_id', 'ce.path')
|
584 |
-
);
|
585 |
-
$query->join(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/category')),
|
586 |
-
'pi.category_id = ce.entity_id',
|
587 |
-
null
|
588 |
-
);
|
589 |
-
$query->where('pi.product_id = ?', $entity[0]);
|
590 |
-
$query->where('pi.is_parent = 1');
|
591 |
-
$query->where('pi.store_id = ?', $this->_storeId);
|
592 |
-
$query->order('ce.path ASC');
|
593 |
-
}
|
594 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
595 |
-
$categoriesTable = $this->_dbConnection->fetchAll($query);
|
596 |
-
$product['categories'] = '';
|
597 |
-
$categorieField = '';
|
598 |
-
$this->oldCatPath = '';
|
599 |
-
foreach ($categoriesTable as $categorie) {
|
600 |
-
if (($this->oldCatPath == '') || (strpos($categorie[1], $this->oldCatPath) !== 0)) {
|
601 |
-
// Start tree
|
602 |
-
if ($this->oldCatPath !== '') {
|
603 |
-
if ($categorieField !== '') {
|
604 |
-
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
605 |
-
} else {
|
606 |
-
$categorieField = $this->_allCat[$this->oldCatPath];
|
607 |
-
}
|
608 |
-
}
|
609 |
-
$this->oldCatPath = $categorie[1];
|
610 |
-
} else {
|
611 |
-
// Add to tree
|
612 |
-
$this->oldCatPath = $categorie[1];
|
613 |
-
}
|
614 |
-
}
|
615 |
-
if ($categorieField !== '') {
|
616 |
-
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
617 |
-
} else {
|
618 |
-
if ($this->oldCatPath !== '') {
|
619 |
-
$categorieField = $this->_allCat[$this->oldCatPath];
|
620 |
-
}
|
621 |
-
}
|
622 |
-
$product['categories'] = $categorieField;
|
623 |
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
$product['stock_status'] = '';
|
636 |
} else {
|
637 |
-
|
|
|
638 |
}
|
|
|
639 |
}
|
640 |
-
|
641 |
-
|
642 |
-
// Get additional image URLs
|
643 |
-
$galleryImagePrefix = $this->_dbConnection->quote($this->_mediaUrl . 'catalog/product');
|
644 |
|
645 |
-
|
646 |
-
|
647 |
-
array(
|
648 |
-
'value_id' => new Zend_Db_Expr("GROUP_CONCAT(gallery.value_id SEPARATOR ',')"),
|
649 |
-
'value' => new Zend_Db_Expr("GROUP_CONCAT(CONCAT(" . $galleryImagePrefix . ", gallery.value) SEPARATOR ',')")
|
650 |
-
)
|
651 |
-
);
|
652 |
-
$query->join(array('gallery_value' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery_value')),
|
653 |
-
'gallery.value_id = gallery_value.value_id',
|
654 |
-
null
|
655 |
-
);
|
656 |
-
$query->where('gallery_value.store_id IN(0, ?)', $this->_storeId);
|
657 |
-
$query->where('gallery_value.disabled = 0');
|
658 |
-
$query->where('gallery.entity_id = ?', $entity[0]);
|
659 |
-
$query->where('gallery.attribute_id = ?', $MEDIA_GALLERY_ATTRIBUTE_ID);
|
660 |
-
$query->order('gallery_value.position ASC');
|
661 |
-
|
662 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
663 |
-
$galleryValues = $this->_dbConnection->fetchAll($query);
|
664 |
-
if (empty($galleryValues) != true) {
|
665 |
-
$additional_images = explode(',', $galleryValues[0][1]);
|
666 |
-
for ($i = 0; $i <= 2; $i++) {
|
667 |
-
if (isset($additional_images[$i])) {
|
668 |
-
$product['cp_additional_image_' . ($i + 1)] = $additional_images[$i];
|
669 |
-
}
|
670 |
-
}
|
671 |
-
}
|
672 |
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
}
|
683 |
|
684 |
-
|
685 |
-
if (empty($product_url) == false) {
|
686 |
-
$product['cp_product_url'] = $this->_urlPathJoin($this->_webUrl, $product_url);
|
687 |
-
}
|
688 |
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
}
|
711 |
-
}
|
712 |
-
}
|
713 |
|
714 |
-
if($
|
715 |
-
$
|
|
|
|
|
|
|
|
|
|
|
716 |
}
|
717 |
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
$this->productId = $product['id'];
|
723 |
-
$productData[] = $product;
|
724 |
-
}
|
725 |
-
}
|
726 |
-
return $productData;
|
727 |
-
}
|
728 |
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
|
|
733 |
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
$query->distinct();
|
739 |
-
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
740 |
-
array('fs.entity_id', 'fs.path', 'fs.name')
|
741 |
-
);
|
742 |
-
$query->join(array('fs' => Mage::getSingleton('core/resource')->getTableName(array('catalog/category_flat', 'store_'.$this->_storeId))),
|
743 |
-
'pi.category_id = fs.entity_id',
|
744 |
-
null
|
745 |
-
);
|
746 |
-
$query->order('fs.path ASC');
|
747 |
-
} else {
|
748 |
-
$subquery = new Zend_Db_Select($this->_dbConnection);
|
749 |
-
$subquery->from(array('att' => Mage::getSingleton('core/resource')->getTableName('eav/attribute')),
|
750 |
-
array('attribute_id')
|
751 |
-
);
|
752 |
-
$subquery->where('att.entity_type_id = ev.entity_type_id');
|
753 |
-
$subquery->where("att.attribute_code = 'name'");
|
754 |
|
755 |
-
$
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
);
|
760 |
-
$query->join(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/category')),
|
761 |
-
'ev.entity_id = ce.entity_id',
|
762 |
-
null
|
763 |
-
);
|
764 |
-
$query->where('ev.attribute_id = ('.$subquery.')');
|
765 |
-
$query->order('ce.path ASC');
|
766 |
-
}
|
767 |
-
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
768 |
|
769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
}
|
786 |
-
} else {
|
787 |
-
// continue tree
|
788 |
-
$this->_allCat[$categorie[1]] = str_replace('Root Catalog', 'Home', $oldCatTree . '>' . $categorie[2]);
|
789 |
-
$oldCatTree = $this->_allCat[$categorie[1]];
|
790 |
-
}
|
791 |
-
$oldCatPath = $categorie[1];
|
792 |
-
}
|
793 |
-
}
|
794 |
|
795 |
-
//
|
796 |
-
private function
|
797 |
-
|
798 |
-
if (strpos($key, '/') != false) {
|
799 |
-
$tmpKey = substr($key, 0, strpos($key, strrchr($key, '/')));
|
800 |
-
if (isset($this->_allCat[$tmpKey])) {
|
801 |
-
$return = $this->_allCat[$tmpKey];
|
802 |
-
} else {
|
803 |
-
$return = $this->getCategory($tmpKey);
|
804 |
-
}
|
805 |
-
}
|
806 |
-
return $return;
|
807 |
}
|
808 |
-
|
809 |
}
|
810 |
|
811 |
?>
|
7 |
*/
|
8 |
class CPExportHandler extends CPAbstractHandler {
|
9 |
|
|
|
10 |
private $_storeId;
|
11 |
private $_siteId;
|
12 |
private $_mediaUrl;
|
17 |
private $limit;
|
18 |
private $last;
|
19 |
private $productId;
|
20 |
+
private $_productEntityTypeId;
|
21 |
+
private $_mediaGalleryAttributeId;
|
22 |
+
private $_blankProduct;
|
23 |
+
private $_baseImageAttributeId;
|
24 |
|
25 |
/**
|
26 |
* Handle status event
|
62 |
ini_set('max_execution_time', 150);
|
63 |
Mage::app('admin');
|
64 |
|
|
|
|
|
65 |
$this->_dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
66 |
+
$this->_productEntityTypeId = Mage::helper('channelpilot/export')->getEntityTypeIdForProduct();
|
67 |
+
|
68 |
+
$this->_blankProduct = array();
|
69 |
+
$this->_blankProduct['id'] = '';
|
70 |
+
$this->_blankProduct['sku'] = '';
|
71 |
+
$this->_blankProduct['name'] = '';
|
72 |
+
$this->_blankProduct['description'] = '';
|
73 |
+
$this->_blankProduct['price'] = '';
|
74 |
+
$this->_blankProduct['categories'] = '';
|
75 |
+
$this->_blankProduct['manufacturer'] = '';
|
76 |
+
$this->_blankProduct['cp_product_url'] = '';
|
77 |
+
$this->_blankProduct['cp_image_url'] = '';
|
78 |
+
$this->_blankProduct['color'] = '';
|
79 |
+
$this->_blankProduct['weight'] = '';
|
80 |
+
|
81 |
+
$this->_blankProduct['cp_additional_image_1'] = '';
|
82 |
+
$this->_blankProduct['cp_additional_image_2'] = '';
|
83 |
+
$this->_blankProduct['cp_additional_image_3'] = '';
|
84 |
+
|
85 |
+
// By default, set media gallery attribute id to 703
|
86 |
+
// Look it up later
|
87 |
+
$this->_mediaGalleryAttributeId = 703;
|
88 |
|
89 |
try {
|
90 |
$store = Mage::app()->getStore($this->_storeId);
|
94 |
} catch (Exception $e) {
|
95 |
die('Store=' . $this->_storeId . " probably does not exist.");
|
96 |
}
|
97 |
+
// $this->buildCategoryTree();
|
98 |
+
$this->_allCat = Mage::helper('channelpilot/export')->buildCategoryTree();
|
99 |
}
|
100 |
|
101 |
private function getStockAndPriceData() {
|
102 |
$selectProductIdsQuery = new Zend_Db_Select($this->_dbConnection);
|
103 |
$selectProductIdsQuery->from(array('p' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),
|
104 |
+
array('p.entity_id')
|
105 |
);
|
106 |
$selectProductIdsQuery->joinLeft(array('l' => Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link')),
|
107 |
'l.product_id = p.entity_id',
|
215 |
return $productData;
|
216 |
}
|
217 |
|
218 |
+
/**
|
219 |
+
* Get all products.
|
220 |
+
* @return array
|
221 |
+
*/
|
222 |
+
private function _getProductEntites() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
$subquery = new Zend_Db_Select($this->_dbConnection);
|
224 |
$subquery->from(Mage::getSingleton('core/resource')->getTableName('catalog/product_super_link'), array('parent_id'));
|
225 |
|
233 |
);
|
234 |
$selectProductIdsQuery->where('p.entity_id NOT IN(?)', $subquery);
|
235 |
|
236 |
+
if (isset($this->last)) {
|
237 |
$selectProductIdsQuery->where('p.entity_id > ?', $this->last);
|
238 |
+
}
|
239 |
$selectProductIdsQuery->group('p.entity_id');
|
240 |
$selectProductIdsQuery->order('p.entity_id ASC');
|
241 |
$selectProductIdsQuery->limit($this->limit);
|
242 |
|
243 |
+
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
244 |
+
$productEntities = $this->_dbConnection->fetchAll($selectProductIdsQuery);
|
245 |
$productIds = array();
|
246 |
+
foreach ($productEntities as $productId) {
|
247 |
$productIds[] = $this->_dbConnection->quote($productId[0]);
|
248 |
+
if (!empty($productId[1])) {
|
249 |
$productIds[] = $this->_dbConnection->quote($productId[1]);
|
250 |
+
}
|
251 |
+
}
|
252 |
$productIds = implode(',', $productIds);
|
253 |
|
254 |
+
// Get all entity_ids for all products in the selected store
|
255 |
$columns = array('cpe.entity_id', 'cpe.sku');
|
256 |
|
257 |
$subquery = new Zend_Db_Select($this->_dbConnection);
|
317 |
$query->where('cpe.entity_id IN ('.$productIds.')');
|
318 |
$query->order(array('is_parent DESC', 'entity_id ASC'));
|
319 |
|
320 |
+
return $this->_dbConnection->fetchAssoc($query);
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Get the category information for a product entity_id.
|
325 |
+
* @param int $entityId
|
326 |
+
* @return string
|
327 |
+
*/
|
328 |
+
private function _getCategoryInformation($entityId) {
|
329 |
+
// Get category information
|
330 |
+
if (substr(Mage::getVersion(), 2, 3) >= 6 && Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category', $this->_storeId)) {
|
331 |
+
$query = new Zend_Db_Select($this->_dbConnection);
|
332 |
+
$query->distinct();
|
333 |
+
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
334 |
+
array('fs.entity_id', 'fs.path', 'fs.name')
|
335 |
+
);
|
336 |
+
$query->join(array('fs' => Mage::getSingleton('core/resource')
|
337 |
+
->getTableName(array('catalog/category_flat', 'store_'.$this->_storeId))),
|
338 |
+
'pi.category_id = fs.entity_id',
|
339 |
+
null
|
340 |
+
);
|
341 |
+
$query->where('pi.product_id = ?', $entityId);
|
342 |
+
$query->order('fs.path ASC');
|
343 |
+
} else {
|
344 |
+
$query = new Zend_Db_Select($this->_dbConnection);
|
345 |
+
$query->from(array('pi' => Mage::getSingleton('core/resource')->getTableName('catalog/category_product_index')),
|
346 |
+
array('pi.category_id', 'ce.path')
|
347 |
+
);
|
348 |
+
$query->join(array('ce' => Mage::getSingleton('core/resource')->getTableName('catalog/category')),
|
349 |
+
'pi.category_id = ce.entity_id',
|
350 |
+
null
|
351 |
+
);
|
352 |
+
$query->where('pi.product_id = ?', $entityId);
|
353 |
+
$query->where('pi.is_parent = 1');
|
354 |
+
$query->where('pi.store_id = ?', $this->_storeId);
|
355 |
+
$query->order('ce.path ASC');
|
356 |
+
}
|
357 |
+
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
358 |
+
$categoriesTable = $this->_dbConnection->fetchAll($query);
|
359 |
+
$categorieField = '';
|
360 |
+
$this->oldCatPath = '';
|
361 |
+
foreach ($categoriesTable as $categorie) {
|
362 |
+
if (($this->oldCatPath == '') || (strpos($categorie[1], $this->oldCatPath) !== 0)) {
|
363 |
+
// Start tree
|
364 |
+
if ($this->oldCatPath !== '') {
|
365 |
+
if ($categorieField !== '') {
|
366 |
+
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
367 |
+
} else {
|
368 |
+
$categorieField = $this->_allCat[$this->oldCatPath];
|
369 |
+
}
|
370 |
+
}
|
371 |
+
$this->oldCatPath = $categorie[1];
|
372 |
+
} else {
|
373 |
+
// Add to tree
|
374 |
+
$this->oldCatPath = $categorie[1];
|
375 |
+
}
|
376 |
+
}
|
377 |
+
if ($categorieField !== '') {
|
378 |
+
$categorieField = $categorieField . ', ' . $this->_allCat[$this->oldCatPath];
|
379 |
+
} else {
|
380 |
+
if ($this->oldCatPath !== '') {
|
381 |
+
$categorieField = $this->_allCat[$this->oldCatPath];
|
382 |
+
}
|
383 |
+
}
|
384 |
+
return $categorieField;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Get the additional image urls for an entity_id.
|
389 |
+
* @param int $entityId
|
390 |
+
* @return array
|
391 |
+
*/
|
392 |
+
private function _getAdditionalImageUrl($entityId) {
|
393 |
+
$galleryImagePrefix = $this->_dbConnection->quote($this->_mediaUrl . 'catalog/product');
|
394 |
|
395 |
+
$query = new Zend_Db_Select($this->_dbConnection);
|
396 |
+
$query->from(array('gallery' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery')),
|
397 |
+
array(
|
398 |
+
'value_id' => new Zend_Db_Expr("GROUP_CONCAT(gallery.value_id SEPARATOR ',')"),
|
399 |
+
'value' => new Zend_Db_Expr("GROUP_CONCAT(CONCAT(" . $galleryImagePrefix . ", gallery.value) SEPARATOR ',')")
|
400 |
+
)
|
401 |
+
);
|
402 |
+
$query->join(array('gallery_value' => Mage::getSingleton('core/resource')->getTableName('catalog/product_attribute_media_gallery_value')),
|
403 |
+
'gallery.value_id = gallery_value.value_id',
|
404 |
+
null
|
405 |
+
);
|
406 |
+
$query->where('gallery_value.store_id IN(0, ?)', $this->_storeId);
|
407 |
+
$query->where('gallery_value.disabled = 0');
|
408 |
+
$query->where('gallery.entity_id = ?', $entityId);
|
409 |
+
$query->where('gallery.attribute_id = ?', $this->_mediaGalleryAttributeId);
|
410 |
+
$query->order('gallery_value.position ASC');
|
411 |
|
412 |
+
$this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
|
413 |
+
return $this->_dbConnection->fetchAll($query);
|
414 |
+
}
|
415 |
|
416 |
+
private function getFullProductData() {
|
417 |
+
// Increase maximium length for group_concat (for additional image URLs field)
|
418 |
+
$query = "SET SESSION group_concat_max_len = 1000000;";
|
419 |
+
$this->_dbConnection->query($query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
|
421 |
+
// Get attribute codes and types
|
422 |
+
$attributes = Mage::helper('channelpilot/export')->getProductAttributes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
|
424 |
+
Mage::helper('channelpilot/export')->setSpecialExportField($this->_blankProduct);
|
425 |
|
426 |
+
$attributeCodes = array();
|
427 |
+
$attributeOptions = array();
|
428 |
+
foreach ($attributes as $row) {
|
429 |
+
// Save attribute ID for media gallery
|
430 |
+
if ($row['attribute_code'] == 'media_gallery') {
|
431 |
+
$this->_mediaGalleryAttributeId = $row['attribute_id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
|
|
433 |
|
434 |
+
if($row['attribute_code'] == 'image') {
|
435 |
+
$this->_baseImageAttributeId = $row['attribute_id'];
|
436 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
+
if($row['backend_type'] != 'static') {
|
439 |
+
$attributeCodes[$row['attribute_id']] = $row['attribute_code'];
|
440 |
+
}
|
441 |
+
|
442 |
+
// If the type is multiple choice, cache the option values
|
443 |
+
// in a lookup array for performance (avoids several joins/aggregations)
|
444 |
+
if ($row['frontend_input'] == 'select' || $row['frontend_input'] == 'multiselect') {
|
445 |
+
$result = Mage::helper('channelpilot/export')->getAttributeOptions($row['attribute_id'], $this->_storeId);
|
446 |
+
// If found, then save the lookup table in the attributeOptions array
|
447 |
+
if (is_array($result)) {
|
448 |
+
$attributeOptions[$row['attribute_id']] = $result;
|
|
|
449 |
} else {
|
450 |
+
// Otherwise, leave a blank array
|
451 |
+
$attributeOptions[$row['attribute_id']] = array();
|
452 |
}
|
453 |
+
$result = null;
|
454 |
}
|
455 |
+
}
|
|
|
|
|
|
|
456 |
|
457 |
+
return $this->_getProductData($attributeCodes, $attributeOptions);
|
458 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
|
460 |
+
/**
|
461 |
+
* Get the product data.
|
462 |
+
*
|
463 |
+
* @param array $attributeCodes
|
464 |
+
* @param array $attributeOptions
|
465 |
+
* @return array
|
466 |
+
*/
|
467 |
+
private function _getProductData(array $attributeCodes, array $attributeOptions) {
|
468 |
+
$parentProductArray = array();
|
469 |
+
$exportFields = Mage::helper('channelpilot/export')->getExportFields($attributeCodes, $this->_blankProduct);
|
470 |
+
$masterProductQuery = Mage::helper('channelpilot/export')->getMasterProductQuery($this->_storeId, $exportFields['id']);
|
471 |
+
$productData = array();
|
472 |
+
foreach ($this->_getProductEntites() as $entity) {
|
473 |
+
// Fill the master query with the entity ID
|
474 |
+
$query = str_replace('@ENTITY_ID', $entity['entity_id'], $masterProductQuery);
|
475 |
+
$result = $this->_dbConnection->query($query);
|
476 |
+
|
477 |
+
// Create a new product record
|
478 |
+
$product = $this->_blankProduct;
|
479 |
+
|
480 |
+
// Initialize basic product data
|
481 |
+
$product['id'] = $entity['entity_id'];
|
482 |
+
$product['sku'] = $entity['sku'];
|
483 |
+
|
484 |
+
$product_status = null;
|
485 |
+
$product_url = null;
|
486 |
+
$product_image = null;
|
487 |
+
// Loop through each field in the row and get the value
|
488 |
+
foreach($result->fetchAll() as $column) {
|
489 |
+
// Translate the option option_id to a value.
|
490 |
+
if (isset($attributeOptions[$column[1]])) {
|
491 |
+
// Convert all option values
|
492 |
+
$optionValues = explode(',', $column[0]);
|
493 |
+
$convertedOptionValues = array();
|
494 |
+
foreach ($optionValues as $optionValue) {
|
495 |
+
if (isset($attributeOptions[$column[1]][$optionValue]) == true) {
|
496 |
+
// If a option_id is found, translate it
|
497 |
+
$convertedOptionValues[] = $attributeOptions[$column[1]][$optionValue];
|
498 |
+
}
|
499 |
+
}
|
500 |
+
// Erase values that are set to zero
|
501 |
+
if ($column[0] == '0') {
|
502 |
+
$column[0] = '';
|
503 |
+
} elseif (!empty($convertedOptionValues)) {
|
504 |
+
// Use convert values if any conversions exist
|
505 |
+
$column[0] = implode(',', $convertedOptionValues);
|
506 |
+
}
|
507 |
+
// Otherwise, leave value as-is
|
508 |
+
}
|
509 |
+
|
510 |
+
if (in_array($attributeCodes[$column[1]], $exportFields['code'])) {
|
511 |
+
$product[$attributeCodes[$column[1]]] = $column[0];
|
512 |
+
}
|
513 |
+
|
514 |
+
if ($attributeCodes[$column[1]] == 'status') {
|
515 |
+
$product_status = $column[0];
|
516 |
+
}
|
517 |
+
if ($attributeCodes[$column[1]] == 'url_path') {
|
518 |
+
$product_url = $column[0];
|
519 |
+
}
|
520 |
+
if ($attributeCodes[$column[1]] == 'image') {
|
521 |
+
$product_image = $column[0];
|
522 |
+
}
|
523 |
+
}
|
524 |
+
$result = null;
|
525 |
|
526 |
+
// Skip product that are disabled or have no status
|
527 |
+
if (empty($product_status) || $product_status == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
|
528 |
+
continue;
|
529 |
+
}
|
|
|
530 |
|
531 |
+
$product['categories'] = $this->_getCategoryInformation($entity['entity_id']);
|
|
|
|
|
|
|
532 |
|
533 |
+
// Get stock quantity
|
534 |
+
// NOTE: stock_id = 1 is the 'Default' stock
|
535 |
+
if (in_array('qty', $exportFields['code'])) {
|
536 |
+
if (empty($entity['qty']) == true) {
|
537 |
+
$product['qty'] = '0';
|
538 |
+
} else {
|
539 |
+
$product['qty'] = $entity['qty'];
|
540 |
+
}
|
541 |
+
}
|
542 |
|
543 |
+
if (in_array('stock_status', $exportFields['code'])) {
|
544 |
+
if (empty($entity['stock_status']) == true) {
|
545 |
+
$product['stock_status'] = '';
|
546 |
+
} else {
|
547 |
+
$product['stock_status'] = $entity['stock_status'];
|
548 |
+
}
|
549 |
+
}
|
550 |
+
$stockInfoResult = null;
|
551 |
+
|
552 |
+
// Get additional image URLs
|
553 |
+
$galleryValues = Mage::helper('channelpilot/export')->getAdditionalImageUrl(
|
554 |
+
$entity['entity_id'],
|
555 |
+
$this->_storeId,
|
556 |
+
$this->_mediaGalleryAttributeId,
|
557 |
+
$this->_baseImageAttributeId
|
558 |
+
);
|
|
|
|
|
|
|
559 |
|
560 |
+
if (empty($galleryValues) != true) {
|
561 |
+
$additional_images = explode(',', $galleryValues[0][1]);
|
562 |
+
for ($i = 0; $i <= 2; $i++) {
|
563 |
+
if (isset($additional_images[$i])) {
|
564 |
+
$product['cp_additional_image_' . ($i + 1)] = $additional_images[$i];
|
565 |
+
}
|
566 |
+
}
|
567 |
}
|
568 |
|
569 |
+
// Get parent ID
|
570 |
+
if (empty($entity['parent']) != true && in_array('parent_id', $exportFields['code'])) {
|
571 |
+
$product['parent_id'] = $entity['parent'];
|
572 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
|
574 |
+
// Override price with catalog price rule, if found
|
575 |
+
if (empty($entity['cat_price']) != true) {
|
576 |
+
// Override price with catalog rule price
|
577 |
+
$product['price'] = $entity['cat_price'];
|
578 |
+
}
|
579 |
|
580 |
+
// Calculate image and product URLs
|
581 |
+
if (empty($product_url) == false) {
|
582 |
+
$product['cp_product_url'] = $this->_urlPathJoin($this->_webUrl, $product_url);
|
583 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
+
if (empty($product_image) == false) {
|
586 |
+
$product['cp_image_url'] = $this->_urlPathJoin($this->_mediaUrl, 'catalog/product');
|
587 |
+
$product['cp_image_url'] = $this->_urlPathJoin($product['cp_image_url'], $product_image);
|
588 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
+
$replace_fields = unserialize(Mage::getStoreConfig('channelpilot_export/channelpilot_productfeed/channelpilot_replacefields'));
|
591 |
+
if (!empty($replace_fields)) {
|
592 |
+
// PARENT
|
593 |
+
if ($entity['is_parent'] > 0) {
|
594 |
+
foreach ($replace_fields as $element) {
|
595 |
+
if (!empty($element['productattribute']) && array_key_exists($element['productattribute'], $product)) {
|
596 |
+
$parentProductArray[$product['id']][$element['productattribute']] = $product[$element['productattribute']];
|
597 |
+
}
|
598 |
+
}
|
599 |
+
} else {
|
600 |
+
// CHILD
|
601 |
+
if ($entity['parent'] != null) {
|
602 |
+
foreach ($replace_fields as $element) {
|
603 |
+
if (!empty($element['productattribute']) && array_key_exists($element['productattribute'], $product)) {
|
604 |
+
$product[$element['productattribute']] = $parentProductArray[$entity['parent']][$element['productattribute']];
|
605 |
+
}
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
}
|
610 |
|
611 |
+
if($exportFields['use_type_id']) {
|
612 |
+
$product['type_id'] = $entity['type_id'];
|
613 |
+
}
|
614 |
|
615 |
+
if ($entity['is_parent'] < 1) {
|
616 |
+
foreach ($product as $key => $value) {
|
617 |
+
$product[$key] = str_replace('""', '"', $value);
|
618 |
+
}
|
619 |
+
$this->productId = $product['id'];
|
620 |
+
$productData[] = $product;
|
621 |
+
}
|
622 |
+
}
|
623 |
+
return $productData;
|
624 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
|
626 |
+
// Join two URL paths and handle forward slashes
|
627 |
+
private function _urlPathJoin($part1, $part2) {
|
628 |
+
return rtrim($part1, '/') . '/' . ltrim($part2, '/');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
}
|
|
|
630 |
}
|
631 |
|
632 |
?>
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewPriceHandler.php
CHANGED
@@ -12,15 +12,13 @@ class CPNewPriceHandler extends CPAbstractHandler {
|
|
12 |
* @return type
|
13 |
*/
|
14 |
public function handle() {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
if (isset($_GET['token']) && self::isIpAllowedViaSecurityToken($_GET['token'])) {
|
17 |
-
if (isset($_GET['priceId'])) {
|
18 |
-
$merchantId = self::getMerchantId($_GET['token']);
|
19 |
-
$shopId = self::getShopId($_GET['token'], Mage::getSingleton('core/resource')->getConnection('core_read'));
|
20 |
-
$store = Mage::getSingleton('core/store')->load($shopId);
|
21 |
-
|
22 |
-
|
23 |
-
$priceId = $_GET['priceId'];
|
24 |
$filterFrom = self::getLastPriceUpdate($priceId);
|
25 |
$method = "all";
|
26 |
if (isset($filterFrom)) {
|
@@ -28,97 +26,113 @@ class CPNewPriceHandler extends CPAbstractHandler {
|
|
28 |
}
|
29 |
$filterArticles = null;
|
30 |
|
31 |
-
$api = new ChannelPilotSellerAPI_v1_0($merchantId, $
|
32 |
$result = $api->getDynamicArticlePrices($priceId, $method, $filterArticles, $filterFrom);
|
33 |
$unknownArticles = array();
|
34 |
$lastPriceUpdate = null;
|
35 |
|
36 |
if (isset($result->managedArticlePrices)) {
|
37 |
-
|
38 |
-
if (Mage::getStoreConfig('channelpilot_pricecontrol/channelpilot_general/channelpilot_saveGrossOrNetPrices') === "net") {
|
39 |
-
$useNet = true;
|
40 |
-
}
|
41 |
-
$taxCalculation = Mage::getModel('tax/calculation');
|
42 |
-
$taxRateRequest = $taxCalculation->getRateRequest(null, null, null, $store);
|
43 |
-
$taxRates = array();
|
44 |
-
foreach ($result->managedArticlePrices as $articlePrice) {
|
45 |
-
$id = $articlePrice->article->id;
|
46 |
-
$articleNumber = Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber');
|
47 |
-
$product = null;
|
48 |
-
switch ($articleNumber) {
|
49 |
-
case 'product_id':
|
50 |
-
$product = Mage::getSingleton('catalog/product')->load($id);
|
51 |
-
break;
|
52 |
-
case 'sku':
|
53 |
-
$product = Mage::getSingleton('catalog/product')->loadByAttribute('sku', $id);
|
54 |
-
break;
|
55 |
-
default:
|
56 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Error by choosing article number '$articleNumber'", "Error by choosing article number '$articleNumber'");
|
57 |
-
break;
|
58 |
-
}
|
59 |
-
if (empty($product)) {
|
60 |
-
$unknownArticles[] = $id;
|
61 |
-
} else {
|
62 |
-
if ($useNet && empty($taxRates[$product->getTaxClassId()])) {
|
63 |
-
$taxRates[$product->getTaxClassId()] = $taxCalculation->getRate($taxRateRequest->setProductClassId($product->getTaxClassId()));
|
64 |
-
}
|
65 |
-
$price = $useNet ? $articlePrice->price / (($taxRates[$product->getTaxClassId()] / 100) + 1) : $articlePrice->price;
|
66 |
-
$field = Mage::getStoreConfig('channelpilot_pricecontrol/general_prices/channelpilot_generalPriceField');
|
67 |
-
switch ($field) {
|
68 |
-
case 'price':
|
69 |
-
Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->entityId), array('price' => round($price, 4)), $shopId);
|
70 |
-
break;
|
71 |
-
case 'special_price':
|
72 |
-
Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->entityId), array('special_price' => round($price, 4)), $shopId);
|
73 |
-
break;
|
74 |
-
default:
|
75 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, " Error by choosing price field '$field'", "Error by choosing price field '$field'");
|
76 |
-
break;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
$lastPriceUpdate = $articlePrice->lastUpdate;
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
/**
|
84 |
-
* reindex prices
|
85 |
-
*
|
86 |
-
* 1 = Product Attributes
|
87 |
-
* 2 = Product prices
|
88 |
-
* 3 = Catalog URL Rewrites
|
89 |
-
* 4 = Product Flat Data
|
90 |
-
* 5 = Category Flat Data
|
91 |
-
* 6 = Category Products
|
92 |
-
* 7 = Catalog Search Index
|
93 |
-
* 8 = Stock Status
|
94 |
-
* 9 = Tag Aggregation Data
|
95 |
-
*/
|
96 |
-
Mage::getModel('index/process')->load(2)->reindexEverything();
|
97 |
}
|
98 |
|
99 |
if (isset($lastPriceUpdate)) {
|
100 |
-
|
|
|
101 |
try {
|
102 |
-
|
103 |
-
$dbWriteConnection->query($sQuery);
|
104 |
-
$dbWriteConnection->closeConnection();
|
105 |
} catch (Exception $e) {
|
106 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update:
|
107 |
}
|
108 |
}
|
109 |
self::hookResult($result->moreAvailable, $unknownArticles);
|
110 |
} else {
|
111 |
-
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no priceId set for method: " . $
|
112 |
}
|
113 |
} else {
|
114 |
-
if (empty($
|
115 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
|
116 |
} else {
|
117 |
-
CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $
|
118 |
}
|
119 |
}
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
private function hookResult($moreAvailable, $errorArticles = null) {
|
123 |
$hook = new CPHookResponse();
|
124 |
$hook->resultCode = CPResultCodes::SUCCESS;
|
@@ -133,29 +147,23 @@ class CPNewPriceHandler extends CPAbstractHandler {
|
|
133 |
}
|
134 |
|
135 |
private function getLastPriceUpdate($priceId) {
|
136 |
-
|
137 |
-
$sQuery = "SELECT last_price_update FROM " . (string)Mage::getConfig()->getTablePrefix().self::DB_PRICES . " WHERE price_id = ?;";
|
138 |
-
$array = array($priceId);
|
139 |
try {
|
140 |
-
$
|
141 |
-
|
142 |
-
if (isset($sResult)) {
|
143 |
-
$date = new DateTime($sResult);
|
144 |
return date_format($date, 'Y-m-d') . "T" . date_format($date, 'H:i:s');
|
145 |
} else {
|
146 |
-
|
|
|
147 |
try {
|
148 |
-
|
149 |
-
$dbWriteConnection->query($sQuery);
|
150 |
-
$dbWriteConnection->closeConnection();
|
151 |
return null;
|
152 |
} catch (Exception $e) {
|
153 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during set last_price_update: " . $e->getMessage(), " Exception during set last_price_update:
|
154 |
}
|
155 |
}
|
156 |
} catch (Exception $e) {
|
157 |
-
$
|
158 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getLastPriceUpdate(): " . $e->getMessage(), "Exception in getLastPriceUpdate(): '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
159 |
}
|
160 |
}
|
161 |
|
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)) {
|
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;
|
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 |
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPNewsHandler.php
CHANGED
@@ -1,39 +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 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
'
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$hook = new CPHookResponse();
|
31 |
-
$hook->resultCode = CPResultCodes::
|
32 |
-
$hook->resultMessage = "
|
33 |
-
$hook->writeResponse(self::defaultHeader, json_encode($hook));
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
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
@@ -10,27 +10,24 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
10 |
var $shopId;
|
11 |
var $store;
|
12 |
var $websiteId;
|
13 |
-
var $dbReadConnection;
|
14 |
-
var $dbWriteConnection;
|
15 |
var $ordersImported;
|
16 |
|
17 |
/**
|
18 |
* Handle order event
|
19 |
*/
|
20 |
public function handle() {
|
|
|
21 |
$this->ordersImported = array();
|
22 |
-
$
|
23 |
-
$this->dbWriteConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
24 |
-
if (isset($_GET['token']) && self::isIpAllowedViaSecurityToken($_GET['token'])) {
|
25 |
self::checkConfig();
|
26 |
-
$merchantId = self::getMerchantId($
|
27 |
try {
|
28 |
-
$this->shopId = self::getShopId($
|
29 |
$this->store = Mage::getModel('core/store')->load($this->shopId);
|
30 |
$this->websiteId = $this->store->getWebsiteId();
|
31 |
$oldOrders = self::getOrdersFromDb();
|
32 |
ini_set('allow_url_fopen', 'On');
|
33 |
-
$api = new ChannelPilotSellerAPI_v1_0($merchantId, $
|
34 |
$result = $api->getNewMarketplaceOrders();
|
35 |
// Check ResultCode of getNewMarketplaceOrders Result
|
36 |
if ($result->header->resultCode == CPResultCodes::SUCCESS) {
|
@@ -43,32 +40,26 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
43 |
}
|
44 |
|
45 |
if (sizeof($orders) == 0) {
|
46 |
-
$this->closeConnections();
|
47 |
self::hookResult(false);
|
48 |
}
|
49 |
$result = $api->setImportedOrders($orders, true);
|
50 |
// Check ResultCode of setImportedOrders Result
|
51 |
if ($result->header->resultCode == CPResultCodes::SUCCESS) {
|
52 |
-
self::changeStatusOrders($result->updateResults
|
53 |
-
$this->closeConnections();
|
54 |
self::hookResult($moreAvailable);
|
55 |
} else {
|
56 |
// Result from getNewMarketplaceOrders has no success
|
57 |
-
$this->closeConnections();
|
58 |
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request setImportedOrders() resultCode " . $result->header->resultCode, "request setImportedOrders() resultCode " . $result->header->resultCode);
|
59 |
}
|
60 |
} else {
|
61 |
// Result from getNewMarketplaceOrders has no success
|
62 |
-
$this->closeConnections();
|
63 |
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode, "request getNewMarketplaceOrders() resultCode " . $result->header->resultCode);
|
64 |
}
|
65 |
} catch (Exception $e) {
|
66 |
-
$this->closeConnections();
|
67 |
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage(), "caught Exception in getNewMarketplaceOrders(): " . $e->getMessage() . "\n" . $e->getTraceAsString());
|
68 |
}
|
69 |
} else {
|
70 |
-
$
|
71 |
-
if (empty($_GET['token'])) {
|
72 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
|
73 |
} else {
|
74 |
CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $_GET['token'], "ip not allowed by token: " . $_GET['token']);
|
@@ -87,13 +78,113 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
87 |
private function importOrders($apiOrders) {
|
88 |
$orders = array();
|
89 |
foreach ($apiOrders as $apiOrder) {
|
|
|
90 |
$orders[] = self::importOrder($apiOrder);
|
91 |
}
|
92 |
return $orders;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
private function importOrder($apiOrder) {
|
96 |
-
$orderId = self::
|
97 |
if (!empty($orderId)) {
|
98 |
$order = Mage::getModel('sales/order')->load($orderId);
|
99 |
$apiOrder->orderHeader->orderId = $order->getIncrementId();
|
@@ -102,65 +193,35 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
102 |
return $apiOrder;
|
103 |
}
|
104 |
try {
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
foreach ($apiOrder->itemsOrdered as $orderItem) {
|
110 |
-
$product = $this->getProduct($orderItem->article->id);
|
111 |
-
if ($product == null) {
|
112 |
-
CPErrorHandler::logError("NO ARTICLE FOR IDENTIFIER: " . $orderItem->article->id);
|
113 |
-
$apiOrder->orderHeader->status->hasError = true;
|
114 |
-
$apiOrder->orderHeader->status->errorMessage = "Unknown article: " . $orderItem->article->id;
|
115 |
-
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SHOP_ERROR_ARTICLE_UNKNOWN;
|
116 |
-
return $apiOrder;
|
117 |
-
}
|
118 |
-
$quote->addProduct($product, (int) $orderItem->quantityOrdered);
|
119 |
-
}
|
120 |
-
|
121 |
-
$quote->getBillingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultBilling()));
|
122 |
-
|
123 |
-
$shippingAddress = $quote->getShippingAddress()->importCustomerAddress(Mage::getModel('customer/address')->load($customer->getDefaultShipping()));
|
124 |
-
if (substr(Mage::getVersion(), 2, 3) >= 9) {
|
125 |
-
$quote->getBillingAddress()->setCompany($apiOrder->addressInvoice->company);
|
126 |
-
$shippingAddress->setCompany($apiOrder->addressDelivery->company);
|
127 |
-
}
|
128 |
-
|
129 |
-
$shippingAddress
|
130 |
-
->setCollectShippingRates(true)
|
131 |
-
->collectShippingRates()
|
132 |
-
->setShippingMethod($apiOrder->shipping->typeId)
|
133 |
-
->setPaymentMethod($apiOrder->payment->typeId);
|
134 |
-
$quote->setShippingAddress($shippingAddress);
|
135 |
-
|
136 |
-
if (strpos($apiOrder->payment->typeId, 'cp_mp') === false) {
|
137 |
-
$quote->getPayment()->importData(array('method' => $apiOrder->payment->typeId));
|
138 |
-
} else {
|
139 |
-
$quote->getPayment()->importData(array('method' => 'cp_mp',
|
140 |
-
'cc_type' => $apiOrder->payment->typeId
|
141 |
-
)
|
142 |
-
);
|
143 |
-
}
|
144 |
-
|
145 |
-
$quote->collectTotals()->save();
|
146 |
|
147 |
$service = Mage::getModel('sales/service_quote', $quote);
|
148 |
$service->submitAll();
|
149 |
$order = $service->getOrder();
|
150 |
$apiOrder->orderHeader->orderId = $order->getIncrementId();
|
151 |
|
152 |
-
$query = "insert into " . (string)Mage::getConfig()->getTablePrefix().self::DB_ORDERS . " (order_id, order_nr, marketplace_order_id, marketplace, shop, status) VALUES (?, ?, ?, ?, ?, ?);";
|
153 |
-
$array = array($order->getId(), $order->getIncrementId(), $apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source, $this->shopId, $apiOrder->orderHeader->status->identifier);
|
154 |
try {
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
} catch (Exception $e) {
|
157 |
-
$this->closeConnections();
|
158 |
Mage::register('isSecureArea', true);
|
159 |
Mage::app('admin');
|
160 |
$order->delete();
|
161 |
-
CPErrorHandler::logError("Exception during insert
|
162 |
$apiOrder->orderHeader->status->hasError = true;
|
163 |
-
$apiOrder->orderHeader->status->errorMessage = "Exception during insert
|
164 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
165 |
return $apiOrder;
|
166 |
}
|
@@ -169,39 +230,43 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
169 |
$orderItemsResponse = array();
|
170 |
try {
|
171 |
foreach ($items as $item) {
|
172 |
-
|
173 |
foreach ($apiOrder->itemsOrdered as $orderItem) {
|
174 |
if ($orderItem->article->id == $item->getSku() || $orderItem->article->id == $item->getProductId()) {
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
$item->save();
|
190 |
$orderItem->id = $item->getId();
|
191 |
$orderItemsResponse[] = $orderItem;
|
192 |
-
$query = "insert into " . (string)Mage::getConfig()->getTablePrefix().self::DB_ORDER_ITEMS . " (order_item_id, marketplace_order_item_id, order_id) VALUES (?, ?, ?);";
|
193 |
-
$array = array($item->getId(), $orderItem->idExternal, $order->getId());
|
194 |
try {
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
} catch (Exception $e) {
|
197 |
self::deleteCPOrder($order->getId());
|
198 |
-
$this->closeConnections();
|
199 |
Mage::register('isSecureArea', true);
|
200 |
Mage::app('admin');
|
201 |
$order->delete();
|
202 |
-
CPErrorHandler::logError("Exception during insert
|
203 |
$apiOrder->orderHeader->status->hasError = true;
|
204 |
-
$apiOrder->orderHeader->status->errorMessage = "Exception during insert into
|
205 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
206 |
return $apiOrder;
|
207 |
}
|
@@ -209,17 +274,17 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
209 |
}
|
210 |
}
|
211 |
} catch (Exception $e) {
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
216 |
Mage::register('isSecureArea', true);
|
217 |
Mage::app('admin');
|
218 |
$order->delete();
|
219 |
-
$
|
220 |
-
CPErrorHandler::logError("Exception during insert into " . (string)Mage::getConfig()->getTablePrefix().self::DB_ORDER_ITEMS . ": '$query'\n" . print_r($array, true) . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString());
|
221 |
$apiOrder->orderHeader->status->hasError = true;
|
222 |
-
$apiOrder->orderHeader->status->errorMessage = "Exception during insert
|
223 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
224 |
return $apiOrder;
|
225 |
}
|
@@ -450,13 +515,12 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
450 |
*/
|
451 |
private function getOrderItems($apiOrder) {
|
452 |
$dbOrderItems = array();
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
foreach ($sResult AS $resultType) {
|
460 |
$dbOrderItems[$resultType['marketplace_order_item_id']] = $resultType['order_item_id'];
|
461 |
}
|
462 |
$orderItemsResponse = array();
|
@@ -476,32 +540,33 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
476 |
return $apiOrder;
|
477 |
}
|
478 |
|
479 |
-
private function
|
480 |
-
|
481 |
-
|
482 |
-
$sResult = $this->dbReadConnection->fetchOne($query, $array);
|
483 |
-
return $sResult;
|
484 |
}
|
485 |
|
486 |
private function deleteCPOrder($orderId) {
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
491 |
}
|
492 |
|
493 |
private function getOrdersFromDb() {
|
494 |
$orders = array();
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
try {
|
504 |
-
$sResult = $
|
505 |
if (!empty($sResult)) {
|
506 |
$order = null;
|
507 |
$orderId = null;
|
@@ -524,14 +589,7 @@ class CPOrderHandler extends CPAbstractHandler {
|
|
524 |
}
|
525 |
return $orders;
|
526 |
} catch (Exception $e) {
|
527 |
-
$
|
528 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getOrdersFromDb(): " . $e->getMessage(), "Exception in getOrdersFromDb(): '$query'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
529 |
}
|
530 |
}
|
531 |
-
|
532 |
-
private function closeConnections() {
|
533 |
-
$this->dbReadConnection->closeConnection();
|
534 |
-
$this->dbWriteConnection->closeConnection();
|
535 |
-
}
|
536 |
-
|
537 |
}
|
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) {
|
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']);
|
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();
|
193 |
return $apiOrder;
|
194 |
}
|
195 |
try {
|
196 |
+
$quote = $this->_getQuote($apiOrder);
|
197 |
+
if($quote === false) {
|
198 |
+
return $apiOrder;
|
199 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
$service = Mage::getModel('sales/service_quote', $quote);
|
202 |
$service->submitAll();
|
203 |
$order = $service->getOrder();
|
204 |
$apiOrder->orderHeader->orderId = $order->getIncrementId();
|
205 |
|
|
|
|
|
206 |
try {
|
207 |
+
Mage::getModel('channelpilot/order')
|
208 |
+
->unsetData()
|
209 |
+
->setData(array(
|
210 |
+
'order_id' => $order->getId(),
|
211 |
+
'order_nr' => $order->getIncrementId(),
|
212 |
+
'marketplace_order_id' => $apiOrder->orderHeader->orderIdExternal,
|
213 |
+
'marketplace' => $apiOrder->orderHeader->source,
|
214 |
+
'shop' => $this->shopId,
|
215 |
+
'status' => $apiOrder->orderHeader->status->identifier
|
216 |
+
))
|
217 |
+
->save();
|
218 |
} catch (Exception $e) {
|
|
|
219 |
Mage::register('isSecureArea', true);
|
220 |
Mage::app('admin');
|
221 |
$order->delete();
|
222 |
+
CPErrorHandler::logError("Exception during insert order \n" . $e->getMessage() . "\n" . $e->getTraceAsString());
|
223 |
$apiOrder->orderHeader->status->hasError = true;
|
224 |
+
$apiOrder->orderHeader->status->errorMessage = "Exception during insert order: " . $e->getMessage();
|
225 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
226 |
return $apiOrder;
|
227 |
}
|
230 |
$orderItemsResponse = array();
|
231 |
try {
|
232 |
foreach ($items as $item) {
|
|
|
233 |
foreach ($apiOrder->itemsOrdered as $orderItem) {
|
234 |
if ($orderItem->article->id == $item->getSku() || $orderItem->article->id == $item->getProductId()) {
|
235 |
+
$item->setPrice($orderItem->costsSingle->net);
|
236 |
+
$item->setCustomPrice($orderItem->costsSingle->net);
|
237 |
+
$item->setBasePrice($orderItem->costsSingle->net);
|
238 |
+
$item->setOriginalCustomPrice($orderItem->costsSingle->net);
|
239 |
+
$item->setOriginalPrice($orderItem->costsSingle->net);
|
240 |
+
$item->setTaxAmount($orderItem->costsTotal->tax);
|
241 |
+
$item->setTaxPercent($orderItem->costsTotal->taxRate);
|
242 |
+
$item->setRowTotal($orderItem->costsTotal->net);
|
243 |
+
$item->setRowTotalInclTax($orderItem->costsTotal->gross);
|
244 |
+
$item->setPriceInclTax($orderItem->costsSingle->gross);
|
245 |
+
$item->setBaseOriginalPrice($orderItem->costsSingle->net);
|
246 |
+
$item->setBaseRowTotal($orderItem->costsTotal->net);
|
247 |
+
$item->setBasePriceInclTax($orderItem->costsSingle->gross);
|
248 |
+
$item->setBaseRowTotalInclTax($orderItem->costsTotal->gross);
|
249 |
$item->save();
|
250 |
$orderItem->id = $item->getId();
|
251 |
$orderItemsResponse[] = $orderItem;
|
|
|
|
|
252 |
try {
|
253 |
+
Mage::getModel('channelpilot/order_item')
|
254 |
+
->unsetData()
|
255 |
+
->setData(array(
|
256 |
+
'order_item_id' => $item->getId(),
|
257 |
+
'marketplace_order_item_id' => $orderItem->idExternal,
|
258 |
+
'order_id' => $order->getId(),
|
259 |
+
'amount' => $orderItem->quantityOrdered,
|
260 |
+
))
|
261 |
+
->save();
|
262 |
} catch (Exception $e) {
|
263 |
self::deleteCPOrder($order->getId());
|
|
|
264 |
Mage::register('isSecureArea', true);
|
265 |
Mage::app('admin');
|
266 |
$order->delete();
|
267 |
+
CPErrorHandler::logError("Exception during insert order item: " . $e->getMessage() . "\n" . $e->getTraceAsString());
|
268 |
$apiOrder->orderHeader->status->hasError = true;
|
269 |
+
$apiOrder->orderHeader->status->errorMessage = "Exception during insert into: " . $e->getMessage();
|
270 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
271 |
return $apiOrder;
|
272 |
}
|
274 |
}
|
275 |
}
|
276 |
} catch (Exception $e) {
|
277 |
+
$collection = Mage::getModel('channelpilot/order_item')->getCollection()
|
278 |
+
->addFieldToFilter('order_id', array('eq' => $order->getId()));
|
279 |
+
$collection->walk('delete');
|
280 |
+
$marketplaceOrder = Mage::getModel('channelpilot/order')->load($order->getId());
|
281 |
+
$$marketplaceOrder->delete();
|
282 |
Mage::register('isSecureArea', true);
|
283 |
Mage::app('admin');
|
284 |
$order->delete();
|
285 |
+
CPErrorHandler::logError("Exception during insert order" . $e->getMessage() . "\n" . $e->getTraceAsString());
|
|
|
286 |
$apiOrder->orderHeader->status->hasError = true;
|
287 |
+
$apiOrder->orderHeader->status->errorMessage = "Exception during insert order item: " . $e->getMessage();
|
288 |
$apiOrder->orderHeader->status->errorCode = CPResultCodes::SYSTEM_ERROR;
|
289 |
return $apiOrder;
|
290 |
}
|
515 |
*/
|
516 |
private function getOrderItems($apiOrder) {
|
517 |
$dbOrderItems = array();
|
518 |
+
|
519 |
+
$itemCollection = Mage::getModel('channelpilot/order_item')->getCollection()
|
520 |
+
->addFieldToSelect(array('order_item_id', 'marketplace_order_item_id'))
|
521 |
+
->addMarketplaceOrderFilter($apiOrder->orderHeader->orderIdExternal, $apiOrder->orderHeader->source);
|
522 |
+
|
523 |
+
foreach ($itemCollection->getData() AS $resultType) {
|
|
|
524 |
$dbOrderItems[$resultType['marketplace_order_item_id']] = $resultType['order_item_id'];
|
525 |
}
|
526 |
$orderItemsResponse = array();
|
540 |
return $apiOrder;
|
541 |
}
|
542 |
|
543 |
+
private function getOrderId($externalOrderId, $source) {
|
544 |
+
$order = Mage::getModel('channelpilot/order')->loadByMarketplaceOrderIdAndMarketplace($externalOrderId, $source);
|
545 |
+
return ($order && $order->getId()) ? $order->getId() : null;
|
|
|
|
|
546 |
}
|
547 |
|
548 |
private function deleteCPOrder($orderId) {
|
549 |
+
$collection = Mage::getModel('channelpilot/order_item')->getCollection()
|
550 |
+
->addFieldToFilter('order_id', array('eq' => $orderId));
|
551 |
+
$collection->walk('delete');
|
552 |
+
|
553 |
+
$collection = Mage::getModel('channelpilot/order')->getCollection()
|
554 |
+
->addFieldToFilter('order_id', array('eq' => $orderId));
|
555 |
+
$collection->walk('delete');
|
556 |
}
|
557 |
|
558 |
private function getOrdersFromDb() {
|
559 |
$orders = array();
|
560 |
|
561 |
+
$collection = Mage::getModel('channelpilot/order_item')->getCollection()
|
562 |
+
->addFieldToSelect(array(
|
563 |
+
'orderItemId' => 'order_item_id',
|
564 |
+
'externalOrderItemId' => 'marketplace_order_item_id'
|
565 |
+
))
|
566 |
+
->addReadyForExportFilter($this->shopId);
|
567 |
+
|
568 |
try {
|
569 |
+
$sResult = $collection->getData();
|
570 |
if (!empty($sResult)) {
|
571 |
$order = null;
|
572 |
$orderId = null;
|
589 |
}
|
590 |
return $orders;
|
591 |
} catch (Exception $e) {
|
592 |
+
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception in getOrdersFromDb(): " . $e->getMessage(), "Exception in getOrdersFromDb():" . $e->getMessage());
|
|
|
593 |
}
|
594 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPPaymentHandler.php
ADDED
@@ -0,0 +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 |
+
?>
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPRegisterHandler.php
CHANGED
@@ -11,60 +11,67 @@ class CPRegisterHandler extends CPAbstractHandler {
|
|
11 |
* Handle register event
|
12 |
*/
|
13 |
public function handle() {
|
14 |
-
|
15 |
-
$dbReadConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
16 |
-
|
17 |
self::checkConfig();
|
18 |
$new = false;
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
if (self::reRegisterParameterSet(true) == true) {
|
25 |
-
$array = array($_GET['ips'], $_GET['merchantid'], $_GET['token'], $_GET['multishopid']);
|
26 |
-
$sQuery = "update " . (string)Mage::getConfig()->getTablePrefix().self::DB_REGISTRATION . " set ips_authorized = ?, merchantid = ?, securityToken = ?, last_stock_update = null, last_price_update=null, last_catalog_update = null WHERE shopId = ?";
|
27 |
try {
|
28 |
-
|
29 |
-
|
|
|
30 |
$new = false;
|
31 |
-
$dbWriteConnection->closeConnection();
|
32 |
} catch (Exception $e) {
|
33 |
-
$
|
34 |
-
$dbWriteConnection->closeConnection();
|
35 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during reregister Shop: " . $e->getMessage(), "Exception during reregister Shop: '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
36 |
}
|
37 |
} else {
|
38 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $
|
39 |
}
|
40 |
} else {
|
41 |
-
if (empty($
|
42 |
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "no token found", "no token found");
|
43 |
} else {
|
44 |
-
CPErrorHandler::handle(CPErrors::RESULT_FAILED, "ip not allowed by token: " . $
|
45 |
}
|
46 |
}
|
47 |
} else {
|
48 |
if (self::reRegisterParameterSet(false) == false) {
|
49 |
-
|
50 |
-
$sQuery = "insert into " . (string)Mage::getConfig()->getTablePrefix().self::DB_REGISTRATION . " (shopId, ips_authorized, merchantid, securityToken) VALUES (?, ?, ?, ?)";
|
51 |
try {
|
52 |
-
|
53 |
-
|
54 |
$new = true;
|
55 |
-
$dbWriteConnection->closeConnection();
|
56 |
} catch (Exception $e) {
|
57 |
-
$
|
58 |
-
$dbWriteConnection->closeConnection();
|
59 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: '$sQuery'\n" . print_r($array, true) . "\n" . $e->getMessage());
|
60 |
}
|
61 |
} else {
|
62 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Shop '" . $
|
63 |
}
|
64 |
}
|
65 |
}
|
66 |
-
}
|
67 |
-
|
|
|
68 |
|
69 |
$hook = new CPRegisterHookResponse();
|
70 |
$hook->ipsAllowed = $_SERVER['SERVER_ADDR'];
|
@@ -77,28 +84,18 @@ class CPRegisterHandler extends CPAbstractHandler {
|
|
77 |
$hook->writeResponse(self::defaultHeader, json_encode($hook));
|
78 |
}
|
79 |
|
80 |
-
/**
|
81 |
-
*
|
82 |
-
* @return true or error response
|
83 |
-
*/
|
84 |
-
public function allRequiredParameterSet() {
|
85 |
-
if (isset($_GET['multishopid']) && isset($_GET['merchantid']) && isset($_GET['token']) && isset($_GET['ips'])) {
|
86 |
-
return true;
|
87 |
-
}
|
88 |
-
CPErrorHandler::handle(CPErrors::RESULT_MISSING_PARAMS, "not enough parameter for method: " . $_GET['method'], "not enough parameter for method: " . $_GET['method']);
|
89 |
-
}
|
90 |
-
|
91 |
/**
|
92 |
*
|
93 |
* @param type $registered
|
94 |
* @return boolean or error response
|
95 |
*/
|
96 |
public function reRegisterParameterSet($registered) {
|
97 |
-
|
|
|
98 |
return true;
|
99 |
} else {
|
100 |
if ($registered == true) {
|
101 |
-
CPErrorHandler::handle(CPErrors::RESULT_ALREADY_REGISTERED, "shop already registered", "shop '" .
|
102 |
}
|
103 |
return false;
|
104 |
}
|
@@ -110,13 +107,15 @@ class CPRegisterHandler extends CPAbstractHandler {
|
|
110 |
* @return boolean
|
111 |
*/
|
112 |
public function existShop($shopId) {
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
119 |
CPErrorHandler::handle(CPErrors::RESULT_SHOP_UNKNOWN, "shop '" . $shopId . "' unknown", "shop '" . $shopId . "' unknown");
|
|
|
120 |
}
|
121 |
|
122 |
}
|
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'];
|
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 |
}
|
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 |
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/CPStatusHandler.php
CHANGED
@@ -152,21 +152,17 @@ class CPStatusHandler extends CPAbstractHandler {
|
|
152 |
|
153 |
private function getCustomerGroups() {
|
154 |
$customerGroups = array();
|
155 |
-
|
156 |
-
$sQuery = "SELECT customer_group_id, customer_group_code FROM ".$dbConnection->quoteIdentifier(Mage::getSingleton('core/resource')->getTableName('customer/customer_group'));
|
157 |
try {
|
158 |
-
$
|
159 |
-
foreach ($sResult AS $resultType) {
|
160 |
$customerGroup = new CPCustomerGroupType();
|
161 |
-
$customerGroup->id = $resultType
|
162 |
-
$customerGroup->title = $resultType
|
163 |
$customerGroup->active = true;
|
164 |
$customerGroups[] = $customerGroup;
|
165 |
}
|
166 |
-
$dbConnection->closeConnection();
|
167 |
} catch (Exception $e) {
|
168 |
-
$
|
169 |
-
CPErrorHandler::handle(CPResultCodes::SYSTEM_ERROR, "Exception during register Shop: " . $e->getMessage(), "Exception during register Shop: '$sQuery'\n" . $e->getMessage());
|
170 |
}
|
171 |
return $customerGroups;
|
172 |
}
|
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 |
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/handler/todoCPPaymentHandler.php
DELETED
@@ -1,12 +0,0 @@
|
|
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 |
-
}
|
12 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Channelpilotsolutions/Channelpilot/Helper/responses/CPHookResponse.php
CHANGED
@@ -1,65 +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 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
public function writeResponse($header, $response) {
|
58 |
-
header($header);
|
59 |
-
print_r($response);
|
60 |
-
exit();
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
?>
|
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/Adminhtml/Source/Trackingmethod.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt
|
9 |
+
*
|
10 |
+
* DISCLAIMER
|
11 |
+
*
|
12 |
+
* Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
|
13 |
+
* versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
|
14 |
+
* needs please refer to http://www.channelpilot.com for more information.
|
15 |
+
*
|
16 |
+
* @category Channelpilotsolutions
|
17 |
+
* @package Channelpilotsolutions_Channelpilot
|
18 |
+
* @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
|
19 |
+
* @author Bj�rn Wehner <info@channelpilot.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.channelpilot.com
|
22 |
+
*/
|
23 |
+
class Channelpilotsolutions_Channelpilot_Model_Adminhtml_Source_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
@@ -20,6 +20,10 @@
|
|
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_Carrier_Cpshipping
|
24 |
extends Mage_Shipping_Model_Carrier_Abstract
|
25 |
implements Mage_Shipping_Model_Carrier_Interface
|
@@ -39,23 +43,29 @@ class Channelpilotsolutions_Channelpilot_Model_Carrier_Cpshipping
|
|
39 |
return true;
|
40 |
}
|
41 |
}
|
|
|
|
|
|
|
42 |
/* set admin session */
|
43 |
Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
|
44 |
-
$isLoggedIn = Mage::getSingleton('admin/session', array('name' =>
|
45 |
/* set original session */
|
46 |
-
Mage::
|
47 |
-
Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
|
48 |
return $isLoggedIn;
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
-
* Returns the shipping rate for '
|
53 |
*
|
54 |
* @param Mage_Shipping_Model_Rate_Request $request
|
55 |
* @return Mage_Shipping_Model_Rate_Result
|
56 |
*/
|
57 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
58 |
-
if
|
|
|
|
|
|
|
|
|
59 |
return false;
|
60 |
}
|
61 |
|
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
|
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 |
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Logs.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order.php
ADDED
@@ -0,0 +1,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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Item.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Order/Shipment.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Prices.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Registration.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Logs/Collection.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order.php
ADDED
@@ -0,0 +1,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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Collection.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Item/Collection.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Order/Shipment/Collection.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt
|
9 |
+
*
|
10 |
+
* DISCLAIMER
|
11 |
+
*
|
12 |
+
* Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
|
13 |
+
* versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
|
14 |
+
* needs please refer to http://www.channelpilot.com for more information.
|
15 |
+
*
|
16 |
+
* @category Channelpilotsolutions
|
17 |
+
* @package Channelpilotsolutions_Channelpilot
|
18 |
+
* @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
|
19 |
+
* @author Bj�rn Wehner <info@channelpilot.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.channelpilot.com
|
22 |
+
*/
|
23 |
+
class Channelpilotsolutions_Channelpilot_Model_Resource_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
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Prices/Collection.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Channelpilotsolutions/Channelpilot/Model/Resource/Registration/Collection.php
ADDED
@@ -0,0 +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 |
+
}
|
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 (
|
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/config.xml
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Channelpilotsolutions_Channelpilot>
|
27 |
-
<version>2.
|
28 |
</Channelpilotsolutions_Channelpilot>
|
29 |
</modules>
|
30 |
<global>
|
@@ -37,16 +37,20 @@
|
|
37 |
<resourceModel>channelpilot_resource</resourceModel>
|
38 |
</channelpilot>
|
39 |
<channelpilot_resource>
|
|
|
40 |
<entities>
|
41 |
<registration>
|
42 |
<table>cp_registration</table>
|
43 |
</registration>
|
44 |
-
<
|
45 |
<table>cp_marketplace_orders</table>
|
46 |
-
</
|
47 |
-
<
|
48 |
<table>cp_marketplace_order_items</table>
|
49 |
-
</
|
|
|
|
|
|
|
50 |
<prices>
|
51 |
<table>cp_prices</table>
|
52 |
</prices>
|
@@ -134,7 +138,7 @@
|
|
134 |
</payment>
|
135 |
<carriers>
|
136 |
<cpshipping>
|
137 |
-
<active>
|
138 |
<backend_only>1</backend_only>
|
139 |
<price>0.0</price>
|
140 |
<sallowspecific>0</sallowspecific>
|
@@ -144,5 +148,36 @@
|
|
144 |
<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>
|
145 |
</cpshipping>
|
146 |
</carriers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
</default>
|
148 |
</config>
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Channelpilotsolutions_Channelpilot>
|
27 |
+
<version>2.2.0</version>
|
28 |
</Channelpilotsolutions_Channelpilot>
|
29 |
</modules>
|
30 |
<global>
|
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>
|
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>
|
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
@@ -122,11 +122,20 @@
|
|
122 |
<show_in_website>1</show_in_website>
|
123 |
<show_in_store>1</show_in_store>
|
124 |
</channelpilot_useTracking>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
<channelpilot_cookiemode>
|
126 |
<label>CP Cookiemode</label>
|
127 |
<frontend_type>select</frontend_type>
|
128 |
<source_model>channelpilot_adminhtml/cookiemode_values</source_model>
|
129 |
-
<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>
|
@@ -135,7 +144,7 @@
|
|
135 |
<label>CP Trackingkeys</label>
|
136 |
<frontend_model>channelpilot_core/adminhtml_field_trackingkeys</frontend_model>
|
137 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
138 |
-
<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>
|
@@ -219,7 +228,7 @@
|
|
219 |
</channelpilot_replacefields>
|
220 |
<channelpilot_imagenumber>
|
221 |
<label>CP Number additional productimages</label>
|
222 |
-
<comment>CP How many additional
|
223 |
<frontend_type>select</frontend_type>
|
224 |
<source_model>channelpilot_adminhtml/imagenumber_values</source_model>
|
225 |
<sort_order>5</sort_order>
|
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>
|
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>
|
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>
|
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/
|
45 |
-
*/
|
46 |
-
$table = $adapter->newTable($installer->getTable('channelpilot/
|
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/
|
72 |
-
), array('order_nr'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
|
73 |
-
)
|
74 |
-
->addIndex(
|
75 |
-
$installer->getIdxName(
|
76 |
-
$installer->getTable('channelpilot/
|
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/
|
83 |
-
*/
|
84 |
-
$table = $adapter->newTable($installer->getTable('channelpilot/
|
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/
|
114 |
-
), array('order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
|
115 |
-
)
|
116 |
-
->addIndex($installer->getIdxName(
|
117 |
-
'channelpilot/
|
118 |
-
), array('marketplace_order_item_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
|
119 |
-
)
|
120 |
-
->addIndex($installer->getIdxName(
|
121 |
-
$installer->getTable('channelpilot/
|
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-2.1.6-2.2.0.php
ADDED
@@ -0,0 +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();
|
app/design/frontend/base/default/layout/Channelpilotsolutions/channelpilot.xml
CHANGED
@@ -22,10 +22,22 @@
|
|
22 |
*/
|
23 |
-->
|
24 |
<layout version="0.1.0">
|
25 |
-
<default>
|
|
|
|
|
|
|
26 |
<reference name="head">
|
27 |
-
<block type="
|
28 |
-
</block>
|
29 |
</reference>
|
30 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</layout>
|
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/channelpilot.phtml
DELETED
@@ -1,118 +0,0 @@
|
|
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 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 |
-
<?php
|
25 |
-
if (strpos($_SERVER['REQUEST_URI'], 'checkout/onepage/success') !== false) {
|
26 |
-
if (strpos(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking'), "1") !== false || strpos(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking'), "true") !== false) {
|
27 |
-
$storeId = Mage::app()->getStore()->getId();
|
28 |
-
$trackingKeys = unserialize(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_trackingkeys'));
|
29 |
-
$TRACKINGKEY = '';
|
30 |
-
foreach ($trackingKeys as $element) {
|
31 |
-
if ($element['shop'] == $storeId) {
|
32 |
-
$TRACKINGKEY = $element['trackingkey'];
|
33 |
-
break;
|
34 |
-
}
|
35 |
-
}
|
36 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
|
37 |
-
$tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
|
38 |
-
|
39 |
-
$dbConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
if (substr(Mage::getVersion(), 2, 7) == '4.0.1') {
|
46 |
-
$query = "
|
47 |
-
SELECT so.entity_id, so.increment_id AS id, (so.grand_total-so.tax_amount) AS orderTotal
|
48 |
-
FROM ChannelPilotSolutions_ChannelPilot_sales_order AS so
|
49 |
-
WHERE so.increment_id = '" . Mage::getSingleton('checkout/session')->getLastRealOrderId() . "'
|
50 |
-
ORDER BY so.entity_id DESC LIMIT 1";
|
51 |
-
} else {
|
52 |
-
$query = "
|
53 |
-
SELECT so.entity_id, so.increment_id AS id, (so.grand_total-so.tax_amount) AS orderTotal
|
54 |
-
FROM ChannelPilotSolutions_ChannelPilot_sales_flat_order AS so
|
55 |
-
WHERE so.increment_id = '" . Mage::getSingleton('checkout/session')->getLastRealOrderId() . "'
|
56 |
-
ORDER BY so.entity_id DESC LIMIT 1";
|
57 |
-
}
|
58 |
-
$query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
|
59 |
-
$orders = $dbConnection->fetchAll($query);
|
60 |
-
foreach ($orders as $ORDER) {
|
61 |
-
?>
|
62 |
-
<script type="text/javascript">
|
63 |
-
var cpSale = {
|
64 |
-
trackingKey: "<?php echo $TRACKINGKEY; ?>",
|
65 |
-
orderId: "<?php echo $ORDER['id']; ?>",
|
66 |
-
orderTotal: <?php echo $ORDER['orderTotal']; ?>,
|
67 |
-
cookie: "<?php echo Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_cookiemode'); ?>",
|
68 |
-
shoppingCart: new Array()
|
69 |
-
};
|
70 |
-
<?php
|
71 |
-
}
|
72 |
-
// Retrieve ordered products
|
73 |
-
$query = "
|
74 |
-
SELECT item_id, sku, product_id, price, qty_ordered, parent_item_id AS parent,
|
75 |
-
IF(parent_item_id IS NOT NULL, (SELECT price FROM ChannelPilotSolutions_ChannelPilot_sales_flat_order_item WHERE item_id = parent), NULL) AS parent_price
|
76 |
-
FROM ChannelPilotSolutions_ChannelPilot_sales_flat_order_item
|
77 |
-
WHERE order_id = '" . $ORDER['entity_id'] . "' ORDER BY parent_item_id DESC";
|
78 |
-
$query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
|
79 |
-
$orderedProducts = $dbConnection->fetchAll($query);
|
80 |
-
|
81 |
-
$parents = array();
|
82 |
-
// Loop through each product in order
|
83 |
-
foreach ($orderedProducts as $orderedProduct) {
|
84 |
-
IF (isset($orderedProduct['parent'])) {
|
85 |
-
$productId = $orderedProduct[Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber')];
|
86 |
-
$price = $orderedProduct['parent_price'];
|
87 |
-
$quantity = (int) $orderedProduct['qty_ordered'];
|
88 |
-
?>
|
89 |
-
cpSale.shoppingCart.push({id: "<?php echo $productId; ?>", price: <?php echo $price; ?>, amount: <?php echo $quantity; ?>});
|
90 |
-
<?php
|
91 |
-
$parents[] = $orderedProduct['parent'];
|
92 |
-
} ELSE {
|
93 |
-
IF (!in_array($orderedProduct['item_id'], $parents)) {
|
94 |
-
$productId = $orderedProduct[Mage::getStoreConfig('channelpilot_general/channelpilot_general/channelpilot_articlenumber')];
|
95 |
-
$price = $orderedProduct['price'];
|
96 |
-
$quantity = (int) $orderedProduct['qty_ordered'];
|
97 |
-
?>
|
98 |
-
cpSale.shoppingCart.push({id: "<?php echo $productId; ?>", price: <?php echo $price; ?>, amount: <?php echo $quantity; ?>});
|
99 |
-
<?php
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
</script>
|
105 |
-
<script type="text/javascript" src="//content.cptrack.de/sales.js"></script>
|
106 |
-
<?php
|
107 |
-
}
|
108 |
-
} else {
|
109 |
-
if (strpos(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking'), "1") !== false || strpos(Mage::getStoreConfig('channelpilot_tracking/channelpilot_tracking/channelpilot_useTracking'), "true") !== false) {
|
110 |
-
?>
|
111 |
-
<script type="text/javascript" src="//content.cptrack.de/clicks.js"></script>
|
112 |
-
<?php
|
113 |
-
} else {
|
114 |
-
?>
|
115 |
-
<script type="text/javascript">/*CP Tracking deactivated*/</script>
|
116 |
-
<?php
|
117 |
-
}
|
118 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking_js.phtml
ADDED
@@ -0,0 +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; ?>
|
app/design/frontend/base/default/template/Channelpilotsolutions/salestracking_js.phtml
ADDED
@@ -0,0 +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 |
+
|
app/design/frontend/base/default/template/Channelpilotsolutions/tracking_image.phtml
ADDED
@@ -0,0 +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; ?>
|
app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
61 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
62 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
63 |
-
"CP Sort Order","Sortierreihenfolge"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
39 |
+
"CP Save prices net or gross?","Preis in netto oder brutto speichern?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
61 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
62 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
63 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
64 |
+
"CP Sort Order","Sortierreihenfolge"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Methode"
|
67 |
+
"CP Image","Bild"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/de_CH/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
61 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
62 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
63 |
-
"CP Sort Order","Sortierreihenfolge"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
39 |
+
"CP Save prices net or gross?","Preis in netto oder brutto speichern?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
61 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
62 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
63 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
64 |
+
"CP Sort Order","Sortierreihenfolge"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Methode"
|
67 |
+
"CP Image","Bild"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/de_DE/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
61 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
62 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
63 |
-
"CP Sort Order","Sortierreihenfolge"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","Globale Preissteuerung"
|
37 |
"CP Field for price","Preisfeld"
|
38 |
"CP This field would be overwritten by the new product price.","Dieses Preisfeld wird von dem neuen Preis überschrieben."
|
39 |
+
"CP Save prices net or gross?","Preis in netto oder brutto speichern?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot Payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!Das ist keine richtige Zahlmethode!!!"
|
61 |
"CP Show Method if Not Applicable","Versandart anzeigen wenn diese nicht verfügbar ist"
|
62 |
"CP Ship to Specific Countries","Versand nur in folgende Länder"
|
63 |
"CP Displayed Error Message","Angezeigte Fehlermeldung"
|
64 |
+
"CP Sort Order","Sortierreihenfolge"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Methode"
|
67 |
+
"CP Image","Bild"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_AU/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_CA/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_GB/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_IE/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_NZ/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/en_US/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
41 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
@@ -60,4 +61,8 @@
|
|
60 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
61 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
62 |
"CP Displayed Error Message","Displayed Error Message"
|
63 |
-
"CP Sort Order","Sort Order"
|
|
|
|
|
|
|
|
36 |
"CP General Repricing","General repricing"
|
37 |
"CP Field for price","Price field"
|
38 |
"CP This field would be overwritten by the new product price.","This price field will be replaced by the new price"
|
39 |
+
"CP Save prices net or gross?","Save prices net or gross?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","ChannelPilot payment"
|
42 |
"CP !!!This is no real payment method!!!","!!!This payment method is not valid!!!"
|
61 |
"CP Show Method if Not Applicable","Show Method If Not Applicable"
|
62 |
"CP Ship to Specific Countries","Ship to Specific Countries"
|
63 |
"CP Displayed Error Message","Displayed Error Message"
|
64 |
+
"CP Sort Order","Sort Order"
|
65 |
+
|
66 |
+
"CP Tracking Method","Tracking Method"
|
67 |
+
"CP Image","Image"
|
68 |
+
"CP JavaScript","JavaScript"
|
app/locale/es_AR/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_CL/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_CO/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_CR/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_ES/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_MX/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_PA/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_PE/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/es_VE/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,6 +36,7 @@
|
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
41 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
36 |
"CP General Repricing","Control de precios general"
|
37 |
"CP Field for price","Campo de precio"
|
38 |
"CP This field would be overwritten by the new product price.","Este campo de precio será sustituido por el precio nuevo"
|
39 |
+
"CP Save prices net or gross?","¿Guardar precios en neto o en bruto?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Pago ChannelPilot"
|
42 |
"CP !!!This is no real payment method!!!","¡¡¡La forma de pago escogida no es válida!!!"
|
app/locale/fr_CA/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,14 +36,15 @@
|
|
36 |
"CP General Repricing","Repricing général"
|
37 |
"CP Field for price","Champ de prix"
|
38 |
"CP This field would be overwritten by the new product price.","Ce champ de prix sera remplacé par le nouveau prix."
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Paiement ChannelPilot"
|
41 |
-
"CP !!!This is no real payment method!!!","!!! Ceci n'est pas un vrai moyen de paiement!!!"
|
42 |
"CP Title","Titre"
|
43 |
"CP Order Status","Statut de la commande"
|
44 |
"CP Payment Types","Moyens de paiement"
|
45 |
|
46 |
-
"CP Activate?","Activer?"
|
47 |
"CP Add","Ajouter"
|
48 |
"CP Delete","Supprimer"
|
49 |
"CP OrderStatus Imported (payed)?","Le statut de l’offre a-t-il été importé (payé) ?"
|
36 |
"CP General Repricing","Repricing général"
|
37 |
"CP Field for price","Champ de prix"
|
38 |
"CP This field would be overwritten by the new product price.","Ce champ de prix sera remplacé par le nouveau prix."
|
39 |
+
"CP Save prices net or gross?","Prix à enregistrer nets ou bruts ?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Paiement ChannelPilot"
|
42 |
+
"CP !!!This is no real payment method!!!","!!! Ceci n'est pas un vrai moyen de paiement !!!"
|
43 |
"CP Title","Titre"
|
44 |
"CP Order Status","Statut de la commande"
|
45 |
"CP Payment Types","Moyens de paiement"
|
46 |
|
47 |
+
"CP Activate?","Activer ?"
|
48 |
"CP Add","Ajouter"
|
49 |
"CP Delete","Supprimer"
|
50 |
"CP OrderStatus Imported (payed)?","Le statut de l’offre a-t-il été importé (payé) ?"
|
app/locale/fr_FR/Channelpilotsolutions_Channelpilot.csv
CHANGED
@@ -36,14 +36,15 @@
|
|
36 |
"CP General Repricing","Repricing général"
|
37 |
"CP Field for price","Champ de prix"
|
38 |
"CP This field would be overwritten by the new product price.","Ce champ de prix sera remplacé par le nouveau prix."
|
|
|
39 |
|
40 |
"CP ChannelPilot-Payment","Paiement ChannelPilot"
|
41 |
-
"CP !!!This is no real payment method!!!","!!! Ceci n'est pas un vrai moyen de paiement!!!"
|
42 |
"CP Title","Titre"
|
43 |
"CP Order Status","Statut de la commande"
|
44 |
"CP Payment Types","Moyens de paiement"
|
45 |
|
46 |
-
"CP Activate?","Activer?"
|
47 |
"CP Add","Ajouter"
|
48 |
"CP Delete","Supprimer"
|
49 |
"CP OrderStatus Imported (payed)?","Le statut de l’offre a-t-il été importé (payé) ?"
|
36 |
"CP General Repricing","Repricing général"
|
37 |
"CP Field for price","Champ de prix"
|
38 |
"CP This field would be overwritten by the new product price.","Ce champ de prix sera remplacé par le nouveau prix."
|
39 |
+
"CP Save prices net or gross?","Prix à enregistrer nets ou bruts ?"
|
40 |
|
41 |
"CP ChannelPilot-Payment","Paiement ChannelPilot"
|
42 |
+
"CP !!!This is no real payment method!!!","!!! Ceci n'est pas un vrai moyen de paiement !!!"
|
43 |
"CP Title","Titre"
|
44 |
"CP Order Status","Statut de la commande"
|
45 |
"CP Payment Types","Moyens de paiement"
|
46 |
|
47 |
+
"CP Activate?","Activer ?"
|
48 |
"CP Add","Ajouter"
|
49 |
"CP Delete","Supprimer"
|
50 |
"CP OrderStatus Imported (payed)?","Le statut de l’offre a-t-il été importé (payé) ?"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Channelpilotsolutions_Channelpilot</name>
|
4 |
-
<version>2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
@@ -26,12 +26,14 @@
|
|
26 |
<li><b>ChannelPilot Multi-Platform:</b> Access ChannelPilot on any device (e.g. computer, tablet or smartphone) and keep a firm hold on your online marketing- wherever you are!</li>
|
27 |
</ul>
|
28 |
Just get more information about ChannelPilot: <a href="http://www.channelpilot.com">www.channelpilot.com</a></description>
|
29 |
-
<notes>-
|
30 |
-
-
|
|
|
|
|
31 |
<authors><author><name>ChannelPilot Solutions GmbH</name><user>auto-converted</user><email>info@channelpilot.com</email></author></authors>
|
32 |
-
<date>2015-
|
33 |
-
<time>
|
34 |
-
<contents><target name="magecommunity"><dir name="Channelpilotsolutions"><dir name="Channelpilot"><dir name="Adminhtml"><dir name="Model"><dir name="Articlenumber"><file name="Values.php" hash="a1701067c9e01cd4e7d62ef3bae53c83"/></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="cbd19b0ff86f303aae19c61327e1dc54"/></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="Exportfields.php" hash="a6c2be2439015238f80ff1bda555e185"/><file name="Replacefields.php" hash="998c731b9e0419271f5ef13237405ad0"/><file name="Specialfields.php" hash="617a423f8632d0bee669bab5a463ce74"/><file name="Trackingkeys.php" hash="383c5112824ccb2998c74dbc3fe10da1"/></dir><file name="Hintlogo.php" hash="be78974a79e7cc59601254a8df0dc48b"/></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="446ffde1318d001c213de2b80855af07"/><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="a0a20eeaeba1296eaf318b23fc881e06"/></dir></dir><dir name="handler"><file name="CPAbstractHandler.php" hash="a9a68bad1195518c1362401acec4dc8b"/><file name="CPCancellationHandler.php" hash="be5631a851c46ff6db4b134952464720"/><file name="CPDebugHandler.php" hash="b46b85718747103deed00598aece3c98"/><file name="CPDeliveryHandler.php" hash="1ecaa833b9d03ffdb7e960caa0c9ad9e"/><file name="CPErrorHandler.php" hash="5d728c064c068fdf8354fa87882e4dba"/><file name="CPExportHandler.php" hash="deecbd39ae98a8eaaebc7d0dab50dafa"/><file name="CPNewPriceHandler.php" hash="63217f81326d1753474879407223dec7"/><file name="CPNewsHandler.php" hash="4975a6271baf09af3b2f007f13bb587c"/><file name="CPOrderHandler.php" hash="826c815f4d76991d773ff3d133a410d3"/><file name="CPRegisterHandler.php" hash="22ce15484f7e7cb13dbe2c3c67271f99"/><file name="CPStatusHandler.php" hash="a0e26bee1a847b8aa7da7e33c4ab47c1"/><file name="todoCPPaymentHandler.php" hash="34ea64beda7c8bc5309ebea280146c32"/></dir><dir name="responses"><file name="CPGetStatusHookResponse.php" hash="672609ebcaa23aa0de85aed04c7662d8"/><file name="CPHookResponse.php" hash="9acdda5838cae8b6022af2f4e0a9314b"/><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="c664a6eaefe2c32d4c4cb43f3afaaac9"/><file name="ExportData.php" hash="b5303dc6632472b72856ccdf42e4ee2e"/></dir><dir name="Model"><dir name="Carrier"><file name="Cpshipping.php" hash="5bff2e3502cf98369f126e228c172935"/></dir><file name="Abstract.php" hash="0e9349f1023527a77e59742dfdb21308"/><file name="Payment.php" hash="5160ffe0422a9a46dc2bd7a79e512b8b"/><file name="PaymentTypes.php" hash="b217cdabf427beadb8d74acff069af4d"/><file name="Paymenttypes.php" hash="b217cdabf427beadb8d74acff069af4d"/></dir><dir name="controllers"><file name="IndexController.php" hash="36e391b61d1914f8669cd48207dd06da"/></dir><dir name="etc"><file name="adminhtml.xml" hash="62fad9ef0e77e858b74d2a7bdd6a6879"/><file name="config.xml" hash="0bd5d22d052c3785077023fe4d8bf791"/><file name="system.xml" hash="c6981ac137ba30fe568a71402b3d8e63"/></dir><dir name="sql"><dir name="channelpilot_setup"><file name="mysql4-install-2.0.0.php" hash="8910b9b0507d1b38c8b8465845fb3849"/></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="732f1d98851f3c1bf0cb9e655a4a0359"/></dir></dir><dir name="template"><dir name="Channelpilotsolutions"><file name="channelpilot.phtml" hash="ac42e9777d28910dddc50d7d82ded4c2"/></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="9bcbe38d89a60bfce101718b63e2a260"/></dir><dir name="de_CH"><file name="Channelpilotsolutions_Channelpilot.csv" hash="9bcbe38d89a60bfce101718b63e2a260"/></dir><dir name="de_AT"><file name="Channelpilotsolutions_Channelpilot.csv" hash="9bcbe38d89a60bfce101718b63e2a260"/></dir><dir name="fr_FR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="b8d336a7aeb2eaad2472a3c3a0982b4c"/></dir><dir name="fr_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="b8d336a7aeb2eaad2472a3c3a0982b4c"/></dir><dir name="en_AU"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="en_CA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="en_GB"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="en_IE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="en_NZ"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="en_US"><file name="Channelpilotsolutions_Channelpilot.csv" hash="52bf2288d036a857d55e043ee34c3174"/></dir><dir name="es_AR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_CL"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_CO"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_CR"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_ES"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_MX"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_PA"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_PE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir><dir name="es_VE"><file name="Channelpilotsolutions_Channelpilot.csv" hash="2983e897242ed7467a334e254cea1ce1"/></dir></target></contents>
|
35 |
<compatible/>
|
36 |
<dependencies/>
|
37 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Channelpilotsolutions_Channelpilot</name>
|
4 |
+
<version>2.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
26 |
<li><b>ChannelPilot Multi-Platform:</b> Access ChannelPilot on any device (e.g. computer, tablet or smartphone) and keep a firm hold on your online marketing- wherever you are!</li>
|
27 |
</ul>
|
28 |
Just get more information about ChannelPilot: <a href="http://www.channelpilot.com">www.channelpilot.com</a></description>
|
29 |
+
<notes>- general bugfixes
|
30 |
+
- tracking method selection added
|
31 |
+
- sellerAPI payment added
|
32 |
+
- sellerAPI partial cancellation added</notes>
|
33 |
<authors><author><name>ChannelPilot Solutions GmbH</name><user>auto-converted</user><email>info@channelpilot.com</email></author></authors>
|
34 |
+
<date>2015-08-13</date>
|
35 |
+
<time>07:47:34</time>
|
36 |
+
<contents><target name="magecommunity"><dir name="Channelpilotsolutions"><dir name="Channelpilot"><dir name="Adminhtml"><dir name="Model"><dir name="Articlenumber"><file name="Values.php" hash="a1701067c9e01cd4e7d62ef3bae53c83"/></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="cbd19b0ff86f303aae19c61327e1dc54"/></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="9a389a3fea32173e571c00bf56cf1ea4"/><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="acffcb3a0c9ca4dc7284d1b0abdffe48"/><file name="CPNewPriceHandler.php" hash="06e8b36560fec6bbe849fa8759238e54"/><file name="CPNewsHandler.php" hash="2c05c335f9d2396d592dffe90860d7f5"/><file name="CPOrderHandler.php" hash="864acf951fa772d7022f1a075246ecec"/><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="b34933c6556d3849ad9b0a8f9bc3b26c"/><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="5160ffe0422a9a46dc2bd7a79e512b8b"/><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="5558a2903e995f79ea3934d7b3342218"/><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-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="salestracking_js.phtml" hash="c786826f6eb3edc8b1484389c4c4ab02"/><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>
|
37 |
<compatible/>
|
38 |
<dependencies/>
|
39 |
</package>
|