Shopalizes_Product_Sharing_Widget - Version 1.0.6

Version Notes

Improve code and remove merchant id from configuration

Download this release

Release Info

Developer Magento Core Team
Extension Shopalizes_Product_Sharing_Widget
Version 1.0.6
Comparing to
See all releases


Code changes from version 1.0.5 to 1.0.6

app/code/community/Shopalize/Productsharing/Block/Button.php CHANGED
@@ -1,150 +1,150 @@
1
- <?php
2
- /**
3
- * @company Bytes Technolab<www.bytestechnolab.com>
4
- * @author Bytes Technolab<info@bytestechnolab.com>
5
- */
6
-
7
- class Shopalize_Productsharing_Block_Button extends Mage_Core_Block_Template{
8
-
9
- protected $_isIntegration = false;
10
- const PRODUCT_IMAGE_SIZE = 256;
11
-
12
- public function isIntegration(){
13
- $this->_isIntegration = true;
14
- return $this;
15
- }
16
-
17
- /**
18
- * Product
19
- *
20
- * @return Mage_Catalog_Model_Product
21
- */
22
- public function getProduct(){
23
-
24
- if ($product = Mage::registry('current_product')){
25
- return $product;
26
- }
27
- return false;
28
- }
29
-
30
- /**
31
- * Product URL
32
- */
33
- public function getCanonicalUrl(){
34
- $params = array();
35
- if (Mage::helper('catalog/product')->canUseCanonicalTag()){
36
- $params = array('_ignore_category'=>true);
37
- }
38
-
39
- /** @var Mage_Catalog_Model_Product $product */
40
- $product = $this->getProduct();
41
- return $product->getUrlModel()->getUrl($product, $params);
42
- }
43
-
44
- /**
45
- * Product URL
46
- */
47
- public function getProductUrl(){
48
- return $this->getCanonicalUrl();
49
- }
50
-
51
- /**
52
- * Product Short Description
53
- */
54
- public function getShortDescription($_product){
55
- $shortDescription = strip_tags($_product->getShortDescription());
56
- $shortDescription = Mage::helper('catalog/output')->productAttribute($_product, strip_tags(str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $shortDescription)), 'short_description');
57
- $shortDescription = str_replace('\'', '\\\'', $shortDescription);
58
-
59
- return $shortDescription;
60
- }
61
-
62
- /**
63
- * Product Name
64
- */
65
- public function getProductName(){
66
- $name = strip_tags($this->getProduct()->getName());
67
- $name = str_replace("'", "", $name);
68
- return addslashes($name);
69
- }
70
-
71
- /**
72
- * Product Image
73
- */
74
- public function getProductImage($_product){
75
- return Mage::helper('catalog/image')->init($_product, 'image', $_product->getImage())->resize(self::PRODUCT_IMAGE_SIZE)->__toString();
76
- }
77
-
78
- /**
79
- * Product Price
80
- */
81
- public function getProductPrice($_product){
82
- if($this->getProduct()->getTypeId() == 'bundle'){
83
- $_priceModel = $_product->getPriceModel();
84
- list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);
85
- return $_minimalPriceInclTax;
86
- } else {
87
- return $this->getProduct()->getPrice();
88
- }
89
- }
90
-
91
- /**
92
- * Product Special Price
93
- */
94
- public function getProductSpecialPrice($_product){
95
- if($this->getProduct()->getTypeId() == 'bundle'){
96
- $_priceModel = $_product->getPriceModel();
97
- list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);
98
- return $_minimalPriceInclTax;
99
- } else {
100
- $special_price = $this->getProduct()->getSpecialPrice();
101
-
102
- if($special_price == '')
103
- return $this->getProduct()->getProductPrice();
104
- else
105
- return $special_price;
106
- }
107
- }
108
-
109
- /**
110
- * Shopalized Product Sharing Enabled
111
- */
112
- public function isEnabled(){
113
- return Mage::getStoreConfig('productsharing/settings/active');
114
- }
115
-
116
- /**
117
- * Product Shopalized Merchant Id
118
- */
119
- public function getShopalizeMerchantId(){
120
- if(Mage::getStoreConfig('purchasesharing/settings/active')){
121
- return Mage::getStoreConfig('purchasesharing/settings/merchant_id');
122
- }else{
123
- return Mage::getStoreConfig('productsharing/settings/merchant_id');
124
- }
125
- }
126
-
127
- /**
128
- * Product Shopalized Store Id
129
- */
130
- public function getShopalizeStoreId(){
131
- if(Mage::getStoreConfig('purchasesharing/settings/active')){
132
- return Mage::getStoreConfig('purchasesharing/settings/store_id');
133
- }else{
134
- return Mage::getStoreConfig('productsharing/settings/store_id');
135
- }
136
- }
137
-
138
- public function isPurchaseSharingEnabled(){
139
- return Mage::getStoreConfig('purchasesharing/settings/active');
140
- }
141
-
142
- public function getButtonClassName(){
143
- return Mage::getStoreConfig('productsharing/settings/share_button_class');
144
- }
145
-
146
- public function getButtonTextName(){
147
- return Mage::getStoreConfig('productsharing/settings/share_button_text');
148
- }
149
-
150
  }
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharing_Block_Button extends Mage_Core_Block_Template{
8
+
9
+ protected $_isIntegration = false;
10
+ const PRODUCT_IMAGE_SIZE = 256;
11
+
12
+ public function isIntegration(){
13
+ $this->_isIntegration = true;
14
+ return $this;
15
+ }
16
+
17
+ /**
18
+ * Product
19
+ *
20
+ * @return Mage_Catalog_Model_Product
21
+ */
22
+ public function getProduct(){
23
+
24
+ if ($product = Mage::registry('current_product')){
25
+ return $product;
26
+ }
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Product URL
32
+ */
33
+ public function getCanonicalUrl(){
34
+ $params = array();
35
+ if (Mage::helper('catalog/product')->canUseCanonicalTag()){
36
+ $params = array('_ignore_category'=>true);
37
+ }
38
+
39
+ /** @var Mage_Catalog_Model_Product $product */
40
+ $product = $this->getProduct();
41
+ return $product->getUrlModel()->getUrl($product, $params);
42
+ }
43
+
44
+ /**
45
+ * Product URL
46
+ */
47
+ public function getProductUrl(){
48
+ return $this->getCanonicalUrl();
49
+ }
50
+
51
+ /**
52
+ * Product Short Description
53
+ */
54
+ public function getShortDescription($_product){
55
+ $shortDescription = strip_tags($_product->getShortDescription());
56
+ $shortDescription = Mage::helper('catalog/output')->productAttribute($_product, strip_tags(str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $shortDescription)), 'short_description');
57
+ $shortDescription = str_replace('\'', '\\\'', $shortDescription);
58
+
59
+ return $shortDescription;
60
+ }
61
+
62
+ /**
63
+ * Product Name
64
+ */
65
+ public function getProductName(){
66
+ $name = strip_tags($this->getProduct()->getName());
67
+ $name = str_replace("'", "", $name);
68
+ return addslashes($name);
69
+ }
70
+
71
+ /**
72
+ * Product Image
73
+ */
74
+ public function getProductImage($_product){
75
+ return Mage::helper('catalog/image')->init($_product, 'image', $_product->getImage())->resize(self::PRODUCT_IMAGE_SIZE)->__toString();
76
+ }
77
+
78
+ /**
79
+ * Product Price
80
+ */
81
+ public function getProductPrice($_product){
82
+ if($this->getProduct()->getTypeId() == 'bundle'){
83
+ $_priceModel = $_product->getPriceModel();
84
+ list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);
85
+ return $_minimalPriceInclTax;
86
+ } else {
87
+ return $this->getProduct()->getPrice();
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Product Special Price
93
+ */
94
+ public function getProductSpecialPrice($_product){
95
+ if($this->getProduct()->getTypeId() == 'bundle'){
96
+ $_priceModel = $_product->getPriceModel();
97
+ list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);
98
+ return $_minimalPriceInclTax;
99
+ } else {
100
+ $special_price = $this->getProduct()->getSpecialPrice();
101
+
102
+ if($special_price == '')
103
+ return $this->getProduct()->getProductPrice();
104
+ else
105
+ return $special_price;
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Shopalized Product Sharing Enabled
111
+ */
112
+ public function isEnabled(){
113
+ return Mage::getStoreConfig('productsharing/settings/active');
114
+ }
115
+
116
+ /**
117
+ * Product Shopalized Merchant Id
118
+ */
119
+ public function getShopalizeMerchantId(){
120
+ /* if(Mage::getStoreConfig('purchasesharing/settings/active')){
121
+ return Mage::getStoreConfig('purchasesharing/settings/merchant_id');
122
+ }else{
123
+ return Mage::getStoreConfig('productsharing/settings/merchant_id');
124
+ }*/
125
+ }
126
+
127
+ /**
128
+ * Product Shopalized Store Id
129
+ */
130
+ public function getShopalizeStoreId(){
131
+ if(Mage::getStoreConfig('purchasesharing/settings/active')){
132
+ return Mage::getStoreConfig('purchasesharing/settings/store_id');
133
+ }else{
134
+ return Mage::getStoreConfig('productsharing/settings/store_id');
135
+ }
136
+ }
137
+
138
+ public function isPurchaseSharingEnabled(){
139
+ return Mage::getStoreConfig('purchasesharing/settings/active');
140
+ }
141
+
142
+ public function getButtonClassName(){
143
+ return Mage::getStoreConfig('productsharing/settings/share_button_class');
144
+ }
145
+
146
+ public function getButtonTextName(){
147
+ return Mage::getStoreConfig('productsharing/settings/share_button_text');
148
+ }
149
+
150
  }
app/code/community/Shopalize/Productsharing/Helper/Data.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
- /**
3
- * @company Bytes Technolab<www.bytestechnolab.com>
4
- * @author Bytes Technolab<info@bytestechnolab.com>
5
- */
6
-
7
- class Shopalize_Productsharing_Helper_Data extends Mage_Core_Helper_Abstract
8
- {
9
-
10
- }
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharing_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+
10
+ }
app/code/community/Shopalize/Productsharing/etc/system.xml CHANGED
@@ -56,14 +56,14 @@
56
  <show_in_website>1</show_in_website>
57
  <show_in_store>1</show_in_store>
58
  </active>
59
- <merchant_id translate="label">
60
  <label>Merchant Id</label>
61
  <frontend_type>text</frontend_type>
62
  <sort_order>20</sort_order><show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
  <comment><![CDATA[Get Shopalize Merchant ID by signing up at <a target="_blank" href="http://www.shopalize.com">www.shopalize.com</a>. Look for Account ID value on Settings or Integration Guide page.]]></comment>
66
- </merchant_id>
67
  <store_id translate="label">
68
  <label>Store Id</label>
69
  <frontend_type>text</frontend_type>
@@ -71,7 +71,7 @@
71
  <show_in_website>1</show_in_website>
72
  <show_in_store>1</show_in_store>
73
  <comment><![CDATA[Get Shopalize Store ID by signing up at <a target="_blank" href="http://www.shopalize.com">www.shopalize.com</a>. Look for Store ID value on Settings or Integration Guide page.]]></comment>
74
- </store_id>
75
  <share_button_class translate="label">
76
  <label>Share Button Class Name</label>
77
  <frontend_type>text</frontend_type>
@@ -85,7 +85,7 @@
85
  <sort_order>23</sort_order><show_in_default>1</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>1</show_in_store>
88
- </share_button_text>
89
  </fields>
90
  </settings>
91
  </groups>
56
  <show_in_website>1</show_in_website>
57
  <show_in_store>1</show_in_store>
58
  </active>
59
+ <!-- <merchant_id translate="label">
60
  <label>Merchant Id</label>
61
  <frontend_type>text</frontend_type>
62
  <sort_order>20</sort_order><show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
  <comment><![CDATA[Get Shopalize Merchant ID by signing up at <a target="_blank" href="http://www.shopalize.com">www.shopalize.com</a>. Look for Account ID value on Settings or Integration Guide page.]]></comment>
66
+ </merchant_id> -->
67
  <store_id translate="label">
68
  <label>Store Id</label>
69
  <frontend_type>text</frontend_type>
71
  <show_in_website>1</show_in_website>
72
  <show_in_store>1</show_in_store>
73
  <comment><![CDATA[Get Shopalize Store ID by signing up at <a target="_blank" href="http://www.shopalize.com">www.shopalize.com</a>. Look for Store ID value on Settings or Integration Guide page.]]></comment>
74
+ </store_id><!--
75
  <share_button_class translate="label">
76
  <label>Share Button Class Name</label>
77
  <frontend_type>text</frontend_type>
85
  <sort_order>23</sort_order><show_in_default>1</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>1</show_in_store>
88
+ </share_button_text> -->
89
  </fields>
90
  </settings>
91
  </groups>
app/design/frontend/default/default/template/shopalizeproductsharing/basic_integration.phtml CHANGED
@@ -5,10 +5,8 @@ if($this->isEnabled() && !$this->isPurchaseSharingEnabled()){ ?>
5
  (function(w, d, id) {
6
  if (d.getElementById(id)) return;
7
  Shopalize = w.Shopalize || {};
8
- Shopalize.merchant_id = '<?php echo $this->getShopalizeMerchantId() ?>';
9
  Shopalize.store_id = '<?php echo $this->getShopalizeStoreId() ?>';
10
- Shopalize.currency = '<?php echo Mage::app()->getStore()->getCurrentCurrencyCode() ?>';
11
- Shopalize.base_url = ('https:'== d.location.protocol ? 'https://' : 'http://') + 'shopalize.com';
12
  var script = d.createElement('script'), entry; script.type = 'text/javascript'; script.id = id;
13
  script.async = true; script.src = Shopalize.base_url + '/js/all.js';
14
  entry = d.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry);
5
  (function(w, d, id) {
6
  if (d.getElementById(id)) return;
7
  Shopalize = w.Shopalize || {};
 
8
  Shopalize.store_id = '<?php echo $this->getShopalizeStoreId() ?>';
9
+ Shopalize.base_url = ('https:'== d.location.protocol ? 'https://' : 'http://') + 'www.shopalize.com';
 
10
  var script = d.createElement('script'), entry; script.type = 'text/javascript'; script.id = id;
11
  script.async = true; script.src = Shopalize.base_url + '/js/all.js';
12
  entry = d.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry);
app/design/frontend/default/default/template/shopalizeproductsharing/product_integration.phtml CHANGED
@@ -2,17 +2,17 @@
2
  if($this->isEnabled()){
3
 
4
  $_product = $this->getProduct();
5
-
6
  ?><!-- Shopalize Button Code BEGIN -->
7
- <div class="shopalize-product-sharing shopalize-share-button <?php echo $this->getButtonClassName() ?>"
8
  data-id = "<?php echo $_product->getSku()?>"
9
  data-title = "<?php echo $this->getProductName()?>"
10
  data-description = "<?php echo $this->getShortDescription($_product)?>"
11
  data-url = "<?php echo $this->getProductUrl()?>"
12
  data-image-url = "<?php echo $this->getProductImage($_product)?>"
13
  data-list-price = "<?php echo $this->getProductPrice($_product); ?>"
14
- data-current-price= "<?php echo $this->getProductSpecialPrice($_product); ?>">
15
- <a href="#"><span class="shopalize-share-button-text"><?php echo $this->getButtonTextName() ?></span></a>
16
  </div>
17
  <!-- Shopalize Button Code END -->
18
  <?php } ?>
2
  if($this->isEnabled()){
3
 
4
  $_product = $this->getProduct();
5
+
6
  ?><!-- Shopalize Button Code BEGIN -->
7
+ <div class="shopalize-product-sharing"
8
  data-id = "<?php echo $_product->getSku()?>"
9
  data-title = "<?php echo $this->getProductName()?>"
10
  data-description = "<?php echo $this->getShortDescription($_product)?>"
11
  data-url = "<?php echo $this->getProductUrl()?>"
12
  data-image-url = "<?php echo $this->getProductImage($_product)?>"
13
  data-list-price = "<?php echo $this->getProductPrice($_product); ?>"
14
+ data-current-price = "<?php echo $this->getProductSpecialPrice($_product); ?>"
15
+ data-currency = "<?php echo Mage::app()->getStore()->getCurrentCurrencyCode() ?>">
16
  </div>
17
  <!-- Shopalize Button Code END -->
18
  <?php } ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shopalizes_Product_Sharing_Widget</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -19,11 +19,11 @@
19
  &#xD;
20
  &lt;ol&gt;&#xD;
21
  &lt;li&gt;Register an account with &lt;a href="http://www.shopalize.com"&gt;Shopalize.com&lt;/a&gt; before you start the installation to get your Account</description>
22
- <notes>Fixed getProductPrice function issue for those products which have customer group based price</notes>
23
  <authors><author><name>Aditya Kothadiya</name><user>auto-converted</user><email>aditya@shopalize.com</email></author></authors>
24
- <date>2012-10-03</date>
25
- <time>08:42:09</time>
26
- <contents><target name="magecommunity"><dir name="Shopalize"><dir name="Productsharing"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="85ddeb0452ac49f57c6cba1c5767c6f0"/></dir><file name="Info.php" hash="722ed6078214cb852016f46fe4d0a2d7"/></dir></dir><file name="Button.php" hash="3bf06d9d1118e6e883390ae7e373eb66"/></dir><dir name="Helper"><file name="Data.php" hash="8a7629fc50842cec4b80feef8a85ccf8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ccd6eae72f74df2ccfca174e646027b3"/><file name="config.xml" hash="e44ccde85201ddae175315210a997104"/><file name="system.xml" hash="99e7130db5f0dc19a47f7b2eb70bae5e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="shopalizeproductsharing.xml" hash="c40655923a1c754b7d491e2cbcd9945c"/></dir><dir name="template"><dir name="shopalizeproductsharing"><file name="basic_integration.phtml" hash="5ebb9c24b1815dc0b10efd37e22f4a1f"/><file name="product_integration.phtml" hash="7043a11cd07cf89fc537fce2635b591c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shopalize_Productsharing.xml" hash="0fe28b06eef40ed847db7d9b41f8c6c2"/></dir></target></contents>
27
  <compatible/>
28
  <dependencies/>
29
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shopalizes_Product_Sharing_Widget</name>
4
+ <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
19
  &#xD;
20
  &lt;ol&gt;&#xD;
21
  &lt;li&gt;Register an account with &lt;a href="http://www.shopalize.com"&gt;Shopalize.com&lt;/a&gt; before you start the installation to get your Account</description>
22
+ <notes>Improve code and remove merchant id from configuration</notes>
23
  <authors><author><name>Aditya Kothadiya</name><user>auto-converted</user><email>aditya@shopalize.com</email></author></authors>
24
+ <date>2012-10-11</date>
25
+ <time>12:16:02</time>
26
+ <contents><target name="magecommunity"><dir name="Shopalize"><dir name="Productsharing"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="85ddeb0452ac49f57c6cba1c5767c6f0"/></dir><file name="Info.php" hash="722ed6078214cb852016f46fe4d0a2d7"/></dir></dir><file name="Button.php" hash="940d0a3e182c4c852cd22342dd1a656c"/></dir><dir name="Helper"><file name="Data.php" hash="bcb1c942f01fc227d50bd8a764a69a9a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ccd6eae72f74df2ccfca174e646027b3"/><file name="config.xml" hash="e44ccde85201ddae175315210a997104"/><file name="system.xml" hash="6f1882d5c2ba0284a6ce2dc96bbd475d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="shopalizeproductsharing.xml" hash="c40655923a1c754b7d491e2cbcd9945c"/></dir><dir name="template"><dir name="shopalizeproductsharing"><file name="basic_integration.phtml" hash="6c38dac0803f2632e9d01b384e6d0b39"/><file name="product_integration.phtml" hash="48e7d88a7fb6d39c491a404f9f880e2d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shopalize_Productsharing.xml" hash="0fe28b06eef40ed847db7d9b41f8c6c2"/></dir></target></contents>
27
  <compatible/>
28
  <dependencies/>
29
  </package>