Ebdev_Gravatar - Version 0.1.0

Version Notes

Tested on 1.7.0.2, 1.6.2.0, 1.5.1.0, 1.4.2.0

Download this release

Release Info

Developer Magento Core Team
Extension Ebdev_Gravatar
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Ebdev/Gravatar/Block/Product/View/List.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adds corresponding customer emails to a review data collection
29
+ *
30
+ */
31
+ class Ebdev_Gravatar_Block_Product_View_List extends Mage_Review_Block_Product_View_List
32
+ {
33
+ public function getReviewsCollection()
34
+ {
35
+ if (null === $this->_reviewsCollection) {
36
+ $this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
37
+ ->addStoreFilter(Mage::app()->getStore()->getId())
38
+ ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
39
+ ->addEntityFilter('product', $this->getProduct()->getId())
40
+ ->setDateOrder();
41
+
42
+ $this->_reviewsCollection->getSelect()->joinLeft(
43
+ array('ce' => 'customer_entity'),
44
+ 'detail.customer_id = ce.entity_id',
45
+ array('ce.email')
46
+ );
47
+ }
48
+ return $this->_reviewsCollection;
49
+ }
50
+
51
+ /**
52
+ * getReviewUrl() resolves to an incorrect URL
53
+ * when the corresponding block is used in catalog/product pages
54
+ *
55
+ */
56
+ public function getPublicReviewUrl($id)
57
+ {
58
+ return Mage::getUrl('review/product/view', array('id' => $id));
59
+ }
60
+ }
app/code/community/Ebdev/Gravatar/Helper/Data.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Used for composing a Gravatar URL based on settings and given data
29
+ *
30
+ */
31
+ class Ebdev_Gravatar_Helper_Data extends Mage_Core_Helper_Abstract
32
+ {
33
+ protected $_gravatarBaseUrl;
34
+
35
+ protected $_imageSizeOptions = array('small' => 30, 'medium' => 40, 'large' => 50);
36
+
37
+ protected function _getGravatarBaseUrl()
38
+ {
39
+ if (null === $this->_gravatarBaseUrl) {
40
+ $url = Mage::app()->getStore()->isCurrentlySecure() ? 'https://secure.' : 'http://www.';
41
+ $url .= 'gravatar.com/avatar/';
42
+ $this->_gravatarBaseUrl = $url;
43
+ }
44
+
45
+ return $this->_gravatarBaseUrl;
46
+ }
47
+
48
+ public function getGravatarUrlByCustomerEmail($email)
49
+ {
50
+ $url = '';
51
+ $url .= $this->_getGravatarBaseUrl();
52
+ if ($email) {
53
+ $url .= md5(strtolower(trim($email)));
54
+ $url .= '?d=identicon';
55
+ } else {
56
+ $guestGrav = Mage::getStoreConfig('catalog/gravatar_in_reviews/guest_gravatar');
57
+ $guestGravEmail = Mage::getStoreConfig('catalog/gravatar_in_reviews/guest_gravatar_email');
58
+ $zeros = '00000000000000000000000000000000';
59
+ if ($guestGrav == 'custom') {
60
+ if ($guestGravEmail) {
61
+ $url .= md5(strtolower(trim($guestGravEmail)));
62
+ $url .= '?d=identicon';
63
+ } else {
64
+ $url .= $zeros;
65
+ $url .= '?f=y';
66
+ }
67
+ } elseif ($guestGrav == 'default') {
68
+ $url .= $zeros;
69
+ $url .= '?f=y';
70
+ } else {
71
+ $url .= $zeros;
72
+ $url .= '?d=' . $guestGrav;
73
+ $url .= '&f=y';
74
+ }
75
+ }
76
+ $url .= '&s=';
77
+ $url .= $this->_imageSizeOptions[Mage::getStoreConfig('catalog/gravatar_in_reviews/size')];
78
+
79
+ return $url;
80
+ }
81
+
82
+ public function getGravatarUrlByCustomerId($customerId)
83
+ {
84
+ $email = false;
85
+ if ($customerId) {
86
+ $email = Mage::getModel('customer/customer')->load($customerId)->getEmail();
87
+ }
88
+
89
+ return $this->getGravatarUrlByCustomerEmail($email);
90
+ }
91
+ }
app/code/community/Ebdev/Gravatar/Model/GuestGravatar.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Guest gravatar options
29
+ *
30
+ */
31
+ class Ebdev_Gravatar_Model_GuestGravatar
32
+ {
33
+ public function toOptionArray()
34
+ {
35
+ return array(
36
+ //array('value'=>'', 'label'=>''),
37
+ array('value'=>'default', 'label'=>Mage::helper('gravatar')->__('Default')),
38
+ array('value'=>'mm', 'label'=>Mage::helper('gravatar')->__('Mystery Man')),
39
+ array('value'=>'custom', 'label'=>Mage::helper('gravatar')->__('Custom...')),
40
+ );
41
+ }
42
+ }
app/code/community/Ebdev/Gravatar/Model/Size.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Gravatar size options
29
+ *
30
+ */
31
+ class Ebdev_Gravatar_Model_Size
32
+ {
33
+ public function toOptionArray()
34
+ {
35
+ return array(
36
+ //array('value'=>'', 'label'=>''),
37
+ array('value'=>'small', 'label'=>Mage::helper('gravatar')->__('Small')),
38
+ array('value'=>'medium', 'label'=>Mage::helper('gravatar')->__('Medium')),
39
+ array('value'=>'large', 'label'=>Mage::helper('gravatar')->__('Large')),
40
+ );
41
+ }
42
+ }
app/code/community/Ebdev/Gravatar/etc/config.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Gravatar in Reviews
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Ebdev
23
+ * @package Ebdev_Gravatar
24
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Ebdev_Gravatar>
31
+ <version>0.1.0</version>
32
+ </Ebdev_Gravatar>
33
+ </modules>
34
+ <frontend>
35
+ <layout>
36
+ <updates>
37
+ <ebdev_gravatar>
38
+ <file>ebdev_gravatar.xml</file>
39
+ </ebdev_gravatar>
40
+ </updates>
41
+ </layout>
42
+ </frontend>
43
+ <global>
44
+ <blocks>
45
+ <review>
46
+ <rewrite>
47
+ <product_view_list>Ebdev_Gravatar_Block_Product_View_List</product_view_list>
48
+ </rewrite>
49
+ </review>
50
+ </blocks>
51
+ <helpers>
52
+ <gravatar>
53
+ <class>Ebdev_Gravatar_Helper</class>
54
+ </gravatar>
55
+ </helpers>
56
+ <models>
57
+ <gravatar>
58
+ <class>Ebdev_Gravatar_Model</class>
59
+ </gravatar>
60
+ </models>
61
+ </global>
62
+ <default>
63
+ <catalog>
64
+ <gravatar_in_reviews>
65
+ <enabled>1</enabled>
66
+ <size>medium</size>
67
+ <guest_gravatar>default</guest_gravatar>
68
+ </gravatar_in_reviews>
69
+ </catalog>
70
+ </default>
71
+ </config>
app/code/community/Ebdev/Gravatar/etc/system.xml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Gravatar in Reviews
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Ebdev
23
+ * @package Ebdev_Gravatar
24
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <sections>
30
+ <catalog>
31
+ <groups>
32
+ <gravatar_in_reviews translate="label">
33
+ <label>Gravatar in Reviews</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>100</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <enabled translate="label">
41
+ <label>Enable Gravatar in Reviews</label>
42
+ <frontend_type>select</frontend_type>
43
+ <source_model>adminhtml/system_config_source_yesno</source_model>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </enabled>
49
+ <size translate="label">
50
+ <label>Size</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>gravatar/size</source_model>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </size>
58
+ <guest_gravatar translate="label">
59
+ <label>Guest Gravatar</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>gravatar/guestGravatar</source_model>
62
+ <sort_order>3</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </guest_gravatar>
67
+ <guest_gravatar_email translate="label">
68
+ <label>Email for Guest Gravatar</label>
69
+ <comment>Create a gravatar.com account with this email to customize.</comment>
70
+ <frontend_type>text</frontend_type>
71
+ <validate>validate-email</validate>
72
+ <sort_order>4</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <depends><guest_gravatar>custom</guest_gravatar></depends>
77
+ </guest_gravatar_email>
78
+ </fields>
79
+ </gravatar_in_reviews>
80
+ </groups>
81
+ </catalog>
82
+ </sections>
83
+ </config>
app/design/frontend/base/default/layout/ebdev_gravatar.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Gravatar in Reviews
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Ebdev
23
+ * @package Ebdev_Gravatar
24
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <layout version="0.1.0">
29
+ <default>
30
+ <reference name="head">
31
+ <action method="addCss" ifconfig="catalog/gravatar_in_reviews/enabled">
32
+ <stylesheet>css/ebdev/gravatar/styles.css</stylesheet>
33
+ </action>
34
+ </reference>
35
+ </default>
36
+ <review_product_list>
37
+ <reference name="content">
38
+ <reference name="product.info.product_additional_data">
39
+ <action method="setTemplate" ifconfig="catalog/gravatar_in_reviews/enabled">
40
+ <template>ebdev/gravatar/review_product_view_list.phtml</template>
41
+ </action>
42
+ </reference>
43
+ </reference>
44
+ </review_product_list>
45
+ <review_product_view>
46
+ <reference name="content">
47
+ <reference name="review_view">
48
+ <action method="setTemplate" ifconfig="catalog/gravatar_in_reviews/enabled">
49
+ <template>ebdev/gravatar/review_view.phtml</template>
50
+ </action>
51
+ </reference>
52
+ </reference>
53
+ </review_product_view>
54
+ <review_customer_view>
55
+ <reference name="my.account.wrapper">
56
+ <reference name="customers_review">
57
+ <action method="setTemplate" ifconfig="catalog/gravatar_in_reviews/enabled">
58
+ <template>ebdev/gravatar/review_customer_view.phtml</template>
59
+ </action>
60
+ </reference>
61
+ </reference>
62
+ </review_customer_view>
63
+ </layout>
app/design/frontend/base/default/template/ebdev/gravatar/review_customer_view.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adds div (class gravatar-box).
29
+ * Used app\design\frontend\base\default\template\review\customer\view.phtml (1.7.0.2)
30
+ *
31
+ */
32
+ ?>
33
+ <?php if($this->getProductData()->getId()): ?>
34
+ <div class="product-review">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Review Details') ?></h1>
37
+ </div>
38
+ <div class="product-img-box">
39
+ <a href="<?php echo $this->getProductData()->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductData()->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($this->getProductData(), 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($this->getProductData()->getName()) ?>" /></a>
40
+ <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
41
+ <p class="label"><?php echo $this->__('Average Customer Rating:') ?></p>
42
+ <?php echo $this->getReviewsSummaryHtml($this->getProductData()) ?>
43
+ <?php endif; ?>
44
+ </div>
45
+ <div class="product-details">
46
+ <h2 class="product-name"><?php echo $this->htmlEscape($this->getProductData()->getName()) ?></h2>
47
+ <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
48
+ <h3><?php echo ($this->isReviewOwner()) ? $this->__('Your Rating:') : $this->__('Rating:'); ?></h3>
49
+ <table class="ratings-table">
50
+ <?php foreach ($this->getRating() as $_rating): ?>
51
+ <?php if($_rating->getPercent()): ?>
52
+ <tr>
53
+ <th><?php echo $this->escapeHtml($_rating->getRatingCode()) ?></th>
54
+ <td>
55
+ <div class="rating-box">
56
+ <div class="rating" style="width:<?php echo ceil($_rating->getPercent()) ?>%;"></div>
57
+ </div>
58
+ </td>
59
+ </tr>
60
+ <?php endif; ?>
61
+ <?php endforeach; ?>
62
+ </table>
63
+ <?php endif;?>
64
+ <dl>
65
+ <dt>
66
+ <?php if ($this->isReviewOwner()): ?>
67
+ <?php echo $this->__('Your Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
68
+ <?php else :?>
69
+ <?php echo $this->__('Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
70
+ <?php endif;?>
71
+ </dt>
72
+ <dd>
73
+ <?php echo nl2br($this->htmlEscape($this->getReviewData()->getDetail())) ?>
74
+ </dd>
75
+ </dl>
76
+ <div class="gravatar-box">
77
+ <img class="gravatar" src="<?php echo $this->helper('gravatar')->getGravatarUrlByCustomerId($this->getReviewData()->getCustomerId()); ?>" alt="" />
78
+ <span><?php echo $this->getReviewData()->getNickname(); ?></span>
79
+ </div>
80
+ </div>
81
+ <div class="buttons-set">
82
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to My Reviews') ?></a></p>
83
+ </div>
84
+ </div>
85
+ <?php endif; ?>
app/design/frontend/base/default/template/ebdev/gravatar/review_product_view_list.phtml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adds img (class gravatar), a class to dl, and getPublicReviewUrl().
29
+ * Used app\design\frontend\base\default\template\review\product\view\list.phtml (1.7.0.2)
30
+ *
31
+ */
32
+ ?>
33
+ <?php $_items = $this->getReviewsCollection()->getItems(); ?>
34
+ <div class="box-collateral box-reviews" id="customer-reviews">
35
+ <?php if (count($_items)):?>
36
+ <h2><?php echo $this->__('Customer Reviews') ?></h2>
37
+ <?php echo $this->getChildHtml('toolbar') ?>
38
+ <dl class="<?php echo Mage::getStoreConfig('catalog/gravatar_in_reviews/size'); ?>">
39
+ <?php foreach ($_items as $_review):?>
40
+ <dt>
41
+ <img class="gravatar" src="<?php echo $this->helper('gravatar')->getGravatarUrlByCustomerEmail($_review->getEmail()); ?>" alt="" /><a href="<?php echo $this->getPublicReviewUrl($_review->getId()) ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> <?php echo $this->__('Review by <span>%s</span>', $this->htmlEscape($_review->getNickname())) ?>
42
+ </dt>
43
+ <dd>
44
+ <?php $_votes = $_review->getRatingVotes(); ?>
45
+ <?php if (count($_votes)): ?>
46
+ <table class="ratings-table">
47
+ <col width="1" />
48
+ <col />
49
+ <tbody>
50
+ <?php foreach ($_votes as $_vote): ?>
51
+ <tr>
52
+ <th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
53
+ <td>
54
+ <div class="rating-box">
55
+ <div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
56
+ </div>
57
+ </td>
58
+ </tr>
59
+ <?php endforeach; ?>
60
+ </tbody>
61
+ </table>
62
+ <?php endif; ?>
63
+ <?php echo nl2br($this->htmlEscape($_review->getDetail())) ?>
64
+ <small class="date"><?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?></small>
65
+ </dd>
66
+ <?php endforeach; ?>
67
+ </dl>
68
+ <?php echo $this->getChildHtml('toolbar') ?>
69
+ <?php endif;?>
70
+ <?php echo $this->getChildHtml('review_form') ?>
71
+ </div>
app/design/frontend/base/default/template/ebdev/gravatar/review_view.phtml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gravatar in Reviews
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Ebdev
22
+ * @package Ebdev_Gravatar
23
+ * @copyright Copyright (c) 2012 Egidijus B. (http://egidij.us)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adds div (class gravatar-box).
29
+ * Used app\design\frontend\base\default\template\review\view.phtml (1.7.0.2)
30
+ *
31
+ */
32
+ ?>
33
+ <?php if($this->getProductData()->getId()): ?>
34
+ <div class="product-review">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Review Details') ?></h1>
37
+ </div>
38
+ <div class="product-img-box">
39
+ <a href="<?php echo $this->getProductData()->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductData()->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($this->getProductData(), 'small_image')->resize(125, 125); ?>" height="125" width="125" alt="<?php echo $this->htmlEscape($this->getProductData()->getName()) ?>" /></a>
40
+ <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
41
+ <p class="label"><?php echo $this->__('Average Customer Rating') ?>:</p>
42
+ <?php echo $this->getReviewsSummaryHtml($this->getProductData()) ?>
43
+ <?php endif; ?>
44
+ </div>
45
+ <div class="product-details">
46
+ <h2 class="product-name"><?php echo $this->htmlEscape($this->getProductData()->getName()) ?></h2>
47
+ <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
48
+ <h3><?php echo $this->__('Product Rating:') ?></h3>
49
+ <table class="ratings-table">
50
+ <?php foreach ($this->getRating() as $_rating): ?>
51
+ <?php if($_rating->getPercent()): ?>
52
+ <tr>
53
+ <th><?php echo $this->__($this->escapeHtml($_rating->getRatingCode())) ?></th>
54
+ <td>
55
+ <div class="rating-box">
56
+ <div class="rating" style="width:<?php echo ceil($_rating->getPercent()) ?>%;"></div>
57
+ </div>
58
+ </td>
59
+ </tr>
60
+ <?php endif; ?>
61
+ <?php endforeach; ?>
62
+ </table>
63
+ </dl>
64
+ <?php endif;?>
65
+ <dl>
66
+ <dt>
67
+ <?php echo $this->__('Product Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
68
+ </dt>
69
+ <dd>
70
+ <?php echo nl2br($this->htmlEscape($this->getReviewData()->getDetail())) ?>
71
+ </dd>
72
+ </dl>
73
+ <div class="gravatar-box">
74
+ <img class="gravatar" src="<?php echo $this->helper('gravatar')->getGravatarUrlByCustomerId($this->getReviewData()->getCustomerId()); ?>" alt="" />
75
+ <span><?php echo $this->getReviewData()->getNickname(); ?></span>
76
+ </div>
77
+ </div>
78
+ <div class="buttons-set">
79
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Product Reviews') ?></a></p>
80
+ </div>
81
+ </div>
82
+ <?php endif; ?>
app/etc/modules/Ebdev_Gravatar.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ebdev_Gravatar>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Review />
9
+ </depends>
10
+ </Ebdev_Gravatar>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ebdev_Gravatar</name>
4
+ <version>0.1.0</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>Display User Gravatars in Reviews</summary>
10
+ <description>Gravatar in Reviews improves product reviews by adding Gravatars (gravatar.com) to customer comments. Simple and configurable.</description>
11
+ <notes>Tested on 1.7.0.2, 1.6.2.0, 1.5.1.0, 1.4.2.0</notes>
12
+ <authors><author><name>Egidijus B.</name><user>auto-converted</user><email>magento@egidij.us</email></author></authors>
13
+ <date>2012-12-05</date>
14
+ <time>15:50:46</time>
15
+ <contents><target name="magecommunity"><dir name="Ebdev"><dir name="Gravatar"><dir name="Block"><dir name="Product"><dir name="View"><file name="List.php" hash="9c101ded7ff6931b4e18f1438344fa06"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ce6f21ca23b4fde37b59d855cd6c35a7"/></dir><dir name="Model"><file name="GuestGravatar.php" hash="3bd4599e0d2652cbed71077839528023"/><file name="Size.php" hash="6fbedd1848d165aa4db52ac27fb4968e"/></dir><dir name="etc"><file name="config.xml" hash="3e12c34c08eceb87b738642ddf7e800a"/><file name="system.xml" hash="a8e8be378d6e35085dca5ba92eb3e439"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ebdev_Gravatar.xml" hash="e6b5cff45abe53554a1d764701731361"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ebdev_gravatar.xml" hash="8df17be20e5397a1ac26dc124a5f2ed6"/></dir><dir name="template"><dir name="ebdev"><dir name="gravatar"><file name="review_customer_view.phtml" hash="411fdf16a302ecb8fd5e0e087181f1c1"/><file name="review_product_view_list.phtml" hash="ebfe5def5869e335ba56f0082aae71ab"/><file name="review_view.phtml" hash="36f9845a61a82623ad1303b05f0e682c"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="ebdev"><dir name="gravatar"><file name="styles.css" hash="386cb1c9ae7a29201566208c208028ba"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><package><name>Mage_Review</name><channel>community</channel><min>1.4.2.0</min><max>1.7.0.2</max></package></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/ebdev/gravatar/styles.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** Gravatar in Reviews **/
2
+ .product-view .box-reviews dl dt { padding-left:55px; position:relative; }
3
+ .product-view .box-reviews dl dt .gravatar { margin-top:3px; margin-left:1px; position:absolute; left:0; }
4
+ .product-view .box-reviews dl dd { margin-bottom:10px; padding-left:55px; min-height:30px; }
5
+ .product-review .product-details .gravatar-box { margin:5px 0 10px; padding:5px 9px 5px 5px; float:right; }
6
+ .product-review .product-details .gravatar-box span { vertical-align:top; }
7
+ .product-review .product-details .gravatar { margin-right:6px;}
8
+ /* Small image */
9
+ .product-view .box-reviews dl.small dt { padding-left:45px; }
10
+ .product-view .box-reviews dl.small dd { padding-left:45px; min-height:20px; }
11
+ /* Large image */
12
+ .product-view .box-reviews dl.large dt { padding-left:65px; }
13
+ .product-view .box-reviews dl.large dd { padding-left:65px; min-height:40px; }