W3CDigitalDataLayerByTriggeredMessaging - Version 0.3.4

Version Notes

All basic features included.
- It can handle full page caching.
- Exception handling has been added.
- Removed empty objects and arrays; Removed duplicated subcategories.
- Added product data for products on category and search pages.
- Fixed issue where configurable products have multiple product entries, and incorrect prices, in the cart object.
- Added more data into digitalData object so websites can be debugged.
- Configurable products have each of their configurations listed under 'linkedProduct'.
- Fixed bug that was breaking some styling.
- Added 'pageName' attribute and fixed type of 'returningStatus' object.
- Tweaks to configuration panel and default values.
- List of all installed non-Magento extensions are exposed (for debug purposes)
- Products associated with a Grouped Product have been included.
- Minimum prices of grouped and bundled products can be extracted.
- Output of debug data can now be controlled through admin configuration panel.

Download this release

Release Info

Developer Muhammed Miah
Extension W3CDigitalDataLayerByTriggeredMessaging
Version 0.3.4
Comparing to
See all releases


Code changes from version 0.3.5 to 0.3.4

app/code/community/TriggeredMessaging/DigitalDataLayer/Model/Page/Observer.php CHANGED
@@ -276,7 +276,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
276
 
277
  $this->_page['pageInfo'] = array();
278
  // $this->_page['pageInfo']['pageID']
279
- $this->_page['pageInfo']['pageName'] = '';
280
  $this->_page['pageInfo']['destinationURL'] = Mage::helper('core/url')->getCurrentUrl();
281
  $referringURL = Mage::app()->getRequest()->getServer('HTTP_REFERER');
282
  if ($referringURL) {
@@ -493,7 +493,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
493
  $product_model[$infoLocation][$attrCode] = $product->getAttributeText($attrCode);
494
  }
495
  }
496
- }
497
  }
498
  } catch(Exception $e){
499
  }
@@ -507,7 +507,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
507
  if($catiterator==0){
508
  $product_model['category']['primaryCategory'] = $cat;
509
  $catiterator++;
510
-
511
  } else {
512
  if(!in_array($cat, $setCategories)){
513
  $product_model['category']["subCategory$catiterator"] = $cat;
@@ -558,7 +558,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
558
  $product_model['price']['basePrice'] = $normal_price;
559
  }
560
  }
561
-
562
  if ($this->_debug) {
563
  $product_model['price']['all'] = array();
564
  $product_model['price']['all']['getPrice'] = $product->getPrice();
@@ -717,7 +717,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
717
  } else {
718
  $litem_model['quantity'] = floatval($item->getQtyOrdered());
719
  }
720
-
721
  if (!is_array($litem_model['price'])) {
722
  $litem_model['price'] = array();
723
  }
@@ -827,7 +827,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
827
 
828
  try {
829
  $basket = $this->_getCheckoutSession();
830
-
831
  if (!isset($basket)) {
832
  return;
833
  }
@@ -841,11 +841,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
841
  $cart['cartID'] = (string) $cart_id;
842
  }
843
  $cart['price'] = array();
844
- if($quote->getBaseSubtotal()){
845
- $cart['price']['basePrice'] = (float) $quote->getBaseSubtotal();
846
- } else {
847
- $cart['price']['basePrice'] = 0.0;
848
- }
849
  if ($quote->getShippingAddress()->getCouponCode()) {
850
  $cart['price']['voucherCode'] = $quote->getShippingAddress()->getCouponCode();
851
  }
@@ -853,26 +849,17 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
853
  $cart['price']['voucherDiscount'] = abs((float) $quote->getShippingAddress()->getDiscountAmount());
854
  }
855
  $cart['price']['currency'] = $this->_getCurrency();
856
- if($cart['price']['basePrice'] > 0.0){
857
- $taxRate = (float) $quote->getShippingAddress()->getTaxAmount() / $cart['price']['basePrice'];
858
- $cart['price']['taxRate'] = round($taxRate, 3); // TODO: Find a better way
859
- }
860
  if ($quote->getShippingAmount()) {
861
  $cart['price']['shipping'] = (float) $quote->getShippingAmount();
862
  }
863
  if ($this->_extractShippingMethod($quote)) {
864
  $cart['price']['shippingMethod'] = $this->_extractShippingMethod($quote);
865
  }
866
- if ($quote->getShippingAddress()->getTaxAmount() && $quote->getBaseSubtotal()){
867
- $cart['price']['priceWithTax'] = (float) $quote->getShippingAddress()->getTaxAmount() + $quote->getBaseSubtotal(); // TODO: Find a better way
868
- } else {
869
- $cart['price']['priceWithTax'] = 0.0;
870
- }
871
- if($quote->getGrandTotal()){
872
- $cart['price']['cartTotal'] = (float) $quote->getGrandTotal();
873
- } else {
874
- $cart['price']['cartTotal'] = 0.0;
875
- }
876
  // $cart['attributes'] = array();
877
  if ($cart['price']['basePrice']===0.0&&$cart['price']['cartTotal']===0.0&&$cart['price']['priceWithTax']===0.0) {
878
  unset($cart['price']);
@@ -880,7 +867,7 @@ class TriggeredMessaging_DigitalDataLayer_Model_Page_Observer {
880
 
881
  // Line items
882
  $items = $quote->getAllVisibleItems();
883
- if (!$items && isset($cart['price'])) {
884
  if ($this->_debug) {
885
  $cart['price']['testLog'] = "Second method used to retrieve cart items.";
886
  }
276
 
277
  $this->_page['pageInfo'] = array();
278
  // $this->_page['pageInfo']['pageID']
279
+ // $this->_page['pageInfo']['pageName']
280
  $this->_page['pageInfo']['destinationURL'] = Mage::helper('core/url')->getCurrentUrl();
281
  $referringURL = Mage::app()->getRequest()->getServer('HTTP_REFERER');
282
  if ($referringURL) {
493
  $product_model[$infoLocation][$attrCode] = $product->getAttributeText($attrCode);
494
  }
495
  }
496
+ }
497
  }
498
  } catch(Exception $e){
499
  }
507
  if($catiterator==0){
508
  $product_model['category']['primaryCategory'] = $cat;
509
  $catiterator++;
510
+
511
  } else {
512
  if(!in_array($cat, $setCategories)){
513
  $product_model['category']["subCategory$catiterator"] = $cat;
558
  $product_model['price']['basePrice'] = $normal_price;
559
  }
560
  }
561
+
562
  if ($this->_debug) {
563
  $product_model['price']['all'] = array();
564
  $product_model['price']['all']['getPrice'] = $product->getPrice();
717
  } else {
718
  $litem_model['quantity'] = floatval($item->getQtyOrdered());
719
  }
720
+
721
  if (!is_array($litem_model['price'])) {
722
  $litem_model['price'] = array();
723
  }
827
 
828
  try {
829
  $basket = $this->_getCheckoutSession();
830
+
831
  if (!isset($basket)) {
832
  return;
833
  }
841
  $cart['cartID'] = (string) $cart_id;
842
  }
843
  $cart['price'] = array();
844
+ $cart['price']['basePrice'] = (float) $quote->getBaseSubtotal();
 
 
 
 
845
  if ($quote->getShippingAddress()->getCouponCode()) {
846
  $cart['price']['voucherCode'] = $quote->getShippingAddress()->getCouponCode();
847
  }
849
  $cart['price']['voucherDiscount'] = abs((float) $quote->getShippingAddress()->getDiscountAmount());
850
  }
851
  $cart['price']['currency'] = $this->_getCurrency();
852
+
853
+ $taxRate = (float) $quote->getShippingAddress()->getTaxAmount() / $quote->getBaseSubtotal();
854
+ $cart['price']['taxRate'] = round($taxRate, 3); // TODO: Find a better way
 
855
  if ($quote->getShippingAmount()) {
856
  $cart['price']['shipping'] = (float) $quote->getShippingAmount();
857
  }
858
  if ($this->_extractShippingMethod($quote)) {
859
  $cart['price']['shippingMethod'] = $this->_extractShippingMethod($quote);
860
  }
861
+ $cart['price']['priceWithTax'] = (float) $quote->getShippingAddress()->getTaxAmount() + $quote->getBaseSubtotal(); // TODO: Find a better way
862
+ $cart['price']['cartTotal'] = (float) $quote->getGrandTotal();
 
 
 
 
 
 
 
 
863
  // $cart['attributes'] = array();
864
  if ($cart['price']['basePrice']===0.0&&$cart['price']['cartTotal']===0.0&&$cart['price']['priceWithTax']===0.0) {
865
  unset($cart['price']);
867
 
868
  // Line items
869
  $items = $quote->getAllVisibleItems();
870
+ if (!$items && $cart['price']) {
871
  if ($this->_debug) {
872
  $cart['price']['testLog'] = "Second method used to retrieve cart items.";
873
  }
app/design/frontend/base/default/template/triggeredmessaging/digital_data_layer.phtml CHANGED
@@ -26,10 +26,8 @@
26
  if (!$page['pageInfo']) {
27
  $page['pageInfo'] = array();
28
  }
29
- if (!$page['pageInfo']['pageName'] || $page['pageInfo']['pageName']==='') {
30
  $page['pageInfo']['pageName'] = $this->getLayout()->getBlock('head')->getTitle();
31
- } else {
32
- unset($page['pageInfo']['pageName']);
33
  }
34
  } catch(Exception $e) {}
35
  ?>
26
  if (!$page['pageInfo']) {
27
  $page['pageInfo'] = array();
28
  }
29
+ if (!$page['pageInfo']['pageName']) {
30
  $page['pageInfo']['pageName'] = $this->getLayout()->getBlock('head')->getTitle();
 
 
31
  }
32
  } catch(Exception $e) {}
33
  ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>W3CDigitalDataLayerByTriggeredMessaging</name>
4
- <version>0.3.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/apachepl.php">Apache Software License v2</license>
7
  <channel>community</channel>
@@ -30,8 +30,8 @@ https://github.com/TriggeredMessaging/digitalDataMagentoExtension/issues</descri
30
  - Output of debug data can now be controlled through admin configuration panel.</notes>
31
  <authors><author><name>Muhammed Miah</name><user>momiah1234</user><email>muhammed.miah@triggeredmessaging.com</email></author><author><name>Triggered Messaging</name><user>tmsdemo</user><email>demostore@triggeredmessaging.com</email></author><author><name>Mike Austin</name><user>tmsdemo</user><email>dev@triggeredmessaging.com</email></author></authors>
32
  <date>2014-10-01</date>
33
- <time>05:55:56</time>
34
- <contents><target name="magecommunity"><dir name="TriggeredMessaging"><dir name="DigitalDataLayer"><dir name="Block"><file name="Ddl.php" hash="134766e2a49c3ecfbf03d1025dd41e8b"/></dir><dir name="Helper"><file name="Data.php" hash="5a6e19225e7db056946c95b1477e5c18"/></dir><dir name="Model"><dir name="Container"><file name="Ddl.php" hash="cc9dcd8cf4e460a01c242ac675ce5634"/></dir><file name="Observer.php" hash="26e0dcfc7a19d5310e44e004c144c23e"/><dir name="Page"><file name="Observer.php" hash="eb6dbe1c03fc786769c25857f807afc8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8b98dee82241e0b69661bf4699cba334"/><file name="cache.xml" hash="1b6658073a8126cd655cb18109559f49"/><file name="config.xml" hash="a29f9fb1250c40a8d973e470ffab46ac"/><file name="system.xml" hash="a72e032172f1a6b05ba969415bf33f63"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="triggeredmessaging"><file name="digital_data_layer.phtml" hash="61001c0d1d3478f9db8366f4386da754"/><file name="digital_data_layer_after_content.phtml" hash="6ee383b4d2011fd7e718b2930b7cd95d"/></dir></dir><dir name="layout"><dir name="triggeredmessaging"><file name="digital_data_layer.xml" hash="3c58b9faec1d9c63e1fb0a3fcc35a2d8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TriggeredMessaging_DigitalDataLayer.xml" hash="cfc3b1bff54f3e1f224f120e536bc411"/></dir></target></contents>
35
  <compatible/>
36
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
37
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>W3CDigitalDataLayerByTriggeredMessaging</name>
4
+ <version>0.3.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/apachepl.php">Apache Software License v2</license>
7
  <channel>community</channel>
30
  - Output of debug data can now be controlled through admin configuration panel.</notes>
31
  <authors><author><name>Muhammed Miah</name><user>momiah1234</user><email>muhammed.miah@triggeredmessaging.com</email></author><author><name>Triggered Messaging</name><user>tmsdemo</user><email>demostore@triggeredmessaging.com</email></author><author><name>Mike Austin</name><user>tmsdemo</user><email>dev@triggeredmessaging.com</email></author></authors>
32
  <date>2014-10-01</date>
33
+ <time>06:26:12</time>
34
+ <contents><target name="magecommunity"><dir name="TriggeredMessaging"><dir name="DigitalDataLayer"><dir name="Block"><file name="Ddl.php" hash="134766e2a49c3ecfbf03d1025dd41e8b"/></dir><dir name="Helper"><file name="Data.php" hash="5a6e19225e7db056946c95b1477e5c18"/></dir><dir name="Model"><dir name="Container"><file name="Ddl.php" hash="cc9dcd8cf4e460a01c242ac675ce5634"/></dir><file name="Observer.php" hash="26e0dcfc7a19d5310e44e004c144c23e"/><dir name="Page"><file name="Observer.php" hash="888be00d4591205342a8ed64cffcd77c"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8b98dee82241e0b69661bf4699cba334"/><file name="cache.xml" hash="1b6658073a8126cd655cb18109559f49"/><file name="config.xml" hash="a29f9fb1250c40a8d973e470ffab46ac"/><file name="system.xml" hash="a72e032172f1a6b05ba969415bf33f63"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="triggeredmessaging"><file name="digital_data_layer.phtml" hash="61001c0d1d3478f9db8366f4386da754"/><file name="digital_data_layer_after_content.phtml" hash="6ee383b4d2011fd7e718b2930b7cd95d"/></dir></dir><dir name="layout"><dir name="triggeredmessaging"><file name="digital_data_layer.xml" hash="3c58b9faec1d9c63e1fb0a3fcc35a2d8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TriggeredMessaging_DigitalDataLayer.xml" hash="cfc3b1bff54f3e1f224f120e536bc411"/></dir></target></contents>
35
  <compatible/>
36
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
37
  </package>