Channelpilotsolutions_Channelpilot - Version 1.0.0

Version Notes

Release version

Download this release

Release Info

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


Version 1.0.0

Files changed (27) hide show
  1. app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Articlenumber/Values.php +33 -0
  2. app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Cookiemode/Values.php +33 -0
  3. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php +83 -0
  4. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Specialfields.php +56 -0
  5. app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Trackingkeys.php +69 -0
  6. app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php +59 -0
  7. app/code/community/Channelpilotsolutions/Channelpilot/Helper/ExportData.php +655 -0
  8. app/code/community/Channelpilotsolutions/Channelpilot/controllers/IndexController.php +33 -0
  9. app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml +45 -0
  10. app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml +97 -0
  11. app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml +125 -0
  12. app/code/community/Channelpilotsolutions/Clicktracking/etc/config.xml +39 -0
  13. app/code/community/Channelpilotsolutions/Salestracking/etc/config.xml +39 -0
  14. app/design/adminhtml/base/default/template/Channelpilotsolutions/array_dropdown.phtml +174 -0
  15. app/design/adminhtml/default/default/layout/Channelpilotsolutions/channelpilot.xml +32 -0
  16. app/design/frontend/base/default/layout/Channelpilotsolutions/clicktracking.xml +31 -0
  17. app/design/frontend/base/default/layout/Channelpilotsolutions/salestracking.xml +31 -0
  18. app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking.phtml +24 -0
  19. app/design/frontend/base/default/template/Channelpilotsolutions/salestracking.phtml +95 -0
  20. app/etc/modules/Channelpilotsolutions_Channelpilot.xml +31 -0
  21. app/etc/modules/Channelpilotsolutions_Clicktracking.xml +31 -0
  22. app/etc/modules/Channelpilotsolutions_Salestracking.xml +31 -0
  23. app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv +30 -0
  24. app/locale/de_CH/Channelpilotsolutions_Channelpilot.csv +30 -0
  25. app/locale/de_DE/Channelpilotsolutions_Channelpilot.csv +30 -0
  26. package.xml +31 -0
  27. skin/adminhtml/default/default/Channelpilotsolutions/Channelpilot/icon.css +4 -0
app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Articlenumber/Values.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
+ * @subpackage adminhtml_model_cookiemode
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Adminhtml_Model_Articlenumber_Values
24
+ {
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => 'product_id', 'label'=>'Entity ID'),
29
+ array('value' => 'sku', 'label'=>'Sku')
30
+ );
31
+ }
32
+ }
33
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Adminhtml/Model/Cookiemode/Values.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
+ * @subpackage adminhtml_model_cookiemode
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Adminhtml_Model_Cookiemode_Values
24
+ {
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => 'last', 'label'=>'Last Cookie Wins'),
29
+ array('value' => 'first', 'label'=>'First Cookie Wins')
30
+ );
31
+ }
32
+ }
33
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Exportfields.php ADDED
@@ -0,0 +1,83 @@
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 Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Exportfields
24
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
25
+ {
26
+
27
+ private $_standardattributes;
28
+
29
+ public function __construct()
30
+ {
31
+ $this->addColumn('productattribute', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Data field'),
33
+ 'size' => 30
34
+ ));
35
+ $this->_addAfter = false;
36
+
37
+ parent::__construct();
38
+ $this->setTemplate('Channelpilotsolutions/array_dropdown.phtml');
39
+ }
40
+
41
+ protected function _renderCellTemplate($columnName)
42
+ {
43
+ $this->_standardattributes = "('sku','price','name','description','manufacturer','color','weight')";
44
+ if (empty($this->_columns[$columnName])) {
45
+ throw new Exception('Wrong column name specified.');
46
+ }
47
+ $column = $this->_columns[$columnName];
48
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
49
+
50
+ if($columnName == 'productattribute')
51
+ {
52
+ $rendered = '<select name="'.$inputName.'">';
53
+
54
+ $tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
55
+ $tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
56
+ $dbConnection = Mage::getSingleton('core/resource') ->getConnection('core_read');
57
+
58
+ // Get attribute codes and types
59
+ $query = "SELECT attribute_code
60
+ FROM ChannelPilotSolutions_ChannelPilot_eav_attribute
61
+ WHERE entity_type_id = (SELECT entity_type_id FROM
62
+ ChannelPilotSolutions_ChannelPilot_eav_entity_type WHERE entity_type_code = 'catalog_product') AND
63
+ attribute_code NOT IN $this->_standardattributes
64
+ ";
65
+ $query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
66
+ $attributes = $dbConnection->FetchAssoc($query);
67
+
68
+ $attributes[]['attribute_code'] = 'qty';
69
+ $attributes[]['attribute_code'] = 'stock_status';
70
+ $attributes[]['attribute_code'] = 'cp_color_attribute_id';
71
+ $attributes[]['attribute_code'] = 'parent_id';
72
+ asort($attributes);
73
+ foreach ($attributes as $attribute) {
74
+ $rendered .= '<option value="'.$attribute['attribute_code'].'">'.$attribute['attribute_code'].'</option>';
75
+ }
76
+ $rendered .= '</select>';
77
+ return $rendered;
78
+ }
79
+
80
+ return '<input type="text" name="'.$inputName.'" value="#{' . $columnName . '}"/>';
81
+ }
82
+ }
83
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Specialfields.php ADDED
@@ -0,0 +1,56 @@
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 Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Specialfields
24
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
25
+ {
26
+ protected $magentoAttributes;
27
+
28
+ public function __construct()
29
+ {
30
+ $this->addColumn('name', array(
31
+ 'label' => Mage::helper('adminhtml')->__('Data field name'),
32
+ 'size' => 30
33
+ ));
34
+ $this->addColumn('value', array(
35
+ 'label' => Mage::helper('adminhtml')->__('Data field value'),
36
+ 'size' => 30
37
+ ));
38
+ $this->_addAfter = false;
39
+
40
+ parent::__construct();
41
+ $this->setTemplate('Channelpilotsolutions/array_dropdown.phtml');
42
+ }
43
+
44
+ protected function _renderCellTemplate($columnName)
45
+ {
46
+ if (empty($this->_columns[$columnName])) {
47
+ throw new Exception('Wrong column name specified.');
48
+ }
49
+ $column = $this->_columns[$columnName];
50
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
51
+
52
+
53
+ return '<input type="text" name="'.$inputName.'" value="#{' . $columnName . '}"/>';
54
+ }
55
+ }
56
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Block/Adminhtml/Field/Trackingkeys.php ADDED
@@ -0,0 +1,69 @@
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 Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Block_Adminhtml_Field_Trackingkeys
24
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
25
+ {
26
+ protected $magentoAttributes;
27
+
28
+ public function __construct()
29
+ {
30
+ $this->addColumn('shop', array(
31
+ 'label' => Mage::helper('adminhtml')->__('Shop'),
32
+ 'size' => 15
33
+ ));
34
+ $this->addColumn('trackingkey', array(
35
+ 'label' => Mage::helper('adminhtml')->__('TrackingKey'),
36
+ 'size' => 28
37
+ ));
38
+ $this->_addAfter = false;
39
+
40
+ parent::__construct();
41
+ $this->setTemplate('Channelpilotsolutions/array_dropdown.phtml');
42
+ }
43
+
44
+ protected function _renderCellTemplate($columnName)
45
+ {
46
+ if (empty($this->_columns[$columnName])) {
47
+ throw new Exception('Wrong column name specified.');
48
+ }
49
+ $column = $this->_columns[$columnName];
50
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
51
+
52
+ if($columnName == 'shop')
53
+ {
54
+ $rendered = '<select name="'.$inputName.'">';
55
+ foreach (Mage::app()->getWebsites() as $website) {
56
+ foreach ($website->getGroups() as $group) {
57
+ $stores = $group->getStores();
58
+ foreach ($stores as $store) {
59
+ $rendered .= '<option value="'.$store->getId().'">'.$store->getName().'</option>';
60
+ }
61
+ }
62
+ }
63
+ $rendered .= '</select>';
64
+ return $rendered;
65
+ }
66
+ return '<input type="text" name="'.$inputName.'" value="#{' . $columnName . '}"/>';
67
+ }
68
+ }
69
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/Data.php ADDED
@@ -0,0 +1,59 @@
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 helper
18
+ * @copyright Copyright (c) 2013 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_Helper_Data extends Mage_Core_Helper_Abstract
24
+ {
25
+ private $xml;
26
+
27
+ public function __construct($root='root'){
28
+ //$this->xml = new SimpleXMLElement("<$root></$root>");
29
+ }
30
+
31
+ public function checkPassword() {
32
+ $password='';
33
+
34
+ $password = Mage::getStoreConfig('channelpilot_section/channelpilot_productfeed/channelpilot_password');
35
+
36
+ if($password==''){
37
+ return true;
38
+ }
39
+ if(isset($_GET['password']) AND $_GET['password']==$password){
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ public function createXml(){
46
+ header('Content-Type: text/xml; charset=utf-8');
47
+ include 'ExportData.php';
48
+ $exporter = new ExportData();
49
+ echo('<?xml version="1.0"?>');
50
+ echo("<root>");
51
+ echo("<catalog>");
52
+ $exporter->_runMain();
53
+ echo("</catalog>");
54
+ echo("</root>");
55
+ exit();
56
+ return;
57
+ }
58
+ }
59
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/Helper/ExportData.php ADDED
@@ -0,0 +1,655 @@
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 helper
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
+ class ExportData
25
+ {
26
+ private $_tablePrefix;
27
+ private $_storeId;
28
+ private $_siteId;
29
+ private $_mediaUrl;
30
+ private $_webUrl;
31
+ private $_dbConnection;
32
+ private $_model;
33
+ private $_allCat;
34
+ private $oldCatPath;
35
+ private $xml;
36
+
37
+ function __construct()
38
+ {
39
+
40
+
41
+ // Increase maximum execution time to 4 hours
42
+ ini_set('max_execution_time', 7200);
43
+
44
+ // Initialize the admin application
45
+ Mage::app('admin');
46
+
47
+ // Get the table prefix
48
+ $tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
49
+ $this->_tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
50
+
51
+ // Get database connection
52
+ $this->_dbConnection = Mage::getSingleton('core/resource') ->getConnection('core_read');
53
+ }
54
+
55
+ // Apply prefix to table names in the query
56
+ private function _applyTablePrefix($query)
57
+ {
58
+ return str_replace('ChannelPilotSolutions_ChannelPilot_', $this->_tablePrefix, $query);
59
+ }
60
+
61
+ // Run the main application and call the appropriate function
62
+ // depending on the command.
63
+ public function _runMain()
64
+ {
65
+ if(isset($_GET['store']) AND $_GET['store']!=''){
66
+ $this->_storeId = $_GET['store'];
67
+ } else {
68
+ $this->_storeId = Mage::app()->getStore()->getId();
69
+ }
70
+
71
+ // Validate store and get information
72
+ $this->_getStoreInformation();
73
+
74
+ // Run extraction
75
+ return $this->_extractFromMySQL();
76
+ }
77
+
78
+ private function getCategory($key){
79
+ if(strpos($key, '/')!=false){
80
+ $tmpKey = substr($key,0,strpos($key,strrchr($key,'/')));
81
+ if(isset($this->_allCat[$tmpKey])){
82
+ return $this->_allCat[$tmpKey];
83
+ } else {
84
+ return $this->getCategory($tmpKey);
85
+ }
86
+ }
87
+ return 0;
88
+ }
89
+
90
+ // Extract natively directly from the database
91
+ private function _extractFromMySQL()
92
+ {
93
+ $selectLimit = 1000;
94
+
95
+ // Increase maximium length for group_concat (for additional image URLs field)
96
+ $query = "SET SESSION group_concat_max_len = 1000000;";
97
+ $this->_dbConnection->query($query);
98
+
99
+ // Get category information
100
+ $query='';
101
+ if(substr(Mage::getVersion(),2,3)>=6){
102
+ $query = "
103
+ SELECT DISTINCT fs.entity_id, fs.path, fs.name
104
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_category_product_index AS pi
105
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_category_flat_store_".$this->_storeId." AS fs
106
+ ON pi.category_id = fs.entity_id
107
+ ORDER BY fs.path ASC
108
+ ";
109
+ } else {
110
+ $query = "
111
+ SELECT DISTINCT ev.entity_id, ce.path, ev.value
112
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_category_entity_varchar AS ev
113
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_category_entity AS ce ON ev.entity_id = ce.entity_id
114
+ WHERE ev.attribute_id = (
115
+ SELECT attribute_id
116
+ FROM ChannelPilotSolutions_ChannelPilot_eav_attribute as att
117
+ WHERE att.entity_type_id = ev.entity_type_id AND att.attribute_code='name'
118
+ )
119
+ ORDER BY ce.path ASC
120
+ ";
121
+ }
122
+ $query = $this->_applyTablePrefix($query);
123
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
124
+
125
+ $categoriesTable = $this->_dbConnection->fetchAll($query);
126
+
127
+ $this->_allCat = array();
128
+ $oldCatPath = 'initialize';
129
+ $oldCatTree = '';
130
+
131
+ foreach($categoriesTable as $categorie) {
132
+ if(strpos($categorie[1],$oldCatPath)!==0){
133
+ // Start tree
134
+ $path = $this->getCategory($categorie[1]);
135
+ if($path!==0){
136
+ $this->_allCat[$categorie[1]] = str_replace('Root Catalog','Home',$path.'>'.$categorie[2]);
137
+ $oldCatTree = $path.'>'.$categorie[2];
138
+ } else {
139
+ $this->_allCat[$categorie[1]] = str_replace('Root Catalog','Home',$categorie[2]);
140
+ $oldCatTree = $categorie[2];
141
+ }
142
+ } else {
143
+ // continue tree
144
+ $this->_allCat[$categorie[1]] = str_replace('Root Catalog','Home',$oldCatTree.'>'.$categorie[2]);
145
+ $oldCatTree = $this->_allCat[$categorie[1]];
146
+ }
147
+ $oldCatPath = $categorie[1];
148
+ }
149
+
150
+ // By default, set media gallery attribute id to 703
151
+ // Look it up later
152
+ $MEDIA_GALLERY_ATTRIBUTE_ID = 703;
153
+
154
+ // Get the entity type for products
155
+ $query = "SELECT entity_type_id FROM ChannelPilotSolutions_ChannelPilot_eav_entity_type WHERE entity_type_code = 'catalog_product'";
156
+ $query = $this->_applyTablePrefix($query);
157
+ $PRODUCT_ENTITY_TYPE_ID = $this->_dbConnection->fetchOne($query);
158
+
159
+ // Get attribute codes and types
160
+ $query = "SELECT attribute_id, attribute_code, backend_type, frontend_input
161
+ FROM ChannelPilotSolutions_ChannelPilot_eav_attribute
162
+ WHERE entity_type_id = $PRODUCT_ENTITY_TYPE_ID
163
+ ";
164
+ $query = $this->_applyTablePrefix($query);
165
+ $attributes = $this->_dbConnection->FetchAssoc($query);
166
+ $attributeCodes = array();
167
+ $blankProduct = array();
168
+ $blankProduct['entity_id'] = '';
169
+ $blankProduct['sku'] = '';
170
+ $blankProduct['name'] = '';
171
+ $blankProduct['description'] = '';
172
+ $blankProduct['price'] = '';
173
+ $blankProduct['categories'] = '';
174
+ $blankProduct['manufacturer'] = '';
175
+ $blankProduct['cp_product_url'] = '';
176
+ $blankProduct['cp_image_url'] = '';
177
+ $blankProduct['color'] = '';
178
+ $blankProduct['weight'] = '';
179
+
180
+ $blankProduct['cp_additional_image_1'] = '';
181
+ $blankProduct['cp_additional_image_2'] = '';
182
+ $blankProduct['cp_additional_image_3'] = '';
183
+
184
+ $special_export_fields= unserialize(Mage::getStoreConfig('channelpilot_section/channelpilot_productfeed/channelpilot_specialexportfields'));
185
+ if(!empty($special_export_fields)){
186
+ foreach($special_export_fields as $element){
187
+ if(!empty($element['name'])){
188
+ $blankProduct[preg_replace('/\W/','',$element['name'])] = $element['value'];
189
+ }
190
+ }
191
+ }
192
+
193
+ foreach($attributes as $row)
194
+ {
195
+ // Save attribute ID for media gallery
196
+ if($row['attribute_code'] == 'media_gallery')
197
+ {
198
+ $MEDIA_GALLERY_ATTRIBUTE_ID = $row['attribute_id'];
199
+ }
200
+
201
+ switch($row['backend_type'])
202
+ {
203
+ case 'datetime':
204
+ case 'decimal':
205
+ case 'int':
206
+ case 'text':
207
+ case 'varchar':
208
+ $attributeCodes[$row['attribute_id']] = $row['attribute_code'];
209
+ //$blankProduct[$row['attribute_code']] = '';
210
+ break;
211
+ case 'static':
212
+ // ignore columns in entity table
213
+ // print("Skipping static attribute: ".$row['attribute_code']."\n");
214
+ break;
215
+ default:
216
+ // print("Unsupported backend_type: ".$row['backend_type']."\n");
217
+ break;
218
+ }
219
+
220
+ // If the type is multiple choice, cache the option values
221
+ // in a lookup array for performance (avoids several joins/aggregations)
222
+ if($row['frontend_input'] == 'select' || $row['frontend_input'] == 'multiselect')
223
+ {
224
+ // Get the option_id => value from the attribute options
225
+ $query = "
226
+ SELECT
227
+ CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.option_id) ELSE
228
+ MAX(CASE WHEN aov.store_id = ".$this->_storeId." THEN aov.option_id ELSE NULL END)
229
+ END AS 'option_id'
230
+ ,CASE WHEN SUM(aov.store_id) = 0 THEN MAX(aov.value) ELSE
231
+ MAX(CASE WHEN aov.store_id = ".$this->_storeId." THEN aov.value ELSE NULL END)
232
+ END AS 'value'
233
+ FROM ChannelPilotSolutions_ChannelPilot_eav_attribute_option AS ao
234
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_eav_attribute_option_value AS aov
235
+ ON ao.option_id = aov.option_id
236
+ WHERE aov.store_id IN (".$this->_storeId.", 0)
237
+ AND ao.attribute_id = ".$row['attribute_id']."
238
+ GROUP BY aov.option_id
239
+ ";
240
+ $query = $this->_applyTablePrefix($query);
241
+ $result = $this->_dbConnection->fetchPairs($query);
242
+
243
+ // If found, then save the lookup table in the attributeOptions array
244
+ if(is_array($result))
245
+ {
246
+ $attributeOptions[$row['attribute_id']] = $result;
247
+ }
248
+ else
249
+ {
250
+ // Otherwise, leave a blank array
251
+ $attributeOptions[$row['attribute_id']] = array();
252
+ }
253
+ $result = null;
254
+ }
255
+ }
256
+
257
+ $export_data_fields_codes = '';
258
+ $export_data_fields_ids = '';
259
+ foreach(array_keys($blankProduct) as $key){
260
+ $export_data_fields_codes = $export_data_fields_codes."'".$key."',";
261
+ $tmpid = array_search($key, $attributeCodes);
262
+ if(!empty($tmpid)){
263
+ $export_data_fields_ids = $export_data_fields_ids."'".$tmpid."',";
264
+ }
265
+
266
+ }
267
+
268
+ $export_fields= unserialize(Mage::getStoreConfig('channelpilot_section/channelpilot_productfeed/channelpilot_exportfields'));
269
+ if(!empty($export_fields)){
270
+ foreach($export_fields as $element){
271
+ if(!empty($element['productattribute'])){
272
+ $blankProduct[preg_replace('/\W/','',$element['productattribute'])] = '';
273
+ $export_data_fields_codes = $export_data_fields_codes."'".$element['productattribute']."',";
274
+ $tmpid = array_search($element['productattribute'], $attributeCodes);
275
+ if(!empty($tmpid)){
276
+ $export_data_fields_ids = $export_data_fields_ids."'".$tmpid."',";
277
+ }
278
+ }
279
+ }
280
+ }
281
+
282
+ $tmpid = array_search('status', $attributeCodes);
283
+ if(!empty($tmpid)){
284
+ $export_data_fields_ids = $export_data_fields_ids."'".$tmpid."',";
285
+ }
286
+ $tmpid = array_search('url_path', $attributeCodes);
287
+ if(!empty($tmpid)){
288
+ $export_data_fields_ids = $export_data_fields_ids."'".$tmpid."',";
289
+ }
290
+ $tmpid = array_search('image', $attributeCodes);
291
+ if(!empty($tmpid)){
292
+ $export_data_fields_ids = $export_data_fields_ids."'".$tmpid."',";
293
+ }
294
+ $export_data_fields_ids=rtrim($export_data_fields_ids, ',');
295
+
296
+
297
+
298
+ // Build queries for each attribute type
299
+ $backendTypes = array(
300
+ 'datetime',
301
+ 'decimal',
302
+ 'int',
303
+ 'text',
304
+ 'varchar',
305
+ );
306
+ $queries = array();
307
+ foreach($backendTypes as $backendType)
308
+ {
309
+ // Get store value if there is one, otherwise, global value
310
+ $queries[] = "
311
+ SELECT CASE WHEN SUM(ev.store_id) = 0 THEN MAX(ev.value) ELSE
312
+ MAX(CASE WHEN ev.store_id = ".$this->_storeId." THEN ev.value ELSE NULL END)
313
+ END AS 'value', ev.attribute_id
314
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_product_entity
315
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_product_entity_$backendType AS ev
316
+ ON ChannelPilotSolutions_ChannelPilot_catalog_product_entity.entity_id = ev.entity_id
317
+ WHERE ev.store_id IN (".$this->_storeId.", 0)
318
+ AND ev.entity_type_id = $PRODUCT_ENTITY_TYPE_ID
319
+ AND ev.entity_id = @ENTITY_ID AND ev.attribute_id IN (".$export_data_fields_ids.")
320
+ GROUP BY ev.attribute_id, ev.entity_id
321
+ ";
322
+ }
323
+ $query = implode(" UNION ALL ", $queries);
324
+ $MasterProductQuery = $query;
325
+
326
+ $count = 0;
327
+ $query = "
328
+ SELECT count(*)
329
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_product_entity AS cpe
330
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_product_website as cpw
331
+ ON cpw.product_id = cpe.entity_id
332
+ WHERE cpw.website_id = ".$this->_siteId."
333
+ AND IFNULL(cpe.sku, '') != ''
334
+ ";
335
+ $query = $this->_applyTablePrefix($query);
336
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
337
+ $count = $this->_dbConnection->fetchAll($query);
338
+
339
+ $counter = 0;
340
+
341
+ $border = (int)$count[0][0]-$selectLimit;
342
+ if($border<$count[0][0]){
343
+ $border=$count[0][0];
344
+ }
345
+ while($counter<=$border){
346
+ // Get all entity_ids for all products in the selected store
347
+ $query = "
348
+ SELECT cpe.entity_id, cpe.sku
349
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_product_entity AS cpe
350
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_product_website as cpw
351
+ ON cpw.product_id = cpe.entity_id
352
+ WHERE cpw.website_id = ".$this->_siteId."
353
+ AND IFNULL(cpe.sku, '') != '' LIMIT ".$counter.", ".$selectLimit."
354
+ ";
355
+ $query = $this->_applyTablePrefix($query);
356
+ // Set fetch mode to numeric to save memory
357
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
358
+ $EntityIds = $this->_dbConnection->fetchAll($query);
359
+ // Loop through each product and output the data
360
+ foreach($EntityIds as $entity)
361
+ {
362
+
363
+ // Fill the master query with the entity ID
364
+ // $entity[0] = entity_id
365
+ // $entity[1] = sku
366
+ $query = str_replace('@ENTITY_ID', $entity[0], $MasterProductQuery);
367
+ $query = $this->_applyTablePrefix($query);
368
+ $result = $this->_dbConnection->query($query);
369
+
370
+ // Create a new product record
371
+ $product = $blankProduct;
372
+
373
+ // Initialize basic product data
374
+ $product['entity_id'] = $entity[0];
375
+ $product['sku'] = $entity[1];
376
+
377
+ // Escape the SKU (it may contain double-quotes)
378
+ $product['sku'] = str_replace('"', '""', $product['sku']);
379
+
380
+ $product_status;
381
+ $product_url;
382
+ $product_image;
383
+ // Loop through each field in the row and get the value
384
+ while(true)
385
+ {
386
+ // Get next column
387
+ // $column[0] = value
388
+ // $column[1] = attribute_id
389
+ $column = $result->fetch(Zend_Db::FETCH_NUM);
390
+ // Break if no more rows
391
+ if(empty($column))
392
+ {
393
+ break;
394
+ }
395
+ // Skip attributes that don't exist in eav_attribute
396
+ if(!isset($attributeCodes[$column[1]]))
397
+ {
398
+ continue;
399
+ }
400
+
401
+ // Translate the option option_id to a value.
402
+ if(isset($attributeOptions[$column[1]]) == true)
403
+ {
404
+ // Convert all option values
405
+ $optionValues = explode(',', $column[0]);
406
+ $convertedOptionValues = array();
407
+ foreach($optionValues as $optionValue)
408
+ {
409
+ if(isset($attributeOptions[$column[1]][$optionValue]) == true)
410
+ {
411
+ // If a option_id is found, translate it
412
+ $convertedOptionValues[] = $attributeOptions[$column[1]][$optionValue];
413
+ }
414
+ }
415
+ // Erase values that are set to zero
416
+ if($column[0] == '0')
417
+ {
418
+ $column[0] = '';
419
+ }
420
+ elseif(empty($convertedOptionValues) == false)
421
+ {
422
+ // Use convert values if any conversions exist
423
+ $column[0] = implode(',', $convertedOptionValues);
424
+ }
425
+ // Otherwise, leave value as-is
426
+ }
427
+ if(strpos($export_data_fields_codes, "'".$attributeCodes[$column[1]]."'")!=false){
428
+ $product[$attributeCodes[$column[1]]] = str_replace('"', '""', $column[0]);
429
+ }
430
+ if($attributeCodes[$column[1]]=='status'){
431
+ $product_status = $column[0];
432
+ }
433
+ if($attributeCodes[$column[1]]=='url_path'){
434
+ $product_url = $column[0];
435
+ }
436
+ if($attributeCodes[$column[1]]=='image'){
437
+ $product_image = $column[0];
438
+ }
439
+
440
+ }
441
+ $result = null;
442
+
443
+ // Skip product that are disabled or have no status
444
+ if(empty($product_status) || $product_status == Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
445
+ {
446
+ continue;
447
+ }
448
+ // Get category information
449
+ $query='';
450
+ if(substr(Mage::getVersion(),2,3)>=6){
451
+ $query = "
452
+ SELECT DISTINCT fs.entity_id, fs.path, fs.name
453
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_category_product_index AS pi
454
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_category_flat_store_".$this->_storeId." AS fs
455
+ ON pi.category_id = fs.entity_id
456
+ WHERE pi.product_id = ".$entity[0]." ORDER BY fs.path ASC
457
+ ";
458
+ } else {
459
+ $query = "
460
+ SELECT pi.category_id, ce.path
461
+ FROM catalog_category_product_index AS pi
462
+ INNER JOIN catalog_category_entity AS ce ON pi.category_id = ce.entity_id
463
+ WHERE pi.product_id = ".$entity[0]." AND pi.is_parent = 1 AND pi.store_id = ".$this->_storeId." ORDER BY ce.path ASC
464
+ ";
465
+ }
466
+ $query = $this->_applyTablePrefix($query);
467
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
468
+
469
+ $categoriesTable = $this->_dbConnection->fetchAll($query);
470
+ $product['categories'] = '';
471
+ $categorieField = '';
472
+ $this->oldCatPath = '';
473
+ foreach($categoriesTable as $categorie) {
474
+ if(($this->oldCatPath=='') || (strpos($categorie[1],$this->oldCatPath)!==0)){
475
+ // Start tree
476
+ if($this->oldCatPath!==''){
477
+ if($categorieField!==''){
478
+ $categorieField = $categorieField.', '.$this->_allCat[$this->oldCatPath];
479
+ } else {
480
+ $categorieField = $this->_allCat[$this->oldCatPath];
481
+ }
482
+ }
483
+ $this->oldCatPath = $categorie[1];
484
+ } else {
485
+ // Add to tree
486
+ $this->oldCatPath = $categorie[1];
487
+ }
488
+
489
+ }
490
+ if($categorieField!==''){
491
+ $categorieField = $categorieField.', '.$this->_allCat[$this->oldCatPath];
492
+ } else {
493
+ if($this->oldCatPath!==''){
494
+ $categorieField = $this->_allCat[$this->oldCatPath];
495
+ }
496
+ }
497
+ $product['categories'] = $categorieField;
498
+
499
+ // Get stock quantity
500
+ // NOTE: stock_id = 1 is the 'Default' stock
501
+ $query = "
502
+ SELECT qty, stock_status
503
+ FROM ChannelPilotSolutions_ChannelPilot_cataloginventory_stock_status
504
+ WHERE product_id=".$entity[0]."
505
+ AND website_id=".$this->_siteId."
506
+ AND stock_id = 1";
507
+ $query = $this->_applyTablePrefix($query);
508
+ $stockInfoResult = $this->_dbConnection->query($query);
509
+ $stockInfo = $stockInfoResult->fetch();
510
+ if($export_data_fields_codes)
511
+ if(strpos($export_data_fields_codes, "'qty'")!=false){
512
+ if(empty($stockInfo) == true)
513
+ {
514
+ $product['qty'] = '0';
515
+ }
516
+ else
517
+ {
518
+ $product['qty'] = $stockInfo[0];
519
+ }
520
+ }
521
+ if(strpos($export_data_fields_codes, "'stock_status'")!=false){
522
+ if(empty($stockInfo) == true)
523
+ {
524
+ $product['stock_status'] = '';
525
+ }
526
+ else
527
+ {
528
+ $product['stock_status'] = $stockInfo[1];
529
+ }
530
+ }
531
+ $stockInfoResult = null;
532
+
533
+ // Get additional image URLs
534
+ $galleryImagePrefix = $this->_dbConnection->quote($this->_mediaUrl.'catalog/product');
535
+ $query = "
536
+ SELECT
537
+ GROUP_CONCAT(gallery.value_id SEPARATOR ',') AS value_id
538
+ ,GROUP_CONCAT(CONCAT(".$galleryImagePrefix.", gallery.value) SEPARATOR ',') AS value
539
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_product_entity_media_gallery AS gallery
540
+ INNER JOIN ChannelPilotSolutions_ChannelPilot_catalog_product_entity_media_gallery_value AS gallery_value
541
+ ON gallery.value_id = gallery_value.value_id
542
+ WHERE gallery_value.store_id IN (".$this->_storeId.", 0)
543
+ AND gallery_value.disabled = 0
544
+ AND gallery.entity_id=".$entity[0]."
545
+ AND gallery.attribute_id = ".$MEDIA_GALLERY_ATTRIBUTE_ID."
546
+ ORDER BY gallery_value.position ASC";
547
+ $query = $this->_applyTablePrefix($query);
548
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
549
+ $galleryValues = $this->_dbConnection->fetchAll($query);
550
+ if(empty($galleryValues) != true)
551
+ {
552
+ $additional_images = explode(',', $galleryValues[0][1]);
553
+ for($i=0;$i<=2; $i++){
554
+ if(isset($additional_images[$i])){
555
+ $product['cp_additional_image_'.($i+1)] = $additional_images[$i];
556
+ }
557
+ }
558
+ }
559
+
560
+ // Get parent ID
561
+ $query = "
562
+ SELECT GROUP_CONCAT(parent_id SEPARATOR ',') AS parent_id
563
+ FROM ChannelPilotSolutions_ChannelPilot_catalog_product_super_link AS super_link
564
+ WHERE super_link.product_id=".intval($entity[0])."";
565
+ $query = $this->_applyTablePrefix($query);
566
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
567
+ $parentId = $this->_dbConnection->fetchAll($query);
568
+ if(empty($parentId) != true && strpos($export_data_fields_codes, "'parent_id'")!=false)
569
+ {
570
+ $product['parent_id'] = $parentId[0][0];
571
+ }
572
+
573
+ // Override price with catalog price rule, if found
574
+ $query = "
575
+ SELECT crpp.rule_price
576
+ FROM ChannelPilotSolutions_ChannelPilot_catalogrule_product_price AS crpp
577
+ WHERE crpp.rule_date = CURDATE()
578
+ AND crpp.product_id = ".intval($entity[0])."
579
+ AND crpp.customer_group_id = 1
580
+ AND crpp.website_id = ".$this->_siteId;
581
+ $query = $this->_applyTablePrefix($query);
582
+ $this->_dbConnection->setFetchMode(ZEND_DB::FETCH_NUM);
583
+ $rule_price = $this->_dbConnection->fetchAll($query);
584
+ if(empty($rule_price) != true)
585
+ {
586
+ // Override price with catalog rule price
587
+ $product['price'] = $rule_price[0][0];
588
+ }
589
+
590
+ // Calculate image and product URLs
591
+ if(empty($product_url) == false)
592
+ {
593
+ $product['cp_product_url'] = $this->_urlPathJoin($this->_webUrl, $product_url);
594
+ }
595
+
596
+ if(empty($product_image) == false)
597
+ {
598
+ $product['cp_image_url'] = $this->_urlPathJoin($this->_mediaUrl, 'catalog/product');
599
+ $product['cp_image_url'] = $this->_urlPathJoin($product['cp_image_url'], $product_image);
600
+ }
601
+
602
+ $this->xml = new SimpleXMLElement("<product></product>");
603
+ echo str_replace('<?xml version="1.0"?>','',$this->toXML($product));
604
+ $this->xml = null;
605
+ }
606
+ $counter=$counter+$selectLimit;
607
+ }
608
+
609
+ return ;
610
+ }
611
+
612
+ // Join two URL paths and handle forward slashes
613
+ private function _urlPathJoin($part1, $part2)
614
+ {
615
+ return rtrim($part1, '/').'/'.ltrim($part2, '/');
616
+ }
617
+
618
+ // Die if the storeId is invalid
619
+ private function _getStoreInformation()
620
+ {
621
+ try
622
+ {
623
+ // Get the store object
624
+ $store = Mage::app()->getStore($this->_storeId);
625
+
626
+ // Load the store information
627
+ $this->_siteId = $store->getWebsiteId();
628
+ $this->_webUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
629
+ $this->_mediaUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
630
+ }
631
+ catch (Exception $e)
632
+ {
633
+ die('Store='.$this->_storeId." probably does not exist.");
634
+ }
635
+ }
636
+
637
+ private function toXML($array) {
638
+ $this->iterate($array, $this->xml);
639
+ return $this->xml->asXML();
640
+ }
641
+
642
+ private function iterate($element, $xmlNode) {
643
+ if(is_array($element)){
644
+ foreach($element as $name=>$value) {
645
+ if(is_string($value) || is_numeric($value) || is_bool($value)) {
646
+ $xmlNode->$name = $value;
647
+ } else {
648
+ $xmlNode->$name = null;
649
+ $this->iterate($value, $xmlNode->$name);
650
+ }
651
+ }
652
+ }
653
+ }
654
+ }
655
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/controllers/IndexController.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
+ * @subpackage controllers
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ class Channelpilotsolutions_Channelpilot_IndexController extends Mage_Core_Controller_Front_Action {
24
+
25
+ public function indexAction() {
26
+ if(Mage::helper('channelpilot')->checkPassword()){
27
+ Mage::helper('channelpilot')->createXml();
28
+ } else {
29
+ echo "Unauthorized";
30
+ }
31
+ }
32
+ }
33
+ ?>
app/code/community/Channelpilotsolutions/Channelpilot/etc/adminhtml.xml ADDED
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package Channelpilotsolutions_Channelpilot
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <acl>
26
+ <resources>
27
+ <admin>
28
+ <children>
29
+ <system>
30
+ <children>
31
+ <config>
32
+ <children>
33
+ <channelpilot_section translate="title" module="channelpilot">
34
+ <title>channelpilot_section Section</title>
35
+ <sort_order>100</sort_order>
36
+ </channelpilot_section>
37
+ </children>
38
+ </config>
39
+ </children>
40
+ </system>
41
+ </children>
42
+ </admin>
43
+ </resources>
44
+ </acl>
45
+ </config>
app/code/community/Channelpilotsolutions/Channelpilot/etc/config.xml ADDED
@@ -0,0 +1,97 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package Channelpilotsolutions_Channelpilot
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Channelpilot>
27
+ <version>1.0.0</version>
28
+ </Channelpilotsolutions_Channelpilot>
29
+ </modules>
30
+ <global>
31
+ <helpers>
32
+ <channelpilot>
33
+ <class>Channelpilotsolutions_Channelpilot_Helper</class>
34
+ </channelpilot>
35
+ </helpers>
36
+ <models>
37
+ <channelpilot_adminhtml>
38
+ <class>Channelpilotsolutions_Channelpilot_Adminhtml_Model</class>
39
+ </channelpilot_adminhtml>
40
+ </models>
41
+ <resources>
42
+ <channelpilot_setup>
43
+ <setup>
44
+ <module>Channelpilotsolutions_Channelpilot</module>
45
+ </setup>
46
+ <connection>
47
+ <use>core_setup</use>
48
+ </connection>
49
+ </channelpilot_setup>
50
+ <channelpilot_write>
51
+ <connection>
52
+ <use>core_write</use>
53
+ </connection>
54
+ </channelpilot_write>
55
+ <channelpilot_read>
56
+ <connection>
57
+ <use>core_read</use>
58
+ </connection>
59
+ </channelpilot_read>
60
+ </resources>
61
+ <extraconfig />
62
+ <blocks>
63
+ <channelpilot_core>
64
+ <class>Channelpilotsolutions_Channelpilot_Block</class>
65
+ </channelpilot_core>
66
+ </blocks>
67
+ </global>
68
+ <adminhtml>
69
+ <translate>
70
+ <modules>
71
+ <Channelpilotsolutions_Channelpilot>
72
+ <files>
73
+ <default>ChannelPilotSolutions_ChannelPilot.csv</default>
74
+ </files>
75
+ </Channelpilotsolutions_Channelpilot>
76
+ </modules>
77
+ </translate>
78
+ <layout>
79
+ <updates>
80
+ <channelpilot>
81
+ <file>Channelpilotsolutions/channelpilot.xml</file>
82
+ </channelpilot>
83
+ </updates>
84
+ </layout>
85
+ </adminhtml>
86
+ <frontend>
87
+ <routers>
88
+ <channelpilot>
89
+ <use>standard</use>
90
+ <args>
91
+ <module>Channelpilotsolutions_Channelpilot</module>
92
+ <frontName>channelpilot</frontName>
93
+ </args>
94
+ </channelpilot>
95
+ </routers>
96
+ </frontend>
97
+ </config>
app/code/community/Channelpilotsolutions/Channelpilot/etc/system.xml ADDED
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package Channelpilotsolutions_Channelpilot
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <tabs>
26
+ <channelpilot_config translate="label" module="channelpilot">
27
+ <label>Channelpilot</label>
28
+ <class>tab-channelpilot</class>
29
+ <sort_order>401</sort_order>
30
+ </channelpilot_config>
31
+ </tabs>
32
+ <sections>
33
+ <channelpilot_section translate="label" module="channelpilot">
34
+ <label>Settings</label>
35
+ <tab>channelpilot_config</tab>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>1000</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ <groups>
42
+ <!-- New group -->
43
+ <channelpilot_productfeed translate="label">
44
+ <label>Productfeed</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>1</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <fields>
51
+ <!-- New Field -->
52
+ <channelpilot_password translate="label">
53
+ <label>Password</label>
54
+ <comment>Protect your productfeed with a password. For example: 'www.testshop.com/channelpilot?password=12345'</comment>
55
+ <frontend_type>password</frontend_type>
56
+ <sort_order>1</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </channelpilot_password>
61
+ <channelpilot_exportfields>
62
+ <label>Select data fields</label>
63
+ <comment>Select the data fields that you want to provide on ChannelPilot. Some product attributes are always included. (Entity_Id, Sku, name, description, price, manufacturer, color, categories, product_url, image_url, additional_image_1, additional_image_2, additional_image_3, weight)</comment>
64
+ <frontend_model>channelpilot_core/adminhtml_field_exportfields</frontend_model>
65
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
66
+ <sort_order>2</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </channelpilot_exportfields>
71
+ <channelpilot_specialexportfields>
72
+ <label>Create static data fields</label>
73
+ <comment>Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.</comment>
74
+ <frontend_model>channelpilot_core/adminhtml_field_specialfields</frontend_model>
75
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
76
+ <sort_order>3</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </channelpilot_specialexportfields>
81
+ </fields>
82
+ </channelpilot_productfeed>
83
+ <!-- New group -->
84
+ <channelpilot_salestracking translate="label">
85
+ <label>Salestracking</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>2</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ <fields>
92
+ <channelpilot_articlenumber>
93
+ <label>Articlenumber</label>
94
+ <comment>Select the same data field which you selected to be the unique article number in ChannelPilot.</comment>
95
+ <frontend_type>select</frontend_type>
96
+ <source_model>channelpilot_adminhtml/articlenumber_values</source_model>
97
+ <sort_order>0</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </channelpilot_articlenumber>
102
+ <channelpilot_cookiemode>
103
+ <label>Cookiemode</label>
104
+ <frontend_type>select</frontend_type>
105
+ <source_model>channelpilot_adminhtml/cookiemode_values</source_model>
106
+ <sort_order>1</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </channelpilot_cookiemode>
111
+ <channelpilot_trackingkeys>
112
+ <label>Trackingkeys</label>
113
+ <frontend_model>channelpilot_core/adminhtml_field_trackingkeys</frontend_model>
114
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
115
+ <sort_order>2</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </channelpilot_trackingkeys>
120
+ </fields>
121
+ </channelpilot_salestracking>
122
+ </groups>
123
+ </channelpilot_section>
124
+ </sections>
125
+ </config>
app/code/community/Channelpilotsolutions/Clicktracking/etc/config.xml ADDED
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><!--
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 Channelpilotsolutions_Clicktracking
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Clicktracking>
27
+ <version>1.0.0</version>
28
+ </Channelpilotsolutions_Clicktracking>
29
+ </modules>
30
+ <frontend>
31
+ <layout>
32
+ <updates>
33
+ <channelpilotsolutions_clicktracking>
34
+ <file>Channelpilotsolutions/clicktracking.xml</file>
35
+ </channelpilotsolutions_clicktracking>
36
+ </updates>
37
+ </layout>
38
+ </frontend>
39
+ </config>
app/code/community/Channelpilotsolutions/Salestracking/etc/config.xml ADDED
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><!--
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_Salestracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Salestracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package Channelpilotsolutions_Salestracking
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Salestracking>
27
+ <version>1.0.0</version>
28
+ </Channelpilotsolutions_Salestracking>
29
+ </modules>
30
+ <frontend>
31
+ <layout>
32
+ <updates>
33
+ <channelpilotsolutions_salestracking>
34
+ <file>Channelpilotsolutions/salestracking.xml</file>
35
+ </channelpilotsolutions_salestracking>
36
+ </updates>
37
+ </layout>
38
+ </frontend>
39
+ </config>
app/design/adminhtml/base/default/template/Channelpilotsolutions/array_dropdown.phtml ADDED
@@ -0,0 +1,174 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_adminhtml_base_default
17
+ * @subpackage template_channelpilotsolutions
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ ?>
24
+
25
+ <?php
26
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
27
+
28
+ $_colspan = 2;
29
+ if (!$this->_addAfter) {
30
+ $_colspan -= 1;
31
+ }
32
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
33
+ ?>
34
+
35
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
36
+ <table cellpadding="0" cellspacing="0" class="border">
37
+ <tbody>
38
+
39
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
40
+ <?php foreach ($this->_columns as $columnName => $column):?>
41
+ <th><?php echo $column['label'] ?></th>
42
+ <?php endforeach;?>
43
+ <th <?php echo $_colspan?>></th>
44
+ </tr>
45
+
46
+ <tr id="addRow<?php echo $_htmlId ?>">
47
+ <td colspan="<?php echo count($this->_columns) ?>"></td>
48
+ <td <?php echo $_colspan?>>
49
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
50
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
51
+ </button>
52
+ </td>
53
+ </tr>
54
+
55
+ </tbody>
56
+ </table>
57
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
58
+ </div>
59
+ <div id="empty<?php echo $_htmlId ?>">
60
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
61
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
62
+ </button>
63
+ </div>
64
+
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ // create row creator
68
+ var arrayRow<?php echo $_htmlId ?> = {
69
+ // define row prototypeJS template
70
+ template : new Template(
71
+ '<tr id="#{_id}">'
72
+ <?php foreach ($this->_columns as $columnName => $column):?>
73
+ +'<td class="#{_id}-<?php echo $columnName?>">'
74
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
75
+ +'<\/td>'
76
+ <?php endforeach;?>
77
+ <?php if ($this->_addAfter):?>
78
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
79
+ <?php endif;?>
80
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
81
+ +'<\/tr>'
82
+ ),
83
+
84
+ rowsCount : 0,
85
+
86
+ add : function(templateData, insertAfterId)
87
+ {
88
+ // generate default template data
89
+ if ('' == templateData) {
90
+ var d = new Date();
91
+ var templateData = {
92
+ <?php foreach ($this->_columns as $columnName => $column):?>
93
+ <?php echo $columnName ?> : '',
94
+ <?php endforeach;?>
95
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
96
+ };
97
+ }
98
+
99
+ // insert before last row
100
+ if ('' == insertAfterId) {
101
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
102
+ }
103
+ // insert after specified row
104
+ else {
105
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
106
+ }
107
+
108
+ // set the selected drop-down list item
109
+ <?php foreach ($this->_columns as $columnName => $column):?>
110
+ var options = $('td.' + templateData._id + '-' + '<?php echo $columnName?>' + ' option')
111
+ for(var index = 0; index < options.length; ++index)
112
+ {
113
+ var option = options[index]
114
+ if(option.getAttribute('value') == templateData.<?php echo $columnName?>)
115
+ {
116
+ option.selected = true
117
+ }
118
+ }
119
+ <?php endforeach;?>
120
+
121
+ <?php if ($this->_addAfter):?>
122
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
123
+ <?php endif;?>
124
+
125
+ this.rowsCount += 1;
126
+ },
127
+
128
+ del : function(rowId)
129
+ {
130
+ $(rowId).remove();
131
+ this.rowsCount -= 1;
132
+ if (0 == this.rowsCount) {
133
+ this.showButtonOnly();
134
+ }
135
+ },
136
+
137
+ showButtonOnly : function()
138
+ {
139
+ $('grid<?php echo $_htmlId ?>').hide();
140
+ $('empty<?php echo $_htmlId ?>').show();
141
+ }
142
+ }
143
+
144
+ // bind add action to "Add" button in last row
145
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
146
+
147
+ // add existing rows
148
+ <?php
149
+ $_addAfterId = "headings{$_htmlId}";
150
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
151
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
152
+ $_addAfterId = $_rowId;
153
+ }
154
+ ?>
155
+
156
+ // initialize standalone button
157
+ $('empty<?php echo $_htmlId ?>').hide();
158
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
159
+ $('grid<?php echo $_htmlId ?>').show();
160
+ $('empty<?php echo $_htmlId ?>').hide();
161
+ arrayRow<?php echo $_htmlId ?>.add('', '');
162
+ });
163
+
164
+ // if no rows, hide grid and show button only
165
+ <?php if (!$this->getArrayRows()):?>
166
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
167
+ <?php endif;?>
168
+
169
+ // toggle the grid, if element is disabled (depending on scope)
170
+ <?php if ($this->getElement()->getDisabled()):?>
171
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
172
+ <?php endif;?>
173
+ //]]>
174
+ </script>
app/design/adminhtml/default/default/layout/Channelpilotsolutions/channelpilot.xml ADDED
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_adminhtml_default_default
17
+ * @subpackage layout
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <layout>
25
+ <default>
26
+ <reference name="head">
27
+ <action method="addCss">
28
+ <name>Channelpilotsolutions/channelpilot/icon.css</name>
29
+ </action>
30
+ </reference>
31
+ </default>
32
+ </layout>
app/design/frontend/base/default/layout/Channelpilotsolutions/clicktracking.xml ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Clicktracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Clicktracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage layout_Channelpilotsolutions
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <layout version="0.1.0">
25
+ <default>
26
+ <reference name="head">
27
+ <block type="core/template" name="clicktracking" template="Channelpilotsolutions/clicktracking.phtml" after="-">
28
+ </block>
29
+ </reference>
30
+ </default>
31
+ </layout>
app/design/frontend/base/default/layout/Channelpilotsolutions/salestracking.xml ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Salestracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Salestracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package design_frontend_base_default
17
+ * @subpackage layout_Channelpilotsolutions
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <layout version="0.1.0">
25
+ <default>
26
+ <reference name="head">
27
+ <block type="core/template" name="salestracking" template="Channelpilotsolutions/salestracking.phtml" after="-">
28
+ </block>
29
+ </reference>
30
+ </default>
31
+ </layout>
app/design/frontend/base/default/template/Channelpilotsolutions/clicktracking.phtml ADDED
@@ -0,0 +1,24 @@
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
+ <script type="text/javascript" src="//content.cptrack.de/clicks.js"></script>
app/design/frontend/base/default/template/Channelpilotsolutions/salestracking.phtml ADDED
@@ -0,0 +1,95 @@
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_Salestracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Salestracking 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
+
26
+ if(strpos($_SERVER['REQUEST_URI'],'checkout/onepage/success')!==false )
27
+ {
28
+ $storeId = Mage::app()->getStore()->getId();
29
+ $trackingKeys= unserialize(Mage::getStoreConfig('channelpilot_section/channelpilot_salestracking/channelpilot_trackingkeys'));
30
+ $TRACKINGKEY = '';
31
+ foreach($trackingKeys as $element){
32
+ if($element['shop']==$storeId){
33
+ $TRACKINGKEY = $element['trackingkey'];
34
+ break;
35
+ }
36
+ }
37
+ $tableName = Mage::getSingleton('core/resource')->getTableName('core_website');
38
+ $tablePrefix = substr($tableName, 0, strpos($tableName, 'core_website'));
39
+
40
+ $dbConnection = Mage::getSingleton('core/resource') ->getConnection('core_read');
41
+
42
+
43
+
44
+
45
+
46
+ if(substr(Mage::getVersion(),2,7)=='4.0.1'){
47
+ $query = "
48
+ SELECT so.entity_id, so.increment_id AS id, (so.grand_total-so.tax_amount) AS orderTotal
49
+ FROM ChannelPilotSolutions_ChannelPilot_sales_order AS so
50
+ WHERE so.increment_id = ".Mage::getSingleton('checkout/session')->getLastRealOrderId()."
51
+ ORDER BY so.entity_id DESC LIMIT 1";
52
+ } else {
53
+ $query = "
54
+ SELECT so.entity_id, so.increment_id AS id, (so.grand_total-so.tax_amount) AS orderTotal
55
+ FROM ChannelPilotSolutions_ChannelPilot_sales_flat_order AS so
56
+ WHERE so.increment_id = ".Mage::getSingleton('checkout/session')->getLastRealOrderId()."
57
+ ORDER BY so.entity_id DESC LIMIT 1";
58
+ }
59
+ $query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
60
+ $orders = $dbConnection->fetchAll($query);
61
+ foreach ($orders as $ORDER) {
62
+ ?>
63
+ <script type="text/javascript">
64
+ var cpSale = {
65
+ trackingKey: "<?php echo $TRACKINGKEY;?>",
66
+ orderId: "<?php echo $ORDER['id'];?>",
67
+ orderTotal: <?php echo $ORDER['orderTotal'];?>,
68
+ cookie: "<?php echo Mage::getStoreConfig('channelpilot_section/channelpilot_salestracking/channelpilot_cookiemode');?>",
69
+ shoppingCart: new Array()
70
+ };
71
+ <?php
72
+ }
73
+ // Retrieve ordered products
74
+ $query = "
75
+ SELECT *
76
+ FROM ChannelPilotSolutions_ChannelPilot_sales_flat_order_item
77
+ WHERE order_id = ".$ORDER['entity_id'];
78
+ $query = str_replace('ChannelPilotSolutions_ChannelPilot_', $tablePrefix, $query);
79
+ $orderedProducts = $dbConnection->fetchAll($query);
80
+
81
+ // Loop through each product in order
82
+ foreach ($orderedProducts as $orderedProduct) {
83
+ $productId = $orderedProduct[Mage::getStoreConfig('channelpilot_section/channelpilot_salestracking/channelpilot_articlenumber')];
84
+ $price = $orderedProduct['price'];
85
+ $quantity = (int) $orderedProduct['qty_ordered'];
86
+ ?>
87
+ cpSale.shoppingCart.push({id: "<?php echo $productId;?>", price: <?php echo $price;?>, amount: <?php echo $quantity;?>});
88
+ <?php
89
+ }
90
+ ?>
91
+ </script>
92
+ <script type="text/javascript" src="//content.cptrack.de/sales.js"></script>
93
+ <?php
94
+ }
95
+ ?>
app/etc/modules/Channelpilotsolutions_Channelpilot.xml ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Channelpilotsolutions_Channelpilot to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Channelpilot for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package etc
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Channelpilot>
27
+ <active>true</active>
28
+ <codePool>community</codePool>
29
+ </Channelpilotsolutions_Channelpilot>
30
+ </modules>
31
+ </config>
app/etc/modules/Channelpilotsolutions_Clicktracking.xml ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><!--
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 etc
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Clicktracking>
27
+ <active>true</active>
28
+ <codePool>community</codePool>
29
+ </Channelpilotsolutions_Clicktracking>
30
+ </modules>
31
+ </config>
app/etc/modules/Channelpilotsolutions_Salestracking.xml ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><!--
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_Salestracking to newer
12
+ * versions in the future. If you wish to customize Channelpilotsolutions_Salestracking for your
13
+ * needs please refer to http://www.channelpilot.com for more information.
14
+ *
15
+ * @category Channelpilotsolutions
16
+ * @package etc
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@channelpilot.com> - www.channelpilot.com
19
+ * @author Peter Hoffmann <info@channelpilot.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.channelpilot.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Channelpilotsolutions_Salestracking>
27
+ <active>true</active>
28
+ <codePool>community</codePool>
29
+ </Channelpilotsolutions_Salestracking>
30
+ </modules>
31
+ </config>
app/locale/de_AT/Channelpilotsolutions_Channelpilot.csv ADDED
@@ -0,0 +1,30 @@
1
+ "Settings","Einstellungen"
2
+
3
+
4
+ "Productfeed","Produktkatalog"
5
+
6
+ "Password","Passwort"
7
+ "Protect your productfeed with a password. For example: 'www.testshop.com/channelpilot?password=12345'","Schützen Sie Ihren Produktkatalog mit einem Passwort. Zum Beispiel: 'www.testshop.com/channelpilot?password=12345'"
8
+ "Select data fields","Datenfelder auswählen"
9
+ "Data field","Datenfeld"
10
+ "Select the data fields that you want to provide on ChannelPilot. Some product attributes are always included. (Entity_Id, Sku, name, description, price, manufacturer, color, categories, product_url, image_url, additional_image_1, additional_image_2, additional_image_3, weight)","Wählen Sie die Datenfelder aus, die Sie ChannelPilot bereitstellen möchten. Einige Datenfelder sind immer im Produktkatalog enthalten. (Entity_Id, Sku, name, description, price, manufacturer, color, categories, product_url, image_url, additional_image_1, additional_image_2, additional_image_3, weight)"
11
+ "Create static data fields","Statische Datenfelder erstellen"
12
+ "Data field name","Datenfeld Name"
13
+ "Data field value","Datenfeld Wert"
14
+ "Set up additional data fields. These fields have for every product the same value. E.g. for additional delivery costs.","Richten Sie zusätzliche Datenfelder ein, die für jedes Produkt einen statischen Wert haben. Z.B. für zusätzliche Versandkosten."
15