Rejoiner - Version 1.1.4

Version Notes

Improved functionality that fetches product images and placeholders.

Download this release

Release Info

Developer Magento Core Team
Extension Rejoiner
Version 1.1.4
Comparing to
See all releases


Code changes from version 1.1.3 to 1.1.4

app/code/community/Rejoiner/Acr/Block/Snippets.php CHANGED
@@ -11,25 +11,59 @@ class Rejoiner_Acr_Block_Snippets extends Mage_Core_Block_Template
11
 
12
  public function getCartItems()
13
  {
 
14
  if ($quote = $this->_getQuote()) {
15
- $items = array();
16
  $mediaUrl = Mage::getBaseUrl('media');
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  foreach ($quote->getAllItems() as $item) {
18
  if ($item->getParentItem()) {
19
  continue;
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  $newItem = array();
22
  $newItem['name'] = htmlspecialchars($item->getName());
23
- $newItem['image_url'] = $mediaUrl . 'catalog/product' . $item->getProduct()->getThumbnail();
24
  $newItem['price'] = (string) $this->_convertPriceToCents($item->getBaseCalculationPrice());
25
  $newItem['product_id'] = (string) $item->getSku();
26
  $newItem['item_qty'] = (string) $item->getQty();
27
  $newItem['qty_price'] = (string) $this->_convertPriceToCents($item->getBaseRowTotal());
28
  $items[] = $newItem;
29
  }
30
- return $items;
31
  }
32
- return '[]';
33
  }
34
 
35
  public function getCartData()
11
 
12
  public function getCartItems()
13
  {
14
+ $items = array();
15
  if ($quote = $this->_getQuote()) {
 
16
  $mediaUrl = Mage::getBaseUrl('media');
17
+ $quoteItems = $quote->getAllItems();
18
+
19
+ $parentToChild = array();
20
+ /** @var Mage_Sales_Model_Quote_Item $item */
21
+ foreach ($quoteItems as $item) {
22
+ /** @var Mage_Sales_Model_Quote_Item $parent */
23
+ if ($parent = $item->getParentItem()) {
24
+ if ($parent->getProductType() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
25
+ $parentToChild[$parent->getId()] = $item;
26
+ }
27
+ }
28
+ }
29
+
30
  foreach ($quote->getAllItems() as $item) {
31
  if ($item->getParentItem()) {
32
  continue;
33
  }
34
+
35
+ $product = $item->getProduct();
36
+ $thumbnail = 'no_selection';
37
+ $imageHelper = Mage::helper('catalog/image');
38
+ // get thumbnail from configurable product
39
+ if ($product->getData('thumbnail') && ($product->getData('thumbnail') != 'no_selection')) {
40
+ $thumbnail = $mediaUrl . 'catalog/product' . $product->getData('thumbnail');
41
+ // or try finding it in the simple one
42
+ } elseif ($item->getProductType() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
43
+ /** @var Mage_Sales_Model_Quote_Item $simpleItem */
44
+ $simpleItem = $parentToChild[$item->getId()];
45
+ $simpleProduct = $simpleItem->getProduct();
46
+ if ($simpleProduct->getData('thumbnail') && ($simpleProduct->getData('thumbnail') != 'no_selection')) {
47
+ $thumbnail = $mediaUrl . 'catalog/product' . $simpleProduct->getData('thumbnail');
48
+ }
49
+ }
50
+ // use placeholder image if nor simple nor configurable products does not have images
51
+ if ($thumbnail == 'no_selection') {
52
+ $imageHelper->init($product, 'thumbnail');
53
+ $thumbnail = Mage::getDesign()->getSkinUrl($imageHelper->getPlaceholder());
54
+ }
55
+
56
  $newItem = array();
57
  $newItem['name'] = htmlspecialchars($item->getName());
58
+ $newItem['image_url'] = $thumbnail;
59
  $newItem['price'] = (string) $this->_convertPriceToCents($item->getBaseCalculationPrice());
60
  $newItem['product_id'] = (string) $item->getSku();
61
  $newItem['item_qty'] = (string) $item->getQty();
62
  $newItem['qty_price'] = (string) $this->_convertPriceToCents($item->getBaseRowTotal());
63
  $items[] = $newItem;
64
  }
 
65
  }
66
+ return $items;
67
  }
68
 
69
  public function getCartData()
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rejoiner</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Rejoiner Cart Abandonment Remarketing</summary>
10
  <description>Minor changes in rejoiner notifications functionality.</description>
11
- <notes>Added compatibility for "One Page Checkout for Magento - Fire Checkout" extension.</notes>
12
  <authors><author><name>Mike</name><user>auto-converted</user><email>mike@rejoiner.com</email></author></authors>
13
- <date>2014-04-15</date>
14
- <time>14:40:15</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash="1aad3601804cead81b6e687dfcb5b83f"/></dir></target><target name="magecommunity"><dir name="Rejoiner"><dir name="Acr"><dir name="Block"><dir name="Adminhtml"><file name="Notification.php" hash="4b4837b59ab85fa886e65be49d511490"/></dir><file name="Snippets.php" hash="e1854b0555146371e75214b9f1b14284"/></dir><dir name="Helper"><file name="Data.php" hash="6bf5f57f4e0c5f394432749d2bafa158"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="1b6a8d728b5fa308b18a222c5981ed52"/></dir></dir></dir><file name="Notification.php" hash="a03d68e9bbaa820ce87557fca9f8f811"/><file name="Observer.php" hash="df2d853ad73acab825dcae806c1e23e1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RejoinerController.php" hash="c2e5fea12a2fc23905d86f119c2baa39"/></dir><file name="AddtocartController.php" hash="9a11506f06aa714dc520ee8cf7a87696"/></dir><dir name="etc"><file name="config.xml" hash="7599dc7571149cb04bc66061590d9207"/><file name="system.xml" hash="7e3be6d652a90327fbb5c6d3d198f5a2"/></dir><dir name="sql"><dir name="rejoiner_setup"><file name="mysql4-install-1.0.0.0.php" hash="8d9a21c9c09fe44c6fe51ddd2106e3e0"/><file name="mysql4-upgrade-1.0.0.0-1.0.1.0.php" hash="36cc70cc6dd37aab7f3c460e0af58d59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="ac5de6f021a440fe3bc1359133406ba7"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="conversion.phtml" hash="13a53b2f28e5f5fa6e0644ea9cf5a6a4"/><file name="email.phtml" hash="05e54d0999953acf865b6a439c4bb6b5"/><file name="tracking.phtml" hash="1fb47f23cd14449a3978c12bb320fdd4"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="3181cf1ca63813a9ce633ed3268659f4"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="3a3872e6434bf7d2ca7fa0edfe6f9726"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="ca059e55cd2380cd1d7af351fa00d9cf"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rejoiner</name>
4
+ <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Rejoiner Cart Abandonment Remarketing</summary>
10
  <description>Minor changes in rejoiner notifications functionality.</description>
11
+ <notes>Improved functionality that fetches product images and placeholders.</notes>
12
  <authors><author><name>Mike</name><user>auto-converted</user><email>mike@rejoiner.com</email></author></authors>
13
+ <date>2014-07-16</date>
14
+ <time>09:12:48</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash="1aad3601804cead81b6e687dfcb5b83f"/></dir></target><target name="magecommunity"><dir name="Rejoiner"><dir name="Acr"><dir name="Block"><dir name="Adminhtml"><file name="Notification.php" hash="4b4837b59ab85fa886e65be49d511490"/></dir><file name="Snippets.php" hash="01213375204319c257a3b11e8a04e735"/></dir><dir name="Helper"><file name="Data.php" hash="6bf5f57f4e0c5f394432749d2bafa158"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="1b6a8d728b5fa308b18a222c5981ed52"/></dir></dir></dir><file name="Notification.php" hash="a03d68e9bbaa820ce87557fca9f8f811"/><file name="Observer.php" hash="df2d853ad73acab825dcae806c1e23e1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RejoinerController.php" hash="c2e5fea12a2fc23905d86f119c2baa39"/></dir><file name="AddtocartController.php" hash="9a11506f06aa714dc520ee8cf7a87696"/></dir><dir name="etc"><file name="config.xml" hash="7599dc7571149cb04bc66061590d9207"/><file name="system.xml" hash="7e3be6d652a90327fbb5c6d3d198f5a2"/></dir><dir name="sql"><dir name="rejoiner_setup"><file name="mysql4-install-1.0.0.0.php" hash="8d9a21c9c09fe44c6fe51ddd2106e3e0"/><file name="mysql4-upgrade-1.0.0.0-1.0.1.0.php" hash="36cc70cc6dd37aab7f3c460e0af58d59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="ac5de6f021a440fe3bc1359133406ba7"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="conversion.phtml" hash="13a53b2f28e5f5fa6e0644ea9cf5a6a4"/><file name="email.phtml" hash="05e54d0999953acf865b6a439c4bb6b5"/><file name="tracking.phtml" hash="1fb47f23cd14449a3978c12bb320fdd4"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="3181cf1ca63813a9ce633ed3268659f4"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="3a3872e6434bf7d2ca7fa0edfe6f9726"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="ca059e55cd2380cd1d7af351fa00d9cf"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>