RecentReviews - Version 1.0.0

Version Notes

RecentReviews

Download this release

Release Info

Developer Cristian Sanclemente
Extension RecentReviews
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/CSL/RecentReviews/Block/Reviews.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CSL_RecentReviews_Block_Reviews
4
+ *
5
+ * @package CSL_RecentReviews
6
+ * @author Cristian Sanclemente <cristian@clickelectrodomesticos.com>
7
+ * @copyright 2014-2015 CSL
8
+ */
9
+ class CSL_RecentReviews_Block_Reviews extends Mage_Core_Block_Template {
10
+
11
+ public function getReviews(){
12
+ return Mage::getModel('recentreviews/reviews')->getReviews();
13
+ }
14
+
15
+ public function getProductImage($id){
16
+ $product = Mage::getModel('catalog/product')->load($id);
17
+ return $product->getImageUrl();
18
+ }
19
+
20
+ public function isenable(){
21
+ if (Mage::getStoreConfig('csl/recentreviews_config/enabled', Mage::app()->getStore()))
22
+ return true;
23
+ return false;
24
+ }
25
+
26
+ }
app/code/community/CSL/RecentReviews/Helper/Data.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CSL_RecentReviews_Helper_Data
4
+ *
5
+ * @package CSL_RecentReviews
6
+ * @author Cristian Sanclemente <cristian@clickelectrodomesticos.com>
7
+ * @copyright 2014-2015 CSL
8
+ */
9
+
10
+ class CSL_RecentReviews_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ }
13
+
app/code/community/CSL/RecentReviews/Model/Reviews.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CSL_RecentReviews_Model_Reviews
4
+ *
5
+ * @package CSL_RecentReviews
6
+ * @author Cristian Sanclemente <cristian@clickelectrodomesticos.com>
7
+ * @copyright 2014-2015 CSL
8
+ */
9
+ Class CSL_RecentReviews_Model_Reviews extends Mage_Core_Model_Abstract{
10
+
11
+ public function getReviews(){
12
+
13
+ $reviews = Mage::getModel('review/review')->getCollection()->setPageSize(Mage::getStoreConfig('csl/recentreviews_config/number', Mage::app()->getStore()));
14
+ $reviews->addStoreFilter( Mage::app()->getStore()->getId() )
15
+ ->addStatusFilter( Mage_Review_Model_Review::STATUS_APPROVED )
16
+ ->setDateOrder()
17
+ ->addRateVotes();
18
+
19
+ return $reviews;
20
+ }
21
+ }
app/code/community/CSL/RecentReviews/controllers/IndexController.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CSL_RecentReviews_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction(){
5
+ $this->loadLayout();
6
+ $this->renderLayout();
7
+ }
8
+
9
+ }
app/code/community/CSL/RecentReviews/etc/config.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <CSL_RecentReviews>
5
+ <version>0.1.0</version>
6
+ </CSL_RecentReviews>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <recentreviews>
11
+ <class>CSL_RecentReviews_Helper</class>
12
+ </recentreviews>
13
+ </helpers>
14
+ <models>
15
+ <recentreviews>
16
+ <class>CSL_RecentReviews_Model</class>
17
+ </recentreviews>
18
+ </models>
19
+ <blocks>
20
+ <recentreviews>
21
+ <class>CSL_RecentReviews_Block</class>
22
+ </recentreviews>
23
+ </blocks>
24
+ </global>
25
+ <frontend>
26
+ <routers>
27
+ <ruta_recentreviews>
28
+ <use>standard</use>
29
+ <args>
30
+ <module>CSL_RecentReviews</module>
31
+ <frontName>recent</frontName>
32
+ </args>
33
+ </ruta_recentreviews>
34
+ </routers>
35
+ <layout>
36
+ <updates>
37
+ <recentreviews>
38
+ <file>recentreviews.xml</file>
39
+ </recentreviews>
40
+ </updates>
41
+ </layout>
42
+ </frontend>
43
+ <adminhtml>
44
+ <acl>
45
+ <resources>
46
+ <all>
47
+ <title>CSL</title>
48
+ </all>
49
+ <admin>
50
+ <children>
51
+ <system>
52
+ <children>
53
+ <config>
54
+ <children>
55
+ <csl>
56
+ <title>CSL - All</title>
57
+ </csl>
58
+ </children>
59
+ </config>
60
+ </children>
61
+ </system>
62
+ </children>
63
+ </admin>
64
+ </resources>
65
+ </acl>
66
+ </adminhtml>
67
+ </config>
app/code/community/CSL/RecentReviews/etc/system.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <csl translate="label" module="recentreviews">
5
+ <label>CSL</label>
6
+ <sort_order>100</sort_order>
7
+ </csl>
8
+ </tabs>
9
+ <sections>
10
+ <csl translate="label" module="recentreviews">
11
+ <label>Reviews</label>
12
+ <tab>csl</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <recentreviews_config translate="label" module="recentreviews">
19
+ <label>Configuration</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1000</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled translate="label">
27
+ <label>Enable reviews: </label>
28
+ <frontend_type>select</frontend_type>
29
+ <sort_order>10</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ </enabled>
35
+ <number translate="label">
36
+ <label>Total of reviews</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>20</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </number>
43
+ <image translate="label">
44
+ <label>Display image: </label>
45
+ <frontend_type>select</frontend_type>
46
+ <sort_order>30</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ </image>
52
+ </fields>
53
+ </recentreviews_config>
54
+ </groups>
55
+ </csl>
56
+ </sections>
57
+ </config>
app/design/frontend/base/default/layout/recentreviews.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <default translate="label">
3
+ <reference name="left">
4
+ <block type="recentreviews/reviews" name="Recent" template="csl/reviews/recent.phtml" />
5
+ </reference>
6
+ </default>
7
+
8
+ <ruta_recentreviews_index_index>
9
+ <reference name="root">
10
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
11
+ </reference>
12
+ </ruta_recentreviews_index_index>
13
+
14
+ </layout>
app/design/frontend/base/default/template/csl/reviews/recent.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Design csl/reviews/recent.phtml
4
+ *
5
+ * @package CSL_RecentReviews
6
+ * @author Cristian Sanclemente <cristian@clickelectrodomesticos.com>
7
+ * @copyright 2014-2015 CSL
8
+ */
9
+ ?>
10
+
11
+
12
+ <?php if ($this->isenable()): ?>
13
+ <?php $r = $this->getReviews() ?>
14
+ <?php if ($r): ?>
15
+ <div class="block block-cart">
16
+ <div class="block-title">
17
+ <b><?php echo "PRODUCT REVIEW'S" ?></b>
18
+ </div>
19
+ <?php foreach ($r as $item): ?>
20
+ <h4><a href="<?php echo $item->getReviewUrl() ?>"><?php echo mb_strtoupper($item->getTitle(), 'utf-8') ?></a></h4>
21
+ <?php $ratingcount = 0;
22
+ $ratingtotal = 0;
23
+ foreach ($item->getRatingVotes() as $_vote):
24
+ $ratingcount++;
25
+ $ratingtotal = $ratingtotal + $_vote->getPercent();
26
+ endforeach;
27
+ $rating_total = $ratingtotal / $ratingcount/20;
28
+ $rating_total_ent = intval($rating_total);
29
+ if ($rating_total - $rating_total_ent == 0)
30
+ $rating_total_literal = number_format($rating_total, 0, ',', '.');
31
+ else
32
+ $rating_total_literal = number_format($rating_total, 1, ',', '.');
33
+ ?>
34
+ <div id="nickname"><?php echo 'Review By <b>' . $item->getNickname() . '</b>' ?></div>
35
+ <div class="ratings-table">
36
+ <div class="rating-box">
37
+ <div title="Global Classification: <?php echo $rating_total_literal ?>" class="rating" style="width: <?php echo round($ratingtotal / $ratingcount); ?>%;"></div>
38
+ </div>
39
+ </div>
40
+ <b><span style="color:#390"><? echo $rating_total_literal; ?></span></b>
41
+ <div style="clear:both"></div>
42
+ <?php if (Mage::getStoreConfig('csl/recentreviews_config/image', Mage::app()->getStore())): ?>
43
+ <?php $img = $this->getProductImage($item->getData('entity_pk_value')) ?>
44
+ <a href="<?php echo $item->getReviewUrl() ?>"><img src="<?php echo $img ?>" width="60px" align="left" style="border:1px solid #CECECE; margin: 5px;" /></a>
45
+ <?php endif; ?>
46
+ <?php echo $item->getDetail() ?>
47
+ <div style="clear:both"></div>
48
+ <?php endforeach; ?>
49
+ </div>
50
+ <?php endif; ?>
51
+ <?php endif; ?>
app/etc/modules/CSL_RecentReviews.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <CSL_RecentReviews>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </CSL_RecentReviews>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>RecentReviews</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Show Recent Product Review's in frontend Magento</summary>
10
+ <description>With RecentReviews you can show your latest product reviews. &#xD;
11
+ &#xD;
12
+ With the extension you can: &#xD;
13
+ &#xD;
14
+ Show the views of the product with your rating.&#xD;
15
+ Choose how many views are shown.&#xD;
16
+ Choose whether to display the product image.&#xD;
17
+ &#xD;
18
+ He also RecentReviews you will help your customers to see quickly what other people think about your products.</description>
19
+ <notes>RecentReviews</notes>
20
+ <authors><author><name>Cristian Sanclemente</name><user>crissanclick</user><email>cristian@clickelectrodomesticos.com</email></author></authors>
21
+ <date>2014-08-08</date>
22
+ <time>08:35:51</time>
23
+ <contents><target name="magecommunity"><dir name="CSL"><dir name="RecentReviews"><dir><dir name="Block"><file name="Reviews.php" hash="a7ebf92244c4428b7460e25dd1d5fe1c"/></dir><dir name="Helper"><file name="Data.php" hash="69d0bbe9f77b5610bea3646b2e473aa8"/></dir><dir name="Model"><file name="Reviews.php" hash="6ae207f0eca59aadb491ab1dee36e071"/></dir><dir name="controllers"><file name="IndexController.php" hash="63bcff115fd60282ba5bbc083e065eb8"/></dir><dir name="etc"><file name="config.xml" hash="dad18525a156689aaa8d4557a7943d22"/><file name="system.xml" hash="0c283b1cca5745c0881769280cdd342e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="csl"><dir><dir name="reviews"><file name="recent.phtml" hash="b829f6ad98e360608073708484dc7944"/></dir></dir></dir></dir><dir name="layout"><file name="recentreviews.xml" hash="09b4138652a56030d810859cdb303702"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CSL_RecentReviews.xml" hash="ed3639a3282e14d4f29303b055bd7e70"/></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
26
+ </package>