recapture - Version 1.0.5

Version Notes

Captures correct images for grouped and configurable products.

Added lots more cool data for campaign segmenting.

Download this release

Release Info

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


Code changes from version 1.0.4 to 1.0.5

app/code/local/Recapture/Connector/Model/Observer.php CHANGED
@@ -25,7 +25,12 @@ class Recapture_Connector_Model_Observer {
25
 
26
  Mage::register('recapture_has_posted', true);
27
 
 
 
 
28
  $transportData = array(
 
 
29
  'email' => $quote->getCustomerEmail(),
30
  'external_id' => $quote->getId(),
31
  'grand_total' => $quote->getGrandTotal(),
@@ -37,12 +42,58 @@ class Recapture_Connector_Model_Observer {
37
 
38
  foreach ($cartItems as $item){
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  $product = array(
41
- 'name' => $item->getName(),
42
- 'sku' => $item->getSku(),
43
- 'price' => $item->getPrice(),
44
- 'qty' => $item->getQty(),
45
- 'image' => (string)Mage::helper('catalog/image')->init($item->getProduct(), 'thumbnail')
 
46
  );
47
 
48
  $transportData['products'][] = $product;
25
 
26
  Mage::register('recapture_has_posted', true);
27
 
28
+ $mediaConfig = Mage::getModel('catalog/product_media_config');
29
+ $storeId = Mage::app()->getStore();
30
+
31
  $transportData = array(
32
+ 'first_name' => $quote->getCustomerFirstname(),
33
+ 'last_name' => $quote->getCustomerLastname(),
34
  'email' => $quote->getCustomerEmail(),
35
  'external_id' => $quote->getId(),
36
  'grand_total' => $quote->getGrandTotal(),
42
 
43
  foreach ($cartItems as $item){
44
 
45
+ $productModel = $item->getProduct();
46
+
47
+ $productImage = (string)Mage::helper('catalog/image')->init($productModel, 'thumbnail');
48
+
49
+ //check configurable first
50
+ if ($item->getProductType() == 'configurable'){
51
+
52
+ if (Mage::getStoreConfig('checkout/cart/configurable_product_image') == 'itself'){
53
+
54
+ $child = $productModel->getIdBySku($item->getSku());
55
+
56
+ $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($child, 'thumbnail', $storeId);
57
+
58
+ if ($image) $productImage = $mediaConfig->getMediaUrl($image);
59
+
60
+ }
61
+ }
62
+
63
+ //then check grouped
64
+ if (Mage::getStoreConfig('checkout/cart/grouped_product_image') == 'parent'){
65
+
66
+ $options = $productModel->getTypeInstance(true)->getOrderOptions($productModel);
67
+
68
+ if (isset($options['super_product_config']) && $options['super_product_config']['product_type'] == 'grouped'){
69
+
70
+ $parent = $options['super_product_config']['product_id'];
71
+ $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($parent, 'thumbnail', $storeId);
72
+
73
+ $productImage = $mediaConfig->getMediaUrl($image);
74
+
75
+ }
76
+ }
77
+
78
+ $optionsHelper = Mage::helper('catalog/product_configuration');
79
+
80
+ if ($item->getProductType() == 'configurable'){
81
+
82
+ $visibleOptions = $optionsHelper->getConfigurableOptions($item);
83
+
84
+ } else {
85
+
86
+ $visibleOptions = $optionsHelper->getCustomOptions($item);
87
+
88
+ }
89
+
90
  $product = array(
91
+ 'name' => $item->getName(),
92
+ 'sku' => $item->getSku(),
93
+ 'price' => $item->getPrice(),
94
+ 'qty' => $item->getQty(),
95
+ 'image' => $productImage,
96
+ 'options' => $visibleOptions
97
  );
98
 
99
  $transportData['products'][] = $product;
app/code/local/Recapture/Connector/controllers/CartController.php CHANGED
@@ -12,6 +12,7 @@ class Recapture_Connector_CartController extends Mage_Core_Controller_Front_Acti
12
  public function indexAction(){
13
 
14
  $helper = Mage::helper('recapture');
 
15
 
16
  $hash = $this->getRequest()->getParam('hash');
17
 
12
  public function indexAction(){
13
 
14
  $helper = Mage::helper('recapture');
15
+ if (!$helper->isEnabled() || !$helper->getApiKey()) return $this->_redirect('/');
16
 
17
  $hash = $this->getRequest()->getParam('hash');
18
 
app/code/local/Recapture/Connector/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Recapture_Connector>
5
- <version>1.0.2</version>
6
  </Recapture_Connector>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Recapture_Connector>
5
+ <version>1.0.5</version>
6
  </Recapture_Connector>
7
  </modules>
8
 
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>recapture</name>
4
- <version>1.0.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>Fixed a small issue with authentication.</notes>
 
 
12
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
13
- <date>2015-07-29</date>
14
- <time>00:04:21</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="b4def4c279d801f7e9c327d8ee87c414"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="003133a47fb37e6f522314778eec9632"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="0a55323dc217e54be74c91c4b92b6ecc"/></dir><file name="CartController.php" hash="77b05dabce511b6cd360aaeae79fbe27"/><file name="RecaptureController.php" hash="987215ca928935afc9d4f9ce4fdf670c"/></dir><dir name="etc"><file name="config.xml" hash="50062202cfd4a8262cd001bfb7e4f6f0"/><file name="system.xml" hash="12f5cd5932b919ba61f0cb366f252efc"/></dir><dir name="Helper"><file name="Data.php" hash="a8256fffe350a4bd82ba13a9af8ddd54"/><file name="Transport.php" hash="a13bf58b13e207f5260fe2bdbe86fb5e"/></dir><dir name="Model"><file name="Observer.php" hash="3dbcbfc25944aedb3cc6658c495bb70b"/></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.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>Captures correct images for grouped and configurable products.&#xD;
12
+ &#xD;
13
+ Added lots more cool data for campaign segmenting.</notes>
14
  <authors><author><name>David Webber</name><user>Adstream</user><email>david@adstreaminc.com</email></author></authors>
15
+ <date>2015-07-31</date>
16
+ <time>21:23:01</time>
17
+ <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="b4def4c279d801f7e9c327d8ee87c414"/><file name="Key.php" hash="adf516740c9e1a392fd7f81c4fb1927e"/><file name="Status.php" hash="003133a47fb37e6f522314778eec9632"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthenticateController.php" hash="0a55323dc217e54be74c91c4b92b6ecc"/></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="12f5cd5932b919ba61f0cb366f252efc"/></dir><dir name="Helper"><file name="Data.php" hash="a8256fffe350a4bd82ba13a9af8ddd54"/><file name="Transport.php" hash="a13bf58b13e207f5260fe2bdbe86fb5e"/></dir><dir name="Model"><file name="Observer.php" hash="d092f076cef50c6b9e91a854e32a3cbf"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Recapture_Connector.xml" hash="e8fea9dc4237af6b34219c7f52bd02d8"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>