Miragedesign_Pinterest - Version 1.0.0

Version Notes

First Release Version.
Currently we support locate files for only English, but will support other languages soon.

Download this release

Release Info

Developer Mirage Design
Extension Miragedesign_Pinterest
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Miragedesign/Pinterest/Block/Button.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Miragedesign Web Development
4
+ *
5
+ * @category Miragedesign
6
+ * @package Miragedesign_Pinterest
7
+ * @copyright Copyright (c) 2011 Mirage Design (http://miragedesign.net)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Miragedesign_Pinterest_Block_Button extends Mage_Core_Block_Template
11
+ {
12
+ const DEFAULT_IMAGE_WIDTH = 300;
13
+ const DEFAULT_PRICE_DECISION = 2;
14
+
15
+ protected $_product;
16
+ protected $_productUrl;
17
+ protected $_productPrice;
18
+ protected $_productImage;
19
+ protected $_productDescription;
20
+ protected $_pinterestCount;
21
+ protected $_isEnabled;
22
+
23
+ /**
24
+ * Constructor
25
+ * Set up private variables
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_isEnabled = Mage::getStoreConfig('miragedesign_pinterest/configuration/pinterest_enabled');
30
+
31
+ if ($this->_isEnabled) {
32
+ parent::_construct();
33
+ $currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
34
+ $priceConfig = Mage::getStoreConfig('miragedesign_pinterest/configuration/pinterest_price');
35
+ $priceDecision = Mage::getStoreConfig('miragedesign_pinterest/configuration/pinterest_price_decision');
36
+ $priceDecision = ($priceDecision) ? self::DEFAULT_PRICE_DECISION : abs((int)$priceDecision);
37
+ $imageSize = Mage::getStoreConfig('miragedesign_pinterest/configuration/pinterest_image_size');
38
+ $imageSize = ($imageSize) ? self::DEFAULT_IMAGE_WIDTH : abs((int)$imageSize);
39
+
40
+ $this->_pinterestCount = Mage::getStoreConfig('miragedesign_pinterest/configuration/pinterest_count');
41
+ $this->_product = Mage::registry('current_product');
42
+ $this->_productPrice = $this->_product->getPrice();
43
+ $this->_productUrl = $this->helper('core/url')->getCurrentUrl();
44
+ $this->_productImage = $this->helper('catalog/image')->init($this->_product, 'image')
45
+ ->constrainOnly(TRUE)
46
+ ->keepAspectRatio(TRUE)
47
+ ->keepFrame(FALSE)
48
+ ->resize($imageSize);
49
+
50
+ if ($this->_product->getAttributeText('manufacturer') == null) {
51
+ $this->_productDescription = $this->helper('catalog/output')->productAttribute($this->_product, $this->_product->getName(), 'name');
52
+ }
53
+ else {
54
+ $this->_productDescription = $this->_product->getAttributeText('manufacturer').' // '.$this->helper('catalog/output')->productAttribute($this->_product, $this->_product->getName(), 'name');
55
+ }
56
+
57
+
58
+ if ($priceConfig) {
59
+ if ($priceConfig == 1) {
60
+ $this->_productDescription .= ' - ' . $currencySymbol .number_format($this->_productPrice, $priceDecision);
61
+ }
62
+
63
+ if (($priceConfig == 2) && ($this->_product->special_price != 0)) {
64
+ $this->_productDescription .= ' - ' . $currencySymbol . number_format($this->_product->special_price, $priceDecision);
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ protected function getProduct() {
71
+ return $this->_product;
72
+ }
73
+
74
+ protected function getProductUrl() {
75
+ return $this->_productUrl;
76
+ }
77
+
78
+ protected function getProductPrice() {
79
+ return $this->_productPrice;
80
+ }
81
+
82
+ protected function getProductImage() {
83
+ return $this->_productImage;
84
+ }
85
+
86
+ protected function getProductDescription() {
87
+ return $this->_productDescription;
88
+ }
89
+
90
+ protected function getPinterestCount() {
91
+ return $this->_pinterestCount;
92
+ }
93
+
94
+ protected function getIsEnabled() {
95
+ return $this->_isEnabled;
96
+ }
97
+ }
98
+ ?>
app/code/community/Miragedesign/Pinterest/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Miragedesign Web Development
4
+ *
5
+ * @category Miragedesign
6
+ * @package Miragedesign_Pinterest
7
+ * @copyright Copyright (c) 2011 Mirage Design (http://miragedesign.net)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ require_once('Mage/Core/Helper/Abstract.php');
11
+
12
+ class Miragedesign_Pinterest_Helper_Data extends Mage_Core_Helper_Abstract {
13
+
14
+ }
app/code/community/Miragedesign/Pinterest/Model/Pincount.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Miragedesign Web Development
4
+ *
5
+ * @category Miragedesign
6
+ * @package Miragedesign_Pinterest
7
+ * @copyright Copyright (c) 2011 Mirage Design (http://miragedesign.net)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Miragedesign_Pinterest_Model_Pincount
11
+ {
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value'=>'horizontal', 'label' => Mage::helper('pinterest')->__('Horizontal')),
16
+ array('value'=>'vertical', 'label' => Mage::helper('pinterest')->__('Vertical')),
17
+ array('value'=>'none', 'label' => Mage::helper('pinterest')->__('No Count')),
18
+ );
19
+ }
20
+
21
+ }
22
+ ?>
app/code/community/Miragedesign/Pinterest/Model/Price.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Miragedesign Web Development
4
+ *
5
+ * @category Miragedesign
6
+ * @package Miragedesign_Pinterest
7
+ * @copyright Copyright (c) 2011 Mirage Design (http://miragedesign.net)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Miragedesign_Pinterest_Model_Price
11
+ {
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 1, 'label' => Mage::helper('pinterest')->__('Always')),
16
+ array('value' => 2, 'label' => Mage::helper('pinterest')->__('Only Special Price')),
17
+ array('value' => 0, 'label' => Mage::helper('pinterest')->__('No')),
18
+ );
19
+ }
20
+ }
21
+ ?>
app/code/community/Miragedesign/Pinterest/etc/adminhtml.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <pinterest module="pinterest">
5
+ <title>Pinterest</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <item module="pinterest">
9
+ <title>Configuration</title>
10
+ <sort_order>30</sort_order>
11
+ <action>adminhtml/system_config/edit/section/miragedesign_pinterest</action>
12
+ </item>
13
+ </children>
14
+ </pinterest>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <admin>
19
+ <children>
20
+ <pinterest translate="title" module="pinterest">
21
+ <title>Pinterest</title>
22
+ <children>
23
+ <item translate="title" module="pinterest">
24
+ <title>Configuration</title>
25
+ <sort_order>20</sort_order>
26
+ </item>
27
+ </children>
28
+ </pinterest>
29
+ <system>
30
+ <children>
31
+ <config>
32
+ <children>
33
+ <miragedesign_pinterest>
34
+ <title>Miragedesign Pinterest</title>
35
+ </miragedesign_pinterest>
36
+ </children>
37
+ </config>
38
+ </children>
39
+ </system>
40
+ </children>
41
+ </admin>
42
+ </resources>
43
+ </acl>
44
+ </config>
app/code/community/Miragedesign/Pinterest/etc/config.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Miragedesign_Pinterest>
5
+ <version>1.0.0</version>
6
+ </Miragedesign_Pinterest>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <pinterest>
12
+ <file>miragedesign/pinterest.xml</file>
13
+ </pinterest>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <miragedesign_pinterest>
19
+ <files>
20
+ <default>Miragedesign_Pinterest.csv</default>
21
+ </files>
22
+ </miragedesign_pinterest>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+ <global>
27
+ <blocks>
28
+ <pinterest>
29
+ <class>Miragedesign_Pinterest_Block</class>
30
+ </pinterest>
31
+ </blocks>
32
+ <helpers>
33
+ <pinterest>
34
+ <class>Miragedesign_Pinterest_Helper</class>
35
+ </pinterest>
36
+ </helpers>
37
+ <models>
38
+ <pinterest>
39
+ <class>Miragedesign_Pinterest_Model</class>
40
+ </pinterest>
41
+ </models>
42
+ </global>
43
+ <adminhtml>
44
+ <acl>
45
+ <resources>
46
+ <admin>
47
+ <children>
48
+ <system>
49
+ <children>
50
+ <config>
51
+ <children>
52
+ <miragedesign_pinterest>
53
+ <title>Pinterest Configuration</title>
54
+ </miragedesign_pinterest>
55
+ </children>
56
+ </config>
57
+ </children>
58
+ </system>
59
+ </children>
60
+ </admin>
61
+ </resources>
62
+ </acl>
63
+ </adminhtml>
64
+ <default>
65
+ <miragedesign_pinterest>
66
+ <configuration>
67
+ <pinterest_image_size>300</pinterest_image_size>
68
+ <pinterest_price_decision>2</pinterest_price_decision>
69
+ </configuration>
70
+ </miragedesign_pinterest>
71
+ </default>
72
+ </config>
app/code/community/Miragedesign/Pinterest/etc/system.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <pinterest translate="label" module="pinterest">
5
+ <label>Miragedesign</label>
6
+ <sort_order>100</sort_order>
7
+ </pinterest>
8
+ </tabs>
9
+ <sections>
10
+ <miragedesign_pinterest translate="label" module="pinterest">
11
+ <label>Pinterest Configuration</label>
12
+ <tab>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" module="pinterest">
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
+ <pinterest_enabled translate="label" module="pinterest">
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
+ </pinterest_enabled>
36
+ <pinterest_count translate="label" module="pinterest">
37
+ <label>Pin Count</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>pinterest/pincount</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
+ </pinterest_count>
45
+ <pinterest_image_size translate="label" module="pinterest">
46
+ <label>Product Image Width</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>2</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <comment>The height of the image will vary based on the width</comment>
53
+ </pinterest_image_size>
54
+ <pinterest_price_decision translate="label" module="pinterest">
55
+ <label>Price Decision</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>2</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment>How many decimal places for product prices</comment>
62
+ </pinterest_price_decision>
63
+ <pinterest_price translate="label" module="pinterest">
64
+ <label>Price in Pinterest Description</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>pinterest/price</source_model>
67
+ <sort_order>3</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </pinterest_price>
72
+ </fields>
73
+ </configuration>
74
+ <author_information translate="label">
75
+ <label>Author</label>
76
+ <frontend_type>text</frontend_type>
77
+ <sort_order>5</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <comment>&lt;a href="http://miragedesign.net"&gt;MirageDesign.net&lt;/a&gt; Best Magento extensions for you! Please contact us at &lt;a href="mailto:contacts@miragedesign.net"&gt;contacts@miragedesign.net&lt;/a&gt; if you have any question or problem.</comment>
82
+ </author_information>
83
+ </groups>
84
+ </miragedesign_pinterest>
85
+ </sections>
86
+ </config>
app/design/frontend/base/default/layout/miragedesign/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="pinterest/button" name="pinterest_button" template="miragedesign/pinterest_button.phtml" />
6
+ </reference>
7
+ </catalog_product_view>
8
+ </layout>
app/locale/en_US/Miragedesign_Pinterest.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ "Horizontal","Horizontal"
2
+ "Vertical","Vertical"
3
+ "No Count","No Count"
4
+ "Always","Always"
5
+ "Only Special Price","Only Special Price"
6
+ "No","No"
7
+ "Pin It","Pin It"
package.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Miragedesign_Pinterest</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A Pinterest Magento linker that allows you to add "Pin It" button to your product page.</summary>
10
+ <description>A Pinterest Magento linker that allows you to add "Pin It" button to your product page.&#xD;
11
+ &#xD;
12
+ Features:&#xD;
13
+ 1. Provide Horizontal, vertical pin count or button only layout.&#xD;
14
+ 2. Uses Products Description for the Pin Description.&#xD;
15
+ 3. Provide an option allows you to display Price or Special Price with the Description.&#xD;
16
+ 4. Support you to define the precision of price (how many decimal places for product prices)&#xD;
17
+ 5. Uses the Products Base Image for the Pin image.&#xD;
18
+ 6. Support you to config the width of the product image that will be displayed in Pin. The height of the image will vary based on the width automatically.&#xD;
19
+ 7. Pin the Product URL&#xD;
20
+ 8. Support locate file (currently only English, but other languages will be available soon)&#xD;
21
+ 8. Allow you to enable / disable the extension.&#xD;
22
+ And much more features are comming!&#xD;
23
+ </description>
24
+ <notes>First Release Version.&#xD;
25
+ Currently we support locate files for only English, but will support other languages soon.</notes>
26
+ <authors><author><name>Mirage Design</name><user>ngocdb</user><email>ngocdbcn@gmail.com</email></author></authors>
27
+ <date>2012-03-06</date>
28
+ <time>05:58:08</time>
29
+ <contents><target name="magecommunity"><dir name="Miragedesign"><dir name="Pinterest"><dir name="Block"><file name="Button.php" hash="ed4856d6e7af423dc66d7d7aecfa7b7a"/></dir><dir name="Helper"><file name="Data.php" hash="0f3173f571a8dbeabf3e55a70ae57c95"/></dir><dir name="Model"><file name="Pincount.php" hash="e405b72545cabc196630ce099a82eb10"/><file name="Price.php" hash="c61c75334b6410649a92d33f22c60bd6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6ec7da759768d8ba1bceeffa15a5ff8d"/><file name="config.xml" hash="ee2263d8fbb5d1d447f8aa23c0a2213f"/><file name="system.xml" hash="428d6baa79e6bbfc08f0024bd272c5cf"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="miragedesign"><file name="pinterest.xml" hash="43561da1c7f77cba4b8f5810d5495ad3"/></dir></dir><dir name="template"><dir name="miragdesign"><file name="pinterest_button.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Miragedesign_Pinterest.csv" hash="f80229646ce5a4bf8951f4d9243cad2e"/></dir></target></contents>
30
+ <compatible/>
31
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
32
+ </package>