recent-reviews-lite - Version 0.1.0

Version Notes

Stable release

Download this release

Release Info

Developer Développeurs EnvoiMoinsCher.com
Extension recent-reviews-lite
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Orange/RecentReviews/Model/Recentreviews.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Orange_RecentReviews_Model_RecentReviews extends Mage_Core_Model_Abstract
3
+ {
4
+ public function getConfigData($item)
5
+ {
6
+ return Mage::getStoreConfig(sprintf('orange_recentreviews/settings/%s', $item));
7
+ }
8
+ public function isActive()
9
+ {
10
+ return $this->getConfigData('enable');
11
+ }
12
+ public function getTitle()
13
+ {
14
+ return $this->getConfigData('title');
15
+ }
16
+ public function showRatings()
17
+ {
18
+ return $this->getConfigData('show_ratings');
19
+ }
20
+ public function showTitle()
21
+ {
22
+ return $this->getConfigData('showtitle');
23
+ }
24
+ public function limitCharacters()
25
+ {
26
+ return $this->getConfigData('limit_characters');
27
+ }
28
+ public function getReviewUrl($id)
29
+ {
30
+ return Mage::getUrl('review/product/view', array('id'=> $id));
31
+ }
32
+ public function data()
33
+ {
34
+ if($this->getConfigData('count') < 1)
35
+ $_limit = 0;
36
+ else
37
+ $_limit = $this->getConfigData('count');
38
+
39
+ $_reviews = Mage::getModel('review/review')->getCollection()
40
+ ->addStoreFilter(Mage::app()->getStore()->getId())
41
+ ->addStatusFilter('approved')
42
+ ->setPageSize($_limit)
43
+ ->setDateOrder()
44
+ ->addRateVotes()
45
+ ->load();
46
+ return $_reviews;
47
+ }
48
+ }
app/code/community/Orange/RecentReviews/etc/config.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Orange_RecentReviews>
5
+ <version>0.1.0</version>
6
+ </Orange_RecentReviews>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <recentreviews>
12
+ <file>orange_recent_reviews.xml</file>
13
+ </recentreviews>
14
+ </updates>
15
+ </layout>
16
+ </frontend>
17
+ <global>
18
+ <models>
19
+ <orange_recentreviews>
20
+ <class>Orange_RecentReviews_Model</class>
21
+ </orange_recentreviews>
22
+ </models>
23
+ </global>
24
+ <adminhtml>
25
+ <acl>
26
+ <resources>
27
+ <admin>
28
+ <children>
29
+ <system>
30
+ <children>
31
+ <config>
32
+ <children>
33
+ <orange_recentreviews/>
34
+ </children>
35
+ </config>
36
+ </children>
37
+ </system>
38
+ </children>
39
+ </admin>
40
+ </resources>
41
+ </acl>
42
+ </adminhtml>
43
+ <default>
44
+ <orange_recentreviews>
45
+ <settings>
46
+ <enable>1</enable>
47
+ <showtitle>1</showtitle>
48
+ <title>Customer Reviews</title>
49
+ <show_ratings>1</show_ratings>
50
+ <limit_characters>0</limit_characters>
51
+ <count>3</count>
52
+ </settings>
53
+ </orange_recentreviews>
54
+ </default>
55
+ </config>
app/code/community/Orange/RecentReviews/etc/system.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <orange translate="label">
5
+ <label>orange</label>
6
+ <sort_order>150</sort_order>
7
+ </orange>
8
+ </tabs>
9
+ <sections>
10
+ <orange_recentreviews translate="label">
11
+ <label>Recent Reviews</label>
12
+ <tab>orange</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <settings translate="label">
20
+ <label>Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </enable>
36
+ <showtitle translate="label">
37
+ <label>Show title</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>2</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </showtitle>
45
+ <title translate="label">
46
+ <label>Title</label>
47
+ <validate>validate-one-required</validate>
48
+ <frontend_type>text</frontend_type>
49
+ <depends>
50
+ <showtitle>1</showtitle>
51
+ </depends>
52
+ <sort_order>3</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </title>
57
+ <show_ratings translate="label">
58
+ <label>Show ratings</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>4</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </show_ratings>
66
+ <limit_characters translate="label">
67
+ <label>Limit characters</label>
68
+ <comment>0 - no limit</comment>
69
+ <frontend_type>text</frontend_type>
70
+ <validate>validate-number validate-one-required</validate>
71
+ <sort_order>5</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </limit_characters>
76
+ <count translate="label">
77
+ <label>Count</label>
78
+ <comment>0 - no limit</comment>
79
+ <frontend_type>text</frontend_type>
80
+ <validate>validate-number validate-one-required</validate>
81
+ <sort_order>6</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </count>
86
+ </fields>
87
+ </settings>
88
+ </groups>
89
+ </orange_recentreviews>
90
+ </sections>
91
+ </config>
app/design/frontend/base/default/layout/orange_recent_reviews.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="right">
5
+ <block type="core/template" name="orange_recentreviews" template="orange/recentreviews/reviews.phtml" />
6
+ </reference>
7
+ <reference name="left">
8
+ <block type="core/template" name="orange_recentreviews" template="orange/recentreviews/reviews.phtml" />
9
+ </reference>
10
+ </default>
11
+ </layout>
app/design/frontend/base/default/template/orange/recentreviews/reviews.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_reviews = Mage::getModel('orange_recentreviews/recentreviews') ?>
2
+ <?php if($_reviews->isActive()): ?>
3
+ <?php if(count($_reviews->data())): ?>
4
+ <div class="block">
5
+ <?php if($_reviews->showTitle()): ?>
6
+ <div class="block-title">
7
+ <strong>
8
+ <span><?php echo $this->__($_reviews->getTitle()) ?></span>
9
+ </strong>
10
+ </div>
11
+ <?php endif ?>
12
+ <div class="block-content">
13
+ <ul>
14
+ <?php foreach($_reviews->data() as $_review): ?>
15
+ <li class="item">
16
+ <p><a href="<?php echo $_reviews->getReviewUrl($_review->getId()) ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> - <?php echo $this->__('by <strong>%s</strong>', $this->htmlEscape($_review->getNickname())) ?></p>
17
+ <?php if($_reviews->showRatings()): ?>
18
+ <?php $_votes = $_review->getRatingVotes() ?>
19
+ <?php if(count($_votes)): ?>
20
+ <table class="ratings-table">
21
+ <col width="1" />
22
+ <col />
23
+ <tbody>
24
+ <?php foreach($_votes as $_vote): ?>
25
+ <tr>
26
+ <th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
27
+ <td>
28
+ <div class="rating-box">
29
+ <div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
30
+ </div>
31
+ </td>
32
+ </tr>
33
+ <?php endforeach ?>
34
+ </tbody>
35
+ </table>
36
+ <?php endif ?>
37
+ <?php endif ?>
38
+ <?php $review = nl2br($this->htmlEscape($_review->getDetail())) ?>
39
+ <?php if($_reviews->limitCharacters()): ?>
40
+ <p><?php echo substr($review, 0, $_reviews->limitCharacters()) . '...' ?></p>
41
+ <?php else: ?>
42
+ <p><?php echo $review ?></p>
43
+ <?php endif ?>
44
+ <small class="date"><?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?></small>
45
+ </li>
46
+ <?php endforeach ?>
47
+ </ul>
48
+ </div>
49
+ </div>
50
+ <?php endif ?>
51
+ <?php endif ?>
app/etc/modules/Orange_RecentReviews.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Orange_RecentReviews>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Orange_RecentReviews>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>recent-reviews-lite</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Display latest reviews</summary>
10
+ <description>Display latest reviews</description>
11
+ <notes>Stable release</notes>
12
+ <authors><author><name>Mage</name><user>Dev</user><email>mage.ext@gmail.com</email></author></authors>
13
+ <date>2013-01-07</date>
14
+ <time>22:38:50</time>
15
+ <contents><target name="magecommunity"><dir name="Orange"><dir name="RecentReviews"><dir name="Model"><file name="Recentreviews.php" hash="7c751c09965a2897caa1ce6fec651f16"/></dir><dir name="etc"><file name="config.xml" hash="b167c4ef444eca5d912a7d0d5e3c28d0"/><file name="system.xml" hash="1342359e211ce7b5c5eba9f19a4ae7b1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="orange"><dir name="recentreviews"><file name="reviews.phtml" hash="f13fa9cd56c1d7d84e2f8af9a6d6cba2"/></dir></dir></dir><dir name="layout"><file name="orange_recent_reviews.xml" hash="6937b3d46a4bf1c2ff75139bfafd22ee"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Orange_RecentReviews.xml" hash="465284a2cfe768c59f90c44b4b56e793"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>