talkable - Version 1.0.0

Version Notes

Extension provides:
- Invite Integration
- Post Purchase Integration
- Advocate Dashboard Integration
- Floating Widget Popup Integration

Note: Extension version 1.0 works with Talkable Integration library version 2.1 or higher.

Download this release

Release Info

Developer Talkable
Extension talkable
Version 1.0.0
Comparing to
See all releases


Code changes from version 0.1.8 to 1.0.0

app/code/community/Talkable/SocialReferrals/Block/Affiliate.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- /**
3
- * Talkable SocialReferrals for Magento
4
- *
5
- * @package Talkable_SocialReferrals
6
- * @author Talkable (http://www.talkable.com/)
7
- * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
8
- * @license MIT
9
- */
10
-
11
- class Talkable_SocialReferrals_Block_Affiliate extends Mage_Core_Block_Template
12
- {
13
-
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Talkable/SocialReferrals/Block/Customer/Dashboard.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- /**
3
- * Talkable SocialReferrals for Magento
4
- *
5
- * @package Talkable_SocialReferrals
6
- * @author Talkable (http://www.talkable.com/)
7
- * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
8
- * @license MIT
9
- */
10
-
11
- class Talkable_SocialReferrals_Block_Customer_Dashboard extends Mage_Core_Block_Template
12
- {
13
-
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Talkable/SocialReferrals/Helper/Data.php CHANGED
@@ -11,9 +11,9 @@
11
  class Talkable_SocialReferrals_Helper_Data extends Mage_Core_Helper_Abstract
12
  {
13
 
14
- //------------------+
15
- // Default Settings |
16
- //------------------+
17
 
18
  public function getSiteId()
19
  {
@@ -22,120 +22,131 @@ class Talkable_SocialReferrals_Helper_Data extends Mage_Core_Helper_Abstract
22
 
23
  public function getIntegrationJsUrl()
24
  {
25
- $retval = $this->_getTextConfigValue("general/integration_js_url");
26
-
27
- if ($retval == "") {
28
- return "//d2jjzw81hqbuqv.cloudfront.net/integration/talkable-1.0.min.js";
29
- } else {
30
  return $retval;
 
 
 
 
 
31
  }
32
  }
33
 
34
- //------------------------+
35
- // Post-Checkout Campaign |
36
- //------------------------+
37
 
38
  /**
39
- * @return bool Whether or not Post-Checkout Integration is enabled
40
  */
41
- public function isPurchaseEnabled()
42
  {
43
- return $this->_getBoolConfigValue("purchase/enabled");
 
 
 
 
 
44
  }
45
 
46
- public function getPurchaseCampaignTags()
 
 
 
47
  {
48
- return $this->_getListConfigValue("purchase/campaign_tags");
49
  }
50
 
51
- public function getPurchaseData($order)
 
 
 
52
  {
53
- $retval = array(
54
- "order_number" => $order->getIncrementId(),
55
- "order_date" => $order->getCreatedAt(),
56
- "subtotal" => $order->getSubtotal(),
57
- "coupon_code" => $order->getCouponCode(),
58
- "customer_id" => $order->getCustomerId(),
59
- "email" => $order->getCustomerEmail(),
60
- "first_name" => $order->getCustomerFirstname(),
61
- "last_name" => $order->getCustomerLastname(),
62
- "items" => array(),
63
- );
64
-
65
- foreach ($order->getAllVisibleItems() as $product) {
66
- $retval["items"][] = array(
67
- "product_id" => $product->getSku(),
68
- "price" => $product->getPrice(),
69
- "quantity" => $product->getQtyOrdered(),
70
- "title" => $product->getName(),
71
- );
72
- }
73
-
74
- return $retval;
75
  }
76
 
77
- //-----------------+
78
- // Invite Campaign |
79
- //-----------------+
80
-
81
  /**
82
- * @return bool Whether or not Standalone Integration is enabled
83
  */
84
- public function isAffiliateEnabled()
85
  {
86
- return $this->_getBoolConfigValue("affiliate/enabled");
87
  }
88
 
89
- public function getAffiliateCampaignTags()
 
 
 
90
  {
91
- return $this->_getListConfigValue("affiliate/campaign_tags");
92
  }
93
 
94
- public function getAffiliateIframeOptions()
 
 
 
 
95
  {
96
- return $this->_getIntegrationIframeOptions("affiliate");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
 
99
- public function getAffiliateData()
100
  {
101
  $helper = Mage::helper("customer");
102
 
103
  if ($helper->isLoggedIn()) {
104
  $customer = $helper->getCustomer();
105
- return array("affiliate_member" => array(
106
  "email" => $customer->getEmail(),
107
  "first_name" => $customer->getFirstname(),
108
  "last_name" => $customer->getLastname(),
109
  "customer_id" => $customer->getId(),
110
- ));
111
  } else {
112
- $emptyObject = new stdClass();
113
- return array("affiliate_member" => $emptyObject);
114
  }
115
  }
116
 
117
- //--------------------+
118
- // Dashboard Campaign |
119
- //--------------------+
120
-
121
- /**
122
- * @return bool Whether or not Dashboard Integration is enabled
123
- */
124
- public function isDashboardEnabled()
125
- {
126
- return $this->_getBoolConfigValue("dashboard/enabled");
127
- }
128
-
129
- public function getDashboardCampaignTags()
130
- {
131
- return $this->_getListConfigValue("dashboard/campaign_tags");
132
- }
133
-
134
- public function getDashboardIframeOptions()
135
- {
136
- return $this->_getIntegrationIframeOptions("dashboard");
137
- }
138
-
139
  //---------+
140
  // Private |
141
  //---------+
@@ -145,34 +156,14 @@ class Talkable_SocialReferrals_Helper_Data extends Mage_Core_Helper_Abstract
145
  return (bool) Mage::getStoreConfig("socialreferrals/" . $path);
146
  }
147
 
148
- private function _getListConfigValue($path)
149
- {
150
- return array_filter(array_map("trim", explode(",", Mage::getStoreConfig("socialreferrals/" . $path))));
151
- }
152
-
153
  private function _getTextConfigValue($path)
154
  {
155
  return trim(Mage::getStoreConfig("socialreferrals/" . $path));
156
  }
157
 
158
- private function _getIntegrationIframeOptions($path)
159
  {
160
- $width = $this->_getTextConfigValue($path . "/iframe_width");
161
- $width = strpos($width, "%") !== false ? $width : (int) $width;
162
-
163
- $height = $this->_getTextConfigValue($path . "/iframe_height");
164
- $height = strpos($height, "%") !== false ? $height : (int) $height;
165
-
166
- $container = $this->_getTextConfigValue($path . "/iframe_container");
167
-
168
- return array(
169
- "responsive" => $this->_getBoolConfigValue($path . "/iframe_responsive"),
170
- "iframe" => array(
171
- "container" => $container ? $container : "talkable-container",
172
- "width" => $width ? $width : "100%",
173
- "height" => $height ? $height : 960,
174
- ),
175
- );
176
  }
177
 
178
  }
11
  class Talkable_SocialReferrals_Helper_Data extends Mage_Core_Helper_Abstract
12
  {
13
 
14
+ //------------------------+
15
+ // Talkable Configuration |
16
+ //------------------------+
17
 
18
  public function getSiteId()
19
  {
22
 
23
  public function getIntegrationJsUrl()
24
  {
25
+ if ($retval = $this->_getTextConfigValue("general/integration_js_url")) {
 
 
 
 
26
  return $retval;
27
+ } else {
28
+ return Mage::getConfig()
29
+ ->loadModulesConfiguration("config.xml")
30
+ ->getNode("default/socialreferrals/general")
31
+ ->integration_js_url;
32
  }
33
  }
34
 
35
+ //--------------------+
36
+ // Talkable Campaigns |
37
+ //--------------------+
38
 
39
  /**
40
+ * @return bool Whether or not Talkable Integration is enabled
41
  */
42
+ public function isEnabled()
43
  {
44
+ return (
45
+ $this->isInviteEnabled() ||
46
+ $this->isPostPurchaseEnabled() ||
47
+ $this->isAdvocateDashboardEnabled() ||
48
+ $this->isFloatingWidgetPopupEnabled()
49
+ );
50
  }
51
 
52
+ /**
53
+ * @return bool Whether or not Post Purchase Integration is enabled
54
+ */
55
+ public function isPostPurchaseEnabled()
56
  {
57
+ return $this->_getBoolConfigValue("campaigns/post_purchase");
58
  }
59
 
60
+ /**
61
+ * @return bool Whether or not Invite Integration is enabled
62
+ */
63
+ public function isInviteEnabled()
64
  {
65
+ return $this->_getBoolConfigValue("campaigns/invite");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
 
 
 
 
68
  /**
69
+ * @return bool Whether or not Advocate Dashboard Integration is enabled
70
  */
71
+ public function isAdvocateDashboardEnabled()
72
  {
73
+ return $this->_getBoolConfigValue("campaigns/advocate_dashboard");
74
  }
75
 
76
+ /**
77
+ * @return bool Whether or not Floating Widget Popup Integration is enabled
78
+ */
79
+ public function isFloatingWidgetPopupEnabled()
80
  {
81
+ return $this->_getBoolConfigValue("campaigns/floating_widget_popup");
82
  }
83
 
84
+ //-------------+
85
+ // Origin Data |
86
+ //-------------+
87
+
88
+ public function getPurchaseData($order)
89
  {
90
+ $shippingAddress = $order->getShippingAddress();
91
+ $countryName = Mage::getModel("directory/country")
92
+ ->loadByCode($shippingAddress->getCountryId())
93
+ ->getName();
94
+
95
+ $shippingFields = array_filter(array(
96
+ implode(", ", $shippingAddress->getStreet()),
97
+ $shippingAddress->getCity(),
98
+ $shippingAddress->getRegion(),
99
+ $shippingAddress->getPostcode(),
100
+ $countryName,
101
+ ));
102
+
103
+ $retval = array(
104
+ "customer" => array(
105
+ "email" => $order->getCustomerEmail(),
106
+ "first_name" => $order->getCustomerFirstname(),
107
+ "last_name" => $order->getCustomerLastname(),
108
+ "customer_id" => $order->getCustomerId(),
109
+ ),
110
+ "purchase" => array(
111
+ "order_number" => $order->getIncrementId(),
112
+ "order_date" => $order->getCreatedAt(),
113
+ "subtotal" => $this->_normalizeAmount($order->getSubtotal()),
114
+ "coupon_code" => $order->getCouponCode(),
115
+ "items" => array(),
116
+ "shipping_zip" => $shippingAddress->getPostcode(),
117
+ "shipping_address" => implode(", ", $shippingFields),
118
+ ),
119
+ );
120
+
121
+ foreach ($order->getAllVisibleItems() as $product) {
122
+ $retval["purchase"]["items"][] = array(
123
+ "product_id" => $product->getSku(),
124
+ "price" => $this->_normalizeAmount($product->getPrice()),
125
+ "quantity" => strval(round($product->getQtyOrdered())),
126
+ "title" => $product->getName(),
127
+ );
128
+ }
129
+
130
+ return $retval;
131
  }
132
 
133
+ public function getCustomerData()
134
  {
135
  $helper = Mage::helper("customer");
136
 
137
  if ($helper->isLoggedIn()) {
138
  $customer = $helper->getCustomer();
139
+ return array(
140
  "email" => $customer->getEmail(),
141
  "first_name" => $customer->getFirstname(),
142
  "last_name" => $customer->getLastname(),
143
  "customer_id" => $customer->getId(),
144
+ );
145
  } else {
146
+ return new stdClass();
 
147
  }
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  //---------+
151
  // Private |
152
  //---------+
156
  return (bool) Mage::getStoreConfig("socialreferrals/" . $path);
157
  }
158
 
 
 
 
 
 
159
  private function _getTextConfigValue($path)
160
  {
161
  return trim(Mage::getStoreConfig("socialreferrals/" . $path));
162
  }
163
 
164
+ private function _normalizeAmount($value)
165
  {
166
+ return number_format((float) $value, 2, ".", "");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
  }
app/code/community/Talkable/SocialReferrals/Model/Observer.php CHANGED
@@ -13,7 +13,7 @@ class Talkable_SocialReferrals_Model_Observer extends Mage_Core_Model_Abstract
13
 
14
  public function customerDashboardLink(Varien_Event_Observer $observer)
15
  {
16
- if (Mage::helper("socialreferrals")->isDashboardEnabled()) {
17
  $observer->getEvent()->getLayout()->getUpdate()->addHandle("customer_dashboard_handle");
18
  }
19
  }
13
 
14
  public function customerDashboardLink(Varien_Event_Observer $observer)
15
  {
16
+ if (Mage::helper("socialreferrals")->isAdvocateDashboardEnabled()) {
17
  $observer->getEvent()->getLayout()->getUpdate()->addHandle("customer_dashboard_handle");
18
  }
19
  }
app/code/community/Talkable/SocialReferrals/controllers/Customer/DashboardController.php CHANGED
@@ -13,7 +13,7 @@ class Talkable_SocialReferrals_Customer_DashboardController extends Mage_Core_Co
13
 
14
  public function indexAction()
15
  {
16
- if (Mage::helper("socialreferrals")->isDashboardEnabled()) {
17
  $this->loadLayout();
18
  $this->renderLayout();
19
  } else {
13
 
14
  public function indexAction()
15
  {
16
+ if (Mage::helper("socialreferrals")->isAdvocateDashboardEnabled()) {
17
  $this->loadLayout();
18
  $this->renderLayout();
19
  } else {
app/code/community/Talkable/SocialReferrals/controllers/IndexController.php CHANGED
@@ -13,7 +13,7 @@ class Talkable_SocialReferrals_IndexController extends Mage_Core_Controller_Fron
13
 
14
  public function indexAction()
15
  {
16
- if (Mage::helper("socialreferrals")->isAffiliateEnabled()) {
17
  $this->loadLayout();
18
  $this->renderLayout();
19
  } else {
13
 
14
  public function indexAction()
15
  {
16
+ if (Mage::helper("socialreferrals")->isInviteEnabled()) {
17
  $this->loadLayout();
18
  $this->renderLayout();
19
  } else {
app/code/community/Talkable/SocialReferrals/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <Talkable_SocialReferrals>
15
- <version>0.1.8</version>
16
  </Talkable_SocialReferrals>
17
  </modules>
18
 
@@ -80,31 +80,15 @@
80
  <socialreferrals>
81
  <general>
82
  <site_id></site_id>
83
- <integration_js_url>//d2jjzw81hqbuqv.cloudfront.net/integration/talkable-1.0.min.js</integration_js_url>
84
  </general>
85
 
86
- <purchase>
87
- <enabled>0</enabled>
88
- <campaign_tags>post-purchase</campaign_tags>
89
- </purchase>
90
-
91
- <affiliate>
92
- <enabled>0</enabled>
93
- <campaign_tags>invite</campaign_tags>
94
- <iframe_responsive>1</iframe_responsive>
95
- <iframe_container>talkable-container</iframe_container>
96
- <iframe_width>100%</iframe_width>
97
- <iframe_height>960</iframe_height>
98
- </affiliate>
99
-
100
- <dashboard>
101
- <enabled>0</enabled>
102
- <campaign_tags>dashboard</campaign_tags>
103
- <iframe_responsive>1</iframe_responsive>
104
- <iframe_container>talkable-container</iframe_container>
105
- <iframe_width>100%</iframe_width>
106
- <iframe_height>960</iframe_height>
107
- </dashboard>
108
  </socialreferrals>
109
  </default>
110
  </config>
12
  <config>
13
  <modules>
14
  <Talkable_SocialReferrals>
15
+ <version>1.0.0</version>
16
  </Talkable_SocialReferrals>
17
  </modules>
18
 
80
  <socialreferrals>
81
  <general>
82
  <site_id></site_id>
83
+ <integration_js_url>//d2jjzw81hqbuqv.cloudfront.net/integration/talkable-2.1.min.js</integration_js_url>
84
  </general>
85
 
86
+ <campaigns>
87
+ <post_purchase>0</post_purchase>
88
+ <invite>0</invite>
89
+ <advocate_dashboard>0</advocate_dashboard>
90
+ <floating_widget_popup>0</floating_widget_popup>
91
+ </campaigns>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </socialreferrals>
93
  </default>
94
  </config>
app/code/community/Talkable/SocialReferrals/etc/system.xml CHANGED
@@ -28,7 +28,7 @@
28
 
29
  <groups>
30
  <general translate="label">
31
- <label>Default Settings</label>
32
  <frontend_type>text</frontend_type>
33
  <sort_order>1</sort_order>
34
  <show_in_default>1</show_in_default>
@@ -58,8 +58,8 @@
58
  </fields>
59
  </general>
60
 
61
- <purchase translate="label">
62
- <label>Post-Checkout Integration</label>
63
  <frontend_type>text</frontend_type>
64
  <sort_order>2</sort_order>
65
  <show_in_default>1</show_in_default>
@@ -67,172 +67,51 @@
67
  <show_in_store>1</show_in_store>
68
 
69
  <fields>
70
- <enabled translate="label">
71
- <label>Enabled</label>
72
- <comment><![CDATA[(Offer will be shown on the Checkout Success page)]]></comment>
73
  <frontend_type>select</frontend_type>
74
- <source_model>adminhtml/system_config_source_yesno</source_model>
75
  <sort_order>1</sort_order>
76
  <show_in_default>1</show_in_default>
77
  <show_in_website>1</show_in_website>
78
  <show_in_store>1</show_in_store>
79
- </enabled>
80
 
81
- <campaign_tags translate="label">
82
- <label>Campaign Tags</label>
83
- <comment><![CDATA[CSV-list of campaign tags]]></comment>
84
- <frontend_type>text</frontend_type>
85
- <sort_order>2</sort_order>
86
- <show_in_default>1</show_in_default>
87
- <show_in_website>1</show_in_website>
88
- <show_in_store>1</show_in_store>
89
- </campaign_tags>
90
- </fields>
91
- </purchase>
92
-
93
- <affiliate translate="label">
94
- <label>Standalone Integration</label>
95
- <frontend_type>text</frontend_type>
96
- <sort_order>3</sort_order>
97
- <show_in_default>1</show_in_default>
98
- <show_in_website>1</show_in_website>
99
- <show_in_store>1</show_in_store>
100
-
101
- <fields>
102
- <enabled translate="label">
103
- <label>Enabled</label>
104
- <comment><![CDATA[(Standalone campaign will be mounted at /share)]]></comment>
105
  <frontend_type>select</frontend_type>
106
- <source_model>adminhtml/system_config_source_yesno</source_model>
107
- <sort_order>1</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>1</show_in_website>
110
- <show_in_store>1</show_in_store>
111
- </enabled>
112
-
113
- <campaign_tags translate="label">
114
- <label>Campaign Tags</label>
115
- <comment><![CDATA[CSV-list of campaign tags]]></comment>
116
- <frontend_type>text</frontend_type>
117
  <sort_order>2</sort_order>
118
  <show_in_default>1</show_in_default>
119
  <show_in_website>1</show_in_website>
120
  <show_in_store>1</show_in_store>
121
- </campaign_tags>
122
 
123
- <iframe_responsive translate="label">
124
- <label>IFrame responsive</label>
125
- <comment><![CDATA[Automatically adapt the IFrame to the viewport size]]></comment>
126
  <frontend_type>select</frontend_type>
127
- <source_model>adminhtml/system_config_source_yesno</source_model>
128
  <sort_order>3</sort_order>
129
  <show_in_default>1</show_in_default>
130
  <show_in_website>1</show_in_website>
131
  <show_in_store>1</show_in_store>
132
- </iframe_responsive>
133
-
134
- <iframe_container translate="label">
135
- <label>IFrame container</label>
136
- <comment><![CDATA[ID of a DOM element to contain the IFrame]]></comment>
137
- <frontend_type>text</frontend_type>
138
- <sort_order>4</sort_order>
139
- <show_in_default>1</show_in_default>
140
- <show_in_website>1</show_in_website>
141
- <show_in_store>1</show_in_store>
142
- </iframe_container>
143
-
144
- <iframe_width translate="label">
145
- <label>IFrame width</label>
146
- <frontend_type>text</frontend_type>
147
- <sort_order>5</sort_order>
148
- <show_in_default>1</show_in_default>
149
- <show_in_website>1</show_in_website>
150
- <show_in_store>1</show_in_store>
151
- </iframe_width>
152
-
153
- <iframe_height translate="label">
154
- <label>IFrame height</label>
155
- <comment><![CDATA[Not applied if <em>responsive</em> is set to "No"]]></comment>
156
- <frontend_type>text</frontend_type>
157
- <sort_order>6</sort_order>
158
- <show_in_default>1</show_in_default>
159
- <show_in_website>1</show_in_website>
160
- <show_in_store>1</show_in_store>
161
- </iframe_height>
162
- </fields>
163
- </affiliate>
164
 
165
- <dashboard translate="label">
166
- <label>Dashboard Integration</label>
167
- <frontend_type>text</frontend_type>
168
- <sort_order>4</sort_order>
169
- <show_in_default>1</show_in_default>
170
- <show_in_website>1</show_in_website>
171
- <show_in_store>1</show_in_store>
172
-
173
- <fields>
174
- <enabled translate="label">
175
- <label>Enabled</label>
176
- <comment><![CDATA[(Will be added to the Customer Account section)]]></comment>
177
  <frontend_type>select</frontend_type>
178
- <source_model>adminhtml/system_config_source_yesno</source_model>
179
- <sort_order>1</sort_order>
180
- <show_in_default>1</show_in_default>
181
- <show_in_website>1</show_in_website>
182
- <show_in_store>1</show_in_store>
183
- </enabled>
184
-
185
- <campaign_tags translate="label">
186
- <label>Campaign Tags</label>
187
- <comment><![CDATA[CSV-list of campaign tags]]></comment>
188
- <frontend_type>text</frontend_type>
189
- <sort_order>2</sort_order>
190
- <show_in_default>1</show_in_default>
191
- <show_in_website>1</show_in_website>
192
- <show_in_store>1</show_in_store>
193
- </campaign_tags>
194
-
195
- <iframe_responsive translate="label">
196
- <label>IFrame responsive</label>
197
- <comment><![CDATA[Automatically adapt the IFrame to the viewport size]]></comment>
198
- <frontend_type>select</frontend_type>
199
- <source_model>adminhtml/system_config_source_yesno</source_model>
200
- <sort_order>3</sort_order>
201
- <show_in_default>1</show_in_default>
202
- <show_in_website>1</show_in_website>
203
- <show_in_store>1</show_in_store>
204
- </iframe_responsive>
205
-
206
- <iframe_container translate="label">
207
- <label>IFrame container</label>
208
- <comment><![CDATA[ID of a DOM element to contain the IFrame]]></comment>
209
- <frontend_type>text</frontend_type>
210
  <sort_order>4</sort_order>
211
  <show_in_default>1</show_in_default>
212
  <show_in_website>1</show_in_website>
213
  <show_in_store>1</show_in_store>
214
- </iframe_container>
215
-
216
- <iframe_width translate="label">
217
- <label>IFrame width</label>
218
- <frontend_type>text</frontend_type>
219
- <sort_order>5</sort_order>
220
- <show_in_default>1</show_in_default>
221
- <show_in_website>1</show_in_website>
222
- <show_in_store>1</show_in_store>
223
- </iframe_width>
224
-
225
- <iframe_height translate="label">
226
- <label>IFrame height</label>
227
- <comment><![CDATA[Not applied if <em>responsive</em> is set to "No"]]></comment>
228
- <frontend_type>text</frontend_type>
229
- <sort_order>6</sort_order>
230
- <show_in_default>1</show_in_default>
231
- <show_in_website>1</show_in_website>
232
- <show_in_store>1</show_in_store>
233
- </iframe_height>
234
  </fields>
235
- </dashboard>
236
  </groups>
237
  </socialreferrals>
238
  </sections>
28
 
29
  <groups>
30
  <general translate="label">
31
+ <label>Talkable Integration</label>
32
  <frontend_type>text</frontend_type>
33
  <sort_order>1</sort_order>
34
  <show_in_default>1</show_in_default>
58
  </fields>
59
  </general>
60
 
61
+ <campaigns translate="label">
62
+ <label>Talkable Campaigns</label>
63
  <frontend_type>text</frontend_type>
64
  <sort_order>2</sort_order>
65
  <show_in_default>1</show_in_default>
67
  <show_in_store>1</show_in_store>
68
 
69
  <fields>
70
+ <post_purchase translate="label">
71
+ <label>Post Purchase</label>
72
+ <comment><![CDATA[Shown on the Checkout Success page]]></comment>
73
  <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
75
  <sort_order>1</sort_order>
76
  <show_in_default>1</show_in_default>
77
  <show_in_website>1</show_in_website>
78
  <show_in_store>1</show_in_store>
79
+ </post_purchase>
80
 
81
+ <invite translate="label">
82
+ <label>Invite</label>
83
+ <comment><![CDATA[Mounted at /share]]></comment>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  <frontend_type>select</frontend_type>
85
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
 
 
 
 
 
 
 
 
 
 
86
  <sort_order>2</sort_order>
87
  <show_in_default>1</show_in_default>
88
  <show_in_website>1</show_in_website>
89
  <show_in_store>1</show_in_store>
90
+ </invite>
91
 
92
+ <advocate_dashboard translate="label">
93
+ <label>Advocate Dashboard</label>
94
+ <comment><![CDATA[Added to the Customer Account section]]></comment>
95
  <frontend_type>select</frontend_type>
96
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
97
  <sort_order>3</sort_order>
98
  <show_in_default>1</show_in_default>
99
  <show_in_website>1</show_in_website>
100
  <show_in_store>1</show_in_store>
101
+ </advocate_dashboard>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
+ <floating_widget_popup translate="label">
104
+ <label>Floating Widget Popup</label>
105
+ <comment><![CDATA[Shown on every page]]></comment>
 
 
 
 
 
 
 
 
 
106
  <frontend_type>select</frontend_type>
107
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  <sort_order>4</sort_order>
109
  <show_in_default>1</show_in_default>
110
  <show_in_website>1</show_in_website>
111
  <show_in_store>1</show_in_store>
112
+ </floating_widget_popup>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  </fields>
114
+ </campaigns>
115
  </groups>
116
  </socialreferrals>
117
  </sections>
app/design/frontend/base/default/layout/talkable/socialreferrals.xml CHANGED
@@ -10,33 +10,50 @@
10
  */
11
  -->
12
  <layout version="0.1.0">
 
 
 
 
 
 
 
 
 
 
13
  <checkout_onepage_success>
 
 
14
  <reference name="before_body_end">
15
- <block type="socialreferrals/purchase" name="talkable.socialreferrals.purchase" template="talkable/socialreferrals/post_purchase.phtml" />
16
  </reference>
17
  </checkout_onepage_success>
18
 
19
  <checkout_multishipping_success>
 
 
20
  <reference name="before_body_end">
21
- <block type="socialreferrals/multishipping_purchase" name="talkable.socialreferrals.multishipping_purchase" template="talkable/socialreferrals/post_purchase.phtml" />
22
  </reference>
23
  </checkout_multishipping_success>
24
 
25
  <socialreferrals_index_index>
 
 
26
  <reference name="root">
27
  <action method="setTemplate"><template>page/1column.phtml</template></action>
28
  </reference>
29
 
30
  <reference name="content">
31
- <block type="socialreferrals/affiliate" name="talkable.socialreferrals.affiliate" template="talkable/socialreferrals/invite.phtml" />
32
  </reference>
33
  </socialreferrals_index_index>
34
 
35
  <customer_dashboard_index>
 
36
  <update handle="customer_account"/>
37
 
38
  <reference name="my.account.wrapper">
39
- <block type="socialreferrals/customer_dashboard" name="talkable.socialreferrals.customer_dashboard" template="talkable/socialreferrals/dashboard.phtml" />
40
  </reference>
41
  </customer_dashboard_index>
42
 
10
  */
11
  -->
12
  <layout version="0.1.0">
13
+ <default>
14
+ <reference name="head">
15
+ <block type="core/template" name="talkable.socialreferrals.head" template="talkable/socialreferrals/head.phtml" />
16
+ </reference>
17
+
18
+ <reference name="before_body_end">
19
+ <block type="core/template" name="talkable.socialreferrals.floating_widget_popup" template="talkable/socialreferrals/floating_widget_popup.phtml" />
20
+ </reference>
21
+ </default>
22
+
23
  <checkout_onepage_success>
24
+ <remove name="talkable.socialreferrals.floating_widget_popup" />
25
+
26
  <reference name="before_body_end">
27
+ <block type="socialreferrals/purchase" name="talkable.socialreferrals.post_purchase" template="talkable/socialreferrals/post_purchase.phtml" />
28
  </reference>
29
  </checkout_onepage_success>
30
 
31
  <checkout_multishipping_success>
32
+ <remove name="talkable.socialreferrals.floating_widget_popup" />
33
+
34
  <reference name="before_body_end">
35
+ <block type="socialreferrals/multishipping_purchase" name="talkable.socialreferrals.post_purchase" template="talkable/socialreferrals/post_purchase.phtml" />
36
  </reference>
37
  </checkout_multishipping_success>
38
 
39
  <socialreferrals_index_index>
40
+ <remove name="talkable.socialreferrals.floating_widget_popup" />
41
+
42
  <reference name="root">
43
  <action method="setTemplate"><template>page/1column.phtml</template></action>
44
  </reference>
45
 
46
  <reference name="content">
47
+ <block type="core/template" name="talkable.socialreferrals.invite" template="talkable/socialreferrals/invite.phtml" />
48
  </reference>
49
  </socialreferrals_index_index>
50
 
51
  <customer_dashboard_index>
52
+ <remove name="talkable.socialreferrals.floating_widget_popup" />
53
  <update handle="customer_account"/>
54
 
55
  <reference name="my.account.wrapper">
56
+ <block type="core/template" name="talkable.socialreferrals.advocate_dashboard" template="talkable/socialreferrals/advocate_dashboard.phtml" />
57
  </reference>
58
  </customer_dashboard_index>
59
 
app/design/frontend/base/default/template/talkable/socialreferrals/advocate_dashboard.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable SocialReferrals for Magento
4
+ *
5
+ * @package Talkable_SocialReferrals
6
+ * @author Talkable (http://www.talkable.com/)
7
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
8
+ * @license MIT
9
+ */
10
+ ?>
11
+
12
+ <?php $_helper = $this->helper("socialreferrals") ?>
13
+
14
+ <?php if ($_helper->isAdvocateDashboardEnabled()): ?>
15
+ <!-- Begin Talkable integration code -->
16
+
17
+ <?php if ($_helper->getSiteId() == ""): ?>
18
+ <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
+ <?php else: ?>
20
+ <div id="talkable-dashboard"></div>
21
+ <script type="text/javascript">
22
+ //<![CDATA[
23
+ _talkableq.push(["register_affiliate", {
24
+ campaign_template: { name: "dashboard" }
25
+ }]);
26
+ //]]>
27
+ </script>
28
+ <?php endif ?>
29
+
30
+ <!-- End Talkable integration code -->
31
+ <?php endif ?>
app/design/frontend/base/default/template/talkable/socialreferrals/floating_widget_popup.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable SocialReferrals for Magento
4
+ *
5
+ * @package Talkable_SocialReferrals
6
+ * @author Talkable (http://www.talkable.com/)
7
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
8
+ * @license MIT
9
+ */
10
+ ?>
11
+
12
+ <?php $_helper = $this->helper("socialreferrals") ?>
13
+
14
+ <?php if ($_helper->isFloatingWidgetPopupEnabled()): ?>
15
+ <!-- Begin Talkable integration code -->
16
+
17
+ <?php if ($_helper->getSiteId() == ""): ?>
18
+ <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
+ <?php else: ?>
20
+ <script type="text/javascript">
21
+ //<![CDATA[
22
+ _talkableq.push(["register_affiliate", {
23
+ campaign_template: {
24
+ name: "popup-trigger",
25
+ path: document.location.pathname
26
+ }
27
+ }]);
28
+ //]]>
29
+ </script>
30
+ <?php endif ?>
31
+
32
+ <!-- End Talkable integration code -->
33
+ <?php endif ?>
app/design/frontend/base/default/template/talkable/socialreferrals/{dashboard.phtml → head.phtml} RENAMED
@@ -11,25 +11,20 @@
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
- <?php if ($_helper->isDashboardEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
18
  <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
  <?php else: ?>
20
- <div id="talkable-container"></div>
21
  <script type="text/javascript">
22
  //<![CDATA[
23
  var _talkableq = _talkableq || [];
24
  _talkableq.push(["init", {
25
- site_id: "<?php echo $_helper->getSiteId() ?>",
26
- server: "https://www.talkable.com"
27
  }]);
28
 
29
- <?php $_event_data = array_merge($_helper->getAffiliateData(), $_helper->getDashboardIframeOptions()) ?>
30
- <?php $_event_data["campaign_tags"] = $_helper->getDashboardCampaignTags() ?>
31
-
32
- _talkableq.push(["register_affiliate", <?php echo Mage::helper("core")->jsonEncode($_event_data) ?>]);
33
  //]]>
34
  </script>
35
  <script type="text/javascript" src="<?php echo $_helper->getIntegrationJsUrl() ?>"></script>
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
+ <?php if ($_helper->isEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
18
  <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
  <?php else: ?>
 
20
  <script type="text/javascript">
21
  //<![CDATA[
22
  var _talkableq = _talkableq || [];
23
  _talkableq.push(["init", {
24
+ site_id: "<?php echo $_helper->getSiteId() ?>"
 
25
  }]);
26
 
27
+ _talkableq.push(["authenticate_customer", <?php echo Mage::helper("core")->jsonEncode($_helper->getCustomerData()) ?>]);
 
 
 
28
  //]]>
29
  </script>
30
  <script type="text/javascript" src="<?php echo $_helper->getIntegrationJsUrl() ?>"></script>
app/design/frontend/base/default/template/talkable/socialreferrals/invite.phtml CHANGED
@@ -11,28 +11,20 @@
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
- <?php if ($_helper->isAffiliateEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
18
  <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
  <?php else: ?>
20
- <div id="talkable-container"></div>
21
  <script type="text/javascript">
22
  //<![CDATA[
23
- var _talkableq = _talkableq || [];
24
- _talkableq.push(["init", {
25
- site_id: "<?php echo $_helper->getSiteId() ?>",
26
- server: "https://www.talkable.com"
27
  }]);
28
-
29
- <?php $_event_data = array_merge($_helper->getAffiliateData(), $_helper->getAffiliateIframeOptions()) ?>
30
- <?php $_event_data["campaign_tags"] = $_helper->getAffiliateCampaignTags() ?>
31
-
32
- _talkableq.push(["register_affiliate", <?php echo Mage::helper("core")->jsonEncode($_event_data) ?>]);
33
  //]]>
34
  </script>
35
- <script type="text/javascript" src="<?php echo $_helper->getIntegrationJsUrl() ?>"></script>
36
  <?php endif ?>
37
 
38
  <!-- End Talkable integration code -->
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
+ <?php if ($_helper->isInviteEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
18
  <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
  <?php else: ?>
20
+ <div id="talkable-invite"></div>
21
  <script type="text/javascript">
22
  //<![CDATA[
23
+ _talkableq.push(["register_affiliate", {
24
+ campaign_template: { name: "invite" }
 
 
25
  }]);
 
 
 
 
 
26
  //]]>
27
  </script>
 
28
  <?php endif ?>
29
 
30
  <!-- End Talkable integration code -->
app/design/frontend/base/default/template/talkable/socialreferrals/post_purchase.phtml CHANGED
@@ -11,7 +11,7 @@
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
- <?php if ($_helper->isPurchaseEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
@@ -20,21 +20,13 @@
20
  <?php if ($_order = $this->getCheckoutOrder()): ?>
21
  <script type="text/javascript">
22
  //<![CDATA[
23
- var _talkableq = _talkableq || [];
24
- _talkableq.push(["init", {
25
- site_id: "<?php echo $_helper->getSiteId() ?>",
26
- server: "https://www.talkable.com"
27
- }]);
28
-
29
  <?php $_event_data = $_helper->getPurchaseData($_order) ?>
30
- <?php $_event_data["responsive"] = true ?>
31
  <?php $_event_data["traffic_source"] = "Post-checkout" ?>
32
- <?php $_event_data["campaign_tags"] = $_helper->getPurchaseCampaignTags() ?>
33
 
34
  _talkableq.push(["register_purchase", <?php echo Mage::helper("core")->jsonEncode($_event_data) ?>]);
35
  //]]>
36
  </script>
37
- <script type="text/javascript" src="<?php echo $_helper->getIntegrationJsUrl() ?>"></script>
38
  <?php else: ?>
39
  <!-- Order could not be found -->
40
  <?php endif ?>
11
 
12
  <?php $_helper = $this->helper("socialreferrals") ?>
13
 
14
+ <?php if ($_helper->isPostPurchaseEnabled()): ?>
15
  <!-- Begin Talkable integration code -->
16
 
17
  <?php if ($_helper->getSiteId() == ""): ?>
20
  <?php if ($_order = $this->getCheckoutOrder()): ?>
21
  <script type="text/javascript">
22
  //<![CDATA[
 
 
 
 
 
 
23
  <?php $_event_data = $_helper->getPurchaseData($_order) ?>
 
24
  <?php $_event_data["traffic_source"] = "Post-checkout" ?>
25
+ <?php $_event_data["campaign_template"] = array("name" => "post-purchase") ?>
26
 
27
  _talkableq.push(["register_purchase", <?php echo Mage::helper("core")->jsonEncode($_event_data) ?>]);
28
  //]]>
29
  </script>
 
30
  <?php else: ?>
31
  <!-- Order could not be found -->
32
  <?php endif ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>talkable</name>
4
- <version>0.1.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
@@ -15,13 +15,16 @@ Using Talkable, you help your customers drive more referral sales per dollar tha
15
  &#xD;
16
  See more at Talkable.com</description>
17
  <notes>Extension provides:&#xD;
18
- - Post-Checkout Integration&#xD;
19
- - Standalone Integration&#xD;
20
- - Customer Dashboard Integration</notes>
 
 
 
21
  <authors><author><name>Talkable</name><user>talkable</user><email>sub@talkable.com</email></author></authors>
22
- <date>2015-12-08</date>
23
- <time>15:03:45</time>
24
- <contents><target name="magecommunity"><dir name="Talkable"><dir name="SocialReferrals"><dir name="Block"><file name="Affiliate.php" hash="e5cf1648f2aab8c8894fd1311ae865b8"/><dir name="Customer"><file name="Dashboard.php" hash="78d93dcf31455b09117506a78d3b7797"/></dir><dir name="Multishipping"><file name="Purchase.php" hash="6eaab3557bdf97f40a77c7b6e040e483"/></dir><file name="Purchase.php" hash="5cd37269372b88cec4657bf85077c1a4"/></dir><dir name="Helper"><file name="Data.php" hash="01fdc77f9c0e94df7c03228c74b5e8f0"/></dir><dir name="Model"><file name="Observer.php" hash="c5ebe37375fb3d6b40d8d440b790ee8b"/></dir><dir name="controllers"><dir name="Customer"><file name="DashboardController.php" hash="fb89ba06fed8cb3329a941d59bd67b7c"/></dir><file name="IndexController.php" hash="41a785b074c529b65a3f82ca3573662e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3f86a3e4bf980fa36aba8c0e33737e59"/><file name="config.xml" hash="cd60d5427ffb0109f27ddfa115e9378e"/><file name="system.xml" hash="403d3059ec5cf53e2494d920f159a3ca"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="talkable"><file name="socialreferrals.xml" hash="87e9f62d2d649e5da197e7a93c47c986"/></dir></dir><dir name="template"><dir name="talkable"><dir name="socialreferrals"><file name="dashboard.phtml" hash="8f500eda3d530a023463f8ebd190d2ef"/><file name="invite.phtml" hash="26f2536cc57b16919409064af76f1551"/><file name="post_purchase.phtml" hash="7cefca2596c5f8da483cd728a0e4d018"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Talkable_SocialReferrals.xml" hash="ed1152e3c169ac8e9d33219e5ec9fb47"/></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>talkable</name>
4
+ <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
15
  &#xD;
16
  See more at Talkable.com</description>
17
  <notes>Extension provides:&#xD;
18
+ - Invite Integration&#xD;
19
+ - Post Purchase Integration&#xD;
20
+ - Advocate Dashboard Integration&#xD;
21
+ - Floating Widget Popup Integration&#xD;
22
+ &#xD;
23
+ Note: Extension version 1.0 works with Talkable Integration library version 2.1 or higher.</notes>
24
  <authors><author><name>Talkable</name><user>talkable</user><email>sub@talkable.com</email></author></authors>
25
+ <date>2016-02-02</date>
26
+ <time>16:56:35</time>
27
+ <contents><target name="magecommunity"><dir name="Talkable"><dir name="SocialReferrals"><dir name="Block"><dir name="Multishipping"><file name="Purchase.php" hash="6eaab3557bdf97f40a77c7b6e040e483"/></dir><file name="Purchase.php" hash="5cd37269372b88cec4657bf85077c1a4"/></dir><dir name="Helper"><file name="Data.php" hash="9c25df7d29303a12026c8c689ccdc6bb"/></dir><dir name="Model"><file name="Observer.php" hash="b9e5a92a24b018b14ccc64658326e92e"/></dir><dir name="controllers"><dir name="Customer"><file name="DashboardController.php" hash="3f715ff823d8b2709d3b6ee106685513"/></dir><file name="IndexController.php" hash="c08758b6a50bbc95ce09773818a6a7c4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3f86a3e4bf980fa36aba8c0e33737e59"/><file name="config.xml" hash="7f0a9593eaec1e19c587d746c15340a7"/><file name="system.xml" hash="24f2eab492ee493224ecd5dd198f3a1f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="talkable"><file name="socialreferrals.xml" hash="c4731fc832bf3cdbe4fec6f6cd336549"/></dir></dir><dir name="template"><dir name="talkable"><dir name="socialreferrals"><file name="advocate_dashboard.phtml" hash="8cd2009d81fc41b844d67e3720f052d1"/><file name="floating_widget_popup.phtml" hash="a6fbbdc319fb39f16d423009aa0c980b"/><file name="head.phtml" hash="4e159f767e7e615b7d0f45617e242e9b"/><file name="invite.phtml" hash="4dc8f89254afd20c229433fd4e633bc1"/><file name="post_purchase.phtml" hash="30f45c14f6b45d92fcd9d26fdb6bbeae"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Talkable_SocialReferrals.xml" hash="ed1152e3c169ac8e9d33219e5ec9fb47"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>