Moii_Pinterest - Version 1.0.1

Version Notes

Stable Release.

Download this release

Release Info

Developer Frédérick Lebel
Extension Moii_Pinterest
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Moii/Pinterest/Block/PinterestButton.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Moii_Pinterest_Block_PinterestButton extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public $product;
7
+ public $productPrice;
8
+ public $url;
9
+ public $media;
10
+ public $desc;
11
+ public $count;
12
+
13
+ /**
14
+ * Constructor. Set template.
15
+ */
16
+ protected function _construct()
17
+ {
18
+ if (Mage::getStoreConfig('Moii_Pinterest_Config/configuration/Moii_Pinterest_Enabled')) {
19
+ parent::_construct();
20
+ $this->setTemplate('moii/pinterest_button.phtml');
21
+ $this->product = Mage::registry('current_product');
22
+ $this->productPrice = '$'.number_format($this->product->getPrice(),2);
23
+ $this->url = $this->helper('core/url')->getCurrentUrl();
24
+ $this->media = $this->helper('catalog/image')->init($this->product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(220);
25
+ $this->desc = $this->product->getAttributeText('manufacturer').' // '.$this->helper('catalog/output')->productAttribute($this->product, $this->product->getName(), 'name');
26
+ $this->count = Mage::getStoreConfig('Moii_SocialShare_Config/configuration/Moii_Pinterest_Count');
27
+ }
28
+ }
29
+
30
+ protected function getProduct() {
31
+ return $this->product;
32
+ }
33
+
34
+ protected function getProductPrice() {
35
+ return $this->productPrice;
36
+ }
37
+
38
+ protected function getPUrl() {
39
+ return $this->url;
40
+ }
41
+
42
+ protected function getMedia() {
43
+ return $this->media;
44
+ }
45
+
46
+ protected function getDesc() {
47
+ return $this->desc;
48
+ }
49
+
50
+ protected function getCount() {
51
+ return $this->count;
52
+ }
53
+ }
54
+ ?>
app/code/community/Moii/Pinterest/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Moii_Pinterest_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
5
+ ?>
app/code/community/Moii/Pinterest/Model/Enable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Moii_Pinterest_Model_Enable
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value'=>1, 'label'=>Mage::helper('Moii_Pinterest')->__('Yes')),
8
+ array('value'=>0, 'label'=>Mage::helper('Moii_Pinterest')->__('No')),
9
+ );
10
+ }
11
+
12
+ }
13
+ ?>
app/code/community/Moii/Pinterest/Model/Pincount.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Moii_Pinterest_Model_Pincount
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value'=>'horizontal', 'label'=>Mage::helper('Moii_Pinterest')->__('Horizontal')),
8
+ array('value'=>'vertical', 'label'=>Mage::helper('Moii_Pinterest')->__('Vertical')),
9
+ array('value'=>'none', 'label'=>Mage::helper('Moii_Pinterest')->__('No Count')),
10
+ );
11
+ }
12
+
13
+ }
14
+ ?>
app/code/community/Moii/Pinterest/etc/config.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Moii_Pinterest>
5
+ <version>1.0.0.0</version>
6
+ </Moii_Pinterest>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <Moii_Pinterest>
11
+ <class>Moii_Pinterest_Block</class>
12
+ </Moii_Pinterest>
13
+ </blocks>
14
+ <helpers>
15
+ <Moii_Pinterest>
16
+ <class>Moii_Pinterest_Helper</class>
17
+ </Moii_Pinterest>
18
+ </helpers>
19
+ <models>
20
+ <Moii_Pinterest>
21
+ <class>Moii_Pinterest_Model</class>
22
+ </Moii_Pinterest>
23
+ </models>
24
+ </global>
25
+
26
+ <frontend>
27
+ <layout>
28
+ <updates>
29
+ <Moii_Pinterest>
30
+ <file>moii/pinterest.xml</file>
31
+ </Moii_Pinterest>
32
+ </updates>
33
+ </layout>
34
+ </frontend>
35
+ <adminhtml>
36
+ <acl>
37
+ <resources>
38
+ <admin>
39
+ <children>
40
+ <system>
41
+ <children>
42
+ <config>
43
+ <children>
44
+ <Moii_Pinterest_Config>
45
+ <title>Pinterest Configuration</title>
46
+ </Moii_Pinterest_Config>
47
+ </children>
48
+ </config>
49
+ </children>
50
+ </system>
51
+ </children>
52
+ </admin>
53
+ </resources>
54
+ </acl>
55
+ </adminhtml>
56
+ </config>
app/code/community/Moii/Pinterest/etc/system.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <Moii_Pinterest translate="label" module="Moii_Pinterest">
5
+ <label>Moii</label>
6
+ <sort_order>100</sort_order>
7
+ </Moii_Pinterest>
8
+ </tabs>
9
+ <sections>
10
+ <Moii_Pinterest_Config translate="label" module="Moii_Pinterest">
11
+ <label>Pinterest</label>
12
+ <tab>Moii_Pinterest</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</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
+ <configuration translate="label">
20
+ <label>Pinterest Configuration</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
+ <Moii_Pinterest_Enabled translate="label" module="Moii_Pinterest">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>Moii_Pinterest/enable</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>0</show_in_store>
35
+ </Moii_Pinterest_Enabled>
36
+ <Moii_Pinterest_Count>
37
+ <label>Pin Count</label>
38
+ <frontend_type>select</frontend_type>
39
+ <!-- adding a source model -->
40
+ <source_model>Moii_Pinterest/pincount</source_model>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </Moii_Pinterest_Count>
46
+ </fields>
47
+ </configuration>
48
+ </groups>
49
+ </Moii_Pinterest_Config>
50
+ </sections>
51
+ </config>
app/design/frontend/base/default/layout/moii/pinterest.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <catalog_product_view>
4
+ <reference name="product.info.extrahint">
5
+ <block type="Moii_Pinterest/PinterestButton" name="Moii_Pinterest" />
6
+ </reference>
7
+ </catalog_product_view>
8
+ </layout>
app/design/frontend/base/default/template/moii/pinterest_button.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*Get the current product*/
3
+ $_product = $this->getProduct();
4
+
5
+ /*Get the current product price*/
6
+ $_productPrice = $this->getProductPrice();
7
+
8
+ /*Get the current product URL*/
9
+ $cUrl = $this->getPUrl();
10
+
11
+ /*Get the current product image URL*/
12
+ $cMedia = $this->getMedia();
13
+
14
+ /*Get the current product description*/
15
+ $cDesc = $this->getDesc();
16
+
17
+ /*Get the current product count on Pinterest*/
18
+ $count = $this->getCount();
19
+ ?>
20
+ <a href="http://pinterest.com/pin/create/button/?url=<?=$cUrl?>&media=<?=$cMedia?>&description=<?=$cDesc?>" class="pin-it-button" count-layout="<?=$count?>">Pin It</a>
21
+ <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
app/etc/modules/Moii_Pinterest.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Moii_Pinterest>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Moii_Pinterest>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Moii_Pinterest</name>
4
- <version>1.0.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>
@@ -10,9 +10,9 @@
10
  <description>This is the easiest way to add the Pinterest button to your product page! You can change the look and feel of the button and their will be newer release as the Pinterest API change.</description>
11
  <notes>Stable Release.</notes>
12
  <authors><author><name>Fr&#xE9;d&#xE9;rick Lebel</name><user>flebel</user><email>flebel@moii.ca</email></author><author><name>Jean-Francois Parent</name><user>moii</user><email>magento@moii.ca</email></author></authors>
13
- <date>2012-02-01</date>
14
- <time>03:02:34</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Moii_Pinterest.xml" hash=""/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Moii_Pinterest</name>
4
+ <version>1.0.1</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>
10
  <description>This is the easiest way to add the Pinterest button to your product page! You can change the look and feel of the button and their will be newer release as the Pinterest API change.</description>
11
  <notes>Stable Release.</notes>
12
  <authors><author><name>Fr&#xE9;d&#xE9;rick Lebel</name><user>flebel</user><email>flebel@moii.ca</email></author><author><name>Jean-Francois Parent</name><user>moii</user><email>magento@moii.ca</email></author></authors>
13
+ <date>2012-02-03</date>
14
+ <time>02:53:49</time>
15
+ <contents><target name="magecommunity"><dir name="Moii"><dir name="Pinterest"><dir name="Block"><file name="PinterestButton.php" hash="21f6dd71d54665efdbb26a623a84a3ac"/></dir><dir name="Helper"><file name="Data.php" hash="bf9533e3afd1f49fdd5fea12ecfa4073"/></dir><dir name="Model"><file name="Enable.php" hash="6f52f2cdf36bdf12b2011e815ea7c7c0"/><file name="Pincount.php" hash="9669113e6ffcc2abf02fe4771bec1753"/></dir><dir name="etc"><file name="config.xml" hash="e4bc53a7cdbc9adadf3a2c9dc12b1e5b"/><file name="system.xml" hash="da45f724f6f26070e2623625d008bccd"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Moii_Pinterest.xml" hash="a7c5113cba5d7d6478722a15cbf85715"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="moii"><file name="pinterest_button.phtml" hash="1d73fdaa064bae94e3002d6bfb20dc34"/></dir></dir><dir name="layout"><dir name="moii"><file name="pinterest.xml" hash="73674e831495740c4413953ce2fab753"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>