Miragedesign_Pinterest - Version 1.0.3

Version Notes

Upgraded Version: Integrated Pin It with other popular social network buttons like Facebook Like, Twitter Tweet and Google+

Download this release

Release Info

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


Code changes from version 1.0.2 to 1.0.3

app/code/community/Miragedesign/Pinterest/Block/Button.php CHANGED
@@ -94,5 +94,25 @@ class Miragedesign_Pinterest_Block_Button extends Mage_Core_Block_Template
94
  protected function getIsEnabled() {
95
  return $this->_isEnabled;
96
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
  ?>
94
  protected function getIsEnabled() {
95
  return $this->_isEnabled;
96
  }
97
+
98
+ protected function checkFacebookIsEnabled() {
99
+ $isEnabled = Mage::getStoreConfig('miragedesign_pinterest/other_social_config/facebook_enabled');
100
+ return $isEnabled;
101
+ }
102
+
103
+ protected function checkTwitterIsEnabled() {
104
+ $isEnabled = Mage::getStoreConfig('miragedesign_pinterest/other_social_config/twitter_enabled');
105
+ return $isEnabled;
106
+ }
107
+
108
+ protected function checkGooglePlusIsEnabled() {
109
+ $isEnabled = Mage::getStoreConfig('miragedesign_pinterest/other_social_config/google_plus_enabled');
110
+ return $isEnabled;
111
+ }
112
+
113
+ protected function getTwitterDataVia() {
114
+ $dataVia = Mage::getStoreConfig('miragedesign_pinterest/other_social_network/pinterest_twitter_account');
115
+ return $dataVia;
116
+ }
117
  }
118
  ?>
app/code/community/Miragedesign/Pinterest/Model/Pindescription.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_Pindescription
11
+ {
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 1, 'label' => Mage::helper('pinterest')->__('Product Name')),
16
+ array('value' => 2, 'label' => Mage::helper('pinterest')->__('Product Description')),
17
+ array('value' => 0, 'label' => Mage::helper('pinterest')->__('Product Short Description')),
18
+ );
19
+ }
20
+
21
+ }
22
+ ?>
app/code/community/Miragedesign/Pinterest/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Miragedesign_Pinterest>
5
- <version>1.0.2</version>
6
  </Miragedesign_Pinterest>
7
  </modules>
8
  <frontend>
@@ -67,6 +67,9 @@
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>
2
  <config>
3
  <modules>
4
  <Miragedesign_Pinterest>
5
+ <version>1.0.3</version>
6
  </Miragedesign_Pinterest>
7
  </modules>
8
  <frontend>
67
  <pinterest_image_size>300</pinterest_image_size>
68
  <pinterest_price_decision>2</pinterest_price_decision>
69
  </configuration>
70
+ <!-- <other_social_config>-->
71
+ <!-- <pinterest_twitter_account>Pinteresttuto</pinterest_twitter_account> -->
72
+ <!-- </other_social_config>-->
73
  </miragedesign_pinterest>
74
  </default>
75
  </config>
app/code/community/Miragedesign/Pinterest/etc/system.xml CHANGED
@@ -41,11 +41,12 @@
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>
@@ -54,23 +55,69 @@
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>
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
+ <comment>Choose the layout Pin It will be, then other social network buttons will base on it too</comment>
45
  </pinterest_count>
46
  <pinterest_image_size translate="label" module="pinterest">
47
  <label>Product Image Width</label>
48
  <frontend_type>text</frontend_type>
49
+ <sort_order>3</sort_order>
50
  <show_in_default>1</show_in_default>
51
  <show_in_website>1</show_in_website>
52
  <show_in_store>1</show_in_store>
55
  <pinterest_price_decision translate="label" module="pinterest">
56
  <label>Price Decision</label>
57
  <frontend_type>text</frontend_type>
58
+ <sort_order>6</sort_order>
59
  <show_in_default>1</show_in_default>
60
  <show_in_website>1</show_in_website>
61
  <show_in_store>1</show_in_store>
62
  <comment>How many decimal places for product prices</comment>
63
+ </pinterest_price_decision>
64
  <pinterest_price translate="label" module="pinterest">
65
  <label>Price in Pinterest Description</label>
66
  <frontend_type>select</frontend_type>
67
  <source_model>pinterest/price</source_model>
68
+ <sort_order>5</sort_order>
69
  <show_in_default>1</show_in_default>
70
  <show_in_website>1</show_in_website>
71
  <show_in_store>1</show_in_store>
72
  </pinterest_price>
73
  </fields>
74
  </configuration>
75
+ <other_social_config translate="label" module="pinterest">
76
+ <label>Pinterest Configuration</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>1</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ <fields>
83
+ <facebook_enabled translate="label" module="pinterest">
84
+ <label>Enable Facebook</label>
85
+ <frontend_type>select</frontend_type>
86
+ <source_model>adminhtml/system_config_source_yesno</source_model>
87
+ <sort_order>1</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </facebook_enabled>
92
+ <twitter_enabled translate="label" module="pinterest">
93
+ <label>Enable Twitter</label>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <sort_order>1</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </twitter_enabled>
101
+ <pinterest_twitter_account translate="label" module="pinterest">
102
+ <label>Twitter Data Via</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>2</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ <comment>Put your Twitter name here</comment>
109
+ </pinterest_twitter_account>
110
+ <google_plus_enabled translate="label" module="pinterest">
111
+ <label>Enable Google+</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_yesno</source_model>
114
+ <sort_order>1</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </google_plus_enabled>
119
+ </fields>
120
+ </other_social_config>
121
  <author_information translate="label">
122
  <label>Author</label>
123
  <frontend_type>text</frontend_type>
app/design/frontend/base/default/template/miragedesign/pinterest_button.phtml CHANGED
@@ -10,7 +10,6 @@
10
  ?>
11
  <?php if ($this->getIsEnabled()) :?>
12
  <?php
13
- $_product = $this->getProduct();
14
  $productUrl = $this->getProductUrl();
15
  $productImage = $this->getProductImage();
16
  $productDescription = $this->getProductDescription();
@@ -20,7 +19,70 @@
20
  ?>
21
  <a href="http://pinterest.com/pin/create/button/?url=<?php echo $productUrl; ?>&media=<?php echo $productImage; ?>&description=<?php echo $productDescription; ?>" class="pin-it-button" count-layout="<?php echo $pinterestCount; ?>"><?php echo $this->helper('pinterest')->__('Pin It'); ?></a>
22
  <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
23
- <a title="Send this page to Twitter!" href="http://twitter.com/home?status=Check out the <?php echo $this->htmlEscape($_product->getName()) ?> at <?php echo $_product->getProductUrl() ?> @foodoAU" target="_blank"><img src="YOUR BUTTON HERE" alt="Follow foodoAU on Twitter" /></a>
24
- <a href="http://www.facebook.com/sharer.php?u=<?php echo $_product->getProductUrl() ?>&t=Check+this+out" target="_blank" title="Share on Facebook"><img src="YOUR BUTTON HERE" alt="Share on Facebook"></a>
25
- <a href="http://www.google.com/buzz/post?url=<?php echo $_product->getProductUrl() ?>&title=<?php echo $this->htmlEscape($_product->getName()) ?>&srcURL=YOUR URL&srcTitle=YOUR SITE NAME" target="_blank" rel="nofollow external" title="Google Buzz This"><img src="YOUR BUTTON" alt="Google Buzz This!" /></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  <?php endif; ?>
10
  ?>
11
  <?php if ($this->getIsEnabled()) :?>
12
  <?php
 
13
  $productUrl = $this->getProductUrl();
14
  $productImage = $this->getProductImage();
15
  $productDescription = $this->getProductDescription();
19
  ?>
20
  <a href="http://pinterest.com/pin/create/button/?url=<?php echo $productUrl; ?>&media=<?php echo $productImage; ?>&description=<?php echo $productDescription; ?>" class="pin-it-button" count-layout="<?php echo $pinterestCount; ?>"><?php echo $this->helper('pinterest')->__('Pin It'); ?></a>
21
  <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
22
+
23
+ <?php if ($pinterestCount == 'horizontal' || $pinterestCount == 'none') :?>
24
+
25
+ <?php if ($this->checkTwitterIsEnabled()) :?>
26
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $productUrl ?>" <?php if ($this->getTwitterDataVia()) :?>data-via="<?php echo $this->getTwitterDataVia(); ?>"<?php endif; ?>>Tweet</a>
27
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
28
+ <?php endif; ?>
29
+
30
+ <?php if ($this->checkGooglePlusIsEnabled()) :?>
31
+ <!-- Place this tag where you want the +1 button to render -->
32
+ <g:plusone size="medium" href="<?php echo $productUrl; ?>"></g:plusone>
33
+ <!-- Place this render call where appropriate -->
34
+ <script type="text/javascript">
35
+ (function() {
36
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
37
+ po.src = 'https://apis.google.com/js/plusone.js';
38
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
39
+ })();
40
+ </script>
41
+ <?php endif; ?>
42
+
43
+ <?php if ($this->checkFacebookIsEnabled()) :?>
44
+ <script>(function(d, s, id) {
45
+ var js, fjs = d.getElementsByTagName(s)[0];
46
+ if (d.getElementById(id)) return;
47
+ js = d.createElement(s); js.id = id;
48
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
49
+ fjs.parentNode.insertBefore(js, fjs);
50
+ }(document, 'script', 'facebook-jssdk'));</script>
51
+
52
+ <div class="fb-like" data-href="<?php echo $productUrl; ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
53
+ <?php endif; ?>
54
+
55
+ <?php elseif ($pinterestCount == 'vertical') :?>
56
+
57
+ <?php if ($this->checkFacebookIsEnabled()) :?>
58
+ <script>(function(d, s, id) {
59
+ var js, fjs = d.getElementsByTagName(s)[0];
60
+ if (d.getElementById(id)) return;
61
+ js = d.createElement(s); js.id = id;
62
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
63
+ fjs.parentNode.insertBefore(js, fjs);
64
+ }(document, 'script', 'facebook-jssdk'));</script>
65
+
66
+ <div class="fb-like" data-href="<?php echo $productUrl ?>" data-send="false" data-layout="box_count" data-width="50" data-show-faces="false"></div>
67
+ <?php endif; ?>
68
+
69
+ <?php if ($this->checkTwitterIsEnabled()) :?>
70
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $productUrl ?>" data-via="Pinteresttuto" data-count="vertical">Tweet</a>
71
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
72
+ <?php endif; ?>
73
+
74
+ <?php if ($this->checkGooglePlusIsEnabled()) :?>
75
+ <!-- Place this tag where you want the +1 button to render -->
76
+ <g:plusone size="tall" href="<?php echo $productUrl; ?>"></g:plusone>
77
+ <!-- Place this render call where appropriate -->
78
+ <script type="text/javascript">
79
+ (function() {
80
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
81
+ po.src = 'https://apis.google.com/js/plusone.js';
82
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
83
+ })();
84
+ </script>
85
+ <?php endif; ?>
86
+
87
+ <?php endif; ?>
88
  <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Miragedesign_Pinterest</name>
4
- <version>1.0.2</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>
@@ -21,12 +21,13 @@ Features:&#xD;
21
  8. Allow you to enable / disable the extension.&#xD;
22
  And much more features are comming!&#xD;
23
  </description>
24
- <notes>Minor modification after the first Release Version.&#xD;
 
25
  </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>07:07:28</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="88af4547febaf40861993b0363c0d9b1"/><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="miragedesign"><file name="pinterest_button.phtml" hash="ec5417f5f0e897d991e69e1d66bc2d53"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Miragedesign_Pinterest.csv" hash="f80229646ce5a4bf8951f4d9243cad2e"/></dir></target><target name="mageetc"><dir name="modules"><file name="Miragedesign_Pinterest.xml" hash="3448b63aef6988ef012fecfec37c6c53"/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Miragedesign_Pinterest</name>
4
+ <version>1.0.3</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>
21
  8. Allow you to enable / disable the extension.&#xD;
22
  And much more features are comming!&#xD;
23
  </description>
24
+ <notes>Upgraded Version: Integrated Pin It with other popular social network buttons like Facebook Like, Twitter Tweet and Google+&#xD;
25
+ &#xD;
26
  </notes>
27
  <authors><author><name>Mirage Design</name><user>ngocdb</user><email>ngocdbcn@gmail.com</email></author></authors>
28
  <date>2012-03-06</date>
29
+ <time>16:20:00</time>
30
+ <contents><target name="magecommunity"><dir name="Miragedesign"><dir name="Pinterest"><dir name="Block"><file name="Button.php" hash="e04ed03b3f6df9425086dc8d705372b5"/></dir><dir name="Helper"><file name="Data.php" hash="0f3173f571a8dbeabf3e55a70ae57c95"/></dir><dir name="Model"><file name="Pincount.php" hash="e405b72545cabc196630ce099a82eb10"/><file name="Pindescription.php" hash="127c90d48a17d4b20bf494a799f3b753"/><file name="Price.php" hash="c61c75334b6410649a92d33f22c60bd6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6ec7da759768d8ba1bceeffa15a5ff8d"/><file name="config.xml" hash="c8990cbb9cbbd5dca01f257a65c6618a"/><file name="system.xml" hash="26c9aef672c22fc497c86dc0d0afca0c"/></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="miragedesign"><file name="pinterest_button.phtml" hash="47d6ad3a6be6cdfa9dbc9df6e2197ada"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Miragedesign_Pinterest.csv" hash="f80229646ce5a4bf8951f4d9243cad2e"/></dir></target><target name="mageetc"><dir name="modules"><file name="Miragedesign_Pinterest.xml" hash="3448b63aef6988ef012fecfec37c6c53"/></dir></target></contents>
31
  <compatible/>
32
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
33
  </package>