Anaraky_GDRT_1 - Version 1.0.3

Version Notes

Update:
* Added the ability to define what to use for ecomm_prodid (Produkt ID or Product SKU).

Download this release

Release Info

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


Code changes from version 1.0.2 to 1.0.3

app/code/community/Anaraky/Gdrt/Block/Script.php CHANGED
@@ -3,6 +3,9 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
3
 
4
  private function getParams()
5
  {
 
 
 
6
  $type = $this->getData('pageType');
7
  $params = array('ecomm_pagetype' => 'siteview');
8
  switch ($type) {
@@ -26,7 +29,7 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
26
  case 'product':
27
  $product = Mage::registry('current_product');
28
  $params = array(
29
- 'ecomm_prodid' => (string)$product->getSku(),
30
  'ecomm_pagetype' => 'product',
31
  'ecomm_totalvalue' => (float)number_format($product->getFinalPrice(), '2', '.', '')
32
  );
@@ -41,7 +44,7 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
41
 
42
  foreach ($items as $item)
43
  {
44
- $data[0][] = (string)$item->getSku();
45
  $data[1][] = (int)$item->getQty();
46
  }
47
 
@@ -70,7 +73,7 @@ class Anaraky_Gdrt_Block_Script extends Mage_Core_Block_Abstract {
70
 
71
  foreach ($items as $item)
72
  {
73
- $data[0][] = (string)$item->getSku();
74
  $data[1][] = (int)$item->getQtyToInvoice();
75
  }
76
 
3
 
4
  private function getParams()
5
  {
6
+ $storeId = Mage::app()->getStore()->getId();
7
+ $gdrt_pid = Mage::getStoreConfig('gdrt/general/gdrt_product_id', $storeId);
8
+
9
  $type = $this->getData('pageType');
10
  $params = array('ecomm_pagetype' => 'siteview');
11
  switch ($type) {
29
  case 'product':
30
  $product = Mage::registry('current_product');
31
  $params = array(
32
+ 'ecomm_prodid' => (string)($gdrt_pid == 0 ? $product->getId() : $product->getSku()),
33
  'ecomm_pagetype' => 'product',
34
  'ecomm_totalvalue' => (float)number_format($product->getFinalPrice(), '2', '.', '')
35
  );
44
 
45
  foreach ($items as $item)
46
  {
47
+ $data[0][] = (string)($gdrt_pid == 0 ? $item->getProductId() : $item->getSku());
48
  $data[1][] = (int)$item->getQty();
49
  }
50
 
73
 
74
  foreach ($items as $item)
75
  {
76
+ $data[0][] = (string)($gdrt_pid == 0 ? $item->getProductId() : $item->getSku());
77
  $data[1][] = (int)$item->getQtyToInvoice();
78
  }
79
 
app/code/community/Anaraky/Gdrt/Model/Adminhtml/System/Config/Source/Useasid.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Anaraky_Gdrt_Model_Adminhtml_System_Config_Source_Useasid
4
+ {
5
+
6
+ /**
7
+ * Options getter
8
+ *
9
+ * @return array
10
+ */
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array('value' => 1, 'label'=> 'Product SKU'),
15
+ array('value' => 0, 'label'=> 'Product ID')
16
+ );
17
+ }
18
+
19
+ /**
20
+ * Get options in "key-value" format
21
+ *
22
+ * @return array
23
+ */
24
+ public function toArray()
25
+ {
26
+ return array(
27
+ 0 => 'Product ID',
28
+ 1 => 'Product SKU',
29
+ );
30
+ }
31
+
32
+ }
app/code/community/Anaraky/Gdrt/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Anaraky_Gdrt>
5
- <version>1.0.2</version>
6
  </Anaraky_Gdrt>
7
  </modules>
8
 
@@ -28,6 +28,7 @@
28
  <gdrt>
29
  <general>
30
  <gdrt_enable>0</gdrt_enable>
 
31
  </general>
32
  <pages>
33
  <home>cms/index/index</home>
2
  <config>
3
  <modules>
4
  <Anaraky_Gdrt>
5
+ <version>1.0.3</version>
6
  </Anaraky_Gdrt>
7
  </modules>
8
 
28
  <gdrt>
29
  <general>
30
  <gdrt_enable>0</gdrt_enable>
31
+ <gdrt_product_id>1</gdrt_product_id>
32
  </general>
33
  <pages>
34
  <home>cms/index/index</home>
app/code/community/Anaraky/Gdrt/etc/system.xml CHANGED
@@ -59,6 +59,21 @@
59
  <show_in_website>1</show_in_website>
60
  <show_in_store>1</show_in_store>
61
  </gc_label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  </fields>
63
  </general>
64
 
59
  <show_in_website>1</show_in_website>
60
  <show_in_store>1</show_in_store>
61
  </gc_label>
62
+ <gdrt_product_id>
63
+ <label>Use for product id</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>gdrt/adminhtml_system_config_source_useasid</source_model>
66
+ <comment>
67
+ Must be same as 'Product ID' in the data feeds of the Google Merchant
68
+ </comment>
69
+ <depends>
70
+ <gdrt_enable>1</gdrt_enable>
71
+ </depends>
72
+ <sort_order>4</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
+ </gdrt_product_id>
77
  </fields>
78
  </general>
79
 
package.xml CHANGED
@@ -1,20 +1,19 @@
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Anaraky_GDRT_1</name>
4
+ <version>1.0.3</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>Update:&#xD;
12
+ * Added the ability to define what to use for ecomm_prodid (Produkt ID or Product SKU).</notes>
 
13
  <authors><author><name>Vladas Tomkevicius</name><user>Neodan</user><email>neodann@gmail.com</email></author></authors>
14
+ <date>2013-08-27</date>
15
+ <time>18:27:33</time>
16
+ <contents><target name="magecommunity"><dir name="Anaraky"><dir name="Gdrt"><dir name="Block"><file name="Script.php" hash="3ee61f382f53e2a31f28f9c352c2f9db"/></dir><dir name="Helper"><file name="Data.php" hash="e1dfad9d739c7c3bc6094abae0af01e7"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Useasid.php" hash="d0f1371d883f6dd3af422e907770ee87"/></dir></dir></dir></dir><file name="Observer.php" hash="36f4dfb4171c670b867d881bde03305d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="03a29217c242534e2f13fe79e5fb43c7"/><file name="config.xml" hash="27e0e7ead63a9abc19864f7c25290b9a"/><file name="system.xml" hash="f775db789d4219d78f1afc987718f052"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Anaraky_Gdrt.xml" hash="43fa98d76721559c9ca20636dcb6af61"/></dir></target></contents>
17
  <compatible/>
18
  <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>
19
  </package>