talkable - Version 0.1.0

Version Notes

First release

Download this release

Release Info

Developer Talkable
Extension talkable
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Talkable/CheckoutOffer/Block/Checkoutoffer.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable CheckoutOffer for Magento
4
+ *
5
+ * @package Talkable_CheckoutOffer
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_CheckoutOffer_Block_Checkoutoffer extends Mage_Checkout_Block_Onepage_Success
12
+ {
13
+
14
+ public function getCheckoutOrder()
15
+ {
16
+ if ($this->getOrderId()) {
17
+ return Mage::getModel("sales/order")->loadByIncrementId($this->getOrderId());
18
+ }
19
+ }
20
+
21
+ }
app/code/community/Talkable/CheckoutOffer/Block/Multishipping/Checkoutoffer.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable CheckoutOffer for Magento
4
+ *
5
+ * @package Talkable_CheckoutOffer
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_CheckoutOffer_Block_Multishipping_Checkoutoffer extends Mage_Checkout_Block_Multishipping_Success
12
+ {
13
+
14
+ public function getCheckoutOrder()
15
+ {
16
+ return Mage::getResourceModel("sales/order_collection")
17
+ ->addFieldToSelect("*")
18
+ ->addFieldToFilter("customer_id", Mage::getSingleton("customer/session")->getCustomer()->getId())
19
+ ->setOrder("created_at", "DESC")
20
+ ->getFirstItem();
21
+ }
22
+
23
+ }
app/code/community/Talkable/CheckoutOffer/Helper/Data.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable CheckoutOffer for Magento
4
+ *
5
+ * @package Talkable_CheckoutOffer
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_CheckoutOffer_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+
14
+ public function isEnabled()
15
+ {
16
+ return (bool) Mage::getStoreConfig("checkoutoffer/settings/enabled");
17
+ }
18
+
19
+ public function getSiteId()
20
+ {
21
+ return trim(Mage::getStoreConfig("checkoutoffer/settings/site_id"));
22
+ }
23
+
24
+ public function getCampaignTags()
25
+ {
26
+ return array_filter(array_map("trim", explode(",", Mage::getStoreConfig("checkoutoffer/settings/campaign_tags"))));
27
+ }
28
+
29
+ public function getOrderData($order)
30
+ {
31
+ $retval = array(
32
+ "order_number" => $order->getIncrementId(),
33
+ "order_date" => $order->getCreatedAt(),
34
+ "email" => $order->getCustomerEmail(),
35
+ "subtotal" => $order->getSubtotal(),
36
+ "coupon_code" => $order->getCouponCode(),
37
+ "customer_id" => $order->getCustomerId(),
38
+ "items" => array(),
39
+ "first_name" => $order->getCustomerFirstname(),
40
+ "last_name" => $order->getCustomerLastname(),
41
+ );
42
+
43
+ foreach ($order->getAllVisibleItems() as $product) {
44
+ $retval["items"][] = array(
45
+ "product_id" => $product->getSku(),
46
+ "price" => $product->getPrice(),
47
+ "quantity" => $product->getQtyOrdered(),
48
+ "title" => $product->getName(),
49
+ );
50
+ }
51
+
52
+ return $retval;
53
+ }
54
+
55
+ }
app/code/community/Talkable/CheckoutOffer/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Talkable CheckoutOffer for Magento
5
+ *
6
+ * @package Talkable_CheckoutOffer
7
+ * @author Talkable (http://www.talkable.com/)
8
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
9
+ * @license MIT
10
+ */
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <checkoutoffer>
22
+ <title>Talkable_CheckoutOffer Settings</title>
23
+ </checkoutoffer>
24
+ </children>
25
+ </config>
26
+ </children>
27
+ </system>
28
+ </children>
29
+ </admin>
30
+ </resources>
31
+ </acl>
32
+ </config>
app/code/community/Talkable/CheckoutOffer/etc/config.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Talkable CheckoutOffer for Magento
5
+ *
6
+ * @package Talkable_CheckoutOffer
7
+ * @author Talkable (http://www.talkable.com/)
8
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
9
+ * @license MIT
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Talkable_CheckoutOffer>
15
+ <version>0.1.0</version>
16
+ </Talkable_CheckoutOffer>
17
+ </modules>
18
+
19
+ <global>
20
+ <blocks>
21
+ <checkoutoffer>
22
+ <class>Talkable_CheckoutOffer_Block</class>
23
+ </checkoutoffer>
24
+ </blocks>
25
+
26
+ <helpers>
27
+ <checkoutoffer>
28
+ <class>Talkable_CheckoutOffer_Helper</class>
29
+ </checkoutoffer>
30
+ </helpers>
31
+ </global>
32
+
33
+ <frontend>
34
+ <layout>
35
+ <updates>
36
+ <checkoutoffer>
37
+ <file>talkable/checkoutoffer.xml</file>
38
+ </checkoutoffer>
39
+ </updates>
40
+ </layout>
41
+ </frontend>
42
+
43
+ <default>
44
+ <checkoutoffer>
45
+ <settings>
46
+ <enabled>0</enabled>
47
+ <site_id></site_id>
48
+ <campaign_tags>default</campaign_tags>
49
+ </settings>
50
+ </checkoutoffer>
51
+ </default>
52
+ </config>
app/code/community/Talkable/CheckoutOffer/etc/system.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Talkable CheckoutOffer for Magento
5
+ *
6
+ * @package Talkable_CheckoutOffer
7
+ * @author Talkable (http://www.talkable.com/)
8
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
9
+ * @license MIT
10
+ */
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <talkable translate="label" module="checkoutoffer">
15
+ <label>Talkable</label>
16
+ <sort_order>1000</sort_order>
17
+ </talkable>
18
+ </tabs>
19
+ <sections>
20
+ <checkoutoffer translate="label" module="checkoutoffer">
21
+ <label>Extension Options</label>
22
+ <tab>talkable</tab>
23
+ <sort_order>1000</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+
28
+ <groups>
29
+ <settings translate="label">
30
+ <label>Default Settings</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>0</show_in_website>
35
+ <show_in_store>0</show_in_store>
36
+
37
+ <fields>
38
+ <enabled translate="label">
39
+ <label>Enabled</label>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_yesno</source_model>
42
+ <sort_order>1</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </enabled>
47
+
48
+ <site_id translate="label">
49
+ <label>Talkable Site ID</label>
50
+ <comment></comment>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>2</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </site_id>
57
+
58
+ <campaign_tags translate="label">
59
+ <label>Campaign Tags</label>
60
+ <comment><![CDATA[CSV-list of campaign tags]]></comment>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>3</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </campaign_tags>
67
+ </fields>
68
+ </settings>
69
+ </groups>
70
+ </checkoutoffer>
71
+ </sections>
72
+ </config>
app/design/frontend/base/default/layout/talkable/checkoutoffer.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Talkable CheckoutOffer for Magento
5
+ *
6
+ * @package Talkable_CheckoutOffer
7
+ * @author Talkable (http://www.talkable.com/)
8
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
9
+ * @license MIT
10
+ */
11
+ -->
12
+ <layout version="0.1.0">
13
+ <checkout_onepage_success>
14
+ <reference name="head">
15
+ <block type="checkoutoffer/checkoutoffer" name="talkable.checkoutoffer" template="talkable/checkoutoffer/checkoutoffer.phtml" />
16
+ </reference>
17
+ </checkout_onepage_success>
18
+
19
+ <checkout_multishipping_success>
20
+ <reference name="head">
21
+ <block type="checkoutoffer/multishipping_checkoutoffer" name="checkout_checkoutoffer_success" template="talkable/checkoutoffer/checkoutoffer.phtml" />
22
+ </reference>
23
+ </checkout_multishipping_success>
24
+ </layout>
app/design/frontend/base/default/template/talkable/checkoutoffer/checkoutoffer.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Talkable CheckoutOffer for Magento
4
+ *
5
+ * @package Talkable_CheckoutOffer
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("checkoutoffer") ?>
13
+
14
+ <?php if ($_helper->isEnabled()): ?>
15
+ <!-- Begin Talkable integration code -->
16
+
17
+ <?php if (empty($_helper->getSiteId())): ?>
18
+ <!-- Talkable Site ID is blank, check your Talkable extension settings -->
19
+ <?php else: ?>
20
+ <?php if ($_order = $this->getCheckoutOrder()): ?>
21
+ <script type="text/javascript" src="//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js"></script>
22
+ <script type="text/javascript">
23
+ //<![CDATA[
24
+ var _curebitq = _curebitq || [];
25
+ _curebitq.push(["init", {
26
+ site_id: '<?php echo $_helper->getSiteId() ?>',
27
+ server: "https://www.talkable.com"
28
+ }]);
29
+
30
+ <?php $_event_data = $_helper->getOrderData($_order) ?>
31
+ <?php $_event_data["responsive"] = true ?>
32
+ <?php $_event_data["traffic_source"] = "Post-checkout" ?>
33
+ <?php $_event_data["campaign_tags"] = $_helper->getCampaignTags() ?>
34
+
35
+ _curebitq.push(["register_purchase", <?php echo Mage::helper("core")->jsonEncode($_event_data) ?>]);
36
+ //]]>
37
+ </script>
38
+ <?php else: ?>
39
+ <!-- Order could not be found -->
40
+ <?php endif ?>
41
+ <?php endif ?>
42
+
43
+ <!-- End Talkable integration code -->
44
+ <?php endif ?>
45
+
app/etc/modules/Talkable_CheckoutOffer.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Talkable CheckoutOffer for Magento
5
+ *
6
+ * @package Talkable_CheckoutOffer
7
+ * @author Talkable (http://www.talkable.com/)
8
+ * @copyright Copyright (c) 2015 Talkable (http://www.talkable.com/)
9
+ * @license MIT
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Talkable_CheckoutOffer>
15
+ <active>true</active>
16
+ <codePool>community</codePool>
17
+ </Talkable_CheckoutOffer>
18
+ </modules>
19
+ </config>
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>talkable</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Talkable (http://www.talkable.com) integration for Magento</summary>
10
+ <description>Talkable enables your Magento store to attract new customers by offering them special deals in exchange for sharing with their friends.&#xD;
11
+ &#xD;
12
+ This checkout extension provides links for them to share their purchase on Facebook, Twitter, and Email and encourages them to bring in new customers for you.&#xD;
13
+ &#xD;
14
+ Using Talkable, you help your customers drive more referral sales per dollar than traditional marketing and advertising.&#xD;
15
+ &#xD;
16
+ See more at Talkable.com</description>
17
+ <notes>First release</notes>
18
+ <authors><author><name>Talkable</name><user>talkable</user><email>sub@talkable.com</email></author></authors>
19
+ <date>2015-02-13</date>
20
+ <time>16:19:34</time>
21
+ <contents><target name="magecommunity"><dir name="Talkable"><dir name="CheckoutOffer"><dir name="Block"><file name="Checkoutoffer.php" hash="aa13875f0f19a5458acdcb9bab4b0d6d"/><dir name="Multishipping"><file name="Checkoutoffer.php" hash="26d43303b2122e30697f8d9d97d99436"/></dir></dir><dir name="Helper"><file name="Data.php" hash="730ff9c0df996dc8334858db12c06602"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6de12c9a1bf4bc22737e4742f65c7829"/><file name="config.xml" hash="e99fbf72ff144279c37b802520dfa29c"/><file name="system.xml" hash="49627bcd4c99d0366d014415a8ab8fae"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="talkable"><file name="checkoutoffer.xml" hash="acf34bd5e1ca703e0f66e26d3a706194"/></dir></dir><dir name="template"><dir name="talkable"><dir name="checkoutoffer"><file name="checkoutoffer.phtml" hash="5cc30bdeed4ed6c7126125c79306227a"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Talkable_CheckoutOffer.xml" hash="54ba77732976d0fd5bc3d744263dc671"/></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
+ </package>