LUKA_GoogleAdWords - Version 1.0.0

Version Notes

# Version 1.0

**Important**:
The system configuration for this module has changed to support multiple conversions!
You have to re-configure your conversion tracking IDs.

* Added support for multiple conversions
* Moved tracking code to `before_body_end` block.
* Moved design components to base package
* Dropped 1.3 and 1.4 support

Download this release

Release Info

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


Code changes from version 0.1.2 to 1.0.0

app/code/community/LUKA/GoogleAdWords/Block/Adminhtml/Config/Conversion/Select.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE:
4
+ * This file is part of LUKA_GoogleAdWords.
5
+ *
6
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ *
20
+ * @category views
21
+ * @package LUKA_GoogleAdWords
22
+ * @copyright Copyright (c) 2011 LUKA netconsult GmbH (www.luka.de)
23
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
24
+ * @version $Id$
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @author Axel Helmert <ah@luka.de>
31
+ */
32
+ class LUKA_GoogleAdWords_Block_Adminhtml_Config_Conversion_Select
33
+ extends Mage_Core_Block_Abstract
34
+ {
35
+ /**
36
+ * Returns option values
37
+ *
38
+ * @return array
39
+ */
40
+ public function getOptions()
41
+ {
42
+ $column = $this->getColumn();
43
+ $options = array();
44
+
45
+ if (is_array($column) && isset($column['options']) && is_array($column['options'])) {
46
+ $options = $column['options'];
47
+ }
48
+
49
+ return $options;
50
+ }
51
+
52
+ /**
53
+ * (non-PHPdoc)
54
+ * @see Mage_Core_Block_Abstract::_toHtml()
55
+ */
56
+ protected function _toHtml()
57
+ {
58
+ $column = $this->getColumn();
59
+ $html = '<select name="' . $this->getInputName() . '"'
60
+ . (isset($column['class']) ? ' class="' . $column['class'] . '"' : '') . '>';
61
+
62
+ foreach ($this->getOptions() as $option) {
63
+ $html .= '<option value="' . $this->htmlEscape($option['value']) . '">'
64
+ . $this->htmlEscape($option['label'])
65
+ . '</option>';
66
+ }
67
+
68
+ $html .= '</select>';
69
+
70
+ return $html;
71
+ }
72
+ }
app/code/community/LUKA/GoogleAdWords/Block/Adminhtml/Config/Conversions.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE:
4
+ * This file is part of LUKA_GoogleAdWords.
5
+ *
6
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ *
20
+ * @category blocks
21
+ * @package LUKA_GoogleAdWords
22
+ * @copyright Copyright (c) 2011 LUKA netconsult GmbH (www.luka.de)
23
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
24
+ * @version $Id$
25
+ */
26
+
27
+ /**
28
+ * Conversions config
29
+ *
30
+ * @author Axel Helmert <ah@luka.de>
31
+ */
32
+ class LUKA_GoogleAdWords_Block_Adminhtml_Config_Conversions
33
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
34
+ {
35
+ /**
36
+ * (non-PHPdoc)
37
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::__construct()
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setTemplate('luka/google/adwords/config/conversions.phtml');
43
+
44
+ }
45
+
46
+ /**
47
+ * (non-PHPdoc)
48
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::_prepareToRender()
49
+ */
50
+ protected function _prepareToRender()
51
+ {
52
+ $this->addColumn('action', array(
53
+ 'label' => $this->__('Page'),
54
+ 'size' => 28,
55
+ 'renderer' => $this->getLayout()->createBlock('luka_googleaw/adminhtml_config_conversion_select'),
56
+ 'options' => array(
57
+ array('value' => 'checkout_onepage_success', 'label' => $this->__('Onepage Checkout Success')),
58
+ array('value' => 'paypal_standard_success', 'label' => $this->__('PayPal Standard Checkout Success')),
59
+ array('value' => 'CUSTOM', 'label' => $this->__('Use Custom Action Name'))
60
+ )
61
+ ));
62
+
63
+ $this->addColumn('custom_action', array(
64
+ 'label' => $this->__('Custom Action'),
65
+ 'size' => 28
66
+ ));
67
+
68
+ $this->addColumn('code', array(
69
+ 'label' => $this->__('ID'),
70
+ 'size' => 28
71
+ ));
72
+
73
+ $this->addColumn('label', array(
74
+ 'label' => $this->__('Label'),
75
+ 'size' => 28
76
+ ));
77
+
78
+ $this->addColumn('format', array(
79
+ 'label' => $this->__('Format'),
80
+ 'size' => 16
81
+ ));
82
+
83
+ $this->addColumn('color', array(
84
+ 'label' => $this->__('Color'),
85
+ 'size' => 16
86
+ ));
87
+
88
+ $this->addColumn('format', array(
89
+ 'label' => $this->__('Notification Format'),
90
+ 'size' => 16,
91
+ 'renderer' => $this->getLayout()->createBlock('luka_googleaw/adminhtml_config_conversion_select'),
92
+ 'options' => Mage::getModel('luka_googleaw/config_source_format')->toOptionArray(true)
93
+ ));
94
+
95
+ $this->addColumn('use_value', array(
96
+ 'label' => $this->__('Submit Order Value'),
97
+ 'size' => 16,
98
+ 'renderer' => $this->getLayout()->createBlock('luka_googleaw/adminhtml_config_conversion_select'),
99
+ 'options' => array(
100
+ array('value' => 1, 'label' => $this->helper('adminhtml')->__('Yes')),
101
+ array('value' => 0, 'label' => $this->helper('adminhtml')->__('No'))
102
+ )
103
+ ));
104
+ }
105
+
106
+ /**
107
+ * (non-PHPdoc)
108
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::addColumn()
109
+ */
110
+ public function addColumn($name, $params)
111
+ {
112
+ parent::addColumn($name, $params);
113
+
114
+ if (isset($params['options']) && is_array($params['options'])) {
115
+ $this->_columns[$name]['options'] = $params['options'];
116
+ }
117
+ }
118
+ }
app/code/community/LUKA/GoogleAdWords/Block/Conversion.php CHANGED
@@ -23,7 +23,7 @@
23
  * @package LUKA_GoogleAdWords
24
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
25
  * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
26
- * @version $Id: Conversion.php 2637 2009-08-31 14:02:28Z helmert $
27
  */
28
 
29
  /**
@@ -31,21 +31,57 @@
31
  *
32
  * @author Axel Helmert <ah@luka.de>
33
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
34
- * @version $Id: Conversion.php 2637 2009-08-31 14:02:28Z helmert $
35
  * @package LUKA_GoogleAdWords
36
  */
37
- class LUKA_GoogleAdWords_Block_Conversion
38
- extends Mage_Core_Block_Template
39
  {
40
  /**
41
- * Block constructor
 
 
 
 
 
 
 
42
  *
 
 
 
 
 
 
43
  */
44
  protected function _construct()
45
  {
46
  parent::_construct();
47
-
48
  $this->setTemplate('luka/google/adwords/conversion.phtml');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
  /**
@@ -56,11 +92,75 @@ extends Mage_Core_Block_Template
56
  public function isEnabled()
57
  {
58
  $enabled = Mage::getStoreConfigFlag('google/adwords_conversion/enable');
59
- $enabled = ($enabled && ($this->getOrder() !== null));
60
-
61
  return $enabled;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Returns the conversion id
66
  *
@@ -68,12 +168,13 @@ extends Mage_Core_Block_Template
68
  */
69
  public function getConversionId()
70
  {
71
- if (!$this->hasConversionId()) {
72
- $conversionId = (int)Mage::getStoreConfig('google/adwords_conversion/conversion_id');
73
- $this->setConversionId($conversionId);
74
- }
 
75
 
76
- return $this->getData('conversion_id');
77
  }
78
 
79
  /**
@@ -98,12 +199,13 @@ extends Mage_Core_Block_Template
98
  */
99
  public function getConversionLabel()
100
  {
101
- if (!$this->hasConversionLabel()) {
102
- $label = (string)Mage::getStoreConfig('google/adwords_conversion/label');
103
- $this->setConversionLabel($label);
104
- }
 
105
 
106
- return $this->getData('conversion_label');
107
  }
108
 
109
  /**
@@ -113,12 +215,17 @@ extends Mage_Core_Block_Template
113
  */
114
  public function getConversionColor()
115
  {
116
- if (!$this->hasConversionColor()) {
117
- $color = (string)Mage::getStoreConfig('google/adwords_conversion/color');
118
- $this->setConversionColor($color);
 
 
 
 
 
119
  }
120
 
121
- return $this->getData('conversion_color');
122
  }
123
 
124
  /**
@@ -146,7 +253,7 @@ extends Mage_Core_Block_Template
146
  $this->setOrder($order);
147
  }
148
 
149
- return $this->getData('order');
150
  }
151
 
152
  /**
@@ -156,9 +263,12 @@ extends Mage_Core_Block_Template
156
  */
157
  public function getConversionValue()
158
  {
159
- if (!$this->hasConversionValue()) {
160
- $total = $this->getOrder()->getSubtotal();
 
161
 
 
 
162
  $this->setConversionValue($total);
163
  }
164
 
@@ -181,6 +291,23 @@ extends Mage_Core_Block_Template
181
  return $url;
182
  }
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  /**
185
  * Returns the non JS fallback url
186
  *
@@ -195,10 +322,17 @@ extends Mage_Core_Block_Template
195
  }
196
 
197
  $url .= '://www.googleadservices.com/pagead/conversion/'
198
- . $this->getConversionId() . '/?value='
199
- . $this->getConversionValue()
200
- . '&label=' . $this->getConversionLabel() . '&guid=ON&script=0';
201
 
202
- return $url;
 
 
 
 
 
 
 
 
 
203
  }
204
  }
23
  * @package LUKA_GoogleAdWords
24
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
25
  * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
26
+ * @version $Id: Conversion.php 9866 2011-11-28 12:10:26Z helmert $
27
  */
28
 
29
  /**
31
  *
32
  * @author Axel Helmert <ah@luka.de>
33
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
34
+ * @version $Id: Conversion.php 9866 2011-11-28 12:10:26Z helmert $
35
  * @package LUKA_GoogleAdWords
36
  */
37
+ class LUKA_GoogleAdWords_Block_Conversion extends Mage_Core_Block_Template
 
38
  {
39
  /**
40
+ * Current conversion model
41
+ *
42
+ * @var LUKA_GoogleAdWords_Model_Conversion
43
+ */
44
+ private $_currentConversion = null;
45
+
46
+ /**
47
+ * Collection containing current conversions
48
  *
49
+ * @var LUKA_GoogleAdWords_Model_Conversion_Collection
50
+ */
51
+ private $_conversionCollection = null;
52
+
53
+ /**
54
+ * Block constructor
55
  */
56
  protected function _construct()
57
  {
58
  parent::_construct();
 
59
  $this->setTemplate('luka/google/adwords/conversion.phtml');
60
+
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * Init current conversion
66
+ */
67
+ protected function _initCurrentConversion()
68
+ {
69
+ $action = $this->getAction();
70
+ $conversion = $this->getConversionCollection()->getItemByAction($action);
71
+ $this->setCurrentConversion($conversion);
72
+
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Init conversion collection
78
+ */
79
+ protected function _initConversionCollection()
80
+ {
81
+ $collection = Mage::getModel('luka_googleaw/conversion_collection');
82
+ $this->setConversionCollection($collection);
83
+
84
+ return $this;
85
  }
86
 
87
  /**
92
  public function isEnabled()
93
  {
94
  $enabled = Mage::getStoreConfigFlag('google/adwords_conversion/enable');
 
 
95
  return $enabled;
96
  }
97
 
98
+ /**
99
+ * Check if this conversion is active
100
+ *
101
+ * @return bool
102
+ */
103
+ public function isActive()
104
+ {
105
+ $result = $this->isEnabled() && $this->getCurrentConversion();
106
+ return $result;
107
+ }
108
+
109
+ /**
110
+ * Returns Possible tracking data
111
+ *
112
+ * @return LUKA_GoogleAdWords_Model_Conversion_Collection
113
+ */
114
+ public function getConversionCollection()
115
+ {
116
+ if ($this->_conversionCollection === null) {
117
+ $this->_initConversionCollection();
118
+ }
119
+
120
+ return $this->_conversionCollection;
121
+ }
122
+
123
+ /**
124
+ * set current conversion collection
125
+ *
126
+ * @param LUKA_GoogleAdWords_Model_Conversion_Collection $collection
127
+ */
128
+ public function setConversionCollection(LUKA_GoogleAdWords_Model_Conversion_Collection $collection)
129
+ {
130
+ $this->_conversionCollection = $collection;
131
+ return $this;
132
+ }
133
+
134
+ /**
135
+ * Set current conversion
136
+ *
137
+ * @param LUKA_GoogleAdWords_Model_Conversion $conversion
138
+ */
139
+ public function setCurrentConversion($conversion = null)
140
+ {
141
+ if (($conversion !== null) && (!$conversion instanceof LUKA_GoogleAdWords_Model_Conversion)) {
142
+ $conversion = false;
143
+ }
144
+
145
+ $this->_currentConversion = $conversion;
146
+ return $this;
147
+ }
148
+
149
+ /**
150
+ * Current conversion
151
+ *
152
+ * @return LUKA_GoogleAdWords_Model_Conversion|false
153
+ */
154
+ public function getCurrentConversion()
155
+ {
156
+ if ($this->_currentConversion === null) {
157
+ $this->_initCurrentConversion();
158
+ }
159
+
160
+ return $this->_currentConversion;
161
+ }
162
+
163
+
164
  /**
165
  * Returns the conversion id
166
  *
168
  */
169
  public function getConversionId()
170
  {
171
+ return $this->getCurrentConversion()->getCode();
172
+ // if (!$this->hasConversionId()) {
173
+ // $conversionId = (int)Mage::getStoreConfig('google/adwords_conversion/conversion_id');
174
+ // $this->setConversionId($conversionId);
175
+ // }
176
 
177
+ // return $this->getData('conversion_id');
178
  }
179
 
180
  /**
199
  */
200
  public function getConversionLabel()
201
  {
202
+ return $this->getCurrentConversion()->getLabel();
203
+ // if (!$this->hasConversionLabel()) {
204
+ // $label = (string)Mage::getStoreConfig('google/adwords_conversion/label');
205
+ // $this->setConversionLabel($label);
206
+ // }
207
 
208
+ // return $this->getData('conversion_label');
209
  }
210
 
211
  /**
215
  */
216
  public function getConversionColor()
217
  {
218
+ $color = $this->getCurrentConversion()->getColor();
219
+ if (!$color) {
220
+ if (!$this->hasConversionColor()) {
221
+ $color = (string)Mage::getStoreConfig('google/adwords_conversion/color');
222
+ $this->setConversionColor($color);
223
+ }
224
+
225
+ $color = $this->getData('conversion_color');
226
  }
227
 
228
+ return $color;
229
  }
230
 
231
  /**
253
  $this->setOrder($order);
254
  }
255
 
256
+ return $this->_getData('order');
257
  }
258
 
259
  /**
263
  */
264
  public function getConversionValue()
265
  {
266
+ if (!$this->getCurrentConversion()->isUsingValue()) {
267
+ return false;
268
+ }
269
 
270
+ if (!$this->hasConversionValue() && $this->getOrder()) {
271
+ $total = $this->getOrder()->getSubtotal();
272
  $this->setConversionValue($total);
273
  }
274
 
291
  return $url;
292
  }
293
 
294
+ /**
295
+ * @return int
296
+ */
297
+ public function getConversionFormat()
298
+ {
299
+ $format = (int)$this->getCurrentConversion()->getFormat();
300
+ if ($format < 1 || $format > 3) {
301
+ $format = (int)Mage::getStoreConfig('google/adwords_conversion/format');
302
+
303
+ if ($format < 1 || $format > 3) {
304
+ $format = 3;
305
+ }
306
+ }
307
+
308
+ return $format;
309
+ }
310
+
311
  /**
312
  * Returns the non JS fallback url
313
  *
322
  }
323
 
324
  $url .= '://www.googleadservices.com/pagead/conversion/'
325
+ . $this->getConversionId() . '/';
 
 
326
 
327
+ $query = array('label' => $this->getConversionLabel());
328
+ if ($this->getConversionValue()) {
329
+ $query['value'] = $this->getConversionValue();
330
+ }
331
+
332
+ /* @var $uri Zend_Uri_Http */
333
+ $uri = Zend_Uri::factory($url);
334
+ $uri->setQuery($query);
335
+
336
+ return $uri->getUri();
337
  }
338
  }
app/code/community/LUKA/GoogleAdWords/Helper/Data.php CHANGED
@@ -23,7 +23,7 @@
23
  * @package LUKA_GoogleAdWords
24
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
25
  * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
26
- * @version $Id: Data.php 2505 2009-08-13 16:26:22Z helmert $
27
  */
28
 
29
  /**
@@ -31,7 +31,7 @@
31
  *
32
  * @author Axel Helmert <ah@luka.de>
33
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
34
- * @version $Id: Data.php 2505 2009-08-13 16:26:22Z helmert $
35
  * @package LUKA_GoogleAdWords
36
  */
37
  class LUKA_GoogleAdWords_Helper_Data extends Mage_Core_Helper_Data
23
  * @package LUKA_GoogleAdWords
24
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
25
  * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
26
+ * @version $Id: Data.php 5049 2010-09-29 15:06:32Z helmert $
27
  */
28
 
29
  /**
31
  *
32
  * @author Axel Helmert <ah@luka.de>
33
  * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
34
+ * @version $Id: Data.php 5049 2010-09-29 15:06:32Z helmert $
35
  * @package LUKA_GoogleAdWords
36
  */
37
  class LUKA_GoogleAdWords_Helper_Data extends Mage_Core_Helper_Data
app/code/community/LUKA/GoogleAdWords/Model/Config/Source/Format.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE: $license_text$
4
+ *
5
+ * @author Axel Helmert <ah@luka.de>
6
+ * @copyright Copyright (c) 2012 LUKA netconsult GmbH (www.luka.de)
7
+ * @license $license$
8
+ * @version $Id$
9
+ */
10
+
11
+ /**
12
+ * Conversion notification format source model
13
+ */
14
+ class LUKA_GoogleAdWords_Model_Config_Source_Format
15
+ {
16
+ /**
17
+ * Options getter
18
+ *
19
+ * @return array
20
+ */
21
+ public function toOptionArray($addEmptyOption = false)
22
+ {
23
+ $helper = Mage::helper('luka_googleaw');
24
+ $options = array(
25
+ array('value' => 1, 'label'=> $helper->__('One-line notification')),
26
+ array('value' => 2, 'label'=> $helper->__('Two-line notification')),
27
+ array('value' => 3, 'label'=> $helper->__('No notification'))
28
+ );
29
+
30
+ if ($addEmptyOption) {
31
+ array_unshift($options, array('value' => '', 'label' => $helper->__('Use default')));
32
+ }
33
+
34
+ return $options;
35
+ }
36
+
37
+ /**
38
+ * Get options in "key-value" format
39
+ *
40
+ * @return array
41
+ */
42
+ public function toArray()
43
+ {
44
+ $options = array();
45
+ foreach ($this->toOptionArray() as $item) {
46
+ $options[$item['value']] = $item['label'];
47
+ }
48
+
49
+ return $options;
50
+ }
51
+ }
app/code/community/LUKA/GoogleAdWords/Model/Conversion.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE:
4
+ * This file is part of LUKA_GoogleAdWords.
5
+ *
6
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ *
20
+ * @category
21
+ * @package
22
+ * @copyright Copyright (c) 2011 LUKA netconsult GmbH (www.luka.de)
23
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
24
+ * @version $Id$
25
+ */
26
+
27
+ /**
28
+ * Conversion config model
29
+ *
30
+ * @author Axel Helmert <ah@luka.de>
31
+ */
32
+ class LUKA_GoogleAdWords_Model_Conversion extends Varien_Object
33
+ {
34
+ /**
35
+ * Match conversion to controller object
36
+ *
37
+ * @param Mage_Core_Controller_Varien_Action $action
38
+ */
39
+ public function match(Mage_Core_Controller_Varien_Action $action)
40
+ {
41
+ $actionName = $action->getFullActionName();
42
+ $match = ($this->getAction() == $actionName);
43
+
44
+ $this->setIsMatching($match);
45
+ Mage::dispatchEvent('luka_googleaw_match_controller', array(
46
+ 'action' => $action,
47
+ 'conversion' => $this
48
+ ));
49
+
50
+ return (bool)$this->getIsMatching();
51
+ }
52
+
53
+ /**
54
+ * Returns the current action
55
+ *
56
+ * @return string
57
+ */
58
+ public function getAction()
59
+ {
60
+ $action = $this->_getData('action');
61
+ if ($action == 'CUSTOM') {
62
+ $action = $this->getCustomAction();
63
+ }
64
+
65
+ return $action;
66
+ }
67
+
68
+ /**
69
+ * Check if value is used
70
+ *
71
+ * @return bool
72
+ */
73
+ public function isUsingValue()
74
+ {
75
+ $flag = (bool)$this->_getData('use_value');
76
+ return $flag;
77
+ }
78
+
79
+ /**
80
+ * Current conversion code
81
+ *
82
+ * @return string
83
+ */
84
+ public function getCode()
85
+ {
86
+ return $this->_getData('code');
87
+ }
88
+
89
+ /**
90
+ * Conversion label
91
+ *
92
+ * @return string
93
+ */
94
+ public function getLabel()
95
+ {
96
+ return $this->_getData('label');
97
+ }
98
+
99
+ /**
100
+ * Current color code
101
+ *
102
+ * @return string|null
103
+ */
104
+ public function getColor()
105
+ {
106
+ return $this->_getData('color');
107
+ }
108
+
109
+ /**
110
+ * @return int|null
111
+ */
112
+ public function getFormat()
113
+ {
114
+ return $this->_getData('format');
115
+ }
116
+ }
app/code/community/LUKA/GoogleAdWords/Model/Conversion/Collection.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE:
4
+ * This file is part of LUKA_GoogleAdWords.
5
+ *
6
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ *
20
+ * @category models
21
+ * @package LUKA_GoogleAdWords
22
+ * @copyright Copyright (c) 2011 LUKA netconsult GmbH (www.luka.de)
23
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
24
+ * @version $Id$
25
+ */
26
+
27
+ /**
28
+ * Collection containing configured conversions
29
+ *
30
+ * @author Axel Helmert <ah@luka.de>
31
+ */
32
+ class LUKA_GoogleAdWords_Model_Conversion_Collection
33
+ extends Varien_Data_Collection
34
+ {
35
+ /**
36
+ * Create item
37
+ *
38
+ * @param array $itemData
39
+ * @return LUKA_GoogleAdWords_Model_Conversion
40
+ */
41
+ public function createItem($itemData)
42
+ {
43
+ if (!is_array($itemData)) {
44
+ return false;
45
+ }
46
+
47
+ $item = Mage::getModel('luka_googleaw/conversion');
48
+ $item->setData($itemData);
49
+
50
+ return $item;
51
+ }
52
+
53
+ /**
54
+ * (non-PHPdoc)
55
+ * @see Varien_Data_Collection::loadData()
56
+ */
57
+ public function loadData($printQuery = false, $logQuery = false)
58
+ {
59
+ if ($this->isLoaded()) {
60
+ return $this;
61
+ }
62
+
63
+ $data = Mage::getStoreConfig('google/adwords_conversion/conversions');
64
+ if ($data && !is_array($data)) {
65
+ $data = @unserialize($data);
66
+
67
+ if (!is_array($data)) {
68
+ $data = false;
69
+ }
70
+ }
71
+
72
+ if (!$data) {
73
+ $this->_setIsLoaded(true);
74
+ return $this;
75
+ }
76
+
77
+ foreach ($data as $itemData) {
78
+ $item = $this->createItem($itemData);
79
+
80
+ if ($item) {
81
+ $this->addItem($item);
82
+ }
83
+ }
84
+
85
+ return $this;
86
+ }
87
+
88
+ /**
89
+ * Find item by action name
90
+ *
91
+ * @param Mage_Core_Controller_Varien_Action $action
92
+ * @return LUKA_GoogleAdWords_Model_Conversion|false
93
+ */
94
+ public function getItemByAction(Mage_Core_Controller_Varien_Action $action)
95
+ {
96
+ foreach ($this as $item) {
97
+ if (!$item->match($action)) {
98
+ continue;
99
+ }
100
+
101
+ return $item;
102
+ }
103
+
104
+ return false;
105
+ }
106
+ }
app/code/community/LUKA/GoogleAdWords/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <LUKA_GoogleAdWords>
5
- <version>0.1.2</version>
6
  </LUKA_GoogleAdWords>
7
  </modules>
8
 
@@ -18,6 +18,12 @@
18
  <class>LUKA_GoogleAdWords_Block</class>
19
  </luka_googleaw>
20
  </blocks>
 
 
 
 
 
 
21
  </global>
22
 
23
  <frontend>
@@ -45,6 +51,8 @@
45
  <adwords_conversion>
46
  <enable>0</enable>
47
  <color>ffffff</color>
 
 
48
  </adwords_conversion>
49
  </google>
50
  </default>
2
  <config>
3
  <modules>
4
  <LUKA_GoogleAdWords>
5
+ <version>1.0.0</version>
6
  </LUKA_GoogleAdWords>
7
  </modules>
8
 
18
  <class>LUKA_GoogleAdWords_Block</class>
19
  </luka_googleaw>
20
  </blocks>
21
+
22
+ <models>
23
+ <luka_googleaw>
24
+ <class>LUKA_GoogleAdWords_Model</class>
25
+ </luka_googleaw>
26
+ </models>
27
  </global>
28
 
29
  <frontend>
51
  <adwords_conversion>
52
  <enable>0</enable>
53
  <color>ffffff</color>
54
+ <locale>en_US</locale>
55
+ <format>3</format>
56
  </adwords_conversion>
57
  </google>
58
  </default>
app/code/community/LUKA/GoogleAdWords/etc/system.xml CHANGED
@@ -21,6 +21,20 @@
21
  <show_in_store>1</show_in_store>
22
  </enable>
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  <conversion_id translate="label">
25
  <label>Conversion ID</label>
26
  <frontend_type>text</frontend_type>
@@ -48,16 +62,38 @@
48
  <show_in_website>1</show_in_website>
49
  <show_in_store>1</show_in_store>
50
  </label>
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  <color translate="label,comment">
53
  <label>Background Color</label>
54
- <comment>Background color in CSS notation without # i.e. "ffffff".</comment>
55
  <frontend_type>text</frontend_type>
56
  <sort_order>50</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
  </color>
 
 
 
 
 
 
 
 
 
 
61
  </fields>
62
  </adwords_conversion>
63
  </groups>
21
  <show_in_store>1</show_in_store>
22
  </enable>
23
 
24
+ <conversions translate="label comment">
25
+ <label>Conversions</label>
26
+ <comment>Select "Custom Action" to define a custom layout handle in the "Custom Action" field.</comment>
27
+
28
+ <frontend_model>luka_googleaw/adminhtml_config_conversions</frontend_model>
29
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
30
+
31
+ <sort_order>20</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </conversions>
36
+
37
+ <!--
38
  <conversion_id translate="label">
39
  <label>Conversion ID</label>
40
  <frontend_type>text</frontend_type>
62
  <show_in_website>1</show_in_website>
63
  <show_in_store>1</show_in_store>
64
  </label>
65
+ -->
66
+
67
+ <format translate="label,comment">
68
+ <label>Notification Format</label>
69
+ <comment>Define the notification format.</comment>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>luka_googleaw/config_source_format</source_model>
72
+ <sort_order>50</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </format>
77
 
78
  <color translate="label,comment">
79
  <label>Background Color</label>
80
+ <comment>Default background color in CSS notation without # i.e. "ffffff".</comment>
81
  <frontend_type>text</frontend_type>
82
  <sort_order>50</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
  </color>
87
+
88
+ <locale translate="label">
89
+ <label>Conversion Language</label>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>adminhtml/system_config_source_locale</source_model>
92
+ <sort_order>30</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </locale>
97
  </fields>
98
  </adwords_conversion>
99
  </groups>
app/design/adminhtml/default/default/template/luka/google/adwords/config/conversions.phtml ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE:
4
+ * This file is part of LUKA_GoogleAdWords.
5
+ *
6
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ *
20
+ * @category
21
+ * @package
22
+ * @copyright Copyright (c) 2011 LUKA netconsult GmbH (www.luka.de)
23
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
24
+ * @version $Id$
25
+ */
26
+
27
+ /* @var $this LUKA_GoogleAdWords_Block_Adminhtml_Config_Conversions */
28
+
29
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
30
+
31
+ $_colspan = 2;
32
+ if (!$this->_addAfter) {
33
+ $_colspan -= 1;
34
+ }
35
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
36
+ ?>
37
+
38
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
39
+ <table cellpadding="0" cellspacing="0" class="border">
40
+ <tbody>
41
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
42
+ <th><?php echo $this->__('Conversion') ?></th>
43
+ <th <?php echo $_colspan?>></th>
44
+ </tr>
45
+
46
+ <tr id="addRow<?php echo $_htmlId ?>">
47
+ <td></td>
48
+ <td <?php echo $_colspan?>>
49
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
50
+ <span><?php echo $this->_addButtonLabel ?></span>
51
+ </button>
52
+ </td>
53
+ </tr>
54
+ </tbody>
55
+ </table>
56
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
57
+ </div>
58
+
59
+ <div id="empty<?php echo $_htmlId ?>">
60
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
61
+ <span><?php echo $this->_addButtonLabel ?></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}"><td><table class="form-list">'
72
+ <?php foreach ($this->_columns as $columnName => $column):?>
73
+ +'<tr>'
74
+ + '<td class="label"><?php echo $column['label'] ?><\/td>'
75
+ + '<td class="value"><?php echo $this->_renderCellTemplate($columnName)?><\/td>'
76
+ +'<\/tr>'
77
+ <?php endforeach;?>
78
+ + '<\/table><\/td>'
79
+ <?php if ($this->_addAfter):?>
80
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/button><\/td>'
81
+ <?php endif;?>
82
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/button><\/td>'
83
+ +'<\/tr>'
84
+ ),
85
+
86
+ rowsCount : 0,
87
+
88
+ add : function(templateData, insertAfterId)
89
+ {
90
+ // generate default template data
91
+ if ('' == templateData) {
92
+ var d = new Date();
93
+ var templateData = {
94
+ <?php foreach ($this->_columns as $columnName => $column):?>
95
+ <?php echo $columnName ?> : '',
96
+ <?php endforeach;?>
97
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
98
+ };
99
+ }
100
+
101
+ // insert before last row
102
+ if ('' == insertAfterId) {
103
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
104
+ }
105
+
106
+ // insert after specified row
107
+ else {
108
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
109
+ }
110
+
111
+ <?php if ($this->_addAfter):?>
112
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
113
+ <?php endif;?>
114
+
115
+ this.initSelectValues(templateData);
116
+ this.rowsCount += 1;
117
+ },
118
+
119
+ initSelectValues: function(templateData)
120
+ {
121
+ var el = $(templateData._id);
122
+ if (!el) {
123
+ return;
124
+ }
125
+
126
+ el.select('select').each(function(sel) {
127
+ var m = sel.name.match(/\[([^\[\]]+)\]$/i);
128
+ var key = (m)? m[1] : false;
129
+
130
+ if (!key || !templateData[key]) {
131
+ return;
132
+ }
133
+
134
+ Form.Element.setValue(sel, templateData[key]);
135
+ });
136
+ },
137
+
138
+ del : function(rowId)
139
+ {
140
+ $(rowId).remove();
141
+ this.rowsCount -= 1;
142
+ if (0 == this.rowsCount) {
143
+ this.showButtonOnly();
144
+ }
145
+ },
146
+
147
+ showButtonOnly : function()
148
+ {
149
+ $('grid<?php echo $_htmlId ?>').hide();
150
+ $('empty<?php echo $_htmlId ?>').show();
151
+ }
152
+ };
153
+
154
+ // bind add action to "Add" button in last row
155
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
156
+
157
+ // add existing rows
158
+ <?php
159
+ $_addAfterId = "headings{$_htmlId}";
160
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
161
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
162
+ $_addAfterId = $_rowId;
163
+ }
164
+ ?>
165
+
166
+ // initialize standalone button
167
+ $('empty<?php echo $_htmlId ?>').hide();
168
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
169
+ $('grid<?php echo $_htmlId ?>').show();
170
+ $('empty<?php echo $_htmlId ?>').hide();
171
+ arrayRow<?php echo $_htmlId ?>.add('', '');
172
+ });
173
+
174
+ // if no rows, hide grid and show button only
175
+ <?php if (!$this->getArrayRows()):?>
176
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
177
+ <?php endif;?>
178
+
179
+ // toggle the grid, if element is disabled (depending on scope)
180
+ <?php if ($this->getElement()->getDisabled()):?>
181
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
182
+ <?php endif;?>
183
+ //]]>
184
+ </script>
app/design/frontend/base/default/layout/luka_googleadwords.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="luka_googleaw/conversion" name="luka.google_conversion_tracking" />
6
+ </reference>
7
+ </default>
8
+ </layout>
app/design/frontend/base/default/template/luka/google/adwords/conversion.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for LUKA GoogleAdWords Conversion Tracking
4
+ *
5
+ * LICENSE:
6
+ * This file is part of LUKA_GoogleAdWords.
7
+ *
8
+ * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ *
22
+ * @see LUKA_GoogleAdWords_Block_Conversion
23
+ * @category Templates
24
+ * @package LUKA_GoogleAdWords
25
+ * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
26
+ * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
27
+ * @version $Id: conversion.phtml 9866 2011-11-28 12:10:26Z helmert $
28
+ */
29
+
30
+ /* @var $this LUKA_GoogleAdWords_Block_Conversion */
31
+ ?>
32
+ <?php if ($this->isActive()): ?>
33
+ <!-- Google Conversion Code -->
34
+ <div class="google-adwords-conversion-tracker">
35
+ <script type="text/javascript">
36
+ var google_conversion_id = <?php echo $this->getConversionId() ?>;
37
+ var google_conversion_language = '<?php echo $this->jsQuoteEscape($this->getConversionLanguage()) ?>';
38
+ var google_conversion_format = <?php echo $this->getConversionFormat() ?>;
39
+ var google_conversion_color = '<?php echo $this->jsQuoteEscape($this->getConversionColor()) ?>';
40
+ var google_conversion_label = '<?php echo $this->jsQuoteEscape($this->getConversionLabel()) ?>';
41
+
42
+ <?php $_value = (float)$this->getConversionValue() ?>
43
+ <?php if ($_value > 0): ?>
44
+ var google_conversion_value = <?php echo $_value ?>;
45
+ <?php endif ?>
46
+ </script>
47
+ <script type="text/javascript" src="<?php echo $this->getConversionScriptUrl() ?>"></script>
48
+
49
+ <noscript>
50
+ <div style="display:inline">
51
+ <img height="1" width="1" style="border-style:none" alt="" src="<?php echo $this->getFallbackUrl() ?>" />
52
+ </div>
53
+ </noscript>
54
+ </div>
55
+ <?php endif ?>
app/design/frontend/default/default/layout/luka_googleadwords.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <layout>
3
- <checkout_onepage_success>
4
- <reference name="content">
5
- <block type="luka_googleaw/conversion" name="google_conversion_tracking" />
6
- </reference>
7
- </checkout_onepage_success>
8
- </layout>
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/luka/google/adwords/conversion.phtml DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Template for LUKA GoogleAdWords Conversion Tracking
4
- *
5
- * LICENSE:
6
- * This file is part of LUKA_GoogleAdWords.
7
- *
8
- * LUKA_GoogleAdWords is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * LUKA_GoogleAdWords is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with LUKA_GoogleAdWords. If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- *
22
- * @see LUKA_GoogleAdWords_Block_Conversion
23
- * @category Templates
24
- * @package LUKA_GoogleAdWords
25
- * @copyright Copyright (c) 2009 LUKA netconsult GmbH (www.luka.de)
26
- * @license GNU General Public Licence 3 <http://www.gnu.org/licenses/gpl-3.0.txt>
27
- * @version $Id: conversion.phtml 2637 2009-08-31 14:02:28Z helmert $
28
- */
29
- ?>
30
- <!-- Google Code for Kauf Conversion Page -->
31
- <div class="google-adwords-conversion-tracker">
32
- <script type="text/javascript">
33
- var google_conversion_id = <?php echo $this->getConversionId() ?>;
34
- var google_conversion_language = '<?php echo $this->jsQuoteEscape($this->getConversionLanguage()) ?>';
35
- var google_conversion_format = "1";
36
- var google_conversion_color = '<?php echo $this->jsQuoteEscape($this->getConversionColor()) ?>';
37
- var google_conversion_label = '<?php echo $this->jsQuoteEscape($this->getConversionLabel()) ?>';
38
-
39
- <?php $_value = (double)$this->getConversionValue() ?>
40
- <?php if ($_value > 0): ?>
41
- var google_conversion_value = <?php echo $_value ?>;
42
- <?php endif ?>
43
- </script>
44
- <script type="text/javascript" src="<?php echo $this->getConversionScriptUrl() ?>"></script>
45
-
46
- <noscript>
47
- <div style="display:inline">
48
- <img height="1" width="1" style="border-style:none" alt="" src="<?php echo $this->getFallbackUrl() ?>" />
49
- </div>
50
- </noscript>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/LUKA_GoogleAdWords.xml CHANGED
@@ -2,9 +2,8 @@
2
  <config>
3
  <modules>
4
  <LUKA_GoogleAdWords>
5
- <codePool>community</codePool>
6
  <active>true</active>
 
7
  </LUKA_GoogleAdWords>
8
  </modules>
9
- </config>
10
-
2
  <config>
3
  <modules>
4
  <LUKA_GoogleAdWords>
 
5
  <active>true</active>
6
+ <codePool>community</codePool>
7
  </LUKA_GoogleAdWords>
8
  </modules>
9
+ </config>
 
app/locale/de_DE/LUKA_GoogleAdWords.csv CHANGED
@@ -2,6 +2,15 @@
2
  "Enable","Aktivieren"
3
  "Conversion ID","Conversion ID"
4
  "Conversion Language","Conversion Sprache"
5
- "Conversion Label","Conversion Label"
6
  "Background Color","Hintergrundfarbe"
7
- "Background color in CSS notation without # i.e. ""ffffff"".","Die Hintergrundfarbe in CSS notation ohne # z.B. ""ffffff""."
 
 
 
 
 
 
 
 
 
2
  "Enable","Aktivieren"
3
  "Conversion ID","Conversion ID"
4
  "Conversion Language","Conversion Sprache"
5
+ "Conversion Label","Conversion Bezeichnung"
6
  "Background Color","Hintergrundfarbe"
7
+ "Default background color in CSS notation without # i.e. ""ffffff"".","Die Standard-Hintergrundfarbe in CSS notation ohne # z.B. ""ffffff""."
8
+ "Color","Farbe"
9
+ "Page","Seite"
10
+ "Onepage Checkout Success","Onepage Checkout Bestellabschluss"
11
+ "PayPal Standard Checkout Success","PayPal Bestellabschluss"
12
+ "Use Custom Action Name","Benutzerdefiniert"
13
+ "Custom Action","Benutzerdefiniert"
14
+ "Label","Bezeichnung"
15
+ "Submit Order Value","Bestellwert Übermitteln"
16
+ "Select ""Custom Action"" to define a custom layout handle in the ""Custom Action"" field.","Wählen Sie ""Benutzerdefiniert"" um ein benutzerdefiniertes Layout-Handle im Feld ""Benutzerdefiniert"" anzugeben."
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LUKA_GoogleAdWords</name>
4
- <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GNU General Public License 3</license>
7
  <channel>community</channel>
@@ -10,11 +10,20 @@
10
  <description>This Module integrates the Google AdWords Conversion Tracking code into Magento.
11
 
12
  The code will be placed on the onepage checkout success page</description>
13
- <notes>Tested with Magento 1.3.2.2</notes>
 
 
 
 
 
 
 
 
 
14
  <authors><author><name>Axel Helmert</name><user>auto-converted</user><email>ah@luka.de</email></author></authors>
15
- <date>2009-09-03</date>
16
- <time>13:41:57</time>
17
- <contents><target name="magelocale"><dir name="de_DE"><file name="LUKA_GoogleAdWords.csv" hash="ea7dd44eb3c8dfa8d7a619b6f49340b8"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="luka_googleadwords.xml" hash="8e103378556bf6e167c02fb0fb3faefe"/></dir><dir name="template"><dir name="luka"><dir name="google"><dir name="adwords"><file name="conversion.phtml" hash="d076c1bc13ac4cfcb81e416be5ec049c"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="LUKA"><dir name="GoogleAdWords"><dir name="Block"><file name="Conversion.php" hash="48faa82265089140c7618ff8c1ccc02e"/></dir><dir name="etc"><file name="config.xml" hash="5efe30afd0ae19b7dfc37ce3d18326b9"/><file name="system.xml" hash="2931cf8a51a0370af785b74a87c97cd9"/></dir><dir name="Helper"><file name="Data.php" hash="fa7448a7d01bb7039f5da946cd32e203"/></dir><file name="LICENSE" hash="d32239bcb673463ab874e80d47fae504"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LUKA_GoogleAdWords.xml" hash="75a2042c3da36b91e1ee247a2cd4de72"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LUKA_GoogleAdWords</name>
4
+ <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GNU General Public License 3</license>
7
  <channel>community</channel>
10
  <description>This Module integrates the Google AdWords Conversion Tracking code into Magento.
11
 
12
  The code will be placed on the onepage checkout success page</description>
13
+ <notes># Version 1.0
14
+
15
+ **Important**:
16
+ The system configuration for this module has changed to support multiple conversions!
17
+ You have to re-configure your conversion tracking IDs.
18
+
19
+ * Added support for multiple conversions
20
+ * Moved tracking code to `before_body_end` block.
21
+ * Moved design components to base package
22
+ * Dropped 1.3 and 1.4 support</notes>
23
  <authors><author><name>Axel Helmert</name><user>auto-converted</user><email>ah@luka.de</email></author></authors>
24
+ <date>2013-06-21</date>
25
+ <time>23:11:48</time>
26
+ <contents><target name="magelocale"><dir name="de_DE"><file name="LUKA_GoogleAdWords.csv" hash="3e28fb20bf5ba663f8acf1281492a02b"/></dir></target><target name="magecommunity"><dir name="LUKA"><dir name="GoogleAdWords"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Conversion"><file name="Select.php" hash="77c995a751380b366305cbada5895aae"/></dir><file name="Conversions.php" hash="83bc6085413d1d06cf88db689f71f3a3"/></dir></dir><file name="Conversion.php" hash="b41e51b80c6cfc916452bdba45c0aa01"/></dir><dir name="Model"><dir name="Conversion"><file name="Collection.php" hash="b0046b139bebb9855bc04cfb6675bd8d"/></dir><dir name="Config"><dir name="Source"><file name="Format.php" hash="d737211284739439554e7452d1ee2723"/></dir></dir><file name="Conversion.php" hash="95f26dddf6d6db2368b698dd7c89cbc0"/></dir><dir name="etc"><file name="config.xml" hash="4da7905facc9d1b120f1b17cdc7963ae"/><file name="system.xml" hash="6e8d1c04b4b1d3751ed5b4d369e11a62"/></dir><dir name="Helper"><file name="Data.php" hash="7ce3036cc683dbd6c051ba5b5ca26aab"/></dir><file name="LICENSE" hash="d32239bcb673463ab874e80d47fae504"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LUKA_GoogleAdWords.xml" hash="affe6a5ded5f194c9f61788b1685ddf2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="luka"><dir name="google"><dir name="adwords"><file name="conversion.phtml" hash="99e059de53bd63f2b23da07b1cf0ffff"/></dir></dir></dir></dir><dir name="layout"><file name="luka_googleadwords.xml" hash="353e80e828d607b6fa2e7cfed226c11e"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="luka"><dir name="google"><dir name="adwords"><dir name="config"><file name="conversions.phtml" hash="5f104879ac02fc30e4742005fdeea845"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
27
  <compatible/>
28
  <dependencies/>
29
  </package>