Klaviyo_Reclaim - Version 1.3.5

Version Notes

Add cron job monitoring to extension page.

Download this release

Release Info

Developer Klaviyo Team
Extension Klaviyo_Reclaim
Version 1.3.5
Comparing to
See all releases


Code changes from version 1.2.4 to 1.3.5

app/code/community/Klaviyo/.DS_Store DELETED
Binary file
app/code/community/Klaviyo/Reclaim/Block/Adminhtml/System/Config/Fieldset/Info.php CHANGED
@@ -18,4 +18,27 @@ class Klaviyo_Reclaim_Block_Adminhtml_System_Config_Fieldset_Info extends Mage_A
18
  public function getKlaviyoVersion() {
19
  return (string) Mage::getConfig()->getNode('modules/Klaviyo_Reclaim/version');
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
18
  public function getKlaviyoVersion() {
19
  return (string) Mage::getConfig()->getNode('modules/Klaviyo_Reclaim/version');
20
  }
21
+
22
+ public function getKlaviyoExtensionStatus() {
23
+ $helper = Mage::helper('klaviyo_reclaim');
24
+
25
+ $is_enabled = $helper->isEnabled();
26
+ $is_api_key_set = $helper->getPublicApiKey() != NULL;
27
+
28
+ $adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
29
+ $hour_ago = Zend_Date::now();
30
+ $hour_ago->sub(60, Zend_Date::MINUTE);
31
+ $hour_ago = $adapter->convertDateTime($hour_ago);
32
+
33
+ $is_cron_running = Mage::getModel('cron/schedule')->getCollection()
34
+ ->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_SUCCESS)
35
+ ->addFieldToFilter('finished_at', array('gteq' => $hour_ago))
36
+ ->count() > 0;
37
+
38
+ $has_reclaim_entries = Mage::getModel('klaviyo_reclaim/checkout')->getCollection()->count() > 0;
39
+
40
+ $is_extension_failing = $is_enabled and !($is_api_key_set or $is_cron_running or $has_reclaim_entries);
41
+
42
+ return array($is_extension_failing, $is_api_key_set, $is_cron_running, $has_reclaim_entries);
43
+ }
44
  }
app/code/community/Klaviyo/Reclaim/Helper/Data.php CHANGED
@@ -88,7 +88,7 @@ class Klaviyo_Reclaim_Helper_Data extends Mage_Core_Helper_Data
88
  */
89
  public function getPublicApiKey($store=null)
90
  {
91
- return Mage::getStoreConfig(self::XML_PATH_PUBLIC_API_KEY, $store);
92
  }
93
 
94
  /**
88
  */
89
  public function getPublicApiKey($store=null)
90
  {
91
+ return Mage::app()->getWebsite($store)->getConfig(self::XML_PATH_PUBLIC_API_KEY);
92
  }
93
 
94
  /**
app/code/community/Klaviyo/Reclaim/Model/Api.php CHANGED
@@ -47,7 +47,17 @@ class Klaviyo_Reclaim_Model_Api
47
  * @return void
48
  */
49
  public function __construct($args) {
50
- $private_api_key = (!isset($args['api_key']) ? Mage::helper('klaviyo_reclaim')->getPrivateApiKey() : $args['api_key']);
 
 
 
 
 
 
 
 
 
 
51
  $this->_api = new Klaviyo_Reclaim_Model_KlaviyoApi($private_api_key);
52
  }
53
 
47
  * @return void
48
  */
49
  public function __construct($args) {
50
+ $store_name = Mage::app()->getRequest()->getParam('store');
51
+
52
+ if (strlen($store_name)){
53
+ $store_id = Mage::getModel('core/store')->load($store_name)->getId();
54
+ $private_api_key = Mage::getStoreConfig('reclaim/general/private_api_key', $store_id);
55
+ }
56
+
57
+ else{
58
+ $private_api_key = (!isset($args['api_key']) ? Mage::helper('klaviyo_reclaim')->getPrivateApiKey() : $args['api_key']);
59
+ }
60
+
61
  $this->_api = new Klaviyo_Reclaim_Model_KlaviyoApi($private_api_key);
62
  }
63
 
app/code/community/Klaviyo/Reclaim/Model/KlaviyoApi.php CHANGED
@@ -42,9 +42,9 @@ class Klaviyo_Reclaim_Model_KlaviyoApi
42
  public $request_params = array();
43
 
44
  /**
45
- * Connect to the MailChimp API for a given list.
46
  *
47
- * @param string $apikey Your MailChimp apikey
48
  * @param string $secure Whether or not this should use a secure connection
49
  */
50
  function __construct($api_key, $secure=true) {
42
  public $request_params = array();
43
 
44
  /**
45
+ * Connect to the Klaviyo API for a given list.
46
  *
47
+ * @param string $apikey Your Klaviyo apikey
48
  * @param string $secure Whether or not this should use a secure connection
49
  */
50
  function __construct($api_key, $secure=true) {
app/code/community/Klaviyo/Reclaim/Model/Observer.php CHANGED
@@ -15,6 +15,9 @@
15
  */
16
  class Klaviyo_Reclaim_Model_Observer
17
  {
 
 
 
18
  /**
19
  * Error messages
20
  *
@@ -27,34 +30,25 @@ class Klaviyo_Reclaim_Model_Observer
27
  *
28
  * @return Klaviyo_Reclaim_Model_Observer
29
  */
30
- public function trackQuotes()
31
- {
32
 
33
  if (!Mage::helper('klaviyo_reclaim')->isEnabled()) {
34
  return;
35
  }
36
 
37
- $public_api_key = Mage::helper('klaviyo_reclaim')->getPublicApiKey();
38
-
39
- if (!$public_api_key) {
40
- return;
41
- }
42
-
43
- $tracker = new Klaviyo_Reclaim_Model_Tracker($public_api_key);
44
-
45
  $this->_errors = array();
46
  try {
47
  $adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
48
 
49
  // Find quotes that are at least 15 minutes old and have been updated in the last 60 minutes.
50
  $created_window_minutes = 15;
51
-
52
  $created_before = Zend_Date::now();
53
  $created_before->sub($created_window_minutes, Zend_Date::MINUTE);
54
  $created_before = $adapter->convertDateTime($created_before);
55
 
56
  $updated_window_minutes = 60;
57
-
58
  $updated_after = Zend_Date::now();
59
  $updated_after->sub($updated_window_minutes, Zend_Date::MINUTE);
60
  $updated_after = $adapter->convertDateTime($updated_after);
@@ -67,10 +61,10 @@ class Klaviyo_Reclaim_Model_Observer
67
  $quotes_tracked = 0;
68
 
69
  foreach ($quotes as $quote) {
70
-
71
  $billing_address = $quote->getBillingAddress();
72
 
73
- if (!$billing_address) {
74
  continue;
75
  }
76
 
@@ -105,6 +99,7 @@ class Klaviyo_Reclaim_Model_Observer
105
 
106
  $item_descriptions = array();
107
  $item_details = array();
 
108
  $item_count = 0;
109
 
110
  $configurable_product_ids = array();
@@ -115,9 +110,10 @@ class Klaviyo_Reclaim_Model_Observer
115
  $quote_item_product_name = $quote_item_product->getName();
116
 
117
  for ($i = 0; $i < $quote_item_quantity; $i++) {
118
- $item_descriptions[] = $quote_item_product_name;
119
  $item_count++;
120
  }
 
 
121
 
122
  $product_images = array();
123
  foreach ($quote_item_product->getMediaGalleryImages() as $product_image) {
@@ -132,18 +128,20 @@ class Klaviyo_Reclaim_Model_Observer
132
  $configurable_product_ids[] = $quote_item_product->getId();
133
  }
134
 
135
- $item_details[] = array(
136
- 'quantity' => (float) $quote_item_quantity,
137
- 'row_total' => (float) $quote_item->getBaseRowTotal(),
138
- 'row_discount' => (float) $quote_item->getBaseDiscountAmount(),
139
- 'product' => array(
140
- 'id' => $quote_item_product->getId(),
141
- 'sku' => $quote_item_product->getSKU(),
142
- 'name' => $quote_item_product->getName(),
143
- 'price' => (float) $quote_item_product->getPrice(),
144
- 'images' => $product_images
145
- )
146
- );
 
 
147
  }
148
 
149
  if (!empty($configurable_product_ids)) {
@@ -195,7 +193,9 @@ class Klaviyo_Reclaim_Model_Observer
195
  if ($coupon_code) {
196
  $totals = $quote->getTotals();
197
  $properties['Discount Codes'] = array($coupon_code);
198
- $properties['Total Discounts'] = (float) $totals['discount']->getValue() * -1;
 
 
199
  }
200
 
201
  $timestamp = strtotime($quote->getUpdatedAt());
@@ -306,4 +306,26 @@ class Klaviyo_Reclaim_Model_Observer
306
  public function syncCustomer (Varien_Event_Observer $observer) {
307
  // Mage::log($observer);
308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  }
15
  */
16
  class Klaviyo_Reclaim_Model_Observer
17
  {
18
+ const MAX_LINE_ITEMS_WITH_DETAILS = 5;
19
+ var $tracker_cache = array();
20
+
21
  /**
22
  * Error messages
23
  *
30
  *
31
  * @return Klaviyo_Reclaim_Model_Observer
32
  */
33
+ public function trackQuotes() {
 
34
 
35
  if (!Mage::helper('klaviyo_reclaim')->isEnabled()) {
36
  return;
37
  }
38
 
 
 
 
 
 
 
 
 
39
  $this->_errors = array();
40
  try {
41
  $adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
42
 
43
  // Find quotes that are at least 15 minutes old and have been updated in the last 60 minutes.
44
  $created_window_minutes = 15;
45
+
46
  $created_before = Zend_Date::now();
47
  $created_before->sub($created_window_minutes, Zend_Date::MINUTE);
48
  $created_before = $adapter->convertDateTime($created_before);
49
 
50
  $updated_window_minutes = 60;
51
+
52
  $updated_after = Zend_Date::now();
53
  $updated_after->sub($updated_window_minutes, Zend_Date::MINUTE);
54
  $updated_after = $adapter->convertDateTime($updated_after);
61
  $quotes_tracked = 0;
62
 
63
  foreach ($quotes as $quote) {
64
+ $tracker = self::getTracker($quote);
65
  $billing_address = $quote->getBillingAddress();
66
 
67
+ if (!$billing_address || !$tracker) {
68
  continue;
69
  }
70
 
99
 
100
  $item_descriptions = array();
101
  $item_details = array();
102
+ $line_item_count = 0;
103
  $item_count = 0;
104
 
105
  $configurable_product_ids = array();
110
  $quote_item_product_name = $quote_item_product->getName();
111
 
112
  for ($i = 0; $i < $quote_item_quantity; $i++) {
 
113
  $item_count++;
114
  }
115
+ $item_descriptions[] = $quote_item_product_name;
116
+ $line_item_count++;
117
 
118
  $product_images = array();
119
  foreach ($quote_item_product->getMediaGalleryImages() as $product_image) {
128
  $configurable_product_ids[] = $quote_item_product->getId();
129
  }
130
 
131
+ if ($line_item_count <= self::MAX_LINE_ITEMS_WITH_DETAILS) {
132
+ $item_details[] = array(
133
+ 'quantity' => (float) $quote_item_quantity,
134
+ 'row_total' => (float) $quote_item->getBaseRowTotal(),
135
+ 'row_discount' => (float) $quote_item->getBaseDiscountAmount(),
136
+ 'product' => array(
137
+ 'id' => $quote_item_product->getId(),
138
+ 'sku' => $quote_item_product->getSKU(),
139
+ 'name' => $quote_item_product->getName(),
140
+ 'price' => (float) $quote_item_product->getPrice(),
141
+ 'images' => $product_images
142
+ )
143
+ );
144
+ }
145
  }
146
 
147
  if (!empty($configurable_product_ids)) {
193
  if ($coupon_code) {
194
  $totals = $quote->getTotals();
195
  $properties['Discount Codes'] = array($coupon_code);
196
+ if (array_key_exists('discount', $totals) && is_object($totals['discount'])) {
197
+ $properties['Total Discounts'] = (float) $totals['discount']->getValue() * -1;
198
+ }
199
  }
200
 
201
  $timestamp = strtotime($quote->getUpdatedAt());
306
  public function syncCustomer (Varien_Event_Observer $observer) {
307
  // Mage::log($observer);
308
  }
309
+
310
+ public function getTracker($quote) {
311
+ $store_id = $quote->getStoreId();
312
+
313
+ foreach($this->tracker_cache as $id => $tracker){
314
+ if($id == $store_id){
315
+ return $tracker;
316
+ }
317
+ }
318
+
319
+ $website_id = Mage::getModel('core/store')->load($store_id)->getWebsiteId();
320
+ $public_api_key = Mage::helper('klaviyo_reclaim')->getPublicApiKey($website_id);
321
+
322
+ if(!$public_api_key){
323
+ return NULL;
324
+ }
325
+
326
+ $tracker = new Klaviyo_Reclaim_Model_Tracker($public_api_key);
327
+ $this->tracker_cache[$store_id] = $tracker;
328
+
329
+ return $tracker;
330
+ }
331
  }
app/code/community/Klaviyo/Reclaim/controllers/IndexController.php CHANGED
@@ -8,6 +8,9 @@
8
 
9
  class Klaviyo_Reclaim_IndexController extends Mage_Core_Controller_Front_Action
10
  {
 
 
 
11
  /**
12
  * Pre dispatch action that allows to redirect to no route page in case of disabled extension through Admin panel
13
  */
@@ -26,7 +29,8 @@ class Klaviyo_Reclaim_IndexController extends Mage_Core_Controller_Front_Action
26
  */
27
  public function viewAction()
28
  {
29
- $checkout_id = $this->getRequest()->getParam('id');
 
30
 
31
  if ($checkout_id) {
32
  $checkout = Mage::getModel('klaviyo_reclaim/checkout');
@@ -35,28 +39,25 @@ class Klaviyo_Reclaim_IndexController extends Mage_Core_Controller_Front_Action
35
  if ($checkout->getId()) {
36
  $saved_quote = Mage::getModel('sales/quote');
37
  $saved_quote->load($checkout->getQuoteId());
38
-
39
  $cart = Mage::getSingleton('checkout/cart');
40
 
41
  if ($saved_quote->getId() != $cart->getQuote()->getId() && !$cart->getItemsCount()) {
42
- foreach ($saved_quote->getItemsCollection() as $quote_item) {
43
- $quote_item_product = Mage::getModel('catalog/product')->load($quote_item->getProduct()->getId());
44
-
45
- // Don't add configurable products for now.
46
- if ($quote_item_product->isConfigurable()) {
47
- continue;
48
- }
49
-
50
- if ($quote_item_product->getId()) {
51
- $cart->addProduct($quote_item_product, $quote_item->getQty());
52
- $cart->save();
53
- }
54
- }
55
  }
56
  }
57
  }
58
 
59
- $this->_redirectUrl(Mage::getUrl('checkout/cart'));
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  /**
@@ -111,7 +112,7 @@ class Klaviyo_Reclaim_IndexController extends Mage_Core_Controller_Front_Action
111
 
112
  $is_cron_running = Mage::getModel('cron/schedule')->getCollection()
113
  ->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_SUCCESS)
114
- ->addFieldToFilter('finished_at', $hour_ago)
115
  ->count() > 0;
116
 
117
  $has_reclaim_entries = Mage::getModel('klaviyo_reclaim/checkout')->getCollection()->count() > 0;
8
 
9
  class Klaviyo_Reclaim_IndexController extends Mage_Core_Controller_Front_Action
10
  {
11
+
12
+ private static $_preservableRequestParams = array('utm_medium', 'utm_source', 'utm_campaign', 'utm_term');
13
+
14
  /**
15
  * Pre dispatch action that allows to redirect to no route page in case of disabled extension through Admin panel
16
  */
29
  */
30
  public function viewAction()
31
  {
32
+ $request = $this->getRequest();
33
+ $checkout_id = $request->getParam('id');
34
 
35
  if ($checkout_id) {
36
  $checkout = Mage::getModel('klaviyo_reclaim/checkout');
39
  if ($checkout->getId()) {
40
  $saved_quote = Mage::getModel('sales/quote');
41
  $saved_quote->load($checkout->getQuoteId());
 
42
  $cart = Mage::getSingleton('checkout/cart');
43
 
44
  if ($saved_quote->getId() != $cart->getQuote()->getId() && !$cart->getItemsCount()) {
45
+ $cart->getQuote()->load($checkout->getQuoteId());
46
+ $cart->save();
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
  }
49
  }
50
 
51
+ $params = array();
52
+ foreach (self::$_preservableRequestParams as $key) {
53
+ $value = $this->getRequest()->getParam($key);
54
+
55
+ if ($value) {
56
+ $params[$key] = $value;
57
+ }
58
+ }
59
+
60
+ $this->_redirectUrl(Mage::getUrl('checkout/cart', array('_query' => $params)));
61
  }
62
 
63
  /**
112
 
113
  $is_cron_running = Mage::getModel('cron/schedule')->getCollection()
114
  ->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_SUCCESS)
115
+ ->addFieldToFilter('finished_at', array('gteq' => $hour_ago))
116
  ->count() > 0;
117
 
118
  $has_reclaim_entries = Mage::getModel('klaviyo_reclaim/checkout')->getCollection()->count() > 0;
app/code/community/Klaviyo/Reclaim/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Klaviyo_Reclaim>
5
- <version>1.2.4</version>
6
  </Klaviyo_Reclaim>
7
  </modules>
8
  <global>
@@ -68,7 +68,7 @@
68
  </klaviyo_reclaim_setup>
69
  </resources>
70
  </global>
71
-
72
  <adminhtml>
73
  <layout>
74
  <updates>
2
  <config>
3
  <modules>
4
  <Klaviyo_Reclaim>
5
+ <version>1.3.5</version>
6
  </Klaviyo_Reclaim>
7
  </modules>
8
  <global>
68
  </klaviyo_reclaim_setup>
69
  </resources>
70
  </global>
71
+
72
  <adminhtml>
73
  <layout>
74
  <updates>
app/design/adminhtml/base/default/template/klaviyoreclaim/system/config/fieldset/info.phtml CHANGED
@@ -3,7 +3,27 @@
3
  * @see Klaviyo_Reclaim_Block_Adminhtml_System_Config_Fieldset_Hint
4
  */
5
  ?>
6
- <div class="klaviyo_reclaim_info">
7
  <h4>Klaviyo for Magento v<?php echo $this->getKlaviyoVersion(); ?>.</h4>
8
- <p>For instructions on configuring Klaviyo, visit the <a href="http://docs.klaviyo.com/" target="_blank">Klaviyo docs</a>.</p>
9
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * @see Klaviyo_Reclaim_Block_Adminhtml_System_Config_Fieldset_Hint
4
  */
5
  ?>
6
+ <div class="klaviyo_reclaim">
7
  <h4>Klaviyo for Magento v<?php echo $this->getKlaviyoVersion(); ?>.</h4>
8
+ <p>For instructions on configuring Klaviyo, visit the <a href="http://learn.klaviyo.com/12888-magento-integration" target="_blank">Magento getting started guide</a>.</p>
9
+ </div>
10
+
11
+ <?php $status_key = $this->getKlaviyoExtensionStatus(); ?>
12
+
13
+ <?php if($status_key[0]) : ?>
14
+
15
+ <div class="klaviyo_reclaim klaviyo_reclaim_error">
16
+ <ul>
17
+ <?php if(!$status_key[1]) : ?>
18
+ <li>Please enter your Klaviyo API keys.</li>
19
+ <?php endif; ?>
20
+ <?php if(!$status_key[2]) : ?>
21
+ <li>Magento's cron jobs need to be enabled. Follow this guide for information on enabling them: <a href="http://learn.klaviyo.com/12888-magento-integration/set-up-magento-cron-job" target="_blank">How to Set Up a Magento Cron Job</a></li>
22
+ <?php endif; ?>
23
+ <?php if(!$status_key[3]) : ?>
24
+ <li>There are no entries in the klaviyo_reclaim_checkout table. If you've set up cron jobs and are still seeing this message, email <a href="mailto:success@klaviyo.com">success@klaviyo.com</a></li>
25
+ <?php endif; ?>
26
+ </ul>
27
+ </div>
28
+
29
+ <?php endif; ?>
app/design/frontend/base/default/layout/klaviyoreclaim.xml CHANGED
@@ -2,12 +2,12 @@
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="before_body_end">
5
- <block type="klaviyo_reclaim/tracking_default" name="klaviyo_reclaim.tracking_default" template="klaviyoreclaim/tracking/default.phtml" />
6
  </reference>
7
  </default>
8
  <catalog_product_view>
9
  <reference name="before_body_end">
10
- <block type="klaviyo_reclaim/tracking_product" name="klaviyo_reclaim.tracking_product" template="klaviyoreclaim/tracking/product.phtml" />
11
  </reference>
12
  </catalog_product_view>
13
  <onestepcheckout_index_index>
@@ -15,4 +15,29 @@
15
  <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
16
  </reference>
17
  </onestepcheckout_index_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </layout>
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="before_body_end">
5
+ <block type="klaviyo_reclaim/tracking_default" name="klaviyo_reclaim.tracking_default" template="klaviyoreclaim/tracking/default.phtml" />
6
  </reference>
7
  </default>
8
  <catalog_product_view>
9
  <reference name="before_body_end">
10
+ <block type="klaviyo_reclaim/tracking_product" name="klaviyo_reclaim.tracking_product" template="klaviyoreclaim/tracking/product.phtml" />
11
  </reference>
12
  </catalog_product_view>
13
  <onestepcheckout_index_index>
15
  <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
16
  </reference>
17
  </onestepcheckout_index_index>
18
+ <lotusbreath_onestepcheckout_index_index>
19
+ <reference name="before_body_end">
20
+ <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
21
+ </reference>
22
+ </lotusbreath_onestepcheckout_index_index>
23
+ <checkout_onepage_index>
24
+ <reference name="before_body_end">
25
+ <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
26
+ </reference>
27
+ </checkout_onepage_index>
28
+ <supercheckout_index_index>
29
+ <reference name="before_body_end">
30
+ <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
31
+ </reference>
32
+ </supercheckout_index_index>
33
+ <amscheckout_onepage_index>
34
+ <reference name="before_body_end">
35
+ <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
36
+ </reference>
37
+ </amscheckout_onepage_index>
38
+ <fancycheckout_index_index>
39
+ <reference name="before_body_end">
40
+ <block type="klaviyo_reclaim/checkout_monitor" name="klaviyo_reclaim.checkout_monitor" template="klaviyoreclaim/checkout/monitor.phtml" />
41
+ </reference>
42
+ </fancycheckout_index_index>
43
  </layout>
app/design/frontend/base/default/template/klaviyoreclaim/tracking/product.phtml CHANGED
@@ -1,10 +1,23 @@
1
- <?php $_product = $this->getProduct(); ?>
 
 
 
 
 
 
 
 
 
 
 
2
  <script text="text/javascript">
3
  var _learnq = _learnq || [];
4
 
5
  _learnq.push(['track', 'Viewed Product', {
6
  Name: "<?php echo $_product->getName(); ?>",
7
  SKU: "<?php echo $_product->getSku(); ?>",
 
 
8
  Categories: <?php echo $this->getProductCategoriesAsJson(); ?>
9
  }]);
10
  </script>
1
+ <?php
2
+ $_product = $this->getProduct();
3
+ $_product_image_url = NULL;
4
+
5
+ // Check to see if we have an image for this product.
6
+ foreach ($_product->getMediaGalleryImages() as $_product_image) {
7
+ if (!$_product_image->getDisabled()) {
8
+ $_product_image_url = $_product_image->getUrl();
9
+ break;
10
+ }
11
+ }
12
+ ?>
13
  <script text="text/javascript">
14
  var _learnq = _learnq || [];
15
 
16
  _learnq.push(['track', 'Viewed Product', {
17
  Name: "<?php echo $_product->getName(); ?>",
18
  SKU: "<?php echo $_product->getSku(); ?>",
19
+ Url: "<?php echo $_product->getProductUrl(); ?>",
20
+ <?php if ($_product_image_url) { ?>ImageUrl: "<?php echo $_product_image_url; ?>", <?php } ?>
21
  Categories: <?php echo $this->getProductCategoriesAsJson(); ?>
22
  }]);
23
  </script>
package.xml CHANGED
@@ -1,27 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Klaviyo_Reclaim</name>
4
- <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>A Magento connector for Klaviyo eCommerce.</summary>
10
  <description>With this extension, you can:&#xD;
11
- &#xD;
12
- - Import newsletter subscribers to a Klaviyo list.&#xD;
13
- - Track checkouts and send abandoned cart emails.&#xD;
14
- - Track site visitors and what products they look at to personalize email campaigns.&#xD;
15
- &#xD;
16
- Additionally, Klaviyo tracks sales data using Magento's built-in API.&#xD;
17
- &#xD;
18
- This extension is supports all Magento versions 1.5 and later.</description>
19
- <notes>- Include the Klaviyo analytics script to track visits and product views.&#xD;
20
- - Add the ability to handle abandoned carts for one step checkouts (one page checkouts were already supported).</notes>
21
  <authors><author><name>Klaviyo Team</name><user>klaviyo</user><email>support@klaviyo.com</email></author></authors>
22
- <date>2014-02-21</date>
23
- <time>15:33:42</time>
24
- <contents><target name="magecommunity"><dir name="Klaviyo"><dir name="Reclaim"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Info.php" hash="161e26574da0f5e6977c804a5c446e72"/></dir></dir></dir></dir><dir name="Checkout"><file name="Monitor.php" hash="79992befa61467274ebbd280745d55ab"/></dir><dir name="Tracking"><file name="Default.php" hash="1ebce8bc5e151135e6b505b161a8a756"/><file name="Product.php" hash="905acae51c2e6a425b781a64dc3a3e8e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="63d068227acaea55ab20fdd092f326b9"/></dir><dir name="Model"><file name="Api.php" hash="782494bae6890e94da6c8e595773ab6e"/><file name="Checkout.php" hash="482b26c7e4e882d15634e660415a4d65"/><file name="KlaviyoApi.php" hash="1a9253011e39b1c3c806e8ba76de69d2"/><dir name="Mysql4"><dir name="Checkout"><file name="Collection.php" hash="6c85e812ce3f3e4a341df4c7549a7e7f"/></dir><file name="Checkout.php" hash="8e3399cf5bf95f8aaf1e369ed95a0456"/></dir><file name="Observer.php" hash="7a2fd504e43f6ed6e3acb12dfa071625"/><file name="PublicApiKey.php" hash="dd78ea7d5ea0a25b0c8db2e7c7887a40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="List.php" hash="44bb20b48631d4b193f46037fd9a5d91"/></dir></dir></dir><file name="Tracker.php" hash="0516ed9923d608a8d3b84636e1ba6bb2"/></dir><dir name="controllers"><file name="IndexController.php" hash="9387b608e253391e0a2ae34732694d50"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50fb6bd76e5945412049be9798282eaf"/><file name="config.xml" hash="02bf1a70e3a3a0c53a8133dee2c497e5"/><file name="system.xml" hash="6c708e11f6f3242f44b07b08690df94d"/></dir><dir name="sql"><dir name="klaviyo_reclaim_setup"><file name="mysql4-install-1.0.5.php" hash="d6479ff37d54bd011270370c7c74e975"/></dir></dir></dir><file name=".DS_Store" hash="fd37e47a3ce76622c71674662d70d3c5"/></dir></target><target name="mageetc"><dir name="modules"><file name="Klaviyo_Reclaim.xml" hash="97fa1624141df9065e240fd12dd49f2c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="klaviyoreclaim.xml" hash="dd011e4784e80626f4b4aae75deadf11"/></dir><dir name="template"><dir name="klaviyoreclaim"><dir name="checkout"><file name="monitor.phtml" hash="4ed26697dcc4a979345e7fc8835e033c"/></dir><dir name="tracking"><file name="default.phtml" hash="0985dab82f9290d3693298e51fd36745"/><file name="product.phtml" hash="2c16d65749a47e615431182af55e6d1a"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="klaviyoreclaim.xml" hash="51b3a3d783921a4e455c141b4a18e7ec"/></dir><dir name="template"><dir name="klaviyoreclaim"><dir name="system"><dir name="config"><dir name="fieldset"><file name="info.phtml" hash="1de767f117df29bc78fc8c904331d134"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="klaviyoreclaim"><file name="klaviyoreclaim.css" hash="b004cd5863d937c97585ba529e58e43c"/></dir></dir></dir></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Klaviyo_Reclaim</name>
4
+ <version>1.3.5</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>A Magento extension to connect to the Klaviyo email marketing platform.</summary>
10
  <description>With this extension, you can:&#xD;
11
+ - Import newsletter subscribers to a Klaviyo list.&#xD;
12
+ - Track checkouts and send abandoned cart emails.&#xD;
13
+ - Track site visitors and what products they look at to personalize email campaigns.&#xD;
14
+ Additionally, Klaviyo tracks sales data using Magento's built-in API.&#xD;
15
+ This extension is supports all Magento versions 1.5 and later.</description>
16
+ <notes>Add cron job monitoring to extension page.</notes>
 
 
 
 
17
  <authors><author><name>Klaviyo Team</name><user>klaviyo</user><email>support@klaviyo.com</email></author></authors>
18
+ <date>2016-03-28</date>
19
+ <time>14:23:12</time>
20
+ <contents><target name="magecommunity"><dir name="Klaviyo"><dir name="Reclaim"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Info.php" hash="a38325604653158f97cd4d98733a69ba"/></dir></dir></dir></dir><dir name="Checkout"><file name="Monitor.php" hash="79992befa61467274ebbd280745d55ab"/></dir><dir name="Tracking"><file name="Default.php" hash="1ebce8bc5e151135e6b505b161a8a756"/><file name="Product.php" hash="905acae51c2e6a425b781a64dc3a3e8e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e0518247bbdccb8350bca77b64968d23"/></dir><dir name="Model"><file name="Api.php" hash="a121792d153c2e6545c825d366451429"/><file name="Checkout.php" hash="482b26c7e4e882d15634e660415a4d65"/><file name="KlaviyoApi.php" hash="8c6b650058fabc2864793ab164b360c1"/><dir name="Mysql4"><dir name="Checkout"><file name="Collection.php" hash="6c85e812ce3f3e4a341df4c7549a7e7f"/></dir><file name="Checkout.php" hash="8e3399cf5bf95f8aaf1e369ed95a0456"/></dir><file name="Observer.php" hash="0c59d1423db59a618de61f9816ec88df"/><file name="PublicApiKey.php" hash="dd78ea7d5ea0a25b0c8db2e7c7887a40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="List.php" hash="44bb20b48631d4b193f46037fd9a5d91"/></dir></dir></dir><file name="Tracker.php" hash="0516ed9923d608a8d3b84636e1ba6bb2"/></dir><dir name="controllers"><file name="IndexController.php" hash="4006484d2bbedf9480af3767ff7c11af"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50fb6bd76e5945412049be9798282eaf"/><file name="config.xml" hash="d0fb11557248073057914548afefce92"/><file name="system.xml" hash="6c708e11f6f3242f44b07b08690df94d"/></dir><dir name="sql"><dir name="klaviyo_reclaim_setup"><file name="mysql4-install-1.0.5.php" hash="d6479ff37d54bd011270370c7c74e975"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="klaviyoreclaim.xml" hash="51b3a3d783921a4e455c141b4a18e7ec"/></dir><dir name="template"><dir name="klaviyoreclaim"><dir name="system"><dir name="config"><dir name="fieldset"><file name="info.phtml" hash="9b972d85ac2e4e5c6d0fada6708b3a4b"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="klaviyoreclaim.xml" hash="3916ca3377e6965babeba8b3e7af3ba1"/></dir><dir name="template"><dir name="klaviyoreclaim"><dir name="checkout"><file name="monitor.phtml" hash="4ed26697dcc4a979345e7fc8835e033c"/></dir><dir name="tracking"><file name="default.phtml" hash="0985dab82f9290d3693298e51fd36745"/><file name="product.phtml" hash="8830831b94ef55f6e22032ed784e0d77"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Klaviyo_Reclaim.xml" hash="97fa1624141df9065e240fd12dd49f2c"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="klaviyoreclaim"><file name="klaviyoreclaim.css" hash="c12f3281cac2d53b181dfcb7da53f278"/></dir></dir></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
skin/adminhtml/base/default/klaviyoreclaim/klaviyoreclaim.css CHANGED
@@ -1,18 +1,42 @@
1
- .klaviyo_reclaim_info {
2
- background: #fafafc;
3
- border: solid 1px #ccc;
4
- margin-bottom: 10px;
5
- padding: 8px;
 
 
 
 
6
  }
7
 
8
- .klaviyo_reclaim_info h4 {
9
- font-size: 15px;
10
  line-height: 18px;
11
  margin: 0 0 2px;
12
- color: #1f5f95;
13
  }
14
 
15
- .klaviyo_reclaim_info p {
16
  margin: 0;
17
- color: #666;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
1
+ .klaviyo_reclaim {
2
+ padding: 1em;
3
+ margin: 1em 0;
4
+ border: 0 solid #eee;
5
+ border-left-width: 5px;
6
+ border-radius: 0;
7
+ background-color: #f1f9f1;
8
+ border-left-color: #50b550;
9
+ color: #50b550;
10
  }
11
 
12
+ .klaviyo_reclaim h4 {
13
+ font-size: 18px;
14
  line-height: 18px;
15
  margin: 0 0 2px;
 
16
  }
17
 
18
+ .klaviyo_reclaim p {
19
  margin: 0;
20
+ }
21
+
22
+ .klaviyo_reclaim a {
23
+ color: #50b550;
24
+ text-decoration: underline;
25
+ font-weight: bold;
26
+ }
27
+
28
+ .klaviyo_reclaim li {
29
+ list-style-type: circle;
30
+ list-style-position: inside;
31
+ }
32
+
33
+ .klaviyo_reclaim.klaviyo_reclaim_error {
34
+ background: rgba(231,76,60,.8);
35
+ border-color: rgba(231,76,60,.9);
36
+ text-shadow: 0 -1px 0 rgba(51,51,51,.2);
37
+ color: #fff;
38
+ }
39
+
40
+ .klaviyo_reclaim.klaviyo_reclaim_error a {
41
+ color: #fff;
42
  }