Retargeting_Tracker - Version 1.1.2

Version Notes

Retargeting

Download this release

Release Info

Developer Retargeting Team
Extension Retargeting_Tracker
Version 1.1.2
Comparing to
See all releases


Code changes from version 1.1.1 to 1.1.2

app/code/community/Retargeting/Tracker/Model/Observer.php CHANGED
@@ -9,13 +9,6 @@
9
 
10
  class Retargeting_Tracker_Model_Observer
11
  {
12
- /*
13
- public function catalogProductLoadAfter(Varien_Event_Observer $observer)
14
- {
15
- $product = $observer->getEvent()->getProduct();
16
- }
17
- */
18
-
19
  public function TrackSetEmail($observer)
20
  {
21
  $event = $observer->getEvent(); //Fetches the current event
@@ -32,7 +25,6 @@ class Retargeting_Tracker_Model_Observer
32
  $customerCity = $cust_data['city'];
33
  }
34
 
35
-
36
  $info = array(
37
  "email" => $customer->getEmail(),
38
  "name" => $customer->getName(),
@@ -46,6 +38,11 @@ class Retargeting_Tracker_Model_Observer
46
 
47
  public function TrackAddToCart($observer)
48
  {
 
 
 
 
 
49
  $helper = Mage::helper('catalog/product_configuration');
50
 
51
  $event = $observer->getEvent(); //Fetches the current event
@@ -97,6 +94,22 @@ class Retargeting_Tracker_Model_Observer
97
  );
98
 
99
  Mage::getSingleton('core/session')->setTriggerAddToCart($info);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
 
102
  public function TrackAddToWishlist($observer)
@@ -126,64 +139,108 @@ class Retargeting_Tracker_Model_Observer
126
 
127
  public function TrackSaveOrder($observer)
128
  {
129
- $helper = Mage::helper('catalog/product_configuration');
 
130
 
131
- $event = $observer->getEvent(); //Fetches the current event
132
- $order = $observer->getOrder();
133
- $shippingAddress = $order->getShippingAddress();
134
- $quote = $observer->getEvent()->getQuote();
135
-
136
- $products = array();
137
- foreach ($order->getAllVisibleItems() as $item) {
138
- $itemOptions = $item->getProductOptions();
139
- $variationCode = "false";
140
- $optionsCode = array();
141
-
142
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
143
- if ( $product->isConfigurable() ) {
144
- $_optCode = str_replace(' ', '', $item->getSku());
145
- $_optCode = str_replace('-', '', $_optCode);
146
- $_optCode = strip_tags($_optCode);
147
- $optionsCode[] = $_optCode;
148
- }
149
 
150
- if ( count($itemOptions['options']) > 0 ) {
151
- foreach ($itemOptions['options'] as $itemOption) {
152
- $_optCode = str_replace(' ', '', $itemOption['value']);
 
 
 
 
 
 
 
 
 
 
 
153
  $_optCode = str_replace('-', '', $_optCode);
154
  $_optCode = strip_tags($_optCode);
155
  $optionsCode[] = $_optCode;
156
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
- $variationCode = count($optionsCode) > 0 ? '"'.implode('-', $optionsCode).'"' : "false";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
- $products[] = '{
162
- "id": "'. $item->getProductId() .'",
163
- "quantity": '. $item->getQtyOrdered() .',
164
- "price": ' . Mage::helper('tax')->getPrice($item, $item->getPrice()).',
165
- "variation_code": ' . $variationCode . '}';
166
- }
167
 
168
- $info = array(
169
- "order_no" => $order->getIncrementId(),
170
- "firstname" => $shippingAddress->getFirstname(),
171
- "lastname" => $shippingAddress->getLastname(),
172
- "email" => $shippingAddress->getEmail(),
173
- "phone" => $shippingAddress->getTelephone(),
174
- "state" => $shippingAddress->getRegion(),
175
- "city" => $shippingAddress->getCity(),
176
- "address" => implode(" ", $shippingAddress->getStreet()),
177
- "data" => $shippingAddress->getData(),
178
- "discount" => $order->getDiscountAmount(),
179
- "discount_code" => '',
180
- "shipping" => $order->getShippingInclTax(),
181
- "total" => $order->getGrandTotal(),
182
- "products" => "[".implode(",", $products)."]",
183
- );
184
 
185
- Mage::log($info, null, 'retargeting.log');
186
 
187
- Mage::getSingleton('core/session')->setTriggerSaveOrder($info);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
189
  }
9
 
10
  class Retargeting_Tracker_Model_Observer
11
  {
 
 
 
 
 
 
 
12
  public function TrackSetEmail($observer)
13
  {
14
  $event = $observer->getEvent(); //Fetches the current event
25
  $customerCity = $cust_data['city'];
26
  }
27
 
 
28
  $info = array(
29
  "email" => $customer->getEmail(),
30
  "name" => $customer->getName(),
38
 
39
  public function TrackAddToCart($observer)
40
  {
41
+
42
+ $magentoVersion = Mage::getVersion();
43
+
44
+ if($magentoVersion > "1.4.2.0"){
45
+
46
  $helper = Mage::helper('catalog/product_configuration');
47
 
48
  $event = $observer->getEvent(); //Fetches the current event
94
  );
95
 
96
  Mage::getSingleton('core/session')->setTriggerAddToCart($info);
97
+
98
+ } else {
99
+ //Magento 1.4 compatibility
100
+ $helper = Mage::helper('catalog/product');
101
+
102
+ $event = $observer->getEvent(); //Fetches the current event
103
+ $product = $event->getProduct();
104
+ $quoteItem = $event->getQuoteItem();
105
+
106
+ $info = array(
107
+ "product_id" => $product->getId(),
108
+ "variation" => "false"
109
+ );
110
+
111
+ Mage::getSingleton('core/session')->setTriggerAddToCart($info);
112
+ }
113
  }
114
 
115
  public function TrackAddToWishlist($observer)
139
 
140
  public function TrackSaveOrder($observer)
141
  {
142
+ $magentoVersion = Mage::getVersion();
143
+ if($magentoVersion > "1.4.2.0") {
144
 
145
+ $helper = Mage::helper('catalog/product_configuration');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
+ $event = $observer->getEvent(); //Fetches the current event
148
+ $order = $observer->getOrder();
149
+ $billingAddress = $order->getbillingAddress();
150
+ $quote = $observer->getEvent()->getQuote();
151
+
152
+ $products = array();
153
+ foreach ($order->getAllVisibleItems() as $item) {
154
+ $itemOptions = $item->getProductOptions();
155
+ $variationCode = "false";
156
+ $optionsCode = array();
157
+
158
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
159
+ if ( $product->isConfigurable() ) {
160
+ $_optCode = str_replace(' ', '', $item->getSku());
161
  $_optCode = str_replace('-', '', $_optCode);
162
  $_optCode = strip_tags($_optCode);
163
  $optionsCode[] = $_optCode;
164
  }
165
+
166
+ if ( count($itemOptions['options']) > 0 ) {
167
+ foreach ($itemOptions['options'] as $itemOption) {
168
+ $_optCode = str_replace(' ', '', $itemOption['value']);
169
+ $_optCode = str_replace('-', '', $_optCode);
170
+ $_optCode = strip_tags($_optCode);
171
+ $optionsCode[] = $_optCode;
172
+ }
173
+ }
174
+
175
+ $variationCode = count($optionsCode) > 0 ? '"'.implode('-', $optionsCode).'"' : "false";
176
+
177
+ $products[] = '{
178
+ "id": "'. $item->getProductId() .'",
179
+ "quantity": '. $item->getQtyOrdered() .',
180
+ "price": ' . Mage::helper('tax')->getPrice($item, $item->getPrice()).',
181
+ "variation_code": ' . $variationCode . '}';
182
  }
183
 
184
+ $info = array(
185
+ "order_no" => $order->getIncrementId(),
186
+ "firstname" => $billingAddress->getFirstname(),
187
+ "lastname" => $billingAddress->getLastname(),
188
+ "email" => $billingAddress->getEmail(),
189
+ "phone" => $billingAddress->getTelephone(),
190
+ "state" => $billingAddress->getRegion(),
191
+ "city" => $billingAddress->getCity(),
192
+ "address" => implode(" ", $billingAddress->getStreet()),
193
+ "data" => $billingAddress->getData(),
194
+ "discount" => $order->getDiscountAmount(),
195
+ "discount_code" => $order->getCouponCode(),
196
+ "shipping" => $order->getShippingInclTax(),
197
+ "total" => $order->getGrandTotal(),
198
+ "products" => "[".implode(",", $products)."]",
199
+ );
200
+ Mage::getSingleton('core/session')->setTriggerSaveOrder($info);
201
+ } else {
202
+
203
+ // Magento 1.4 compatibility
204
+ $helper = Mage::helper('catalog/product');
205
+
206
+ $event = $observer->getEvent(); //Fetches the current event
207
+ $order = $observer->getOrder();
208
+ $billingAddress = $order->getBillingAddress();
209
+ $quote = $observer->getEvent()->getQuote();
210
 
211
+ $products = array();
212
+ foreach ($order->getAllVisibleItems() as $item) {
213
+ $itemOptions = $item->getProductOptions();
 
 
 
214
 
215
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
+ $variationCode = "";
218
 
219
+ $products[] = '{
220
+ "id": "'. $item->getProductId() .'",
221
+ "quantity": '. $item->getQtyOrdered() .',
222
+ "price": ' . Mage::helper('tax')->getPrice($item, $item->getPrice()).',
223
+ "variation_code": false}';
224
+ }
225
+
226
+ $info = array(
227
+ "order_no" => $order->getIncrementId(),
228
+ "firstname" => $billingAddress->getFirstname(),
229
+ "lastname" => $billingAddress->getLastname(),
230
+ "email" => $billingAddress->getEmail(),
231
+ "phone" => $billingAddress->getTelephone(),
232
+ "state" => $billingAddress->getRegion(),
233
+ "city" => $billingAddress->getCity(),
234
+ "address" => implode(" ", $billingAddress->getStreet()),
235
+ "data" => $billingAddress->getData(),
236
+ "discount" => $order->getDiscountAmount(),
237
+ "discount_code" => $order->getCouponCode(),
238
+ "shipping" => $order->getShippingInclTax(),
239
+ "total" => $order->getGrandTotal(),
240
+ "products" => "[".implode(",", $products)."]",
241
+ );
242
+
243
+ Mage::getSingleton('core/session')->setTriggerSaveOrder($info);
244
+ }
245
  }
246
  }
app/code/community/Retargeting/Tracker/etc/config.xml CHANGED
@@ -11,7 +11,7 @@
11
  <config>
12
  <modules>
13
  <Retargeting_Tracker>
14
- <version>1.1.1</version>
15
  </Retargeting_Tracker>
16
  </modules>
17
  <global>
11
  <config>
12
  <modules>
13
  <Retargeting_Tracker>
14
+ <version>1.1.2</version>
15
  </Retargeting_Tracker>
16
  </modules>
17
  <global>
app/design/frontend/base/default/template/retargeting_tracker/triggers.phtml CHANGED
@@ -12,6 +12,8 @@
12
  * Retargeting Triggers code
13
  **/
14
  ?>
 
 
15
  <?php if ( Mage::app()->getFrontController()->getRequest()->getControllerName() == "product" && !is_null(Mage::registry('product')) ) : ?>
16
  <script>
17
  // Retargeting JS helpers
@@ -266,6 +268,7 @@
266
  /*
267
  ----------------------- Trigger setVariation -----------------------
268
  */
 
269
  ?>
270
  <?php if ( Mage::app()->getFrontController()->getRequest()->getControllerName() == "product" && !is_null(Mage::registry('product')) ) : ?>
271
 
@@ -283,7 +286,6 @@
283
  if(typeof _ra.setVariation !== "undefined") _ra.setVariation("<?php echo $_product->getId(); ?>", _ra_variation);
284
  }
285
 
286
-
287
  _ra_optElfunc = [];
288
  function _ra_grabVariation() {
289
  var _ra_vo = {};
@@ -564,6 +566,8 @@
564
  });
565
  <?php endif ?>
566
 
 
 
567
  <?php /*is not configurable*/ ?>
568
  <?php else : ?>
569
  <?php /*is configurable*/ ?>
@@ -627,7 +631,7 @@
627
 
628
  <?php endif ?>
629
  <?php endif ?>
630
-
631
 
632
 
633
  <?php
@@ -891,10 +895,6 @@ _ra_helper_addLoadEvent(function() {
891
  if(typeof _ra.saveOrder !== "undefined") _ra.saveOrder(_ra.saveOrderInfo, _ra.saveOrderProducts);
892
  }
893
 
894
- /*
895
- <?php echo $info['debug']; ?>
896
- */
897
-
898
  <?php Mage::getSingleton('core/session')->unsTriggerSaveOrder(); ?>
899
  <?php endif ?>
900
 
@@ -943,8 +943,6 @@ _ra_helper_addLoadEvent(function() {
943
  $module = $request->getModuleName();
944
  $controller = $request->getControllerName();
945
  $action = $request->getActionName();
946
-
947
- print_r(Mage::helper('core/url')->getCurrentUrl());
948
  ?>
949
  <?php if ( ($module == 'checkout' && $controller == 'cart' && $action == 'index') || ($module == 'checkout' && $controller == 'onepage' && $action == 'index') || (Mage::getURL('checkout/onepage') == Mage::helper('core/url')->getCurrentUrl()) || (strrpos(Mage::helper('core/url')->getCurrentUrl(), "/onestepcheckout") === false) ) : ?>
950
 
12
  * Retargeting Triggers code
13
  **/
14
  ?>
15
+ <?php $magentoVersion = Mage::getVersion(); ?>
16
+
17
  <?php if ( Mage::app()->getFrontController()->getRequest()->getControllerName() == "product" && !is_null(Mage::registry('product')) ) : ?>
18
  <script>
19
  // Retargeting JS helpers
268
  /*
269
  ----------------------- Trigger setVariation -----------------------
270
  */
271
+ if($magentoVersion > "1.4.2.0") :
272
  ?>
273
  <?php if ( Mage::app()->getFrontController()->getRequest()->getControllerName() == "product" && !is_null(Mage::registry('product')) ) : ?>
274
 
286
  if(typeof _ra.setVariation !== "undefined") _ra.setVariation("<?php echo $_product->getId(); ?>", _ra_variation);
287
  }
288
 
 
289
  _ra_optElfunc = [];
290
  function _ra_grabVariation() {
291
  var _ra_vo = {};
566
  });
567
  <?php endif ?>
568
 
569
+
570
+
571
  <?php /*is not configurable*/ ?>
572
  <?php else : ?>
573
  <?php /*is configurable*/ ?>
631
 
632
  <?php endif ?>
633
  <?php endif ?>
634
+ <?php endif //magento version ?>
635
 
636
 
637
  <?php
895
  if(typeof _ra.saveOrder !== "undefined") _ra.saveOrder(_ra.saveOrderInfo, _ra.saveOrderProducts);
896
  }
897
 
 
 
 
 
898
  <?php Mage::getSingleton('core/session')->unsTriggerSaveOrder(); ?>
899
  <?php endif ?>
900
 
943
  $module = $request->getModuleName();
944
  $controller = $request->getControllerName();
945
  $action = $request->getActionName();
 
 
946
  ?>
947
  <?php if ( ($module == 'checkout' && $controller == 'cart' && $action == 'index') || ($module == 'checkout' && $controller == 'onepage' && $action == 'index') || (Mage::getURL('checkout/onepage') == Mage::helper('core/url')->getCurrentUrl()) || (strrpos(Mage::helper('core/url')->getCurrentUrl(), "/onestepcheckout") === false) ) : ?>
948
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Retargeting_Tracker</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -46,9 +46,9 @@ With our personalized live triggers that&amp;amp;#39;s exactly what you&amp;amp;
46
  &amp;lt;p&amp;gt;For help or more info, please contact info@retargeting.biz or visit&amp;amp;nbsp;&amp;lt;a href="http://www.retargeting.biz"&amp;gt;retargeting.biz&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;</description>
47
  <notes>Retargeting</notes>
48
  <authors><author><name>Cosmin Atomei</name><user>retargeting</user><email>info@retargeting.biz</email></author></authors>
49
- <date>2015-06-23</date>
50
- <time>11:37:29</time>
51
- <contents><target name="magecommunity"><dir name="Retargeting"><dir name="Tracker"><dir name="Block"><file name="Embed.php" hash="d114429b378b186d144f75b725bd36c4"/><file name="Triggers.php" hash="fd2f2fad2041280b0d0572ea0e2220de"/></dir><dir name="Helper"><file name="Data.php" hash="6b547d3d67003b8bef48fd4eb8efe23f"/></dir><dir name="Model"><file name="Helppages.php" hash="51305978cda160ad7b3aa8bb8e42d3a5"/><file name="Observer.php" hash="891bb244bf9caa5d5742338cd5697ee8"/></dir><dir name="controllers"><file name="DiscountsController.php" hash="2c1386a96a75a2b3e5c3667a37dc285f"/><file name="IndexController.php" hash="9cbd5b979859b2014c5ed191d9b5686a"/><file name="ProductsController.php" hash="6498c0be8d4989d47f70f4c24b9fa904"/></dir><dir name="etc"><file name="config.xml" hash="0d685b4a87fdfa1962b2c89b0c9812b3"/><file name="system.xml" hash="46a5ed1ce340892c1010240e9c622a4e"/></dir><dir name="sql"><dir name="retargeting_tracker_setup"><file name="mysql4-install-1.0.0.php" hash="6613b3db4b7ec61fe47f9b69591fa0c5"/><file name="mysql4-install-1.1.0.php" hash="6613b3db4b7ec61fe47f9b69591fa0c5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Retargeting_Tracker.xml" hash="44dbbcea34bc8ed9cc6d744176adb9a6"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="retargeting_tracker.xml" hash="a27cb36a780ee24f3e70aba08599f37e"/></dir><dir name="template"><dir name="retargeting_tracker"><file name="embed.phtml" hash="2d973cc9fe231ebf13da0b8ae3d3ccbb"/><file name="triggers.phtml" hash="dc3ba090077c9009e06b7498670de5f2"/></dir></dir></dir></dir></dir></target></contents>
52
  <compatible/>
53
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
54
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Retargeting_Tracker</name>
4
+ <version>1.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
46
  &amp;lt;p&amp;gt;For help or more info, please contact info@retargeting.biz or visit&amp;amp;nbsp;&amp;lt;a href="http://www.retargeting.biz"&amp;gt;retargeting.biz&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;</description>
47
  <notes>Retargeting</notes>
48
  <authors><author><name>Cosmin Atomei</name><user>retargeting</user><email>info@retargeting.biz</email></author></authors>
49
+ <date>2015-08-07</date>
50
+ <time>12:46:54</time>
51
+ <contents><target name="magecommunity"><dir name="Retargeting"><dir name="Tracker"><dir name="Block"><file name="Embed.php" hash="d114429b378b186d144f75b725bd36c4"/><file name="Triggers.php" hash="fd2f2fad2041280b0d0572ea0e2220de"/></dir><dir name="Helper"><file name="Data.php" hash="6b547d3d67003b8bef48fd4eb8efe23f"/></dir><dir name="Model"><file name="Helppages.php" hash="51305978cda160ad7b3aa8bb8e42d3a5"/><file name="Observer.php" hash="6c737c6cdd63d6920a6ad6c258c88bca"/></dir><dir name="controllers"><file name="DiscountsController.php" hash="2c1386a96a75a2b3e5c3667a37dc285f"/><file name="IndexController.php" hash="9cbd5b979859b2014c5ed191d9b5686a"/><file name="ProductsController.php" hash="6498c0be8d4989d47f70f4c24b9fa904"/></dir><dir name="etc"><file name="config.xml" hash="4e534c7c7f1659850c91210a0bc74e8e"/><file name="system.xml" hash="46a5ed1ce340892c1010240e9c622a4e"/></dir><dir name="sql"><dir name="retargeting_tracker_setup"><file name="mysql4-install-1.0.0.php" hash="6613b3db4b7ec61fe47f9b69591fa0c5"/><file name="mysql4-install-1.1.0.php" hash="6613b3db4b7ec61fe47f9b69591fa0c5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Retargeting_Tracker.xml" hash="44dbbcea34bc8ed9cc6d744176adb9a6"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="retargeting_tracker.xml" hash="a27cb36a780ee24f3e70aba08599f37e"/></dir><dir name="template"><dir name="retargeting_tracker"><file name="embed.phtml" hash="2d973cc9fe231ebf13da0b8ae3d3ccbb"/><file name="triggers.phtml" hash="6a7ad86b318030232f3d71fd86d8f065"/></dir></dir></dir></dir></dir></target></contents>
52
  <compatible/>
53
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
54
  </package>