minewhat - Version 1.0.5

Version Notes

MineWhat magento plugin

Download this release

Release Info

Developer MineWhat Inc.
Extension minewhat
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/design/frontend/base/default/template/minewhat/insights/event/catalog/product/view.phtml CHANGED
@@ -7,33 +7,48 @@
7
  */
8
  ?>
9
  <?php $_product = $this->getCurrentProduct() ?>
 
10
  <?php
11
  $_associated_products = $this->getAssociatedProducts($_product);
12
- $associated_ids = Array();
13
- ?>
14
- <script type="text/mwdata">
15
- //<![CDATA[
16
- var _mwdata = _mwdata || {};
17
-
18
- _mwdata['product'] = {};
19
- _mwdata['product'].id = '<?php echo $_product->getId() ?>';
20
- _mwdata['product'].sku = '<?php echo $_product->getSku() ?>';
21
- _mwdata['product'].cat = '<?php echo json_encode($_product->getCategoryIds()) ?>';
22
- _mwdata['product'].price = '<?php echo $_product->getPrice() ?>';
23
-
24
- <?php if($_associated_products != null): ?>
25
- _mwdata['associated_products'] = [];
26
- <?php endif; ?>
27
 
28
- <?php foreach($_associated_products as $simple_product):
 
 
29
  $product_info = array();
30
  $associated_ids[] = $simple_product->getId();
31
  $product_info['id'] = $simple_product->getId();
32
  $product_info['sku'] = $simple_product->getSku();
33
  $product_info['price'] = $simple_product->getPrice();
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  ?>
35
- _mwdata['associated_products'].push(<?php echo json_encode($product_info) ?>);
36
- <?php endforeach; ?>
37
  //]]>
38
  </script>
39
 
@@ -43,3 +58,4 @@
43
  _mwapi.push(['trackEvent', 'product', '<?php echo $_product->getId() ?>', '<?php echo json_encode($associated_ids) ?>']);
44
  //]]>
45
  </script>
 
7
  */
8
  ?>
9
  <?php $_product = $this->getCurrentProduct() ?>
10
+ <?php if ($_product) { ?>
11
  <?php
12
  $_associated_products = $this->getAssociatedProducts($_product);
13
+ $associated_ids = array();
14
+
15
+ $mwdata = array();
16
+ $mwdata['product'] = array();
17
+ $mwdata['associated_products'] = array();
18
+
19
+ $mwdata['product']['id'] = $_product->getId();
20
+ $mwdata['product']['sku'] = $_product->getSku();
21
+
22
+ $categories = $_product->getCategoryCollection()->addAttributeToSelect('name');
23
+
24
+ $mwdata['product']['cat'] = array();
25
+ foreach($categories as $category) {
26
+ $mwdata['product']['cat'][] = $category->getName();
27
+ }
28
 
29
+ $mwdata['product']['price'] = $_product->getPrice();
30
+
31
+ foreach($_associated_products as $simple_product) {
32
  $product_info = array();
33
  $associated_ids[] = $simple_product->getId();
34
  $product_info['id'] = $simple_product->getId();
35
  $product_info['sku'] = $simple_product->getSku();
36
  $product_info['price'] = $simple_product->getPrice();
37
+ $mwdata['associated_products'][] = $product_info;
38
+ }
39
+
40
+ ?>
41
+ <script type="text/mwdata">
42
+ //<![CDATA[
43
+
44
+ <?php
45
+ try {
46
+ echo json_encode($mwdata);
47
+ } catch(Exception $exception) {
48
+
49
+ }
50
  ?>
51
+
 
52
  //]]>
53
  </script>
54
 
58
  _mwapi.push(['trackEvent', 'product', '<?php echo $_product->getId() ?>', '<?php echo json_encode($associated_ids) ?>']);
59
  //]]>
60
  </script>
61
+ <?php } ?>
app/design/frontend/base/default/template/minewhat/insights/event/checkout/cart/index.phtml CHANGED
@@ -7,11 +7,11 @@
7
  */
8
  ?>
9
  <?php $_product = $this->getProductToShoppingCart() ?>
10
- <?php if ($_product && $_product["id"]): ?>
11
  <script type="text/javascript">
12
  //<![CDATA[
13
  var _mwapi = _mwapi || [];
14
  _mwapi.push(['trackEvent', 'cart', '<?php echo $_product["id"] ?>', '<?php echo $_product["sku"] ?>', '<?php echo json_encode($_product["parentId"]) ?>', '<?php echo json_encode($_product["bundle"]) ?>']);
15
  //]]>
16
  </script>
17
- <?php endif; ?>
7
  */
8
  ?>
9
  <?php $_product = $this->getProductToShoppingCart() ?>
10
+ <?php if ($_product && $_product["id"]) { ?>
11
  <script type="text/javascript">
12
  //<![CDATA[
13
  var _mwapi = _mwapi || [];
14
  _mwapi.push(['trackEvent', 'cart', '<?php echo $_product["id"] ?>', '<?php echo $_product["sku"] ?>', '<?php echo json_encode($_product["parentId"]) ?>', '<?php echo json_encode($_product["bundle"]) ?>']);
15
  //]]>
16
  </script>
17
+ <?php } ?>
app/design/frontend/base/default/template/minewhat/insights/event/checkout/onepage/success.phtml CHANGED
@@ -6,13 +6,13 @@
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  ?>
9
- <?php if (($orderInfo = $this->getOrderInfo())): ?>
10
  <script type="text/javascript">
11
  //<![CDATA[
12
  var _mwapi = _mwapi || [];
13
- <?php foreach ($orderInfo['items'] as $product): ?>
14
  _mwapi.push(['trackEvent', 'buy', '<?php echo $product["id"] ?>', '<?php echo intval($product["qty"]) ?>', '<?php echo $product["sku"] ?>', '<?php echo $product["price"] ?>', '<?php echo json_encode($product["parentId"]) ?>', '<?php echo json_encode($product["bundle"]) ?>']);
15
- <?php endforeach; ?>
16
  //]]>
17
  </script>
18
- <?php endif; ?>
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  ?>
9
+ <?php if (($orderInfo = $this->getOrderInfo())) { ?>
10
  <script type="text/javascript">
11
  //<![CDATA[
12
  var _mwapi = _mwapi || [];
13
+ <?php foreach ($orderInfo['items'] as $product) { ?>
14
  _mwapi.push(['trackEvent', 'buy', '<?php echo $product["id"] ?>', '<?php echo intval($product["qty"]) ?>', '<?php echo $product["sku"] ?>', '<?php echo $product["price"] ?>', '<?php echo json_encode($product["parentId"]) ?>', '<?php echo json_encode($product["bundle"]) ?>']);
15
+ <?php } ?>
16
  //]]>
17
  </script>
18
+ <?php } ?>
app/design/frontend/default/default/template/minewhat/insights/event/catalog/product/view.phtml CHANGED
@@ -7,33 +7,48 @@
7
  */
8
  ?>
9
  <?php $_product = $this->getCurrentProduct() ?>
 
10
  <?php
11
  $_associated_products = $this->getAssociatedProducts($_product);
12
- $associated_ids = Array();
13
- ?>
14
- <script type="text/mwdata">
15
- //<![CDATA[
16
- var _mwdata = _mwdata || {};
17
-
18
- _mwdata['product'] = {};
19
- _mwdata['product'].id = '<?php echo $_product->getId() ?>';
20
- _mwdata['product'].sku = '<?php echo $_product->getSku() ?>';
21
- _mwdata['product'].cat = '<?php echo json_encode($_product->getCategoryIds()) ?>';
22
- _mwdata['product'].price = '<?php echo $_product->getPrice() ?>';
23
-
24
- <?php if($_associated_products != null): ?>
25
- _mwdata['associated_products'] = [];
26
- <?php endif; ?>
27
 
28
- <?php foreach($_associated_products as $simple_product):
 
 
29
  $product_info = array();
30
  $associated_ids[] = $simple_product->getId();
31
  $product_info['id'] = $simple_product->getId();
32
  $product_info['sku'] = $simple_product->getSku();
33
  $product_info['price'] = $simple_product->getPrice();
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  ?>
35
- _mwdata['associated_products'].push(<?php echo json_encode($product_info) ?>);
36
- <?php endforeach; ?>
37
  //]]>
38
  </script>
39
 
@@ -43,3 +58,4 @@
43
  _mwapi.push(['trackEvent', 'product', '<?php echo $_product->getId() ?>', '<?php echo json_encode($associated_ids) ?>']);
44
  //]]>
45
  </script>
 
7
  */
8
  ?>
9
  <?php $_product = $this->getCurrentProduct() ?>
10
+ <?php if ($_product) { ?>
11
  <?php
12
  $_associated_products = $this->getAssociatedProducts($_product);
13
+ $associated_ids = array();
14
+
15
+ $mwdata = array();
16
+ $mwdata['product'] = array();
17
+ $mwdata['associated_products'] = array();
18
+
19
+ $mwdata['product']['id'] = $_product->getId();
20
+ $mwdata['product']['sku'] = $_product->getSku();
21
+
22
+ $categories = $_product->getCategoryCollection()->addAttributeToSelect('name');
23
+
24
+ $mwdata['product']['cat'] = array();
25
+ foreach($categories as $category) {
26
+ $mwdata['product']['cat'][] = $category->getName();
27
+ }
28
 
29
+ $mwdata['product']['price'] = $_product->getPrice();
30
+
31
+ foreach($_associated_products as $simple_product) {
32
  $product_info = array();
33
  $associated_ids[] = $simple_product->getId();
34
  $product_info['id'] = $simple_product->getId();
35
  $product_info['sku'] = $simple_product->getSku();
36
  $product_info['price'] = $simple_product->getPrice();
37
+ $mwdata['associated_products'][] = $product_info;
38
+ }
39
+
40
+ ?>
41
+ <script type="text/mwdata">
42
+ //<![CDATA[
43
+
44
+ <?php
45
+ try {
46
+ echo json_encode($mwdata);
47
+ } catch(Exception $exception) {
48
+
49
+ }
50
  ?>
51
+
 
52
  //]]>
53
  </script>
54
 
58
  _mwapi.push(['trackEvent', 'product', '<?php echo $_product->getId() ?>', '<?php echo json_encode($associated_ids) ?>']);
59
  //]]>
60
  </script>
61
+ <?php } ?>
app/design/frontend/default/default/template/minewhat/insights/event/checkout/cart/index.phtml CHANGED
@@ -7,11 +7,11 @@
7
  */
8
  ?>
9
  <?php $_product = $this->getProductToShoppingCart() ?>
10
- <?php if ($_product && $_product["id"]): ?>
11
  <script type="text/javascript">
12
  //<![CDATA[
13
  var _mwapi = _mwapi || [];
14
  _mwapi.push(['trackEvent', 'cart', '<?php echo $_product["id"] ?>', '<?php echo $_product["sku"] ?>', '<?php echo json_encode($_product["parentId"]) ?>', '<?php echo json_encode($_product["bundle"]) ?>']);
15
  //]]>
16
  </script>
17
- <?php endif; ?>
7
  */
8
  ?>
9
  <?php $_product = $this->getProductToShoppingCart() ?>
10
+ <?php if ($_product && $_product["id"]) { ?>
11
  <script type="text/javascript">
12
  //<![CDATA[
13
  var _mwapi = _mwapi || [];
14
  _mwapi.push(['trackEvent', 'cart', '<?php echo $_product["id"] ?>', '<?php echo $_product["sku"] ?>', '<?php echo json_encode($_product["parentId"]) ?>', '<?php echo json_encode($_product["bundle"]) ?>']);
15
  //]]>
16
  </script>
17
+ <?php } ?>
app/design/frontend/default/default/template/minewhat/insights/event/checkout/onepage/success.phtml CHANGED
@@ -6,13 +6,13 @@
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  ?>
9
- <?php if (($orderInfo = $this->getOrderInfo())): ?>
10
  <script type="text/javascript">
11
  //<![CDATA[
12
  var _mwapi = _mwapi || [];
13
- <?php foreach ($orderInfo['items'] as $product): ?>
14
  _mwapi.push(['trackEvent', 'buy', '<?php echo $product["id"] ?>', '<?php echo intval($product["qty"]) ?>', '<?php echo $product["sku"] ?>', '<?php echo $product["price"] ?>', '<?php echo json_encode($product["parentId"]) ?>', '<?php echo json_encode($product["bundle"]) ?>']);
15
- <?php endforeach; ?>
16
  //]]>
17
  </script>
18
- <?php endif; ?>
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  ?>
9
+ <?php if (($orderInfo = $this->getOrderInfo())) { ?>
10
  <script type="text/javascript">
11
  //<![CDATA[
12
  var _mwapi = _mwapi || [];
13
+ <?php foreach ($orderInfo['items'] as $product) { ?>
14
  _mwapi.push(['trackEvent', 'buy', '<?php echo $product["id"] ?>', '<?php echo intval($product["qty"]) ?>', '<?php echo $product["sku"] ?>', '<?php echo $product["price"] ?>', '<?php echo json_encode($product["parentId"]) ?>', '<?php echo json_encode($product["bundle"]) ?>']);
15
+ <?php } ?>
16
  //]]>
17
  </script>
18
+ <?php } ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>minewhat</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
7
  <channel>community</channel>
@@ -10,8 +10,8 @@
10
  <description>MineWhat Insights</description>
11
  <notes>MineWhat magento plugin</notes>
12
  <authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
13
- <date>2014-03-27</date>
14
- <time>20:10:38</time>
15
  <contents><target name="magecommunity"><dir name="MineWhat"><dir name="Insights"><dir name="Block"><dir name="Base"><file name="Script.php" hash="4af0a2e100d9d33f99125a0a6e64421b"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="e1f3e3e9172a1c42d520f4dd870b54b2"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="fafaf6953262ea2b0bc3092d538c30d1"/></dir><dir name="Onepage"><file name="Success.php" hash="0c314455071a35d765f8447ac7df6a44"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f55be36b0f6e46f0fccd3a2dee670ec3"/></dir><dir name="Model"><file name="Observer.php" hash="509eb21a74d2693e0aa24d7acd039aae"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f1fb655aac4dc7f71cadb6c7a7e816f8"/><file name="config.xml" hash="dfb8144831b6cee45bba4167076eb266"/><file name="system.xml" hash="75d5165628b2b748a985db0aef1e505d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="minewhat_insights.xml" hash="81061e0839af5d4f44ca0e4ae5383ab2"/></dir><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="a6b4ecb06d6c40b402ad619425d4493d"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="4f4f45eb87b55cf2de64188fcac7f13b"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="63393e384b3e8b8f76ccc74fc4db5dec"/></dir><dir name="onepage"><file name="success.phtml" hash="4614dfe802afe6e73b8707b536071912"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="minewhat_insights.xml" hash="81061e0839af5d4f44ca0e4ae5383ab2"/></dir><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="a6b4ecb06d6c40b402ad619425d4493d"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="4f4f45eb87b55cf2de64188fcac7f13b"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="63393e384b3e8b8f76ccc74fc4db5dec"/></dir><dir name="onepage"><file name="success.phtml" hash="4614dfe802afe6e73b8707b536071912"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MineWhat_Insights.xml" hash="8d2f076cbfcc14688ed800f622869d4b"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>minewhat</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
7
  <channel>community</channel>
10
  <description>MineWhat Insights</description>
11
  <notes>MineWhat magento plugin</notes>
12
  <authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
13
+ <date>2014-04-01</date>
14
+ <time>15:10:38</time>
15
  <contents><target name="magecommunity"><dir name="MineWhat"><dir name="Insights"><dir name="Block"><dir name="Base"><file name="Script.php" hash="4af0a2e100d9d33f99125a0a6e64421b"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="e1f3e3e9172a1c42d520f4dd870b54b2"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="fafaf6953262ea2b0bc3092d538c30d1"/></dir><dir name="Onepage"><file name="Success.php" hash="0c314455071a35d765f8447ac7df6a44"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f55be36b0f6e46f0fccd3a2dee670ec3"/></dir><dir name="Model"><file name="Observer.php" hash="509eb21a74d2693e0aa24d7acd039aae"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f1fb655aac4dc7f71cadb6c7a7e816f8"/><file name="config.xml" hash="dfb8144831b6cee45bba4167076eb266"/><file name="system.xml" hash="75d5165628b2b748a985db0aef1e505d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="minewhat_insights.xml" hash="81061e0839af5d4f44ca0e4ae5383ab2"/></dir><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="a6b4ecb06d6c40b402ad619425d4493d"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="4f4f45eb87b55cf2de64188fcac7f13b"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="63393e384b3e8b8f76ccc74fc4db5dec"/></dir><dir name="onepage"><file name="success.phtml" hash="4614dfe802afe6e73b8707b536071912"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="minewhat_insights.xml" hash="81061e0839af5d4f44ca0e4ae5383ab2"/></dir><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="a6b4ecb06d6c40b402ad619425d4493d"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="4f4f45eb87b55cf2de64188fcac7f13b"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="63393e384b3e8b8f76ccc74fc4db5dec"/></dir><dir name="onepage"><file name="success.phtml" hash="4614dfe802afe6e73b8707b536071912"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MineWhat_Insights.xml" hash="8d2f076cbfcc14688ed800f622869d4b"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>