reviewscouk_reviews - Version 0.4.0

Version Notes

Improved variation widget handling

Download this release

Release Info

Developer Reviews.co.uk
Extension reviewscouk_reviews
Version 0.4.0
Comparing to
See all releases


Code changes from version 0.3.4 to 0.4.0

app/design/frontend/base/default/layout/reviews_layout.xml CHANGED
@@ -7,4 +7,9 @@
7
  template="reviews/product_reviews_widget.phtml" />
8
  </reference>
9
  </catalog_product_view>
 
 
 
 
 
10
  </layout>
7
  template="reviews/product_reviews_widget.phtml" />
8
  </reference>
9
  </catalog_product_view>
10
+ <default>
11
+ <reference name="footer">
12
+ <block type="core/template" name="unique_name_here" template="reviews/rich_snippet.phtml" />
13
+ </reference>
14
+ </default>
15
  </layout>
app/design/frontend/base/default/template/reviews/.DS_Store ADDED
Binary file
app/design/frontend/base/default/template/reviews/product_reviews_widget.phtml CHANGED
@@ -1,10 +1,27 @@
1
  <?php
2
  $enabled = Mage::getStoreConfig('reviewscouk_reviews_settings/widget/product_widget_enabled', Mage::app()->getStore());
3
- $rich_snippets_enabled = Mage::getStoreConfig('reviewscouk_reviews_settings/rich_snippet/rich_snippet_enabled', Mage::app()->getStore());
4
  $colour = Mage::getStoreConfig('reviewscouk_reviews_settings/widget/product_widget_colour', Mage::app()->getStore());
5
  $store_id = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_store_id', Mage::app()->getStore());
6
  $region = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_region', Mage::app()->getStore());
7
- $sku = Mage::registry('current_product')->getSku();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  $api_url = 'widget.reviews.co.uk';
10
  if ($region == 'US') $api_url = 'widget.review.io';
@@ -14,10 +31,8 @@ if(strpos($colour,'#') === FALSE) $colour = '#'.$colour;
14
 
15
  // checking to see if we hare a valid colour. If not then we change it to reviews default hex colour
16
  if(!preg_match('/^#[a-f0-9]{6}$/i', $colour)) $colour = '#5db11f';
17
-
18
  ?>
19
 
20
-
21
  <!-- Only Display this if enabled -->
22
  <?php if ($enabled): ?>
23
  <script src="https://<?php echo $api_url ?>/product/dist.js"></script>
@@ -25,7 +40,7 @@ if(!preg_match('/^#[a-f0-9]{6}$/i', $colour)) $colour = '#5db11f';
25
  <script type="text/javascript">
26
  productWidget("widget", {
27
  store: '<?php echo $store_id; ?>',
28
- sku: '<?php echo $sku; ?>', // Multiple SKU"s Seperated by Semi-Colons
29
  primaryClr: "<?php echo $colour; ?>",
30
  neutralClr: "#EBEBEB",
31
  buttonClr: "#EEE",
@@ -38,12 +53,3 @@ if(!preg_match('/^#[a-f0-9]{6}$/i', $colour)) $colour = '#5db11f';
38
  });
39
  </script>
40
  <?php endif; ?>
41
-
42
- <?php
43
- if($rich_snippets_enabled):
44
- ?>
45
-
46
- <?php
47
- endif;
48
- ?>
49
-
1
  <?php
2
  $enabled = Mage::getStoreConfig('reviewscouk_reviews_settings/widget/product_widget_enabled', Mage::app()->getStore());
 
3
  $colour = Mage::getStoreConfig('reviewscouk_reviews_settings/widget/product_widget_colour', Mage::app()->getStore());
4
  $store_id = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_store_id', Mage::app()->getStore());
5
  $region = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_region', Mage::app()->getStore());
6
+ $product = Mage::registry('current_product');
7
+ $sku = $product->getSku();
8
+ $type = $product->getTypeID();
9
+
10
+ $productSkus = array($sku);
11
+
12
+ if($type == 'configurable'){
13
+ $usedProducts = $product->getTypeInstance() ->getUsedProducts();
14
+ foreach($usedProducts as $usedProduct){
15
+ $productSkus[] = $usedProduct->getSku();
16
+ }
17
+ }
18
+
19
+ if($type == 'grouped'){
20
+ $usedProducts = $product->getTypeInstance()->getAssociatedProducts();
21
+ foreach($usedProducts as $usedProduct){
22
+ $productSkus[] = $usedProduct->getSku();
23
+ }
24
+ }
25
 
26
  $api_url = 'widget.reviews.co.uk';
27
  if ($region == 'US') $api_url = 'widget.review.io';
31
 
32
  // checking to see if we hare a valid colour. If not then we change it to reviews default hex colour
33
  if(!preg_match('/^#[a-f0-9]{6}$/i', $colour)) $colour = '#5db11f';
 
34
  ?>
35
 
 
36
  <!-- Only Display this if enabled -->
37
  <?php if ($enabled): ?>
38
  <script src="https://<?php echo $api_url ?>/product/dist.js"></script>
40
  <script type="text/javascript">
41
  productWidget("widget", {
42
  store: '<?php echo $store_id; ?>',
43
+ sku: '<?php echo implode(';',$productSkus); ?>', // Multiple SKU"s Seperated by Semi-Colons
44
  primaryClr: "<?php echo $colour; ?>",
45
  neutralClr: "#EBEBEB",
46
  buttonClr: "#EEE",
53
  });
54
  </script>
55
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/reviews/rich_snippet.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $enabled = Mage::getStoreConfig('reviewscouk_reviews_settings/rich_snippet/rich_snippet_enabled', Mage::app()->getStore());
3
+ $store_id = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_store_id', Mage::app()->getStore());
4
+ $region = Mage::getStoreConfig('reviewscouk_reviews_settings/api/reviews_region', Mage::app()->getStore());
5
+
6
+ if(Mage::registry('current_product'))
7
+ {
8
+ $sku = Mage::registry('current_product')->getSku();
9
+ }
10
+ else
11
+ {
12
+ $sku = '';
13
+ }
14
+ ?>
15
+ <?php if($enabled) : ?>
16
+ <script src="http://widget.reviews.co.uk/rich-snippet/dist.js"></script>
17
+ <script>
18
+ richSnippet({
19
+ store: '<?php echo $store_id; ?>',
20
+ sku: '<?php echo $sku ?>'
21
+ });
22
+ </script>
23
+ <?php endif ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>reviewscouk_reviews</name>
4
- <version>0.3.4</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Reviews.co.uk Integration Plugin</summary>
10
  <description>Reviews.co.uk Integration Plugin</description>
11
- <notes>- Bugfixes</notes>
12
  <authors><author><name>Reviews.co.uk</name><user>Reviews</user><email>support@reviews.co.uk</email></author></authors>
13
- <date>2015-09-29</date>
14
- <time>14:17:20</time>
15
- <contents><target name="magecommunity"><dir name="Reviewscouk"><dir name="Reviews"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Region.php" hash="65d7d2f061114099282e40a5353dc6a9"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b799266bdb83494aaf103f5a308bd3ee"/></dir><dir name="Model"><file name="Observer.php" hash="6d03f143367bf29478a79e5fd3987e85"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ReviewsController.php" hash="6954cfb11321a561c312a8cfa9617426"/></dir><file name="IndexController.php" hash="7007f3bed91c42e2f128f0c00f65937e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c34c86777be121695f3a73726c51a64a"/><file name="config.xml" hash="4433c04293b6ee55f74e086c978aa71b"/><file name="system.xml" hash="cd2da862ec64731a4b3a8cb9ddce5995"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Reviewscouk_Reviews.xml" hash="347761ff6c475622697073d62f52e014"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="reviews"><file name="dashboard.phtml" hash="925eeb5ee6bee1c7bf973f60008c1f3f"/><file name="export.phtml" hash="ab1225207cd4631941735c9a99594b65"/></dir></dir><dir name="layout"><file name="reviews_admin.xml" hash="3cdd4facfeb240634d81843cae1a5325"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="reviews_layout.xml" hash="dbe6efb46b1b965aefacf71d0dd11e77"/></dir><dir name="template"><dir name="reviews"><file name="product_reviews_widget.phtml" hash="03d4bec6509fdfc41bc937a76a65df36"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>reviewscouk_reviews</name>
4
+ <version>0.4.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Reviews.co.uk Integration Plugin</summary>
10
  <description>Reviews.co.uk Integration Plugin</description>
11
+ <notes>Improved variation widget handling</notes>
12
  <authors><author><name>Reviews.co.uk</name><user>Reviews</user><email>support@reviews.co.uk</email></author></authors>
13
+ <date>2015-11-26</date>
14
+ <time>12:11:04</time>
15
+ <contents><target name="magecommunity"><dir name="Reviewscouk"><dir name="Reviews"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Region.php" hash="65d7d2f061114099282e40a5353dc6a9"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b799266bdb83494aaf103f5a308bd3ee"/></dir><dir name="Model"><file name="Observer.php" hash="6d03f143367bf29478a79e5fd3987e85"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ReviewsController.php" hash="32986fa07e24b272d1ab6864d5ab7027"/></dir><file name="IndexController.php" hash="7007f3bed91c42e2f128f0c00f65937e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c34c86777be121695f3a73726c51a64a"/><file name="config.xml" hash="4433c04293b6ee55f74e086c978aa71b"/><file name="system.xml" hash="5062c2b34061dacf47e14e467dd6a36b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Reviewscouk_Reviews.xml" hash="347761ff6c475622697073d62f52e014"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="reviews"><file name="dashboard.phtml" hash="925eeb5ee6bee1c7bf973f60008c1f3f"/><file name="export.phtml" hash="ab1225207cd4631941735c9a99594b65"/></dir></dir><dir name="layout"><file name="reviews_admin.xml" hash="3cdd4facfeb240634d81843cae1a5325"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="reviews_layout.xml" hash="ade6f7c127b8bca792bbfd75540f4673"/></dir><dir name="template"><dir name="reviews"><file name="product_reviews_widget.phtml" hash="6c6dfecd7c43548b5f39e4f94548dac0"/><file name="rich_snippet.phtml" hash="2206c517987b97153cd903049ac31e4f"/><file name=".DS_Store" hash="4fe84b7db7aa067d7fd4b3ee082e4b2f"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>