Magpleasure_Facecomments - Version 1.0.0

Version Notes

To install Facebook Comments at the Product page of your store you should: open the ///template/catalog/product/view.phtml file, which has your_skin as the name of your current store skin and your_locale as your current locale. If you haven't ever changed your store's skin or locale, use the default value for your_skin and your_locale.
Find the following string:
getChildHtml('upsell_products') ?>
and insert this code before it:
getChildHtml('facecomments'); ?>

Download this release

Release Info

Developer Magento Core Team
Extension Magpleasure_Facecomments
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Magpleasure/Facecomments/Block/Comments.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagPleasure Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
11
+ *
12
+ * @category Magpleasure
13
+ * @package Magpleasure_Facecomments
14
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+
18
+ /** Facebook Comments */
19
+ class Magpleasure_Facecomments_Block_Comments extends Mage_Core_Block_Template
20
+ {
21
+ protected $_isGeneral = false;
22
+
23
+ public function isEnabled()
24
+ {
25
+ return Mage::getStoreConfig('facecomments/general/enabled');
26
+ }
27
+
28
+ public function isGeneral()
29
+ {
30
+ $this->_isGeneral = true;
31
+ }
32
+
33
+ public function canShow()
34
+ {
35
+ if ($this->_isGeneral){
36
+ return $this->isEnabled() && !!$this->getProductId();
37
+ } else {
38
+ return $this->isEnabled() && !!$this->getProductId() && Mage::getStoreConfig("facecomments/general/display_in_additional");
39
+ }
40
+ }
41
+
42
+ public function getProductId()
43
+ {
44
+ if ($product = Mage::registry('current_product')){
45
+ return sprintf('%s', $product->getId());
46
+ }
47
+ return false;
48
+ }
49
+
50
+ public function getWidth()
51
+ {
52
+ return Mage::getStoreConfig('facecomments/general/width') ? Mage::getStoreConfig('facecomments/general/width') : 500;
53
+ }
54
+
55
+ public function getLimit()
56
+ {
57
+ return Mage::getStoreConfig('facecomments/general/limit') ? Mage::getStoreConfig('facecomments/general/limit') : 15;
58
+ }
59
+
60
+ /**
61
+ * Retrieves Canonical Url
62
+ *
63
+ * @return string
64
+ */
65
+ public function getCanonicalUrl()
66
+ {
67
+ $params = array();
68
+ if (Mage::helper('catalog/product')->canUseCanonicalTag()){
69
+ $params = array('_ignore_category'=>true);
70
+ }
71
+ /** @var Mage_Catalog_Model_Product $product */
72
+ $product = Mage::registry('current_product');
73
+ return $product->getUrlModel()->getUrl($product, $params);
74
+ }
75
+
76
+ }
app/code/local/Magpleasure/Facecomments/Block/Wrap.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagPleasure Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
11
+ *
12
+ * @category Magpleasure
13
+ * @package Magpleasure_Facecomments
14
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+ class Magpleasure_Facecomments_Block_Wrap extends Magpleasure_Facecomments_Block_Comments
18
+ {
19
+ public function getTitle()
20
+ {
21
+ return $this->getLayout()->getBlock('head')->getTitle();
22
+ }
23
+ }
app/code/local/Magpleasure/Facecomments/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagPleasure Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
11
+ *
12
+ * @category Magpleasure
13
+ * @package Magpleasure_Facecomments
14
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+ class Magpleasure_Facecomments_Helper_Data extends Mage_Core_Helper_Abstract
18
+ {
19
+
20
+ }
app/code/local/Magpleasure/Facecomments/etc/adminhtml.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <translate>
4
+ <modules>
5
+ <Magpleasure_Facecomments>
6
+ <files>
7
+ <default>Magpleasure_Facecomments.csv</default>
8
+ </files>
9
+ </Magpleasure_Facecomments>
10
+ </modules>
11
+ </translate>
12
+ <acl>
13
+ <resources>
14
+ <all>
15
+ <title>Allow Everything</title>
16
+ </all>
17
+ <admin>
18
+ <children>
19
+ <system>
20
+ <children>
21
+ <config>
22
+ <children>
23
+ <facecomments>
24
+ <title>Vkontakte Comments</title>
25
+ </facecomments>
26
+ </children>
27
+ </config>
28
+ </children>
29
+ </system>
30
+ </children>
31
+ </admin>
32
+ </resources>
33
+ </acl>
34
+ </config>
app/code/local/Magpleasure/Facecomments/etc/config.xml ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * MagPleasure Co.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
12
+ *
13
+ * @category Magpleasure
14
+ * @package Magpleasure_Facecomments
15
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
16
+ * @license http://www.magpleasure.com/LICENSE.txt
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Magpleasure_Facecomments>
22
+ <version>1.0</version>
23
+ </Magpleasure_Facecomments>
24
+ </modules>
25
+ <global>
26
+ <models>
27
+ <facecomments>
28
+ <class>Magpleasure_Facecomments_Model</class>
29
+ </facecomments>
30
+ </models>
31
+ <blocks>
32
+ <facecomments>
33
+ <class>Magpleasure_Facecomments_Block</class>
34
+ </facecomments>
35
+ </blocks>
36
+ <helpers>
37
+ <facecomments>
38
+ <class>Magpleasure_Facecomments_Helper</class>
39
+ </facecomments>
40
+ </helpers>
41
+ <resources>
42
+ <facecomments_setup>
43
+ <setup>
44
+ <module>Magpleasure_Facecomments</module>
45
+ </setup>
46
+ <connection>
47
+ <use>core_setup</use>
48
+ </connection>
49
+ </facecomments_setup>
50
+ <facecomments_write>
51
+ <connection>
52
+ <use>core_write</use>
53
+ </connection>
54
+ </facecomments_write>
55
+ <facecomments_read>
56
+ <connection>
57
+ <use>core_read</use>
58
+ </connection>
59
+ </facecomments_read>
60
+ </resources>
61
+ <layout>
62
+ <updates>
63
+ <facecomments>
64
+ <file>facecomments.xml</file>
65
+ </facecomments>
66
+ </updates>
67
+ </layout>
68
+ </global>
69
+ <frontend>
70
+ <routers>
71
+ <facecomments>
72
+ <use>standard</use>
73
+ <args>
74
+ <module>Magpeasure_Vkomments</module>
75
+ <frontName>facecomments</frontName>
76
+ </args>
77
+ </facecomments>
78
+ </routers>
79
+ <layout>
80
+ <updates>
81
+ <facecomments>
82
+ <file>facecomments.xml</file>
83
+ </facecomments>
84
+ </updates>
85
+ </layout>
86
+ <translate>
87
+ <modules>
88
+ <Magpleasure_Facecomments>
89
+ <files>
90
+ <default>Magpleasure_Facecomments.csv</default>
91
+ </files>
92
+ </Magpleasure_Facecomments>
93
+ </modules>
94
+ </translate>
95
+ </frontend>
96
+ <adminhtml>
97
+ <translate>
98
+ <modules>
99
+ <Magpleasure_Facecomments>
100
+ <files>
101
+ <default>Magpleasure_Facecomments.csv</default>
102
+ </files>
103
+ </Magpleasure_Facecomments>
104
+ </modules>
105
+ </translate>
106
+ <acl>
107
+ <resources>
108
+ <all>
109
+ <title>Allow Everything</title>
110
+ </all>
111
+ <admin>
112
+ <children>
113
+ <system>
114
+ <children>
115
+ <config>
116
+ <children>
117
+ <facecomments>
118
+ <title>Vkontakte Comments</title>
119
+ </facecomments>
120
+ </children>
121
+ </config>
122
+ </children>
123
+ </system>
124
+ </children>
125
+ </admin>
126
+ </resources>
127
+ </acl>
128
+ </adminhtml>
129
+ <default>
130
+ <facecomments>
131
+ <general>
132
+ <width>500</width>
133
+ <limit>15</limit>
134
+ </general>
135
+ </facecomments>
136
+ </default>
137
+ </config>
app/code/local/Magpleasure/Facecomments/etc/system.xml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <magpleasure translate="label" module="facecomments">
5
+ <label>Magpleasure Extensions</label>
6
+ <sort_order>210</sort_order>
7
+ </magpleasure>
8
+ </tabs>
9
+ <sections>
10
+ <facecomments module="facecomments" translate="label">
11
+ <label>Facebook Comments</label>
12
+ <tab>magpleasure</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>120</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
+ <general>
20
+ <label>General</label>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <sort_order>10</sort_order>
25
+ <fields>
26
+ <enabled translate="label">
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </enabled>
35
+ <display_in_additional translate="label">
36
+ <label>Display in Additional Data</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>30</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </display_in_additional>
44
+ <width translate="label">
45
+ <label>Width</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>40</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </width>
52
+ <limit translate="label">
53
+ <label>Limit</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>50</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </limit>
60
+ </fields>
61
+ </general>
62
+ </groups>
63
+ </facecomments>
64
+ </sections>
65
+ </config>
app/design/frontend/default/default/layout/facecomments.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * MagPleasure Co.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
12
+ *
13
+ * @category Magpleasure
14
+ * @package Magpleasure_Facecomments
15
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
16
+ * @license http://www.magpleasure.com/LICENSE.txt
17
+ */
18
+ -->
19
+ <layout version="0.1.0">
20
+ <catalog_product_view>
21
+ <reference name="head">
22
+ <block type="facecomments/wrap" template="facecomments/wrap.phtml" name="facecomments.wrapper" ifconfig="facecomments/general/enabled" />
23
+ </reference>
24
+ <reference name="product.info">
25
+ <block type="facecomments/comments" name="facecomments.comments" as="facecomments" template="facecomments/comments.phtml" >
26
+ <action method="isGeneral"><value>1</value></action>
27
+ </block>
28
+ </reference>
29
+ <reference name="product.info.additional">
30
+ <block type="facecomments/comments" name="additional.facecomments.comments" as="additional.facecomments" template="facecomments/comments.phtml" before="*" />
31
+ </reference>
32
+ </catalog_product_view>
33
+ </layout>
app/design/frontend/default/default/template/facecomments/comments.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagPleasure Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
11
+ *
12
+ * @category Magpleasure
13
+ * @package Magpleasure_Facecomments
14
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+ /** @var Magpleasure_Facecomments_Block_Comments $this */
18
+ ?>
19
+ <?php if ($this->canShow()): ?>
20
+ <div class="box-collateral">
21
+ <h2><?php echo $this->__('Comments'); ?></h2>
22
+ <div id="fb-root"></div>
23
+ <script type="text/javascript">(function(d, s, id) {
24
+ var js, fjs = d.getElementsByTagName(s)[0];
25
+ if (d.getElementById(id)) {return;}
26
+ js = d.createElement(s); js.id = id;
27
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
28
+ fjs.parentNode.insertBefore(js, fjs);
29
+ }(document, 'script', 'facebook-jssdk'));</script>
30
+ <fb:comments href="<?php echo $this->getCanonicalUrl(); ?>" num_posts="<?php echo $this->getLimit(); ?>" width="<?php echo $this->getWidth(); ?>"></fb:comments>
31
+ </div>
32
+ <?php endif; ?>
33
+
34
+
app/design/frontend/default/default/template/facecomments/wrap.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagPleasure Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
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://www.magpleasure.com/LICENSE.txt
11
+ *
12
+ * @category Magpleasure
13
+ * @package Magpleasure_Facecomments
14
+ * @copyright Copyright (c) 2011 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+ /** @var Magpleasure_Facecomments_Block_Wrap $this */
18
+ ?>
19
+ <?php if ($this->canShow()): ?>
20
+ <meta property="og:url" content="<?php echo $this->getCanonicalUrl(); ?>" />
21
+ <meta property="og:type" content="product" />
22
+ <meta property="og:title" content="<?php echo $this->getTitle(); ?>" />
23
+
24
+ <?php endif; ?>
25
+
26
+
app/etc/modules/Magpleasure_Facecomments.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magpleasure_Facecomments>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magpleasure_Facecomments>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magpleasure_Facecomments.csv ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ "Comments","Comments"
2
+ "Display in Additional Data","Display in Additional Data"
3
+ "Enabled","Enabled"
4
+ "Facebook Comments","Facebook Comments"
5
+ "General","General"
6
+ "Limit","Limit"
7
+ "Magpleasure Extensions","Magpleasure Extensions"
8
+ "Width","Width"
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magpleasure_Facecomments</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/OSL-3.0">OSL-3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allow to integrate Facebook.com Comments Widget into your store</summary>
10
+ <description>Facebook Comments is an extension for Magento. This one allow to integrate Facebook.com Comments Widget into your store. In a few minutes you can easy create section with comments on each product page of the your store.</description>
11
+ <notes>To install Facebook Comments at the Product page of your store you should: open the /&lt;your_locale&gt;/&lt;your_skin&gt;/template/catalog/product/view.phtml file, which has your_skin as the name of your current store skin and your_locale as your current locale. If you haven't ever changed your store's skin or locale, use the default value for your_skin and your_locale.&#xD;
12
+ Find the following string:&#xD;
13
+ &lt;?php echo $this-&gt;getChildHtml('upsell_products') ?&gt;&#xD;
14
+ and insert this code before it:&#xD;
15
+ &lt;?php echo $this-&gt;getChildHtml('facecomments'); ?&gt;</notes>
16
+ <authors><author><name>MagPleasure</name><user>auto-converted</user><email>general@magpleasure.com</email></author></authors>
17
+ <date>2011-10-10</date>
18
+ <time>18:07:59</time>
19
+ <contents><target name="magelocal"><dir name="Magpleasure"><dir name="Facecomments"><dir name="Block"><file name="Comments.php" hash="3fff12baf7e49dccf626b8331589bb54"/><file name="Wrap.php" hash="b0331a2ef1575c6a824a417fcda7e2cc"/></dir><dir name="Helper"><file name="Data.php" hash="503e818ef9926dc442e3949415dfe89c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="68a10768437895a38a13cf4e0b40eca3"/><file name="config.xml" hash="f4c8f66771784cc3ada2ce53520cb1dc"/><file name="system.xml" hash="fc09facb381fc9294b92e0bf87afeab6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="facecomments.xml" hash="0d4d88ba0eb0b1506091b2d76077fef8"/></dir><dir name="template"><dir name="facecomments"><file name="comments.phtml" hash="cbb740fe7c1f65c50e642454ad67cab3"/><file name="wrap.phtml" hash="461b50e33e75cf63d9af04ba1af58420"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Magpleasure_Facecomments.csv" hash="8c6fa4b685307c8a1d41763666af613e"/></dir></target><target name="mageetc"><dir name="modules"><file name="Magpleasure_Facecomments.xml" hash="52706dff65f1ccdc14cc59375d614379"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>