recapture - Version 1.0.9.5

Version Notes

Added version tracking, better product and user data tracking.

Download this release

Release Info

Developer David Webber
Extension recapture
Version 1.0.9.5
Comparing to
See all releases


Code changes from version 1.0.9.4 to 1.0.9.5

app/code/local/Recapture/Connector/Helper/Data.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
4
 
 
 
5
  public function isEnabled(){
6
 
7
  return Mage::getStoreConfig('recapture/configuration/enabled');
@@ -16,8 +18,11 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
16
 
17
  public function getScopeStoreId(){
18
 
19
- $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
20
- $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
 
 
 
21
 
22
  if (!$website && !$store) return '0';
23
 
@@ -30,8 +35,11 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
30
 
31
  public function getCurrentScope(){
32
 
33
- $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
34
- $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
 
 
 
35
 
36
  if (!$website && !$store) return 'default';
37
 
@@ -42,8 +50,11 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
42
 
43
  public function getScopeForUrl(){
44
 
45
- $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
46
- $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
 
 
 
47
 
48
  if (!$website && !$store) return array();
49
 
@@ -54,8 +65,11 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
54
 
55
  public function getCurrentScopeId(){
56
 
57
- $website = Mage::app()->getRequest()->getParam('website') ? Mage::app()->getRequest()->getParam('website') : Mage::getSingleton('adminhtml/config_data')->getWebsite();
58
- $store = Mage::app()->getRequest()->getParam('store') ? Mage::app()->getRequest()->getParam('store') : Mage::getSingleton('adminhtml/config_data')->getStore();
 
 
 
59
 
60
  if (!$website && !$store) return 0;
61
 
@@ -100,4 +114,88 @@ class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
100
 
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
2
 
3
  class Recapture_Connector_Helper_Data extends Mage_Core_Helper_Abstract {
4
 
5
+ private $_registry = array();
6
+
7
  public function isEnabled(){
8
 
9
  return Mage::getStoreConfig('recapture/configuration/enabled');
18
 
19
  public function getScopeStoreId(){
20
 
21
+ $website = Mage::app()->getRequest()->getParam('website');
22
+ $website = !empty($website) ? $website : Mage::getSingleton('adminhtml/config_data')->getWebsite();
23
+
24
+ $store = Mage::app()->getRequest()->getParam('store');
25
+ $store = !empty($store) ? $store : Mage::getSingleton('adminhtml/config_data')->getStore();
26
 
27
  if (!$website && !$store) return '0';
28
 
35
 
36
  public function getCurrentScope(){
37
 
38
+ $website = Mage::app()->getRequest()->getParam('website');
39
+ $website = !empty($website) ? $website : Mage::getSingleton('adminhtml/config_data')->getWebsite();
40
+
41
+ $store = Mage::app()->getRequest()->getParam('store');
42
+ $store = !empty($store) ? $store : Mage::getSingleton('adminhtml/config_data')->getStore();
43
 
44
  if (!$website && !$store) return 'default';
45
 
50
 
51
  public function getScopeForUrl(){
52
 
53
+ $website = Mage::app()->getRequest()->getParam('website');
54
+ $website = !empty($website) ? $website : Mage::getSingleton('adminhtml/config_data')->getWebsite();
55
+
56
+ $store = Mage::app()->getRequest()->getParam('store');
57
+ $store = !empty($store) ? $store : Mage::getSingleton('adminhtml/config_data')->getStore();
58
 
59
  if (!$website && !$store) return array();
60
 
65
 
66
  public function getCurrentScopeId(){
67
 
68
+ $website = Mage::app()->getRequest()->getParam('website');
69
+ $website = !empty($website) ? $website : Mage::getSingleton('adminhtml/config_data')->getWebsite();
70
+
71
+ $store = Mage::app()->getRequest()->getParam('store');
72
+ $store = !empty($store) ? $store : Mage::getSingleton('adminhtml/config_data')->getStore();
73
 
74
  if (!$website && !$store) return 0;
75
 
114
 
115
  }
116
 
117
+ public function getCustomerFirstname(Mage_Sales_Model_Quote $quote){
118
+
119
+ //we first check the quote model itself
120
+ $customerFirstname = $quote->getCustomerFirstname();
121
+ if (!empty($customerFirstname)) return $customerFirstname;
122
+
123
+ //if not on the quote model, we check the billing address
124
+ $billingAddress = $quote->getBillingAddress();
125
+ if ($billingAddress){
126
+
127
+ $customerFirstname = $billingAddress->getFirstname();
128
+ if (!empty($customerFirstname)) return $customerFirstname;
129
+
130
+ }
131
+
132
+ //if not in the billing address, last resort we check the shipping address
133
+ $shippingAddress = $quote->getShippingAddress();
134
+ if ($shippingAddress){
135
+
136
+ $customerFirstname = $shippingAddress->getFirstname();
137
+ if (!empty($customerFirstname)) return $customerFirstname;
138
+
139
+ }
140
+
141
+ return null;
142
+
143
+ }
144
+
145
+ public function getCustomerLastname(Mage_Sales_Model_Quote $quote){
146
+
147
+ //we first check the quote model itself
148
+ $customerLastname = $quote->getCustomerLastname();
149
+ if (!empty($customerLastname)) return $customerLastname;
150
+
151
+ //if not on the quote model, we check the billing address
152
+ $billingAddress = $quote->getBillingAddress();
153
+ if ($billingAddress){
154
+
155
+ $customerLastname = $billingAddress->getLastname();
156
+ if (!empty($customerLastname)) return $customerLastname;
157
+
158
+ }
159
+
160
+ //if not in the billing address, last resort we check the shipping address
161
+ $shippingAddress = $quote->getShippingAddress();
162
+ if ($shippingAddress){
163
+
164
+ $customerLastname = $shippingAddress->getLastname();
165
+ if (!empty($customerLastname)) return $customerLastname;
166
+
167
+ }
168
+
169
+ return null;
170
+
171
+ }
172
+
173
+ public function getCustomerEmail(Mage_Sales_Model_Quote $quote){
174
+
175
+ //we first check the quote model itself
176
+ $customerEmail = $quote->getCustomerEmail();
177
+ if (!empty($customerEmail)) return $customerEmail;
178
+
179
+ //if not on the quote model, we check the billing address
180
+ $billingAddress = $quote->getBillingAddress();
181
+ if ($billingAddress){
182
+
183
+ $customerEmail = $billingAddress->getEmail();
184
+ if (!empty($customerEmail)) return $customerEmail;
185
+
186
+ }
187
+
188
+ //if not in the billing address, last resort we check the shipping address
189
+ $shippingAddress = $quote->getShippingAddress();
190
+ if ($shippingAddress){
191
+
192
+ $customerEmail = $shippingAddress->getEmail();
193
+ if (!empty($customerEmail)) return $customerEmail;
194
+
195
+ }
196
+
197
+ return null;
198
+
199
+ }
200
+
201
  }
app/code/local/Recapture/Connector/Model/Observer.php CHANGED
@@ -31,9 +31,9 @@ class Recapture_Connector_Model_Observer {
31
  $storeId = Mage::app()->getStore();
32
 
33
  $transportData = array(
34
- 'first_name' => $quote->getCustomerFirstname(),
35
- 'last_name' => $quote->getCustomerLastname(),
36
- 'email' => $quote->getCustomerEmail(),
37
  'external_id' => $quote->getId(),
38
  'grand_total' => $quote->getGrandTotal(),
39
  'products' => array(),
@@ -46,8 +46,10 @@ class Recapture_Connector_Model_Observer {
46
 
47
  $productModel = $item->getProduct();
48
 
49
- $rawImage = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productModel->getId(), 'thumbnail', $storeId);
50
- $productImage = $mediaConfig->getMediaUrl($rawImage);
 
 
51
 
52
  //check configurable first
53
  if ($item->getProductType() == 'configurable'){
@@ -72,11 +74,18 @@ class Recapture_Connector_Model_Observer {
72
  $parent = $options['super_product_config']['product_id'];
73
  $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($parent, 'thumbnail', $storeId);
74
 
75
- $productImage = $mediaConfig->getMediaUrl($image);
76
 
77
  }
78
  }
79
 
 
 
 
 
 
 
 
80
  $optionsHelper = Mage::helper('catalog/product_configuration');
81
 
82
  if ($item->getProductType() == 'configurable'){
31
  $storeId = Mage::app()->getStore();
32
 
33
  $transportData = array(
34
+ 'first_name' => Mage::helper('recapture')->getCustomerFirstname($quote),
35
+ 'last_name' => Mage::helper('recapture')->getCustomerLastname($quote),
36
+ 'email' => Mage::helper('recapture')->getCustomerEmail($quote),
37
  'external_id' => $quote->getId(),
38
  'grand_total' => $quote->getGrandTotal(),
39
  'products' => array(),
46
 
47
  $productModel = $item->getProduct();
48
 
49
+ $productImage = false;
50
+
51
+ $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productModel->getId(), 'thumbnail', $storeId);
52
+ if ($image && $image != 'no_selection') $productImage = $mediaConfig->getMediaUrl($image);
53
 
54
  //check configurable first
55
  if ($item->getProductType() == 'configurable'){
74
  $parent = $options['super_product_config']['product_id'];
75
  $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($parent, 'thumbnail', $storeId);
76
 
77
+ if ($image && $image != 'no_selection') $productImage = $mediaConfig->getMediaUrl($image);
78
 
79
  }
80
  }
81
 
82
+ //if after all that, we still don't have a product image, we get the placeholder image
83
+ if (!$productImage) {
84
+
85
+ $productImage = $mediaConfig->getMediaUrl('placeholder/' . Mage::getStoreConfig("catalog/placeholder/image_placeholder"));
86
+
87
+ }
88
+
89
  $optionsHelper = Mage::helper('catalog/product_configuration');
90
 
91
  if ($item->getProductType() == 'configurable'){
app/code/local/Recapture/Connector/controllers/CartController.php CHANGED
@@ -2,13 +2,6 @@
2
 
3
  class Recapture_Connector_CartController extends Mage_Core_Controller_Front_Action {
4
 
5
- public function testAction(){
6
-
7
- echo 'Api Key: ' . Mage::helper('recapture')->getApiKey() . '<br>';
8
- echo 'Enabled: ' . Mage::getStoreConfig('recapture/configuration/enabled') . '<br>';
9
-
10
- }
11
-
12
  public function indexAction(){
13
 
14
  $helper = Mage::helper('recapture');
2
 
3
  class Recapture_Connector_CartController extends Mage_Core_Controller_Front_Action {
4
 
 
 
 
 
 
 
 
5
  public function indexAction(){
6
 
7
  $helper = Mage::helper('recapture');
app/code/local/Recapture/Connector/controllers/IndexController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Recapture_Connector_IndexController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function versionAction(){
6
+
7
+ $version = (string)Mage::getConfig()->getModuleConfig("Recapture_Connector")->version;
8
+ $response = array('version' => $version);
9
+
10
+ $this->getResponse()->clearHeaders()->setHeader('Content-type','application/json',true);
11
+ $this->getResponse()->setBody(json_encode($response));
12
+
13
+ }
14
+
15
+ }
app/code/local/Recapture/Connector/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Recapture_Connector>
5
- <version>1.0.5</version>
6
  </Recapture_Connector>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Recapture_Connector>
5
+ <version>1.0.9.5</version>
6
  </Recapture_Connector>
7
  </modules>
8
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>recapture</name>
4
- <version>1.0.9.4</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</summary>
10
  <description>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</description>
11
- <notes>Small bug fix.</notes>
12
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
13
- <date>2015-09-29</date>
14
- <time>15:45:51</time>
15
- <contents><target name="magelocal"><dir name="Recapture"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Authenticate.php" hash="2433544256c447f96d1e4b4a823e724a"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="f19858c8bb476b05e7e86cbdce403323"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="0722003698fa2710d58d0d806840f543"/></dir><file name="CartController.php" hash="b1a13eaa32a9d6af551b1b73c1573a0d"/><file name="RecaptureController.php" hash="987215ca928935afc9d4f9ce4fdf670c"/></dir><dir name="etc"><file name="config.xml" hash="972e1b80755b47428392e7ab8224bbd2"/><file name="system.xml" hash="af2ebdfe2b9796f62aa3b956c0e20bd6"/></dir><dir name="Helper"><file name="Data.php" hash="75303b11410e45bca05e1a70b5ef3ab2"/><file name="Transport.php" hash="7bdbdbf7c3cee4841fe7ce42371f5951"/></dir><dir name="Model"><file name="Observer.php" hash="51c6d6796e3353640aefd06cc7183918"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Recapture_Connector.xml" hash="e8fea9dc4237af6b34219c7f52bd02d8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>recapture</name>
4
+ <version>1.0.9.5</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</summary>
10
  <description>Free analytics dashboard for abandoned carts. Set up automated cart recovery email campaigns in minutes.</description>
11
+ <notes>Added version tracking, better product and user data tracking.</notes>
12
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
13
+ <date>2015-10-13</date>
14
+ <time>15:48:42</time>
15
+ <contents><target name="magelocal"><dir name="Recapture"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Authenticate.php" hash="2433544256c447f96d1e4b4a823e724a"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="f19858c8bb476b05e7e86cbdce403323"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="0722003698fa2710d58d0d806840f543"/></dir><file name="CartController.php" hash="dff4d0442ff4101a23c7e506e5317cc7"/><file name="IndexController.php" hash="3b1bb4f397617f696ac89e688c4dc1ae"/><file name="RecaptureController.php" hash="987215ca928935afc9d4f9ce4fdf670c"/></dir><dir name="etc"><file name="config.xml" hash="ca755a4c3d9f435e699960896e7854c8"/><file name="system.xml" hash="af2ebdfe2b9796f62aa3b956c0e20bd6"/></dir><dir name="Helper"><file name="Data.php" hash="f149c1a41c797c9f883255a598d6bf2f"/><file name="Transport.php" hash="7bdbdbf7c3cee4841fe7ce42371f5951"/></dir><dir name="Model"><file name="Observer.php" hash="ebb0d3e134cc115c4849384590b28b1e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Recapture_Connector.xml" hash="e8fea9dc4237af6b34219c7f52bd02d8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>