unbeatablechat - Version 0.2.1

Version Notes

Initial Release

Download this release

Release Info

Developer Unbeatable.com
Extension unbeatablechat
Version 0.2.1
Comparing to
See all releases


Code changes from version 0.2.0 to 0.2.1

app/code/community/Unbeatable/Chat/Helper/Data.php CHANGED
@@ -1,4 +1,32 @@
1
  <?php
2
  class Unbeatable_Chat_Helper_Data extends Mage_Core_Helper_Abstract {
 
 
 
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
1
  <?php
2
  class Unbeatable_Chat_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ public function insertChatWidget(){
4
+ try {
5
+ $checkoutSession = Mage::getSingleton('checkout/session');
6
+ $products = array();
7
 
8
+ foreach ($checkoutSession->getQuote()->getAllItems() as $item) {
9
+ $_item = Mage::getModel('catalog/product')->load($item->getProductId());
10
+ $products[] = array(
11
+ 'image' => $_item->getThumbnailUrl(),
12
+ 'name' => $_item->getName(),
13
+ 'quantity' => $item->getQty(),
14
+ 'price' => number_format($item->getBaseCalculationPrice(), 2, '.', '')
15
+ );
16
+ }
17
+
18
+ $apikey = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_apikey', Mage::app()->getStore());
19
+ $enabled = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_chat_enabled', Mage::app()->getStore());
20
+
21
+ if ($enabled){
22
+ echo '<script src="https://dash.unbeatable.com/public/widget.js?client='.$apikey.'" async></script>';
23
+ echo '<script>var unb_tmr = setInterval(function(){ if(Unbeatable){ Unbeatable.setItems('.json_encode($products).'); clearInterval(unb_tmr); }},200)</script>';
24
+ } else {
25
+ echo '<!-- UnbDisabled -->';
26
+ }
27
+ }
28
+ catch(Exception $e){
29
+ echo '<!-- UnbError -->';
30
+ }
31
+ }
32
  }
app/code/community/Unbeatable/Chat/Model/Observer.php CHANGED
@@ -1,53 +1,4 @@
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
- }
1
  <?php
 
 
2
  class Unbeatable_Chat_Model_Observer
3
  {
4
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Unbeatable/Chat/etc/adminhtml.xml CHANGED
@@ -1,11 +1,11 @@
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>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <menu>
4
+ <unbeatabletab module="unbeatablechat" translate="title">
5
  <title>Unbeatable</title>
6
  <sort_order>100</sort_order>
7
  <children>
8
+ <setup module="unbeatablechat" translate="title">
9
  <title>Setup</title>
10
  <sort_order>1</sort_order>
11
  <action>adminhtml/system_config/edit/section/unbeatable</action>
app/code/community/Unbeatable/Chat/etc/config.xml CHANGED
@@ -1,5 +1,4 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
-
3
  <config>
4
  <modules>
5
  <Unbeatable_Chat>
@@ -7,31 +6,17 @@
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>
@@ -59,10 +44,10 @@
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>
1
  <?xml version="1.0" encoding="UTF-8"?>
 
2
  <config>
3
  <modules>
4
  <Unbeatable_Chat>
6
  </Unbeatable_Chat>
7
  </modules>
8
  <global>
 
 
9
  <models>
10
+ <unbeatablechat>
 
 
11
  <class>Unbeatable_Chat_Model</class>
12
+ </unbeatablechat>
 
 
 
 
 
 
 
 
13
  </models>
14
  <helpers>
15
+ <unbeatablechat>
16
  <class>Unbeatable_Chat_Helper</class>
17
+ </unbeatablechat>
18
  </helpers>
 
19
  </global>
 
20
  <adminhtml>
21
  <acl>
22
  <resources>
44
  <frontend>
45
  <layout>
46
  <updates>
47
+ <Unbeatable_Chat module="Unbeatable_Chat">
48
  <file>unbeatable.xml</file>
49
  </Unbeatable_Chat>
50
  </updates>
51
  </layout>
52
  </frontend>
53
+ </config>
app/code/community/Unbeatable/Chat/etc/system.xml CHANGED
@@ -1,13 +1,13 @@
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>
@@ -15,7 +15,7 @@
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>
@@ -40,7 +40,7 @@
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>
@@ -70,7 +70,7 @@
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>
@@ -88,4 +88,4 @@
88
  </groups>
89
  </unbeatable>
90
  </sections>
91
- </config>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <tabs>
4
+ <unbeatable translate="label" module="unbeatablechat">
5
  <label>Unbeatable</label>
6
  <sort_order>100</sort_order>
7
  </unbeatable>
8
  </tabs>
9
  <sections>
10
+ <unbeatable translate="label" module="unbeatablechat">
11
  <label>Setup</label>
12
  <tab>unbeatable</tab>
13
  <sort_order>1000</sort_order>
15
  <show_in_website>1</show_in_website>
16
  <show_in_store>1</show_in_store>
17
  <groups>
18
+ <unbeatable_group translate="label" module="unbeatablechat">
19
  <label>Introduction</label>
20
  <frontend_type>text</frontend_type>
21
  <sort_order>1000</sort_order>
40
  ]]>
41
  </comment>
42
  </unbeatable_group>
43
+ <unbeatable_group2 translate="label" module="unbeatablechat">
44
  <label>Account Details</label>
45
  <frontend_type>text</frontend_type>
46
  <sort_order>2000</sort_order>
70
  </unbeatable_chat_enabled>
71
  </fields>
72
  </unbeatable_group2>
73
+ <unbeatable_group4 translate="label" module="unbeatablechat">
74
  <label>Support</label>
75
  <frontend_type>text</frontend_type>
76
  <sort_order>6000</sort_order>
88
  </groups>
89
  </unbeatable>
90
  </sections>
91
+ </config>
app/design/frontend/base/default/template/unbeatable/footer.phtml CHANGED
@@ -1,32 +1,3 @@
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
  ?>
1
  <?php
2
+ Mage::helper('unbeatablechat')->insertChatWidget();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
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>
@@ -11,8 +11,8 @@
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>unbeatablechat</name>
4
+ <version>0.2.1</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
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>16:57:09</time>
15
+ <contents><target name="magecommunity"><dir name="Unbeatable"><dir name="Chat"><dir name="Helper"><file name="Data.php" hash="9056ef430c5fd34d6d5138a84bf08e25"/></dir><dir name="Model"><file name="Observer.php" hash="c19a8efa9855b590037bc16244b47ec9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="UnbeatableController.php" hash="588444bc54c48c83b119f4edb3ceef2b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="fa15a41d1ffeec89707d3d4c24f72ab6"/><file name="config.xml" hash="557901b9b3a9c4171d47f0a784782ec6"/><file name="system.xml" hash="1f0893eddea95ea760e707934595d6c7"/></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="664adb023e9f2696ba91cc20c4c81d3f"/></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>