Anaraky_GDRT_1 - Version 1.0.2

Version Notes

Updates:
* fixed bug: "Attribute key contains space or non-ASCII characters" (thanks x-magneto for defining a bug);
* fixed problem on “purchase” window (thanks chris r for defining a problem);

Download this release

Release Info

Developer Vladas Tomkevicius
Extension Anaraky_GDRT_1
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Anaraky/Gdrt/Block/Script.php CHANGED
@@ -53,27 +53,32 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
53
  );
54
  }
55
  else
56
- $params = array( 'ecomm_pagetype: "cart"' );
57
 
58
  unset($cart, $items, $item, $data);
59
  break;
60
 
61
  case 'purchase':
62
- $cart = Mage::getSingleton('checkout/session')->getQuote();
63
- $items = $cart->getAllVisibleItems();
 
 
 
 
 
64
  $data = array();
65
 
66
  foreach ($items as $item)
67
  {
68
  $data[0][] = (string)$item->getSku();
69
- $data[1][] = (int)$item->getQty();
70
  }
71
 
72
  $params = array(
73
  'ecomm_prodid' => $data[0],
74
  'ecomm_pagetype' => 'purchase',
75
  'ecomm_quantity' => $data[1],
76
- 'ecomm_totalvalue' => (float)number_format($cart->getGrandTotal(), '2', '.', '')
77
  );
78
  break;
79
 
@@ -103,7 +108,7 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
103
  elseif (is_string($value))
104
  $value = '"' . $value . '"';
105
 
106
- $result[] = '\'' . $key . '\': ' . $value;
107
  }
108
 
109
  return PHP_EOL . "\t" . implode(',' . PHP_EOL . "\t", $result) . PHP_EOL;
@@ -134,10 +139,10 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
134
  $s = PHP_EOL .
135
  '<script type="text/javascript">' . PHP_EOL .
136
  '/* <![CDATA[ */' . PHP_EOL .
137
- 'var window.google_tag_params = {' . $this->paramsToJS($gcParams) . '};' . PHP_EOL .
138
  'var google_conversion_id = ' . $gcId . ';' . PHP_EOL .
139
  (!empty($gcLabel) ? 'var google_conversion_label = "' . $gcLabel . '";' . PHP_EOL : '') .
140
- 'var google_custom_params = window.google_tag_params;' . PHP_EOL .
141
  'var google_remarketing_only = true;' . PHP_EOL .
142
  '/* ]]> */' . PHP_EOL .
143
  '</script>' . PHP_EOL .
53
  );
54
  }
55
  else
56
+ $params = array( 'ecomm_pagetype' => 'siteview' );
57
 
58
  unset($cart, $items, $item, $data);
59
  break;
60
 
61
  case 'purchase':
62
+ //$cart = Mage::getSingleton('checkout/session')->getQuote();
63
+ //$items = $cart->getAllVisibleItems();
64
+
65
+ $order = Mage::getModel('sales/order')->loadByIncrementId(
66
+ Mage::getSingleton('checkout/session')
67
+ ->getLastRealOrderId());
68
+ $items = $order->getAllItems();
69
  $data = array();
70
 
71
  foreach ($items as $item)
72
  {
73
  $data[0][] = (string)$item->getSku();
74
+ $data[1][] = (int)$item->getQtyToInvoice();
75
  }
76
 
77
  $params = array(
78
  'ecomm_prodid' => $data[0],
79
  'ecomm_pagetype' => 'purchase',
80
  'ecomm_quantity' => $data[1],
81
+ 'ecomm_totalvalue' => (float)number_format($order->getGrandTotal(), '2', '.', '')
82
  );
83
  break;
84
 
108
  elseif (is_string($value))
109
  $value = '"' . $value . '"';
110
 
111
+ $result[] = $key . ': ' . $value;
112
  }
113
 
114
  return PHP_EOL . "\t" . implode(',' . PHP_EOL . "\t", $result) . PHP_EOL;
139
  $s = PHP_EOL .
140
  '<script type="text/javascript">' . PHP_EOL .
141
  '/* <![CDATA[ */' . PHP_EOL .
142
+ 'var google_tag_params = {' . $this->paramsToJS($gcParams) . '};' . PHP_EOL .
143
  'var google_conversion_id = ' . $gcId . ';' . PHP_EOL .
144
  (!empty($gcLabel) ? 'var google_conversion_label = "' . $gcLabel . '";' . PHP_EOL : '') .
145
+ 'var google_custom_params = google_tag_params;' . PHP_EOL .
146
  'var google_remarketing_only = true;' . PHP_EOL .
147
  '/* ]]> */' . PHP_EOL .
148
  '</script>' . PHP_EOL .
app/code/community/Anaraky/Gdrt/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Anaraky_Gdrt>
5
- <version>1.0.1</version>
6
  </Anaraky_Gdrt>
7
  </modules>
8
 
@@ -35,7 +35,7 @@
35
  <category>catalog/category/view</category>
36
  <product>catalog/product/view</product>
37
  <cart>checkout/cart/index</cart>
38
- <purchase>checkout/onepage/index</purchase>
39
  </pages>
40
  </gdrt>
41
  </default>
2
  <config>
3
  <modules>
4
  <Anaraky_Gdrt>
5
+ <version>1.0.2</version>
6
  </Anaraky_Gdrt>
7
  </modules>
8
 
35
  <category>catalog/category/view</category>
36
  <product>catalog/product/view</product>
37
  <cart>checkout/cart/index</cart>
38
+ <purchase>checkout/onepage/success</purchase>
39
  </pages>
40
  </gdrt>
41
  </default>
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Anaraky_GDRT_1</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Google Dynamic Remarketing Tag extension for Magento</summary>
10
  <description>With this extension is simply and easy to integrate the Google Dynamic Remarketing Tag into Magento.</description>
11
- <notes>First stable release</notes>
 
 
12
  <authors><author><name>Vladas Tomkevicius</name><user>Neodan</user><email>neodann@gmail.com</email></author></authors>
13
- <date>2013-08-05</date>
14
- <time>19:03:41</time>
15
- <contents><target name="magecommunity"><dir name="Anaraky"><dir name="Gdrt"><dir name="Block"><file name="Script.php" hash="0433df3dd69f65c2543b875d60afd84f"/></dir><dir name="Helper"><file name="Data.php" hash="e1dfad9d739c7c3bc6094abae0af01e7"/></dir><dir name="Model"><file name="Observer.php" hash="36f4dfb4171c670b867d881bde03305d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="03a29217c242534e2f13fe79e5fb43c7"/><file name="config.xml" hash="e2d6b41fe02bbbc88988c88118bab75b"/><file name="system.xml" hash="acdf972eba3a3c42edb738158954779e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Anaraky_Gdrt.xml" hash="43fa98d76721559c9ca20636dcb6af61"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.1.0</min><max>1.7</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Anaraky_GDRT_1</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Google Dynamic Remarketing Tag extension for Magento</summary>
10
  <description>With this extension is simply and easy to integrate the Google Dynamic Remarketing Tag into Magento.</description>
11
+ <notes>Updates:&#xD;
12
+ * fixed bug: "Attribute key contains space or non-ASCII characters" (thanks x-magneto for defining a bug);&#xD;
13
+ * fixed problem on &#x201C;purchase&#x201D; window (thanks chris r for defining a problem);</notes>
14
  <authors><author><name>Vladas Tomkevicius</name><user>Neodan</user><email>neodann@gmail.com</email></author></authors>
15
+ <date>2013-08-21</date>
16
+ <time>20:07:01</time>
17
+ <contents><target name="magecommunity"><dir name="Anaraky"><dir name="Gdrt"><dir name="Block"><file name="Script.php" hash="48fc20cc30af448bb90a29fb61f6f91c"/></dir><dir name="Helper"><file name="Data.php" hash="e1dfad9d739c7c3bc6094abae0af01e7"/></dir><dir name="Model"><file name="Observer.php" hash="36f4dfb4171c670b867d881bde03305d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="03a29217c242534e2f13fe79e5fb43c7"/><file name="config.xml" hash="8bac280f49b474b1049a9e1bf7d8c87b"/><file name="system.xml" hash="acdf972eba3a3c42edb738158954779e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Anaraky_Gdrt.xml" hash="43fa98d76721559c9ca20636dcb6af61"/></dir></target></contents>
18
  <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.1.0</min><max>1.7.0.2</max></package></required></dependencies>
20
  </package>