Shopalizes_Purchase_Sharing_Widget - Version 1.1.4

Version Notes

Make basic tracking code common and load it before end of body task

Download this release

Release Info

Developer Magento Core Team
Extension Shopalizes_Purchase_Sharing_Widget
Version 1.1.4
Comparing to
See all releases


Code changes from version 1.1.3 to 1.1.4

app/code/community/Shopalize/Basic/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_Basic_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('sbasic/'.$group.'/'.$field);
35
+ if(!isset($value) or trim($value) == ''){
36
+ return $default;
37
+ }else{
38
+ return $value;
39
+ }
40
+ }
41
+ }
app/code/community/Shopalize/Basic/Block/System/Config/Info.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+ class Shopalize_Basic_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
+ *
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</h4>
20
+ <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 />
21
+ <h4>Contact Us</h4>
22
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
23
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
24
+ Skype: adikot<br />
25
+ </p>
26
+ </div>';
27
+
28
+ return $html;
29
+ }
30
+ }
app/code/community/Shopalize/Basic/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_Basic_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
+ *
14
+ * @param Varien_Data_Form_Element_Abstract $element
15
+ * @return string
16
+ */
17
+ public function render(Varien_Data_Form_Element_Abstract $element)
18
+ {
19
+ $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;">
20
+ <h4>About Shopalize\'s Basic Plugin</h4>
21
+ <p>
22
+ Shopalize\'s Basic Plugin appears tracking code on your store\'s all pages before end of body tag. <br />
23
+ <h4>Contact Us</h4>
24
+ Website: <a href="http://www.shopalize.com" target="_blank">www.shopalize.com</a><br />
25
+ Email: <a href="mailto:help@shopalize.com">help@shopalize.com</a><br />
26
+ Skype: adikot<br/>
27
+ </p>
28
+ </div>';
29
+
30
+ return $html;
31
+ }
32
+ }
app/code/community/Shopalize/Basic/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ */
6
+ class Shopalize_Basic_Helper_Data extends Mage_Core_Helper_Abstract
7
+ {
8
+
9
+ }
app/code/community/Shopalize/Basic/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
+ <sbasic>
15
+ <title>Shopalize Basic Plugin Settings</title>
16
+ </sbasic>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Shopalize/Basic/etc/config.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Basic>
11
+ <version>0.0.1</version>
12
+ </Shopalize_Basic>
13
+ </modules>
14
+ <global>
15
+ <helpers>
16
+ <sbasic>
17
+ <class>Shopalize_Basic_Helper</class>
18
+ </sbasic>
19
+ </helpers>
20
+ <blocks>
21
+ <sbasic>
22
+ <class>Shopalize_Basic_Block</class>
23
+ </sbasic>
24
+ </blocks>
25
+ </global>
26
+ <frontend>
27
+ <layout>
28
+ <updates>
29
+ <sbasic>
30
+ <file>sbasic.xml</file>
31
+ </sbasic>
32
+ </updates>
33
+ </layout>
34
+ </frontend>
35
+ <adminhtml>
36
+ <acl>
37
+ <resources>
38
+ <all>
39
+ <title>Allow Everything</title>
40
+ </all>
41
+ <admin>
42
+ <children>
43
+ <system>
44
+ <children>
45
+ <config>
46
+ <children>
47
+ <shopalizeinfo>
48
+ <title>Shopalize</title>
49
+ </shopalizeinfo>
50
+ <sbasic>
51
+ <title>Basic Setting</title>
52
+ </sbasic>
53
+ </children>
54
+ </config>
55
+ </children>
56
+ </system>
57
+ </children>
58
+ </admin>
59
+ </resources>
60
+ </acl>
61
+ </adminhtml>
62
+ </config>
app/code/community/Shopalize/Basic/etc/system.xml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @website http://www.bytestechnolab.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="sbasic">
11
+ <label>Shopalize Extensions</label>
12
+ <sort_order>400</sort_order>
13
+ </shopalizeall>
14
+ </tabs>
15
+ <sections>
16
+ <sbasic module="sbasic">
17
+ <label>Basic</label>
18
+ <tab>shopalizeall</tab>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>100</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
+ <sbasic_info translate="label">
34
+ <frontend_model>sbasic/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
+ </sbasic_info>
40
+ </fields>
41
+ </info>
42
+ <settings translate="label">
43
+ <label>Plugin Settings</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>11</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <fields>
50
+ <active translate="label">
51
+ <label>Enabled</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>adminhtml/system_config_source_yesno</source_model>
54
+ <sort_order>10</sort_order>
55
+ <show_in_default>1</show_in_default>
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>
70
+ <sort_order>21</sort_order><show_in_default>1</show_in_default>
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
+ </fields>
76
+ </settings>
77
+ </groups>
78
+ </sbasic>
79
+ </sections>
80
+ </config>
app/code/community/Shopalize/Purchasesharingwidget/Block/Purchasesharingwidget.php CHANGED
@@ -1,10 +1,10 @@
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
1
  <?php
2
  /**
3
+ * @company Bytes Technolab <www.bytestechnolab.com>
4
+ * @author Bytes Technolab <info@bytestechnolab.com>
5
  *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_Block_Purchasesharingwidget
8
  */
9
 
10
  class Shopalize_Purchasesharingwidget_Block_Purchasesharingwidget extends Mage_Core_Block_Template
app/code/community/Shopalize/Purchasesharingwidget/Block/Success.php CHANGED
@@ -1,30 +1,12 @@
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
 
1
  <?php
2
  /**
3
+ * @company Bytes Technolab <www.bytestechnolab.com>
4
+ * @author Bytes Technolab <info@bytestechnolab.com>
5
  *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_Block_Success
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  */
9
 
 
10
  class Shopalize_Purchasesharingwidget_Block_Success extends Mage_Checkout_Block_Success
11
  {
12
 
app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info.php CHANGED
@@ -1,10 +1,10 @@
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
1
  <?php
2
  /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
  *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_Block_System_Config_Info
8
  */
9
  class Shopalize_Purchasesharingwidget_Block_System_Config_Info
10
  extends Mage_Adminhtml_Block_Abstract
app/code/community/Shopalize/Purchasesharingwidget/Block/System/Config/Info/About.php CHANGED
@@ -1,16 +1,16 @@
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
  *
1
  <?php
2
  /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
  *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_Block_Purchasesharingwidget
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
  *
app/code/community/Shopalize/Purchasesharingwidget/Helper/Data.php CHANGED
@@ -1,307 +1,270 @@
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
  }
1
+ <?php
2
+ /**
3
+ * @company Bytes Technolab<www.bytestechnolab.com>
4
+ * @author Bytes Technolab<info@bytestechnolab.com>
5
+ *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_Helper_Data
8
+ */
9
+ class Shopalize_Purchasesharingwidget_Helper_Data extends Mage_Core_Helper_Abstract{
10
+
11
+ const PRODUCT_IMAGE_SIZE = 256;
12
+
13
+ public function getWidget($order_id) {
14
+
15
+ if($order_id){
16
+
17
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
18
+ $_items = $order->getAllVisibleItems();
19
+ $_count = count($_items);
20
+
21
+ if($_count > 0){
22
+
23
+ $orderDate = explode(" ",$order->getCreatedAt());
24
+ $orderDate1 = explode("-",$orderDate[0]);
25
+ $_output='<!-- Shopalize Integration BEGIN -->';
26
+ $_output.="\n".'<div id="shopalize-purchase-sharing-wrapper"></div>';
27
+ $_output.="\n".'<script type="text/javascript">';
28
+ $_output.="\nvar Shopalize = window.Shopalize || {};
29
+ (function() {
30
+ // Populate Purchase Order details
31
+ var order_details = {'is_debug' : false, 'merchant_id': '', 'widget_width': '', 'campaign_id': '', 'customer_email': '', 'order_number': '', 'order_total': '', 'order_currency': '', 'order_date': '', 'items' : []},
32
+ num_items = '".$_count."';
33
+ for(var cnt = 0; cnt < num_items; cnt++) { order_details.items[cnt] = {'id':'', 'title':'', 'current_price':'', 'list_price':'', 'url':'', 'image_url':''};}
34
+
35
+ // Provide Merchant account, Order, and Product Details\n";
36
+
37
+ $_output.="\n\torder_details['is_debug'] = true;";
38
+ $_output.="\n\torder_details['widget_width'] = '".Mage::getStoreConfig('purchasesharingwidget/settings/widget_width')."px';";
39
+ $_output.="\n\torder_details['customer_email'] = '".$this->escapeHtml($order->getCustomerEmail())."';";
40
+ $_output.="\n\torder_details['order_number'] = '".$order_id."';";
41
+ $_output.="\n\torder_details['order_total'] = '".$this->escapeHtml($order->getGrandTotal())."';";
42
+ $_output.="\n\torder_details['order_currency'] = '".$this->escapeHtml($order->getOrderCurrencyCode())."';";
43
+ $_output.="\n\torder_details['order_date'] = '".$orderDate1[1]."-".$orderDate1[2]."-".$orderDate1[0]."';";
44
+ $_output.="\n";
45
+
46
+ /*get ordered items*/
47
+ $k=0;
48
+
49
+ foreach ($_items as $_item):
50
+ $_product = Mage::getModel('catalog/product');
51
+ $_product->load($_product->getIdBySku($_item->getSku()));
52
+ /*additional changes for configurable products*/
53
+ $parent_url='';
54
+ $product_url='';
55
+ $parentIdArray='';
56
+
57
+ $_version_array=Mage::getVersionInfo();
58
+ $_version=$_version_array['major'].$_version_array['minor'].$_version_array['revision'];
59
+
60
+ $l_bHasParent = false;
61
+
62
+ if($_product->getvisibility()=='1'){
63
+
64
+ if($_version<='141'){
65
+ list($parentIdArray) = $_product->loadParentProductIds()->getData('parent_product_ids');
66
+ if(isset($parentIdArray[0])){
67
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray[0]);
68
+ $parent_url=$parent->getProductUrl();
69
+
70
+ // product has parent
71
+ $l_bHasParent = true;
72
+ }
73
+ } else {
74
+
75
+ list($parentIdArray) = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getIdBySku($_item->getSku()));
76
+
77
+ if(isset($parentIdArray)){
78
+
79
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray);
80
+ $parent_url=$parent->getProductUrl();
81
+
82
+ // product has parent
83
+ $l_bHasParent = true;
84
+ }
85
+ }
86
+ $product_url=$parent_url;
87
+ }
88
+ else
89
+ {
90
+ $product_url=$_product->getProductUrl();
91
+
92
+ }
93
+
94
+ /*additional changes for configurable products*/
95
+ $_helper = Mage::helper('catalog/output');
96
+
97
+ if ($l_bHasParent && (!$_product->getImage() || 'no_selection' === $_product->getImage())) {
98
+
99
+ // product has parent, we use the parent image
100
+ $_img = Mage::helper('catalog/image')->init($parent, 'image', $parent->getImage())->resize(self::PRODUCT_IMAGE_SIZE)->__toString();
101
+ }
102
+ else {
103
+ if ($_product->getImage() != 'no_selection' && $_product->getImage()):
104
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
105
+ else:
106
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
107
+ endif;
108
+ }
109
+
110
+ if($_item->getPrice()==$_product->getPrice()):
111
+ $price=$_item->getPrice(); $special_price=$price;
112
+ else:
113
+ $price=$_product->getPrice(); $special_price=$_item->getPrice();
114
+ endif;
115
+
116
+ //$_output .= "/*". $_product->getShortDescription(). "*/";
117
+ $_output.="\n\torder_details['items'][".$k."]['id'] = '".$_item->getSku()."';";
118
+ $_output.="\n\torder_details['items'][".$k."]['title'] = '".str_replace("'", "", $_item->getName())."';";
119
+ $_output.="\n\torder_details['items'][".$k."]['current_price'] = '".$special_price."';";
120
+ $_output.="\n\torder_details['items'][".$k."]['list_price'] = '".$price."';";
121
+ $_output.="\n\torder_details['items'][".$k."]['url'] = '".$product_url."';";
122
+ $_output.="\n\torder_details['items'][".$k."]['image_url'] = '".$_img."';";
123
+ $_output.="\n\torder_details['items'][".$k."]['description'] = '". $this->_sanitizeDescription($_product). "';";
124
+
125
+ $k++;
126
+ endforeach;
127
+
128
+ /*get ordered items*/
129
+ $_output.="\n\n// Assign Purchase Order details to Shopalize scope
130
+ Shopalize.order_details = order_details;
131
+ }());";
132
+
133
+ $_output.="\n</script>\n".'<!-- Shopalize Integration END -->';
134
+
135
+ }
136
+ return $_output;
137
+ }else {
138
+ return false;
139
+ }
140
+ }
141
+
142
+ public function getOrderinfoWidget($order_id) {
143
+
144
+ if($order_id){
145
+
146
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
147
+ $_items = $order->getAllVisibleItems();
148
+ $_count = count($_items);
149
+
150
+ $_output="<h3>Order Details (".$_count." Items)</h3>";
151
+ $_output.="<p>Customer Name : ".$this->escapeHtml($order->getCustomerName())."</p>";
152
+ $_output.="<p>Customer Email : ".$this->escapeHtml($order->getCustomerEmail())."</p>";
153
+ $_output.="<p>Order No : ".$order_id."</p>";
154
+ $_output.="<p>Order Total : ".$this->escapeHtml($order->getGrandTotal())."</p>";
155
+ $_output.="<p>Order Currency : ".$this->escapeHtml($order->getOrderCurrencyCode())."</p>";
156
+ $_output.="<p>Order Date : ".$order->getCreatedAtDate()."</p>";
157
+
158
+ if($_count>0){
159
+ $_output.='<h3>Ordered Items</h3>';
160
+ $_output.='<table width="100%" class="data-table">
161
+ <tr style="background:#eee;">
162
+ <th>Item</th>
163
+ <th>Product Name</th>
164
+ <th>Product Code</th>
165
+ <th>Url</th>
166
+ <th>Visibility</th>
167
+ <th>Parent Id</th>
168
+ <th>Product Id</th>
169
+ <th>Price</th>
170
+ <th>Special Price</th>
171
+ </tr>';
172
+
173
+ /*get ordered items*/
174
+ $k=0;
175
+ foreach ($_items as $_item):
176
+ $_product = Mage::getModel('catalog/product');
177
+ $_product->load($_product->getIdBySku($_item->getSku()));
178
+ $parent_url='';
179
+ $product_url='';
180
+ $parentIdArray='';
181
+
182
+ $_version_array=Mage::getVersionInfo();
183
+ $_version=$_version_array['major'].$_version_array['minor'].$_version_array['revision'];
184
+
185
+ $l_bHasParent = false;
186
+
187
+ if($_product->getvisibility()=='1'){
188
+ if($_version <= '141'){
189
+ list($parentIdArray) = $_product->loadParentProductIds()->getData('parent_product_ids');
190
+ if(isset($parentIdArray[0])){
191
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray[0]);
192
+ $parent_url=$parent->getProductUrl();
193
+
194
+ // product has parent
195
+ $l_bHasParent = true;
196
+ }
197
+ } else {
198
+
199
+ list($parentIdArray) = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getIdBySku($_item->getSku()));
200
+
201
+ if(isset($parentIdArray)) {
202
+
203
+ $parent = Mage::getModel('catalog/product')->load($parentIdArray);
204
+ $parent_url=$parent->getProductUrl();
205
+ // product has parent
206
+ $l_bHasParent = true;
207
+ }
208
+ }
209
+ $product_url=$parent_url;
210
+ } else {
211
+ $product_url=$_product->getProductUrl();
212
+
213
+ }
214
+ $_helper = Mage::helper('catalog/output');
215
+
216
+ $l_bUseParentImage = false;
217
+ if ($l_bHasParent && (!$_product->getImage() || 'no_selection' === $_product->getImage())) {
218
+ // product has parent we use the parent's image
219
+ $_img = Mage::helper('catalog/image')->init($parent, 'image', $parent->getImage())->resize(self::PRODUCT_IMAGE_SIZE);
220
+ $l_bUseParentImage = true;
221
+ }
222
+ else {
223
+ if ($_product->getImage() != 'no_selection' && $_product->getImage()):
224
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
225
+ else:
226
+ $_img = Mage::helper('catalog/image')->init($_product, 'image')->resize(self::PRODUCT_IMAGE_SIZE);
227
+ endif;
228
+ }
229
+
230
+ if($_item->getPrice()==$_product->getPrice()):
231
+ $price=$_item->getPrice(); $special_price=$price;
232
+ else:
233
+ $price=$_product->getPrice(); $special_price=$_item->getPrice();
234
+ endif;
235
+
236
+ //print items
237
+ $_output.='<tr>';
238
+ $_output.='<td>'.$_helper->productAttribute($l_bUseParentImage?$parent:$_product, $_img, 'image').'</td>';
239
+ $_output.='<td>'.$_item->getName().'</td>';
240
+ $_output.='<td>'.$_item->getSku().'</td>';
241
+ $_output.='<td>'.$product_url.'</td>';
242
+ $_output.='<td>'.$_product->getvisibility().'</td>';
243
+ $_output.='<td>'.$parentIdArray.'</td>';
244
+ $_output.='<td>'.$_product->getIdBySku($_item->getSku()).'</td>';
245
+ $_output.='<td>'.$price.'</td>';
246
+ $_output.='<td>'.$special_price.','.$_item->getCost().'</td>';
247
+ $_output.='</tr>';
248
+
249
+ $k++;
250
+ endforeach;
251
+
252
+ /*get ordered items*/
253
+ $_output.='</table>';
254
+ }
255
+ return $_output;
256
+ } else {
257
+ return false;
258
+ }
259
+ }
260
+
261
+ protected function _sanitizeDescription($p_oProduct) {
262
+
263
+ $_helper = Mage::helper('catalog/output');
264
+
265
+ $l_sDescription = $_helper->productAttribute($p_oProduct, strip_tags(str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $p_oProduct->getShortDescription())), 'short_description');
266
+ $l_sDescription = str_replace('\'', '\\\'', $l_sDescription);
267
+
268
+ return $l_sDescription;
269
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
app/code/community/Shopalize/Purchasesharingwidget/Helper/Event.php CHANGED
@@ -1,47 +1,50 @@
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
  }
1
+ <?php
2
+
3
+ /**
4
+ * @company Bytes Technolab<www.bytestechnolab.com>
5
+ * @author Bytes Technolab<info@bytestechnolab.com>
6
+ *
7
+ * @category Shopalize
8
+ * @package Shopalize_Purchasesharingwidget_Helper_Event
9
+ */
10
+
11
+ class Shopalize_Purchasesharingwidget_Helper_Event extends Mage_Core_Helper_Abstract {
12
+
13
+ public function core_block_abstract_to_html_after_checkout_success($p_oObserver) {
14
+
15
+ /* @var $l_oBlock Mage_Core_Block_Abstract */
16
+ $l_oBlock = $p_oObserver->getBlock();
17
+
18
+ if ('checkout.success' === $l_oBlock->getNameInLayout()) {
19
+
20
+ $l_oTransport = $p_oObserver->getTransport();
21
+ $_widget = Mage::helper('purchasesharingwidget');
22
+
23
+ $l_sHtml = $l_oTransport->getHtml();
24
+ $l_sHtml = $l_sHtml. '<div style="clear: both;"></div>'. $_widget->getWidget($l_oBlock->getOrderId());
25
+ $l_oTransport->setHtml($l_sHtml);
26
+ }
27
+ }
28
+
29
+ public function core_block_abstract_to_html_before_checkout_success($p_oObserver) {
30
+
31
+ /* @var $l_oBlock Mage_Core_Block_Abstract */
32
+ $l_oBlock = $p_oObserver->getBlock();
33
+
34
+ if ('checkout.success' === $l_oBlock->getNameInLayout()) {
35
+
36
+ if (Mage::getStoreConfig('purchasesharingwidget/settings/active')) {
37
+
38
+ $l_oChild = $l_oBlock->getLayout()->createBlock(
39
+ 'core/template',
40
+ 'purchasesharingwidget.success',
41
+ array(
42
+ 'template' => 'purchasesharingwidget/widget.phtml'
43
+ )
44
+ );
45
+
46
+ $l_oBlock->append($l_oChild);
47
+ }
48
+ }
49
+ }
50
  }
app/code/community/Shopalize/Purchasesharingwidget/controllers/IndexController.php CHANGED
@@ -1,10 +1,10 @@
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
1
  <?php
2
  /**
3
+ * @company Bytes Technolab <www.bytestechnolab.com>
4
+ * @author Bytes Technolab <info@bytestechnolab.com>
5
  *
6
+ * @category Shopalize
7
+ * @package Shopalize_Purchasesharingwidget_IndexController
8
  */
9
 
10
  class Shopalize_Purchasesharingwidget_IndexController extends Mage_Core_Controller_Front_Action
app/code/community/Shopalize/Purchasesharingwidget/etc/adminhtml.xml CHANGED
@@ -1,13 +1,12 @@
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>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <!--
3
  /**
4
+ * @company Bytes Technolab <www.bytestechnolab.com>
5
+ * @author Bytes Technolab <info@bytestechnolab.com>
6
  *
7
+ * @category Shopalize
8
+ * @package Shopalize_Purchasesharingwidget
9
  */
 
10
  -->
11
  <config>
12
  <acl>
app/code/community/Shopalize/Purchasesharingwidget/etc/config.xml CHANGED
@@ -1,81 +1,80 @@
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>
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
+ </settings>
78
+ </purchasesharingwidget>
79
+ </default>
 
80
  </config>
app/code/community/Shopalize/Purchasesharingwidget/etc/system.xml CHANGED
@@ -1,7 +1,7 @@
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
  -->
@@ -13,24 +13,6 @@
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>
@@ -74,23 +56,7 @@
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>
@@ -99,11 +65,8 @@
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>
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
  -->
13
  </shopalizeall>
14
  </tabs>
15
  <sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  <purchasesharingwidget module="purchasesharingwidget">
17
  <label>Post Purchase Sharing</label>
18
  <tab>shopalizeall</tab>
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
  <widget_width translate="label">
61
  <label>Plugin Width</label>
62
  <frontend_type>text</frontend_type>
65
  <show_in_store>1</show_in_store>
66
  <comment><![CDATA[Size in px Example: 400]]></comment>
67
  </widget_width>
 
 
68
  </fields>
69
  </settings>
 
70
  </groups>
71
  </purchasesharingwidget>
72
  </sections>
app/design/frontend/default/default/layout/sbasic.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Shopalize
14
+ * @package Shopalize_Baisc
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
+ <default>
21
+ <reference name="before_body_end">
22
+ <block type="sbasic/sa" name="shopalize_analytics" as="shopalize_analytics" template="basic/sa.phtml" />
23
+ </reference>
24
+ </default>
25
+ </layout>
app/design/frontend/default/default/template/basic/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_Basic.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Shopalize_Basic>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Shopalize_Basic>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shopalizes_Purchase_Sharing_Widget</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Shopalize helps Online Retailers to increase social sharing and customer referrals from Social Media.</summary>
10
  <description>Shopalize's Post Purchase Sharing Plugin appears on your store'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. Once you integrate Shopalize's plugin to your storefront and kick start few campaigns, then you don't need any involvement maintaining these campaigns. Just sit back</description>
11
- <notes>Add Store Id in Magento configuration and provide store id setting from Shapalize</notes>
12
  <authors><author><name>Aditya Kothadiya</name><user>auto-converted</user><email>aditya@shopalize.com</email></author></authors>
13
- <date>2012-07-27</date>
14
- <time>08:32:53</time>
15
- <contents><target name="magecommunity"><dir name="Shopalize"><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="purchasesharingwidget.xml" hash="3854556688b7e27a8e7eda0cdf2b6610"/></dir><dir name="template"><dir name="purchasesharingwidget"><file name="success.phtml" hash="c8c9d7cc98322536216ea9b03744b0b7"/><file name="widget.phtml" hash="610125320c31cf7960077555a0acbeef"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shopalize_Purchasesharingwidget.xml" hash="374670608fd7b7012a90aeec163220f9"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shopalizes_Purchase_Sharing_Widget</name>
4
+ <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Shopalize helps Online Retailers to increase social sharing and customer referrals from Social Media.</summary>
10
  <description>Shopalize's Post Purchase Sharing Plugin appears on your store'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. Once you integrate Shopalize's plugin to your storefront and kick start few campaigns, then you don't need any involvement maintaining these campaigns. Just sit back</description>
11
+ <notes>Make basic tracking code common and load it before end of body task</notes>
12
  <authors><author><name>Aditya Kothadiya</name><user>auto-converted</user><email>aditya@shopalize.com</email></author></authors>
13
+ <date>2012-08-17</date>
14
+ <time>18:05:45</time>
15
+ <contents><target name="magecommunity"><dir name="Shopalize"><dir name="Basic"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="267e9a0169ef0958f073fa30fa7c6689"/></dir><file name="Info.php" hash="b020b2d243600b723196fc74e2484b03"/></dir></dir><file name="Sa.php" hash="fbbfd05235399229e9fc1f6b46a79aa3"/></dir><dir name="Helper"><file name="Data.php" hash="63d1fc27e1a6260268ad85d5900ea777"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1e64b73ef0d8242e56cf3f2a0ae216dd"/><file name="config.xml" hash="c81d803948546fc0c1caeb499e86e56e"/><file name="system.xml" hash="a50307711f3bbe91fd79c36da2562b13"/></dir></dir><dir name="Purchasesharingwidget"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Info"><file name="About.php" hash="c446c21e63964dcd05dbcb5a54bba6d1"/></dir><file name="Info.php" hash="51af518de186fb563e05e8465b1e0dc2"/></dir></dir><file name="Purchasesharingwidget.php" hash="334dd425aedec3a94cb91309fdf7e4a1"/><file name="Success.php" hash="942499eb64cbd78c4484031735beff75"/></dir><dir name="Helper"><file name="Data.php" hash="68223edf1aba6ebe244df3cc22531e53"/><file name="Event.php" hash="1bbf170aec4797e892062fee8be2049f"/></dir><dir name="controllers"><file name="IndexController.php" hash="d06cd2d5fe876c987b752766ae6dc03c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1b3ee670d21002e5f64646118b532d9d"/><file name="config.xml" hash="5c19fd104f07ff13a214b2ecf4bbeb83"/><file name="system.xml" hash="bb98d038fcb387e444b74f391a289d4b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="purchasesharingwidget.xml" hash="3854556688b7e27a8e7eda0cdf2b6610"/><file name="sbasic.xml" hash="7c857358e62756443964e038bf2fbb98"/></dir><dir name="template"><dir name="purchasesharingwidget"><file name="success.phtml" hash="c8c9d7cc98322536216ea9b03744b0b7"/><file name="widget.phtml" hash="610125320c31cf7960077555a0acbeef"/></dir><dir name="basic"><file name="sa.phtml" hash="5cf89471ad2ef9b386585a709bf86d3e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shopalize_Purchasesharingwidget.xml" hash="374670608fd7b7012a90aeec163220f9"/><file name="Shopalize_Basic.xml" hash="46ffdbf1ea16cf1ca03cac825ff736c4"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>