Shopalizes_Product_Sharing_Widget - Version 1.0.0

Version Notes

Shopalize Product Sharing Widget 1.0.0 Released

Download this release

Release Info

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


Version 1.0.0

Files changed (29) hide show
  1. app/code/community/Shopalize/Pinterest_bk/Block/Button.php +105 -0
  2. app/code/community/Shopalize/Pinterest_bk/Helper/Data.php +20 -0
  3. app/code/community/Shopalize/Pinterest_bk/Model/System/Config/Source/Type.php +34 -0
  4. app/code/community/Shopalize/Pinterest_bk/etc/adminhtml.xml +34 -0
  5. app/code/community/Shopalize/Pinterest_bk/etc/config.xml +139 -0
  6. app/code/community/Shopalize/Pinterest_bk/etc/system.xml +67 -0
  7. app/code/community/Shopalize/Productsharingwidget/Block/Button.php +115 -0
  8. app/code/community/Shopalize/Productsharingwidget/Block/Sa.php +41 -0
  9. app/code/community/Shopalize/Productsharingwidget/Block/System/Config/Info.php +28 -0
  10. app/code/community/Shopalize/Productsharingwidget/Block/System/Config/Info/About.php +32 -0
  11. app/code/community/Shopalize/Productsharingwidget/Helper/Data.php +10 -0
  12. app/code/community/Shopalize/Productsharingwidget/etc/adminhtml.xml +25 -0
  13. app/code/community/Shopalize/Productsharingwidget/etc/config.xml +89 -0
  14. app/code/community/Shopalize/Productsharingwidget/etc/system.xml +82 -0
  15. app/code/community/Shopalize/Purchasesharingwidget/Block/Purchasesharingwidget.php +13 -0
  16. app/code/community/Shopalize/Purchasesharingwidget/Block/Success.php +31 -0
  17. app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info.php +34 -0
  18. app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info/About.php +37 -0
  19. app/code/community/Shopalize/Purchasesharingwidget/Helper/Data.php +307 -0
  20. app/code/community/Shopalize/Purchasesharingwidget/Helper/Event.php +47 -0
  21. app/code/community/Shopalize/Purchasesharingwidget/controllers/IndexController.php +13 -0
  22. app/code/community/Shopalize/Purchasesharingwidget/etc/adminhtml.xml +33 -0
  23. app/code/community/Shopalize/Purchasesharingwidget/etc/config.xml +81 -0
  24. app/code/community/Shopalize/Purchasesharingwidget/etc/system.xml +110 -0
  25. app/design/frontend/default/default/layout/productsharingwidget.xml +32 -0
  26. app/design/frontend/default/default/template/productsharingwidget/button.phtml +18 -0
  27. app/design/frontend/default/default/template/productsharingwidget/sa.phtml +18 -0
  28. app/etc/modules/Shopalize_Productsharingwidget.xml +9 -0
  29. package.xml +29 -0
app/code/community/Shopalize/Pinterest_bk/Block/Button.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Pinterest
14
+ * @copyright Copyright (c) 2012 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+
18
+
19
+ class Magpleasure_Pinterest_Block_Button extends Mage_Core_Block_Template
20
+ {
21
+ protected $_isIntegration = false;
22
+
23
+ public function isIntegration()
24
+ {
25
+ $this->_isIntegration = true;
26
+ return $this;
27
+ }
28
+
29
+ public function isEnabled()
30
+ {
31
+ return Mage::getStoreConfig('mppinterest/general/enabled');
32
+ }
33
+
34
+ public function canShow()
35
+ {
36
+ if ($this->_isIntegration){
37
+ return (Mage::getStoreConfig('mppinterest/general/display_in_other') && $this->isEnabled() && !!$this->getProduct());
38
+ } else {
39
+ return ($this->isEnabled() && !!$this->getProduct());
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Product
45
+ *
46
+ * @return Mage_Catalog_Model_Product
47
+ */
48
+ public function getProduct()
49
+ {
50
+ if ($product = Mage::registry('current_product')){
51
+ return $product;
52
+ }
53
+ return false;
54
+ }
55
+
56
+ /**
57
+ * Retrieves Canonical Url
58
+ *
59
+ * @return string
60
+ */
61
+ public function getCanonicalUrl()
62
+ {
63
+ $params = array();
64
+ if (Mage::helper('catalog/product')->canUseCanonicalTag()){
65
+ $params = array('_ignore_category'=>true);
66
+ }
67
+ /** @var Mage_Catalog_Model_Product $product */
68
+ $product = $this->getProduct();
69
+ return $product->getUrlModel()->getUrl($product, $params);
70
+ }
71
+
72
+ public function getProductUrl()
73
+ {
74
+ return urlencode($this->getCanonicalUrl());
75
+ }
76
+
77
+ public function getAddPrice()
78
+ {
79
+ return Mage::getStoreConfig('mppinterest/general/add_price');
80
+ }
81
+
82
+ public function getButtonType()
83
+ {
84
+ return Mage::getStoreConfig('mppinterest/general/button_type');
85
+ }
86
+
87
+ public function getShortDescription()
88
+ {
89
+ $shortDescription = strip_tags($this->getProduct()->getShortDescription());
90
+ if ($this->getAddPrice()){
91
+ $price = str_replace("USD", "$", Mage::app()->getStore()->formatPrice($this->getProduct()->getFinalPrice(), false));
92
+ $shortDescription = trim($shortDescription).$this->__(" Price %s", $price);
93
+ }
94
+ return urlencode($shortDescription);
95
+ }
96
+
97
+ public function getPinItUrl()
98
+ {
99
+ $productUrl = $this->getProductUrl();
100
+ $shortDescription = $this->getShortDescription();
101
+ $imageUrl = urlencode($this->helper('catalog/image')->init($this->getProduct(), 'image')->__toString());
102
+ $url = "http://pinterest.com/pin/create/button/?url={$productUrl}&media={$imageUrl}&description={$shortDescription}";
103
+ return $url;
104
+ }
105
+ }
app/code/community/Shopalize/Pinterest_bk/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_Pinterest
14
+ * @copyright Copyright (c) 2012 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+ class Magpleasure_Pinterest_Helper_Data extends Mage_Core_Helper_Abstract
18
+ {
19
+
20
+ }
app/code/community/Shopalize/Pinterest_bk/Model/System/Config/Source/Type.php 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_Pinterest
14
+ * @copyright Copyright (c) 2012 Magpleasure Co. (http://www.magpleasure.com)
15
+ * @license http://www.magpleasure.com/LICENSE.txt
16
+ */
17
+
18
+
19
+ class Magpleasure_Pinterest_Model_System_Config_Source_Type extends Mage_Core_Block_Template
20
+ {
21
+ protected function _helper()
22
+ {
23
+ return Mage::helper('mppinterest');
24
+ }
25
+
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>'horizontal', 'label'=> $this->_helper()->__("Horizontal")),
30
+ array('value'=>'vertical', 'label'=> $this->_helper()->__("Vertical")),
31
+ array('value'=>'none', 'label'=> $this->_helper()->__("No Count")),
32
+ );
33
+ }
34
+ }
app/code/community/Shopalize/Pinterest_bk/etc/adminhtml.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <translate>
4
+ <modules>
5
+ <Magpleasure_Pinterest>
6
+ <files>
7
+ <default>Magpleasure_Pinterest.csv</default>
8
+ </files>
9
+ </Magpleasure_Pinterest>
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
+ <mppinterest>
24
+ <title>Pinterest Integration</title>
25
+ </mppinterest>
26
+ </children>
27
+ </config>
28
+ </children>
29
+ </system>
30
+ </children>
31
+ </admin>
32
+ </resources>
33
+ </acl>
34
+ </config>
app/code/community/Shopalize/Pinterest_bk/etc/config.xml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Pinterest
15
+ * @copyright Copyright (c) 2012 Magpleasure Co. (http://www.magpleasure.com)
16
+ * @license http://www.magpleasure.com/LICENSE.txt
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Magpleasure_Pinterest>
22
+ <version>1.0.4</version>
23
+ </Magpleasure_Pinterest>
24
+ </modules>
25
+ <global>
26
+ <models>
27
+ <mppinterest>
28
+ <class>Magpleasure_Pinterest_Model</class>
29
+ </mppinterest>
30
+ </models>
31
+ <blocks>
32
+ <mppinterest>
33
+ <class>Magpleasure_Pinterest_Block</class>
34
+ </mppinterest>
35
+ </blocks>
36
+ <helpers>
37
+ <mppinterest>
38
+ <class>Magpleasure_Pinterest_Helper</class>
39
+ </mppinterest>
40
+ </helpers>
41
+ <resources>
42
+ <mppinterest_setup>
43
+ <setup>
44
+ <module>Magpleasure_Pinterest</module>
45
+ </setup>
46
+ <connection>
47
+ <use>core_setup</use>
48
+ </connection>
49
+ </mppinterest_setup>
50
+ <mppinterest_write>
51
+ <connection>
52
+ <use>core_write</use>
53
+ </connection>
54
+ </mppinterest_write>
55
+ <mppinterest_read>
56
+ <connection>
57
+ <use>core_read</use>
58
+ </connection>
59
+ </mppinterest_read>
60
+ </resources>
61
+ <layout>
62
+ <updates>
63
+ <mppinterest>
64
+ <file>mppinterest.xml</file>
65
+ </mppinterest>
66
+ </updates>
67
+ </layout>
68
+ </global>
69
+ <frontend>
70
+ <routers>
71
+ <mppinterest>
72
+ <use>standard</use>
73
+ <args>
74
+ <module>Magpeasure_Pinterest</module>
75
+ <frontName>mppinterest</frontName>
76
+ </args>
77
+ </mppinterest>
78
+ </routers>
79
+ <layout>
80
+ <updates>
81
+ <mppinterest>
82
+ <file>mppinterest.xml</file>
83
+ </mppinterest>
84
+ </updates>
85
+ </layout>
86
+ <translate>
87
+ <modules>
88
+ <Magpleasure_Pinterest>
89
+ <files>
90
+ <default>Magpleasure_Pinterest.csv</default>
91
+ </files>
92
+ </Magpleasure_Pinterest>
93
+ </modules>
94
+ </translate>
95
+ </frontend>
96
+ <adminhtml>
97
+ <translate>
98
+ <modules>
99
+ <Magpleasure_Pinterest>
100
+ <files>
101
+ <default>Magpleasure_Pinterest.csv</default>
102
+ </files>
103
+ </Magpleasure_Pinterest>
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
+ <mppinterest>
118
+ <title>Pinterest Integration</title>
119
+ </mppinterest>
120
+ </children>
121
+ </config>
122
+ </children>
123
+ </system>
124
+ </children>
125
+ </admin>
126
+ </resources>
127
+ </acl>
128
+ </adminhtml>
129
+ <default>
130
+ <mppinterest>
131
+ <general>
132
+ <enabled>1</enabled>
133
+ <display_in_other>1</display_in_other>
134
+ <button_type>horizontal</button_type>
135
+ <add_price>1</add_price>
136
+ </general>
137
+ </mppinterest>
138
+ </default>
139
+ </config>
app/code/community/Shopalize/Pinterest_bk/etc/system.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <magpleasure translate="label" module="mppinterest">
5
+ <label>Magpleasure Extensions</label>
6
+ <sort_order>210</sort_order>
7
+ </magpleasure>
8
+ </tabs>
9
+ <sections>
10
+ <mppinterest module="mppinterest" translate="label">
11
+ <label>Pinterest Integration</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_other translate="label">
36
+ <label>Integrate into Product Page</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>20</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_other>
44
+ <button_type translate="label">
45
+ <label>Button Type</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>mppinterest/system_config_source_type</source_model>
48
+ <sort_order>30</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
+ </button_type>
53
+ <add_price translate="label">
54
+ <label>Add Price to Description</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <sort_order>40</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
+ </add_price>
62
+ </fields>
63
+ </general>
64
+ </groups>
65
+ </mppinterest>
66
+ </sections>
67
+ </config>
app/code/community/Shopalize/Productsharingwidget/Block/Button.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharingwidget_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(){
82
+ return $this->getProduct()->getPrice();
83
+ }
84
+
85
+ /**
86
+ * Product Special Price
87
+ */
88
+ public function getProductSpecialPrice(){
89
+ $special_price = $this->getProduct()->getSpecialPrice();
90
+
91
+ if($special_price == '')
92
+ return $this->getProductPrice();
93
+ else
94
+ return $special_price;
95
+ }
96
+
97
+ /**
98
+ * Shopalized Product Sharing Enabled
99
+ */
100
+ public function isEnabled(){
101
+ return $this->getConfig('active', 'settings');
102
+ }
103
+
104
+ /**
105
+ * Get Config of Product Sharing Extension
106
+ */
107
+ public function getConfig($field, $group = 'settings', $default = null){
108
+ $value = Mage::getStoreConfig('productsharingwidget/'.$group.'/'.$field);
109
+ if(!isset($value) or trim($value) == ''){
110
+ return $default;
111
+ }else{
112
+ return $value;
113
+ }
114
+ }
115
+ }
app/code/community/Shopalize/Productsharingwidget/Block/Sa.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharingwidget_Block_Sa extends Mage_Core_Block_Template
8
+ {
9
+ /**
10
+ * Product Shopalized Merchant Id
11
+ */
12
+ public function getShopalizeMerchantId(){
13
+ return $this->getConfig('merchant_id', 'settings');
14
+ }
15
+
16
+ /**
17
+ * Product Shopalized Store Id
18
+ */
19
+ public function getShopalizeStoreId(){
20
+ return $this->getConfig('store_id', 'settings');
21
+ }
22
+
23
+ /**
24
+ * Shopalized Product Sharing Enabled
25
+ */
26
+ public function isEnabled(){
27
+ return $this->getConfig('active', 'settings');
28
+ }
29
+
30
+ /**
31
+ * Get Config of Product Sharing Extension
32
+ */
33
+ public function getConfig($field, $group = 'settings', $default = null){
34
+ $value = Mage::getStoreConfig('productsharingwidget/'.$group.'/'.$field);
35
+ if(!isset($value) or trim($value) == ''){
36
+ return $default;
37
+ }else{
38
+ return $value;
39
+ }
40
+ }
41
+ }
app/code/community/Shopalize/Productsharingwidget/Block/System/Config/Info.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+ class Shopalize_Productsharingwidget_Block_System_Config_Info
7
+ extends Mage_Adminhtml_Block_Abstract
8
+ implements Varien_Data_Form_Element_Renderer_Interface{
9
+
10
+ /**
11
+ * Render fieldset html
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ public function render(Varien_Data_Form_Element_Abstract $element){
16
+ $html = '<div style="background:url(\'http://www.shopalize.com/images/shopalize_icon.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
17
+ <h4>About Shopalize</h4>
18
+ <p>Shopalize provides a comprehensive Social Commerce platform for online retailers to help increase social sharing and customer referrals from Social Media to their eCommerce stores.<br />Shopalize&acute;s Product Sharing Plugin appears on your store&acute;s product detail page.Shoppers are prompted and rewarded for sharing product or your store with their friends on Facebook or Twitter. Shopalize also provide an A/B Testing platform to experiment with various campaigns and social analytics suite to measure ROI and track influential customers.<br />
19
+ <h4>Contact Us</h4>
20
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
21
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
22
+ Skype: adikot<br />
23
+ </p>
24
+ </div>';
25
+
26
+ return $html;
27
+ }
28
+ }
app/code/community/Shopalize/Productsharingwidget/Block/System/Config/Info/About.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharingwidget_Block_System_Config_Info_About
8
+ extends Mage_Adminhtml_Block_Abstract
9
+ implements Varien_Data_Form_Element_Renderer_Interface{
10
+
11
+ /**
12
+ * Render fieldset html
13
+ * @param Varien_Data_Form_Element_Abstract $element
14
+ * @return string
15
+ */
16
+ public function render(Varien_Data_Form_Element_Abstract $element){
17
+
18
+ $html = '<div style="background:url(\'http://www.shopalize.com/images/shopalize_icon.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
19
+ <h4>About Shopalize\'s Product Sharing Plugin</h4>
20
+ <p>
21
+ Shopalize\'s Product Sharing Plugin appears on your store\'s product detail page.
22
+ Shoppers are prompted and rewarded for sharing product or your store with their friends on Facebook or Twitter.
23
+ Shopalize also provide an A/B Testing platform to experiment with various campaigns and social analytics suite to measure ROI and track influential customers.<br />
24
+ <h4>Contact Us</h4>
25
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
26
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
27
+ Skype: adikot<br/>
28
+ </p>
29
+ </div>';
30
+ return $html;
31
+ }
32
+ }
app/code/community/Shopalize/Productsharingwidget/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+
7
+ class Shopalize_Productsharingwidget_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+
10
+ }
app/code/community/Shopalize/Productsharingwidget/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <productsharingwidget>
15
+ <title>Shopalize Product Sharing Widget</title>
16
+ </productsharingwidget>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Shopalize/Productsharingwidget/etc/config.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Shopalize_Productsharingwidget>
5
+ <version>0.0.1</version>
6
+ </Shopalize_Productsharingwidget>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <productsharingwidget>
11
+ <class>Shopalize_Productsharingwidget_Block</class>
12
+ </productsharingwidget>
13
+ </blocks>
14
+ <helpers>
15
+ <productsharingwidget>
16
+ <class>Shopalize_Productsharingwidget_Helper</class>
17
+ </productsharingwidget>
18
+ </helpers>
19
+ <resources>
20
+ <productsharingwidget_setup>
21
+ <setup>
22
+ <module>Shopalize_Productsharingwidget</module>
23
+ </setup>
24
+ <connection>
25
+ <use>core_setup</use>
26
+ </connection>
27
+ </productsharingwidget_setup>
28
+ <productsharingwidget_write>
29
+ <connection>
30
+ <use>core_write</use>
31
+ </connection>
32
+ </productsharingwidget_write>
33
+ <productsharingwidget_read>
34
+ <connection>
35
+ <use>core_read</use>
36
+ </connection>
37
+ </productsharingwidget_read>
38
+ </resources>
39
+ <layout>
40
+ <updates>
41
+ <productsharingwidget>
42
+ <file>productsharingwidget.xml</file>
43
+ </productsharingwidget>
44
+ </updates>
45
+ </layout>
46
+ </global>
47
+ <frontend>
48
+ <routers>
49
+ <productsharingwidget>
50
+ <use>standard</use>
51
+ <args>
52
+ <module>Shopalize_Productsharingwidget</module>
53
+ <frontName>productsharingwidget</frontName>
54
+ </args>
55
+ </productsharingwidget>
56
+ </routers>
57
+ <layout>
58
+ <updates>
59
+ <productsharingwidget>
60
+ <file>productsharingwidget.xml</file>
61
+ </productsharingwidget>
62
+ </updates>
63
+ </layout>
64
+ </frontend>
65
+ <adminhtml>
66
+ <acl>
67
+ <resources>
68
+ <all>
69
+ <title>Allow Everything</title>
70
+ </all>
71
+ <admin>
72
+ <children>
73
+ <system>
74
+ <children>
75
+ <config>
76
+ <children>
77
+ <productsharingwidget>
78
+ <title>Shopalize Product Sharing Widget</title>
79
+ </productsharingwidget>
80
+ </children>
81
+ </config>
82
+ </children>
83
+ </system>
84
+ </children>
85
+ </admin>
86
+ </resources>
87
+ </acl>
88
+ </adminhtml>
89
+ </config>
app/code/community/Shopalize/Productsharingwidget/etc/system.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @website http://www.oceanwebsoft.com
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+ <config>
9
+ <tabs>
10
+ <shopalizeall translate="label" module="productsharingwidget">
11
+ <label>Shopalize Extensions</label>
12
+ <sort_order>400</sort_order>
13
+ </shopalizeall>
14
+ </tabs>
15
+ <sections>
16
+ <productsharingwidget module="productsharingwidget">
17
+ <label>Product Sharing</label>
18
+ <tab>shopalizeall</tab>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>400</sort_order>
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
+ <groups>
25
+ <info>
26
+ <label>About Extension</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>10</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <fields>
33
+ <productsharingwidget_info translate="label">
34
+ <frontend_model>productsharingwidget/system_config_info_about</frontend_model>
35
+ <sort_order>10</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </productsharingwidget_info>
40
+
41
+ </fields>
42
+ </info>
43
+ <settings translate="label">
44
+ <label>Plugin Settings</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>11</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <fields>
51
+ <active translate="label">
52
+ <label>Enabled</label>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_yesno</source_model>
55
+ <sort_order>10</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
+ </active>
60
+ <merchant_id translate="label">
61
+ <label>Merchant Id</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>20</sort_order><show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <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>
67
+ </merchant_id>
68
+ <store_id translate="label">
69
+ <label>Store Id</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>21</sort_order><show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <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>
75
+ </store_id>
76
+ </fields>
77
+ </settings>
78
+
79
+ </groups>
80
+ </productsharingwidget>
81
+ </sections>
82
+ </config>
app/code/community/Shopalize/Purchasesharingwidget/Block/Purchasesharingwidget.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Ocean Websoft Pvt. Ltd.<www.oceanwebsoft.com>
4
+ * @author Ashwini Dinker<ashwini.owsm@gmail.com>
5
+ *
6
+ * @category Oceanwebsoft
7
+ * @package Oceanwebsoft_Shopalize_Social_widget
8
+ */
9
+
10
+ class Shopalize_Purchasesharingwidget_Block_Purchasesharingwidget extends Mage_Core_Block_Template
11
+ {
12
+
13
+ }
app/code/community/Shopalize/Purchasesharingwidget/Block/Success.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Checkout
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Shopalize_Purchasesharingwidget_Block_Success extends Mage_Checkout_Block_Success
29
+ {
30
+
31
+ }
app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Ocean Websoft Pvt. Ltd.<www.oceanwebsoft.com>
4
+ * @author Ashwini Dinker<ashwini.owsm@gmail.com>
5
+ *
6
+ * @category Oceanwebsoft
7
+ * @package Oceanwebsoft_Shopalize_Social_widget
8
+ */
9
+ class Shopalize_Purchasesharingwidget_Block_System_Config_Info
10
+ extends Mage_Adminhtml_Block_Abstract
11
+ implements Varien_Data_Form_Element_Renderer_Interface
12
+ {
13
+
14
+ /**
15
+ * Render fieldset html
16
+ *
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ * @return string
19
+ */
20
+ public function render(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+ $html = '<div style="background:url(\'http://www.shopalize.com/images/shopalize_icon.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
23
+ <h4>About Shopalize</h4>
24
+ <p>Shopalize provides a comprehensive Social Commerce platform for online retailers to help increase social sharing and customer referrals from Social Media to their eCommerce stores.<br />Shopalize&acute;s Post Purchase Sharing Plugin appears on your store&acute;s order confirmation page i.e. after checkout is complete. After every purchase is complete, shoppers are prompted and rewarded for sharing their purchase or your store with their friends on Facebook or Twitter. Shopalize also provide an A/B Testing platform to experiment with various campaigns and social analytics suite to measure ROI and track influential customers.<br />
25
+ <h4>Contact Us</h4>
26
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
27
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
28
+ Skype: adikot<br />
29
+ </p>
30
+ </div>';
31
+
32
+ return $html;
33
+ }
34
+ }
app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info/About.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Ocean Websoft Pvt. Ltd.<www.oceanwebsoft.com>
4
+ * @author Ashwini Dinker<ashwini.owsm@gmail.com>
5
+ *
6
+ * @category Oceanwebsoft
7
+ * @package Oceanwebsoft_Shopalize_Social_widget
8
+ */
9
+ class Shopalize_Purchasesharingwidget_Block_System_Config_Info_About
10
+ extends Mage_Adminhtml_Block_Abstract
11
+ implements Varien_Data_Form_Element_Renderer_Interface
12
+ {
13
+
14
+ /**
15
+ * Render fieldset html
16
+ *
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ * @return string
19
+ */
20
+ public function render(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+ $html = '<div style="background:url(\'http://www.shopalize.com/images/shopalize_icon.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
23
+ <h4>About Shopalize\'s Post Purchase Sharing Plugin</h4>
24
+ <p>
25
+ Shopalize\'s Post Purchase Sharing Plugin appears on your store\'s order confirmation page i.e. after checkout is complete.
26
+ After every purchase is complete, shoppers are prompted and rewarded for sharing their purchase or your store with their friends on Facebook or Twitter.
27
+ Shopalize also provide an A/B Testing platform to experiment with various campaigns and social analytics suite to measure ROI and track influential customers.<br />
28
+ <h4>Contact Us</h4>
29
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
30
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
31
+ Skype: adikot<br/>
32
+ </p>
33
+ </div>';
34
+
35
+ return $html;
36
+ }
37
+ }
app/code/community/Shopalize/Purchasesharingwidget/Helper/Data.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @website http://www.shopalize.com
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+ class Shopalize_Purchasesharingwidget_Helper_Data extends Mage_Core_Helper_Abstract
7
+ {
8
+
9
+ const PRODUCT_IMAGE_SIZE = 256;
10
+
11
+ public function getConfig($field, $group = 'settings', $default = null){
12
+ $value = Mage::getStoreConfig('purchasesharingwidget/'.$group.'/'.$field);
13
+ if(!isset($value) or trim($value) == ''){
14
+ return $default;
15
+ }else{
16
+ return $value;
17
+ }
18
+ }
19
+
20
+ public function getWidget($order_id) {
21
+
22
+ if($order_id)
23
+
24
+ {
25
+
26
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
27
+ $_items = $order->getAllVisibleItems();
28
+ $_count = count($_items);
29
+
30
+ if($_count>0)
31
+ {
32
+ $orderDate=explode(" ",$order->getCreatedAt());
33
+ $orderDate1=explode("-",$orderDate[0]);
34
+ $_output='<!-- Shopalize Integration BEGIN -->';
35
+ $_output.="\n".'<div id="shopalize-purchase-sharing-wrapper"></div>';
36
+ $_output.="\n".'<script type="text/javascript">';
37
+ $_output.="\nvar Shopalize = window.Shopalize || {};
38
+ (function() {
39
+ // Populate Purchase Order details
40
+ var order_details = {'is_debug' : false, 'merchant_id': '', 'widget_width': '', 'campaign_id': '', 'customer_email': '', 'order_number': '', 'order_total': '', 'order_currency': '', 'order_date': '', 'items' : []},
41
+ num_items = '".$_count."';
42
+ for(var cnt = 0; cnt < num_items; cnt++) { order_details.items[cnt] = {'id':'', 'title':'', 'current_price':'', 'list_price':'', 'url':'', 'image_url':''};}
43
+
44
+ // Provide Merchant account, Order, and Product Details\n";
45
+
46
+ $_output.="\n\torder_details['is_debug'] = true;";
47
+ $_output.="\n\torder_details['merchant_id'] = '".$this->getConfig('merchant_id', 'settings')."';";
48
+ $_output.="\n\torder_details['store_id'] = '".$this->getConfig('store_id', 'settings')."';";
49
+ $_output.="\n\torder_details['widget_width'] = '".$this->getConfig('widget_width', 'settings')."px';";
50
+ $_output.="\n\torder_details['customer_email'] = '".$this->escapeHtml($order->getCustomerEmail())."';";
51
+ $_output.="\n\torder_details['order_number'] = '".$order_id."';";
52
+ $_output.="\n\torder_details['order_total'] = '".$this->escapeHtml($order->getGrandTotal())."';";
53
+ $_output.="\n\torder_details['order_currency'] = '".$this->escapeHtml($order->getOrderCurrencyCode())."';";
54
+ $_output.="\n\torder_details['order_date'] = '".$orderDate1[1]."-".$orderDate1[2]."-".$orderDate1[0]."';";
55
+ $_output.="\n";
56
+
57
+ /*get ordered items*/
58
+
59
+ $k=0; foreach ($_items as $_item):
60
+ $_product = Mage::getModel('catalog/product');
61
+ $_product->load($_product->getIdBySku($_item->getSku()));
62
+ /*additional changes for configurable products*/
63
+ $parent_url='';
64
+ $product_url='';
65
+ $parentIdArray='';
66
+
67
+ $_version_array=Mage::getVersionInfo();
68
+ $_version=$_version_array['major'].$_version_array['minor'].$_version_array['revision'];
69
+
70
+ $l_bHasParent = false;
71
+
72
+ if($_product->getvisibility()=='1')
73
+ {
74
+ if($_version<='141')
75
+ {
76
+ list($parentIdArray) = $_product->loadParentProductIds()->getData('parent_product_ids');
77
+ if(isset($parentIdArray[0]))
78
+ {
79
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray[0]);
80
+ $parent_url=$parent->getProductUrl();
81
+
82
+ // product has parent
83
+ $l_bHasParent = true;
84
+ }
85
+ }
86
+ else
87
+ {
88
+
89
+ list($parentIdArray) = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getIdBySku($_item->getSku()));
90
+
91
+ if(isset($parentIdArray))
92
+ {
93
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray);
94
+ $parent_url=$parent->getProductUrl();
95
+
96
+ // product has parent
97
+ $l_bHasParent = true;
98
+ }
99
+ }
100
+ $product_url=$parent_url;
101
+ }
102
+ else
103
+ {
104
+ $product_url=$_product->getProductUrl();
105
+
106
+ }
107
+ /*additional changes for configurable products*/
108
+ $_helper = Mage::helper('catalog/output');
109
+
110
+ if ($l_bHasParent && (!$_product->getImage() || 'no_selection' === $_product->getImage())) {
111
+ // product has parent, we use the parent image
112
+ $_img = Mage::helper('catalog/image')->init($parent, 'image', $parent->getImage())->resize(self::PRODUCT_IMAGE_SIZE)->__toString();
113
+ }
114
+ else {
115
+ if ($_product->getImage() != 'no_selection' && $_product->getImage()):
116
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
117
+ else:
118
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
119
+ endif;
120
+ }
121
+
122
+ if($_item->getPrice()==$_product->getPrice()):
123
+ $price=$_item->getPrice(); $special_price=$price;
124
+ else:
125
+ $price=$_product->getPrice(); $special_price=$_item->getPrice();
126
+ endif;
127
+
128
+ //$_output .= "/*". $_product->getShortDescription(). "*/";
129
+
130
+ $_output.="\n\torder_details['items'][".$k."]['id'] = '".$_item->getSku()."';";
131
+ $_output.="\n\torder_details['items'][".$k."]['title'] = '".str_replace("'", "", $_item->getName())."';";
132
+ $_output.="\n\torder_details['items'][".$k."]['current_price'] = '".$special_price."';";
133
+ $_output.="\n\torder_details['items'][".$k."]['list_price'] = '".$price."';";
134
+ $_output.="\n\torder_details['items'][".$k."]['url'] = '".$product_url."';";
135
+ $_output.="\n\torder_details['items'][".$k."]['image_url'] = '".$_img."';";
136
+ $_output.="\n\torder_details['items'][".$k."]['description'] = '". $this->_sanitizeDescription($_product). "';";
137
+
138
+ $k++; endforeach;
139
+
140
+ /*get ordered items*/
141
+
142
+ $_output.="\n\n// Assign Purchase Order details to Shopalize scope
143
+ Shopalize.order_details = order_details;
144
+ Shopalize.base_url = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.shopalize.com';
145
+
146
+ // Load Widget script Asynchronously
147
+ var script = document.createElement('script');
148
+ script.type = 'text/javascript'; script.async = true;
149
+ script.src = Shopalize.base_url + '/js/purchase_sharing.js';
150
+ var entry = document.getElementsByTagName('script')[0];
151
+ entry.parentNode.insertBefore(script, entry);
152
+ }());";
153
+
154
+ $_output.="\n</script>\n".'<!-- Shopalize Integration END -->';
155
+
156
+ }
157
+
158
+ return $_output;
159
+ }
160
+ else {
161
+ return false;
162
+ }
163
+ }
164
+ public function getOrderinfoWidget($order_id) {
165
+
166
+ if($order_id)
167
+
168
+ {
169
+
170
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
171
+ $_items = $order->getAllVisibleItems();
172
+ $_count = count($_items);
173
+
174
+
175
+ $_output="<h3>Order Details (".$_count." Items)</h3>";
176
+ $_output.="<p>Customer Name : ".$this->escapeHtml($order->getCustomerName())."</p>";
177
+ $_output.="<p>Customer Email : ".$this->escapeHtml($order->getCustomerEmail())."</p>";
178
+ $_output.="<p>Order No : ".$order_id."</p>";
179
+ $_output.="<p>Order Total : ".$this->escapeHtml($order->getGrandTotal())."</p>";
180
+ $_output.="<p>Order Currency : ".$this->escapeHtml($order->getOrderCurrencyCode())."</p>";
181
+ $_output.="<p>Order Date : ".$order->getCreatedAtDate()."</p>";
182
+
183
+ if($_count>0)
184
+ {
185
+ $_output.='<h3>Ordered Items</h3>';
186
+ $_output.='<table width="100%" class="data-table">
187
+ <tr style="background:#eee;">
188
+ <th>Item</th>
189
+ <th>Product Name</th>
190
+ <th>Product Code</th>
191
+ <th>Url</th>
192
+ <th>Visibility</th>
193
+ <th>Parent Id</th>
194
+ <th>Product Id</th>
195
+ <th>Price</th>
196
+ <th>Special Price</th>
197
+ </tr>';
198
+
199
+
200
+
201
+ /*get ordered items*/
202
+
203
+ $k=0; foreach ($_items as $_item):
204
+ $_product = Mage::getModel('catalog/product');
205
+ $_product->load($_product->getIdBySku($_item->getSku()));
206
+ $parent_url='';
207
+ $product_url='';
208
+ $parentIdArray='';
209
+
210
+ $_version_array=Mage::getVersionInfo();
211
+ $_version=$_version_array['major'].$_version_array['minor'].$_version_array['revision'];
212
+
213
+ $l_bHasParent = false;
214
+
215
+ if($_product->getvisibility()=='1')
216
+ {
217
+ if($_version<='141')
218
+ {
219
+ list($parentIdArray) = $_product->loadParentProductIds()->getData('parent_product_ids');
220
+ if(isset($parentIdArray[0]))
221
+ {
222
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray[0]);
223
+ $parent_url=$parent->getProductUrl();
224
+ // product has parent
225
+ $l_bHasParent = true;
226
+ }
227
+ }
228
+ else
229
+ {
230
+
231
+ list($parentIdArray) = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getIdBySku($_item->getSku()));
232
+
233
+ if(isset($parentIdArray))
234
+ {
235
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray);
236
+ $parent_url=$parent->getProductUrl();
237
+ // product has parent
238
+ $l_bHasParent = true;
239
+ }
240
+ }
241
+ $product_url=$parent_url;
242
+ }
243
+ else
244
+ {
245
+ $product_url=$_product->getProductUrl();
246
+
247
+ }
248
+ $_helper = Mage::helper('catalog/output');
249
+
250
+ $l_bUseParentImage = false;
251
+ if ($l_bHasParent && (!$_product->getImage() || 'no_selection' === $_product->getImage())) {
252
+ // product has parent we use the parent's image
253
+ $_img = Mage::helper('catalog/image')->init($parent, 'image', $parent->getImage())->resize(self::PRODUCT_IMAGE_SIZE);
254
+ $l_bUseParentImage = true;
255
+ }
256
+ else {
257
+ if ($_product->getImage() != 'no_selection' && $_product->getImage()):
258
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
259
+ else:
260
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
261
+ endif;
262
+ }
263
+
264
+ if($_item->getPrice()==$_product->getPrice()):
265
+ $price=$_item->getPrice(); $special_price=$price;
266
+ else:
267
+ $price=$_product->getPrice(); $special_price=$_item->getPrice();
268
+ endif;
269
+
270
+ //print items
271
+ $_output.='<tr>';
272
+ $_output.='<td>'.$_helper->productAttribute($l_bUseParentImage?$parent:$_product, $_img, 'image').'</td>';
273
+ $_output.='<td>'.$_item->getName().'</td>';
274
+ $_output.='<td>'.$_item->getSku().'</td>';
275
+ $_output.='<td>'.$product_url.'</td>';
276
+ $_output.='<td>'.$_product->getvisibility().'</td>';
277
+ $_output.='<td>'.$parentIdArray.'</td>';
278
+ $_output.='<td>'.$_product->getIdBySku($_item->getSku()).'</td>';
279
+ $_output.='<td>'.$price.'</td>';
280
+ $_output.='<td>'.$special_price.','.$_item->getCost().'</td>';
281
+ $_output.='</tr>';
282
+
283
+ $k++; endforeach;
284
+
285
+ /*get ordered items*/
286
+ $_output.='</table>';
287
+ }
288
+
289
+ return $_output;
290
+ }
291
+ else {
292
+ return false;
293
+ }
294
+ }
295
+
296
+ protected function _sanitizeDescription($p_oProduct) {
297
+
298
+ $_helper = Mage::helper('catalog/output');
299
+
300
+ $l_sDescription = $_helper->productAttribute($p_oProduct, strip_tags(str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $p_oProduct->getShortDescription())), 'short_description');
301
+ $l_sDescription = str_replace('\'', '\\\'', $l_sDescription);
302
+
303
+ return $l_sDescription;
304
+
305
+ }
306
+
307
+ }
app/code/community/Shopalize/Purchasesharingwidget/Helper/Event.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopalize_Purchasesharingwidget_Helper_Event extends Mage_Core_Helper_Abstract {
4
+
5
+ public function core_block_abstract_to_html_after_checkout_success($p_oObserver) {
6
+
7
+ /* @var $l_oBlock Mage_Core_Block_Abstract */
8
+ $l_oBlock = $p_oObserver->getBlock();
9
+
10
+ if ('checkout.success' === $l_oBlock->getNameInLayout()) {
11
+
12
+ $l_oTransport = $p_oObserver->getTransport();
13
+
14
+ $_widget = Mage::helper('purchasesharingwidget');
15
+
16
+ $l_sHtml = $l_oTransport->getHtml();
17
+ $l_sHtml = $l_sHtml. '<div style="clear: both;"></div>'. $_widget->getWidget($l_oBlock->getOrderId());
18
+ $l_oTransport->setHtml($l_sHtml);
19
+
20
+ }
21
+
22
+ }
23
+
24
+ public function core_block_abstract_to_html_before_checkout_success($p_oObserver) {
25
+
26
+ /* @var $l_oBlock Mage_Core_Block_Abstract */
27
+ $l_oBlock = $p_oObserver->getBlock();
28
+
29
+ if ('checkout.success' === $l_oBlock->getNameInLayout()) {
30
+
31
+ if (Mage::getStoreConfig('purchasesharingwidget/settings/active')) {
32
+
33
+ $l_oChild = $l_oBlock->getLayout()->createBlock(
34
+ 'core/template',
35
+ 'purchasesharingwidget.success',
36
+ array(
37
+ 'template' => 'purchasesharingwidget/widget.phtml'
38
+ )
39
+ );
40
+
41
+ $l_oBlock->append($l_oChild);
42
+ }
43
+ }
44
+
45
+ }
46
+
47
+ }
app/code/community/Shopalize/Purchasesharingwidget/controllers/IndexController.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Ocean Websoft Pvt. Ltd.<www.oceanwebsoft.com>
4
+ * @author Ashwini Dinker<ashwini.owsm@gmail.com>
5
+ *
6
+ * @category Oceanwebsoft
7
+ * @package Oceanwebsoft_Shopalize_Social_widget
8
+ */
9
+
10
+ class Shopalize_Purchasesharingwidget_IndexController extends Mage_Core_Controller_Front_Action
11
+ {
12
+
13
+ }
app/code/community/Shopalize/Purchasesharingwidget/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @company Ocean Websoft Pvt. Ltd.<www.oceanwebsoft.com>
5
+ * @author Ashwini Dinker<ashwini.owsm@gmail.com>
6
+ *
7
+ * @category Oceanwebsoft
8
+ * @package Oceanwebsoft_Shopalize_Social_widget
9
+ */
10
+
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <purchasesharingwidget translate="title" module="purchasesharingwidget">
22
+ <title>Shpalize Purchase Sharing Widget</title>
23
+
24
+ </purchasesharingwidget>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Shopalize/Purchasesharingwidget/etc/config.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @website http://www.shopalize.com
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+ <config>
9
+ <modules>
10
+ <Shopalize_Purchasesharingwidget>
11
+ <version>1.1.1</version>
12
+ </Shopalize_Purchasesharingwidget>
13
+ </modules>
14
+ <global>
15
+ <helpers>
16
+ <purchasesharingwidget>
17
+ <class>Shopalize_Purchasesharingwidget_Helper</class>
18
+ </purchasesharingwidget>
19
+ </helpers>
20
+
21
+ <blocks>
22
+ <purchasesharingwidget>
23
+ <class>Shopalize_Purchasesharingwidget_Block</class>
24
+ </purchasesharingwidget>
25
+ <checkout>
26
+ <rewrite>
27
+ <success>Shopalize_Purchasesharingwidget_Block_Success</success>
28
+ </rewrite>
29
+ </checkout>
30
+ </blocks>
31
+
32
+
33
+ </global>
34
+ <frontend>
35
+
36
+ <events>
37
+ <core_block_abstract_to_html_before>
38
+ <observers>
39
+ <purchasesharingwidget_core_block_abstract_to_html_before>
40
+ <class>Shopalize_Purchasesharingwidget_Helper_Event</class>
41
+ <method>core_block_abstract_to_html_before_checkout_success</method>
42
+ </purchasesharingwidget_core_block_abstract_to_html_before>
43
+ </observers>
44
+ </core_block_abstract_to_html_before>
45
+ </events>
46
+
47
+ </frontend>
48
+ <adminhtml>
49
+ <acl>
50
+ <resources>
51
+ <admin>
52
+ <children>
53
+ <system>
54
+ <children>
55
+ <config>
56
+ <children>
57
+ <shopalizeinfo>
58
+ <title>Shopalize</title>
59
+ </shopalizeinfo>
60
+ <purchasesharingwidget>
61
+ <title>Post Purchase Sharing Plugin</title>
62
+ </purchasesharingwidget>
63
+ </children>
64
+ </config>
65
+ </children>
66
+ </system>
67
+ </children>
68
+ </admin>
69
+ </resources>
70
+ </acl>
71
+ </adminhtml>
72
+ <default>
73
+ <purchasesharingwidget>
74
+ <settings>
75
+ <active>0</active>
76
+ <widget_width>400</widget_width>
77
+
78
+ </settings>
79
+ </purchasesharingwidget>
80
+ </default>
81
+ </config>
app/code/community/Shopalize/Purchasesharingwidget/etc/system.xml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @website http://www.oceanwebsoft.com
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+ <config>
9
+ <tabs>
10
+ <shopalizeall translate="label" module="purchasesharingwidget">
11
+ <label>Shopalize Extensions</label>
12
+ <sort_order>400</sort_order>
13
+ </shopalizeall>
14
+ </tabs>
15
+ <sections>
16
+ <!-- <shopalizeinfo translate="label" module="purchasesharingwidget">
17
+ <label>Info</label>
18
+ <tab>shopalizeall</tab>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>99999999999</sort_order>
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
+ <groups>
25
+ <info>
26
+ <frontend_model>purchasesharingwidget/system_config_info</frontend_model>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </info>
32
+ </groups>
33
+ </shopalizeinfo>-->
34
+ <purchasesharingwidget module="purchasesharingwidget">
35
+ <label>Post Purchase Sharing</label>
36
+ <tab>shopalizeall</tab>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>400</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ <groups>
43
+ <info>
44
+ <label>About Extension</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>10</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <fields>
51
+ <purchasesharingwidget_info translate="label">
52
+ <frontend_model>purchasesharingwidget/system_config_info_about</frontend_model>
53
+ <sort_order>10</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </purchasesharingwidget_info>
58
+
59
+ </fields>
60
+ </info>
61
+ <settings translate="label">
62
+ <label>Plugin Settings</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>11</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <fields>
69
+ <active translate="label">
70
+ <label>Enabled</label>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>adminhtml/system_config_source_yesno</source_model>
73
+ <sort_order>10</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </active>
78
+ <merchant_id translate="label">
79
+ <label>Merchant Id</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>20</sort_order><show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <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>
85
+ </merchant_id>
86
+ <store_id translate="label">
87
+ <label>Store Id</label>
88
+ <frontend_type>text</frontend_type>
89
+ <sort_order>21</sort_order><show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <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>
93
+ </store_id>
94
+ <widget_width translate="label">
95
+ <label>Plugin Width</label>
96
+ <frontend_type>text</frontend_type>
97
+ <sort_order>30</sort_order><show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment><![CDATA[Size in px Example: 400]]></comment>
101
+ </widget_width>
102
+
103
+
104
+ </fields>
105
+ </settings>
106
+
107
+ </groups>
108
+ </purchasesharingwidget>
109
+ </sections>
110
+ </config>
app/design/frontend/default/default/layout/productsharingwidget.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Pinterest
15
+ * @copyright Copyright (c) 2012 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="product.info">
22
+ <block type="core/text_list" name="product.info.other" as="other" ifconfig="productsharingwidget/settings/active">
23
+ <block type="productsharingwidget/button" name="productsharingwidget" template="productsharingwidget/button.phtml" >
24
+ <action method="isIntegration" />
25
+ </block>
26
+ </block>
27
+ </reference>
28
+ <reference name="before_body_end">
29
+ <block type="productsharingwidget/sa" name="shopalize_analytics" as="shopalize_analytics" template="productsharingwidget/sa.phtml" />
30
+ </reference>
31
+ </catalog_product_view>
32
+ </layout>
app/design/frontend/default/default/template/productsharingwidget/button.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if($this->isEnabled()){
3
+
4
+ $_product = $this->getProduct();
5
+
6
+ ?><!-- Shopalize Button Code BEGIN -->
7
+ <div class="shopalize-product-sharing shopalize-share-button shopalize-share-icon-24"
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(); ?>"
14
+ data-current-price= "<?php echo $this->getProductSpecialPrice(); ?>">
15
+ <a href="#"><span class="shopalize-share-button-text">Share & Save</span></a>
16
+ </div>
17
+ <!-- Shopalize Button Code END -->
18
+ <?php } ?>
app/design/frontend/default/default/template/productsharingwidget/sa.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if($this->isEnabled()){ ?>
3
+ <!-- Shopalize Basic Integration BEGIN -->
4
+ <script>
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);
15
+ }(window, document, 'shopalize-js'));
16
+ </script>
17
+ <!-- Shopalize Basic Integration END -->
18
+ <?php } ?>
app/etc/modules/Shopalize_Productsharingwidget.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Shopalize_Productsharingwidget>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Shopalize_Productsharingwidget>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Shopalizes_Product_Sharing_Widget</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Enables seamless sharing of Products you like with rewards to leading social platforms</summary>
10
+ <description>&lt;p&gt;Shopalize's Product Sharing Plugin appears on your store's Product page. Shoppers are prompted and rewarded for sharing the Products they like with their friends on Facebook, Twitter, Pinterest and Email.&lt;/p&gt;&#xD;
11
+ &#xD;
12
+ &lt;p&gt;Once you integrate Shopalize's plugin to your store and start few campaigns, then you don't need any involvement maintaining these campaigns. Just sit back and let Shopalize drive social traffic and sales to your store. Seriously, it's the easiest and most powerful marketing solution out there.&lt;/p&gt;&#xD;
13
+ &#xD;
14
+ &lt;p&gt;Shopalize also provide an A/B Testing platform to experiment with various campaigns and social analytics suite to measure ROI and track influential customers.&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ &lt;p&gt;&lt;a href="http://www.shopalize.com"&gt;Learn more about Shopalize.com&lt;/a&gt;.&lt;/p&gt;&#xD;
17
+ &#xD;
18
+ &lt;h1&gt;Installation Steps&lt;/h1&gt;&#xD;
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>Shopalize Product Sharing Widget 1.0.0 Released</notes>
23
+ <authors><author><name>Aditya Kothadiya</name><user>auto-converted</user><email>aditya@shopalize.com</email></author></authors>
24
+ <date>2012-08-13</date>
25
+ <time>10:35:09</time>
26
+ <contents><target name="magecommunity"><dir name="Shopalize"><dir name="Pinterest_bk"><dir name="Block"><file name="Button.php" hash="2b2c7ff345a5d546b5d984ed6e9531dc"/></dir><dir name="Helper"><file name="Data.php" hash="e4baf7dba31d7ce5c1af8f490c40d313"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Type.php" hash="323676388d747ca2723d98d9ebf28351"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4c026022491b18018767410fded982f9"/><file name="config.xml" hash="e82c63b4a93012013c6804a1fe70e91e"/><file name="system.xml" hash="e4c928bc1d57d49e392d78f5b2153d8e"/></dir></dir><dir name="Productsharingwidget"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="bf3d4532dde2bf3907762787f8acb9ec"/></dir><file name="Info.php" hash="1e05d67b820b279d0a10ae45edefdec6"/></dir></dir><file name="Button.php" hash="5787d6db2cc8fa4ce39bc4e569304dd9"/><file name="Sa.php" hash="2c83401b08f11c619ab7cb02fa8d80ae"/></dir><dir name="Helper"><file name="Data.php" hash="ade70c5def73b4f1655e94fc11e4ef3e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="58e1bbf1175cd056c0bb5f08f6ae8371"/><file name="config.xml" hash="1dbd2bcc8a5290e99dc6c384acdaef67"/><file name="system.xml" hash="37a12445745d8477512c8bcea851e121"/></dir></dir><dir name="Purchasesharingwidget"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="4cd569d89ef211946be266ba39a9cdd0"/></dir><file name="Info.php" hash="7631831242ab43ae4727bc5fe96a6ddb"/></dir></dir><file name="Purchasesharingwidget.php" hash="345cd1a160a857e4cec48d400bb91c1c"/><file name="Success.php" hash="92428ca11a72510a62952e8515e38d7f"/></dir><dir name="Helper"><file name="Data.php" hash="97d88800c4e23bc627ab5c9218142b4a"/><file name="Event.php" hash="2d0abe92ee6e32e23007165a9a17542a"/></dir><dir name="controllers"><file name="IndexController.php" hash="a82c545d242ee4fc9a40de34c103b1db"/></dir><dir name="etc"><file name="adminhtml.xml" hash="86bdb512b92ee4b236d6e611953cad6d"/><file name="config.xml" hash="98b33b5109f2977acbc1b403c3f7c71a"/><file name="system.xml" hash="83b7a00fde3561667697ba5c2d9ba4bf"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="productsharingwidget.xml" hash="7926013085dd5e260bdefe93ad42ccb5"/></dir><dir name="template"><dir name="productsharingwidget"><file name="button.phtml" hash="ea2b14a1bb4d040b8e7f1cc4cda7367f"/><file name="sa.phtml" hash="5cf89471ad2ef9b386585a709bf86d3e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shopalize_Productsharingwidget.xml" hash="aec3a36581765de378ed5521098c9ee9"/></dir></target></contents>
27
+ <compatible/>
28
+ <dependencies/>
29
+ </package>