Version Notes
Initial Release
Download this release
Release Info
Developer | Unbeatable.com |
Extension | unbeatablechat |
Version | 0.2.0 |
Comparing to | |
See all releases |
Version 0.2.0
- app/code/community/Unbeatable/Chat/Helper/Data.php +4 -0
- app/code/community/Unbeatable/Chat/Model/Observer.php +53 -0
- app/code/community/Unbeatable/Chat/controllers/Adminhtml/UnbeatableController.php +14 -0
- app/code/community/Unbeatable/Chat/etc/adminhtml.xml +16 -0
- app/code/community/Unbeatable/Chat/etc/config.xml +68 -0
- app/code/community/Unbeatable/Chat/etc/system.xml +91 -0
- app/design/frontend/base/default/layout/unbeatable.xml +10 -0
- app/design/frontend/base/default/template/unbeatable/footer.phtml +32 -0
- app/etc/modules/Unbeatable_Chat.xml +14 -0
- package.xml +18 -0
app/code/community/Unbeatable/Chat/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Unbeatable_Chat_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
app/code/community/Unbeatable/Chat/Model/Observer.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Unbeatable_Chat_Model_Observer
|
5 |
+
{
|
6 |
+
|
7 |
+
public function sendOrderAck(Varien_Event_Observer $observer)
|
8 |
+
{
|
9 |
+
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
public function sendShippedMessage(Varien_Event_Observer $observer)
|
15 |
+
{
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function sendCompletedMessage(Varien_Event_Observer $observer)
|
22 |
+
{
|
23 |
+
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
public function sendOrderCancelledSMS(Varien_Event_Observer $observer)
|
28 |
+
{
|
29 |
+
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Make a curl Request
|
35 |
+
*/
|
36 |
+
private function doRequest($data)
|
37 |
+
{
|
38 |
+
|
39 |
+
$curl = curl_init();
|
40 |
+
curl_setopt_array($curl, array(
|
41 |
+
CURLOPT_RETURNTRANSFER => 1,
|
42 |
+
CURLOPT_URL => 'http://rain-cloud.co.uk/api/v1/sms/send',
|
43 |
+
CURLOPT_USERAGENT => 'Codular Sample cURL Request',
|
44 |
+
CURLOPT_POST => 1,
|
45 |
+
CURLOPT_POSTFIELDS => $data
|
46 |
+
|
47 |
+
));
|
48 |
+
|
49 |
+
$resp = curl_exec($curl);
|
50 |
+
|
51 |
+
curl_close($curl);
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Unbeatable/Chat/controllers/Adminhtml/UnbeatableController.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Unbeatable_Chat_Adminhtml_UnbeatableController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction(){
|
7 |
+
|
8 |
+
$this->loadLayout();
|
9 |
+
|
10 |
+
return $this->renderLayout();
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Unbeatable/Chat/etc/adminhtml.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<unbeatabletab module="reviewshelper" translate="title">
|
5 |
+
<title>Unbeatable</title>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
<children>
|
8 |
+
<setup module="reviewshelper" translate="title">
|
9 |
+
<title>Setup</title>
|
10 |
+
<sort_order>1</sort_order>
|
11 |
+
<action>adminhtml/system_config/edit/section/unbeatable</action>
|
12 |
+
</setup>
|
13 |
+
</children>
|
14 |
+
</unbeatabletab>
|
15 |
+
</menu>
|
16 |
+
</config>
|
app/code/community/Unbeatable/Chat/etc/config.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Unbeatable_Chat>
|
6 |
+
<version>0.1.0</version>
|
7 |
+
</Unbeatable_Chat>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
|
11 |
+
<!-- Defining models -->
|
12 |
+
<models>
|
13 |
+
|
14 |
+
<unbeatable_chat>
|
15 |
+
|
16 |
+
<class>Unbeatable_Chat_Model</class>
|
17 |
+
|
18 |
+
</unbeatable_chat>
|
19 |
+
|
20 |
+
</models>
|
21 |
+
|
22 |
+
<models>
|
23 |
+
<mymodule>
|
24 |
+
<class>Unbeatable_Chat_Model</class>
|
25 |
+
</mymodule>
|
26 |
+
</models>
|
27 |
+
<helpers>
|
28 |
+
<mymodule>
|
29 |
+
<class>Unbeatable_Chat_Helper</class>
|
30 |
+
</mymodule>
|
31 |
+
</helpers>
|
32 |
+
|
33 |
+
</global>
|
34 |
+
|
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 |
+
<unbeatable>
|
48 |
+
<title>Unbeatable - All</title>
|
49 |
+
</unbeatable>
|
50 |
+
</children>
|
51 |
+
</config>
|
52 |
+
</children>
|
53 |
+
</system>
|
54 |
+
</children>
|
55 |
+
</admin>
|
56 |
+
</resources>
|
57 |
+
</acl>
|
58 |
+
</adminhtml>
|
59 |
+
<frontend>
|
60 |
+
<layout>
|
61 |
+
<updates>
|
62 |
+
<Unbeatable_Chat module="Unbeatable_Chat" >
|
63 |
+
<file>unbeatable.xml</file>
|
64 |
+
</Unbeatable_Chat>
|
65 |
+
</updates>
|
66 |
+
</layout>
|
67 |
+
</frontend>
|
68 |
+
</config>
|
app/code/community/Unbeatable/Chat/etc/system.xml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<unbeatable translate="label" module="mymodule">
|
5 |
+
<label>Unbeatable</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</unbeatable>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<unbeatable translate="label" module="mymodule">
|
11 |
+
<label>Setup</label>
|
12 |
+
<tab>unbeatable</tab>
|
13 |
+
<sort_order>1000</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<unbeatable_group translate="label" module="mymodule">
|
19 |
+
<label>Introduction</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1000</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<comment>
|
26 |
+
<![CDATA[
|
27 |
+
<div style="width:46%;float:left;padding-right:4%;border-right:1px solid #ccc;">
|
28 |
+
<h3>Already a Unbeatable Customer?</h3>
|
29 |
+
|
30 |
+
<p>To configure this plugin you need to your Unbeatable API KEY</p>
|
31 |
+
|
32 |
+
<p>Just enter your <strong>API KEY</strong> and you are ready to go</p>
|
33 |
+
|
34 |
+
</div>
|
35 |
+
<div style="width:46%;float:right;">
|
36 |
+
<h3>Not a Unbeatable Customer?</h3>
|
37 |
+
|
38 |
+
<p>You'll need to sign up at <a href="https://www.unbeatable.com">Unbeatable.com</a> to use this plugin.</p>
|
39 |
+
</div>
|
40 |
+
]]>
|
41 |
+
</comment>
|
42 |
+
</unbeatable_group>
|
43 |
+
<unbeatable_group2 translate="label" module="mymodule">
|
44 |
+
<label>Account Details</label>
|
45 |
+
<frontend_type>text</frontend_type>
|
46 |
+
<sort_order>2000</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
<fields>
|
51 |
+
<unbeatable_apikey translate="label">
|
52 |
+
<label>Api key: </label>
|
53 |
+
<comment>This can be found on your Unbeatable dashboard settings</comment>
|
54 |
+
<frontend_type>text</frontend_type>
|
55 |
+
<sort_order>10</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</unbeatable_apikey>
|
60 |
+
</fields>
|
61 |
+
<fields>
|
62 |
+
<unbeatable_chat_enabled>
|
63 |
+
<label>Enable Chat?</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>1</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</unbeatable_chat_enabled>
|
71 |
+
</fields>
|
72 |
+
</unbeatable_group2>
|
73 |
+
<unbeatable_group4 translate="label" module="mymodule">
|
74 |
+
<label>Support</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>6000</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>
|
81 |
+
<![CDATA[
|
82 |
+
<h3>Need some Help?</h3>
|
83 |
+
|
84 |
+
<p>If you are having any problems with this plugin please contact us at <a href="mailto:support@unbeatable.com">support@unbeatable.com</a></p>
|
85 |
+
]]>
|
86 |
+
</comment>
|
87 |
+
</unbeatable_group4>
|
88 |
+
</groups>
|
89 |
+
</unbeatable>
|
90 |
+
</sections>
|
91 |
+
</config>
|
app/design/frontend/base/default/layout/unbeatable.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="footer">
|
5 |
+
<block type="core/template"
|
6 |
+
name="unbeatable_layout_footer"
|
7 |
+
template="unbeatable/footer.phtml" />
|
8 |
+
</reference>
|
9 |
+
</default>
|
10 |
+
</layout>
|
app/design/frontend/base/default/template/unbeatable/footer.phtml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
try {
|
3 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
4 |
+
$products = array();
|
5 |
+
|
6 |
+
foreach ($checkoutSession->getQuote()->getAllItems() as $item) {
|
7 |
+
$_item = Mage::getModel('catalog/product')->load($item->getProductId());
|
8 |
+
$products[] = array(
|
9 |
+
'image' => $_item->getThumbnailUrl(),
|
10 |
+
'name' => $_item->getName(),
|
11 |
+
'quantity' => $item->getQty(),
|
12 |
+
'price' => number_format($item->getBaseCalculationPrice(), 2, '.', '')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
|
16 |
+
$apikey = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_apikey', Mage::app()->getStore());
|
17 |
+
$enabled = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_chat_enabled', Mage::app()->getStore());
|
18 |
+
|
19 |
+
if ($enabled)
|
20 |
+
{
|
21 |
+
echo '<script src="https://dash.unbeatable.com/public/widget.js?client='.$apikey.'" async></script>';
|
22 |
+
echo '<script>var unb_tmr = setInterval(function(){console.log("y"); if(Unbeatable){ Unbeatable.setItems('.json_encode($products).'); clearInterval(unb_tmr); }},200)</script>';
|
23 |
+
}
|
24 |
+
else
|
25 |
+
{
|
26 |
+
echo '<!-- UnbDisabled -->';
|
27 |
+
}
|
28 |
+
}
|
29 |
+
catch(Exception $e){
|
30 |
+
echo '<!-- UnbError -->';
|
31 |
+
}
|
32 |
+
?>
|
app/etc/modules/Unbeatable_Chat.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Unbeatable_Chat>
|
5 |
+
|
6 |
+
<!-- Whether our module is active: true or false -->
|
7 |
+
<active>true</active>
|
8 |
+
|
9 |
+
<!-- Which code pool to use: core, community or local -->
|
10 |
+
<codePool>community</codePool>
|
11 |
+
|
12 |
+
</Unbeatable_Chat>
|
13 |
+
</modules>
|
14 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>unbeatablechat</name>
|
4 |
+
<version>0.2.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Unbeatable Chat Integration</summary>
|
10 |
+
<description>Unbeatable Chat Integration</description>
|
11 |
+
<notes>Initial Release</notes>
|
12 |
+
<authors><author><name>Unbeatable.com</name><user>Unbetable</user><email>support@unbeatable.com</email></author></authors>
|
13 |
+
<date>2016-02-02</date>
|
14 |
+
<time>15:07:07</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Unbeatable"><dir name="Chat"><dir name="Helper"><file name="Data.php" hash="d045a1e0a7f76e5c7e9a14aabdc1af09"/></dir><dir name="Model"><file name="Observer.php" hash="bb73c1f8ef8b3f4b6fd3240c64334ef2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="UnbeatableController.php" hash="588444bc54c48c83b119f4edb3ceef2b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="40bb51aa9fa9d12274f076c558a02365"/><file name="config.xml" hash="f207f91cc18dbef8254d2ae6b762ecaf"/><file name="system.xml" hash="49cb251a3fb9cb854a8adeb777bb8b27"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Unbeatable_Chat.xml" hash="820d09c2f6a920a287894ace7032acc9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="unbeatable"><file name="footer.phtml" hash="3aa7a4e1311dd486aef6a9223fa150da"/></dir></dir><dir name="layout"><file name="unbeatable.xml" hash="c746ee1959fba615556db84abdedad54"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|