Version Notes
Bug Fix for Widget - Wasn't Displaying Properly on Themes
Download this release
Release Info
Developer | Unbeatable.com |
Extension | unbeatablechat |
Version | 0.2.2 |
Comparing to | |
See all releases |
Code changes from version 0.2.1 to 0.2.2
- app/code/community/Unbeatable/Chat/Helper/Data.php +44 -24
- app/code/community/Unbeatable/Chat/controllers/Adminhtml/UnbeatableController.php +0 -14
- app/code/community/Unbeatable/Chat/controllers/CartController.php +14 -0
- app/code/community/Unbeatable/Chat/etc/config.xml +9 -0
- app/design/frontend/base/default/layout/unbeatable.xml +1 -1
- app/design/frontend/base/default/template/unbeatable/footer.phtml +4 -1
- package.xml +5 -5
app/code/community/Unbeatable/Chat/Helper/Data.php
CHANGED
@@ -1,32 +1,52 @@
|
|
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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
-
}
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
31 |
}
|
32 |
}
|
1 |
<?php
|
2 |
class Unbeatable_Chat_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
/*
|
5 |
+
* Used by CartController
|
6 |
+
*/
|
7 |
+
public function getCartItems(){
|
8 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
9 |
+
$products = array();
|
10 |
+
|
11 |
+
foreach ($checkoutSession->getQuote()->getAllItems() as $item) {
|
12 |
+
$_item = Mage::getModel('catalog/product')->load($item->getProductId());
|
13 |
+
$products[] = array(
|
14 |
+
'image' => $_item->getThumbnailUrl(),
|
15 |
+
'name' => $_item->getName(),
|
16 |
+
'quantity' => $item->getQty(),
|
17 |
+
'price' => number_format($item->getBaseCalculationPrice(), 2, '.', '')
|
18 |
+
);
|
19 |
+
}
|
20 |
+
return $products;
|
21 |
+
}
|
22 |
|
23 |
+
/*
|
24 |
+
* Used to insert chat widget via Template
|
25 |
+
*/
|
26 |
+
public function insertChatWidget(){
|
27 |
+
$apikey = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_apikey', Mage::app()->getStore());
|
28 |
|
29 |
+
echo '<script src="https://dash.unbeatable.com/public/widget.js?client='.$apikey.'" async></script>';
|
30 |
+
echo "<script>
|
31 |
+
function ajax(url, callback, data, x) {
|
32 |
+
try {
|
33 |
+
x = new(this.XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
|
34 |
+
x.open(data ? 'POST' : 'GET', url, 1);
|
35 |
+
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
36 |
+
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
37 |
+
x.onreadystatechange = function () {
|
38 |
+
x.readyState > 3 && callback && callback(x.responseText, x);
|
39 |
+
};
|
40 |
+
x.send(data)
|
41 |
+
} catch (e) {
|
42 |
+
window.console && console.log(e);
|
43 |
}
|
44 |
+
};
|
45 |
+
ajax('/unbeatable/cart/index', function(response){
|
46 |
+
if(Unbeatable){
|
47 |
+
Unbeatable.setItems(JSON.parse(response));
|
48 |
+
}
|
49 |
+
});
|
50 |
+
</script>";
|
51 |
}
|
52 |
}
|
app/code/community/Unbeatable/Chat/controllers/Adminhtml/UnbeatableController.php
DELETED
@@ -1,14 +0,0 @@
|
|
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/controllers/CartController.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Unbeatable_Chat_CartController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Index Page
|
7 |
+
*/
|
8 |
+
public function indexAction()
|
9 |
+
{
|
10 |
+
$cartItems = Mage::helper('unbeatablechat')->getCartItems();
|
11 |
+
echo json_encode($cartItems);
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
app/code/community/Unbeatable/Chat/etc/config.xml
CHANGED
@@ -49,5 +49,14 @@
|
|
49 |
</Unbeatable_Chat>
|
50 |
</updates>
|
51 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</frontend>
|
53 |
</config>
|
49 |
</Unbeatable_Chat>
|
50 |
</updates>
|
51 |
</layout>
|
52 |
+
<routers>
|
53 |
+
<unbeatable>
|
54 |
+
<use>standard</use>
|
55 |
+
<args>
|
56 |
+
<module>Unbeatable_Chat</module>
|
57 |
+
<frontName>unbeatable</frontName>
|
58 |
+
</args>
|
59 |
+
</unbeatable>
|
60 |
+
</routers>
|
61 |
</frontend>
|
62 |
</config>
|
app/design/frontend/base/default/layout/unbeatable.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<layout>
|
3 |
<default>
|
4 |
-
<reference name="
|
5 |
<block type="core/template"
|
6 |
name="unbeatable_layout_footer"
|
7 |
template="unbeatable/footer.phtml" />
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<layout>
|
3 |
<default>
|
4 |
+
<reference name="before_body_end">
|
5 |
<block type="core/template"
|
6 |
name="unbeatable_layout_footer"
|
7 |
template="unbeatable/footer.phtml" />
|
app/design/frontend/base/default/template/unbeatable/footer.phtml
CHANGED
@@ -1,3 +1,6 @@
|
|
1 |
<?php
|
2 |
-
Mage::
|
|
|
|
|
|
|
3 |
?>
|
1 |
<?php
|
2 |
+
$enabled = Mage::getStoreConfig('unbeatable/unbeatable_group2/unbeatable_chat_enabled', Mage::app()->getStore());
|
3 |
+
if($enabled){
|
4 |
+
Mage::helper('unbeatablechat')->insertChatWidget();
|
5 |
+
}
|
6 |
?>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>unbeatablechat</name>
|
4 |
-
<version>0.2.
|
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>
|
12 |
<authors><author><name>Unbeatable.com</name><user>Unbetable</user><email>support@unbeatable.com</email></author></authors>
|
13 |
-
<date>2016-02-
|
14 |
-
<time>16:
|
15 |
-
<contents><target name="magecommunity"><dir name="Unbeatable"><dir name="Chat"><dir name="Helper"><file name="Data.php" hash="
|
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.2</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>Bug Fix for Widget - Wasn't Displaying Properly on Themes</notes>
|
12 |
<authors><author><name>Unbeatable.com</name><user>Unbetable</user><email>support@unbeatable.com</email></author></authors>
|
13 |
+
<date>2016-02-04</date>
|
14 |
+
<time>16:16:54</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Unbeatable"><dir name="Chat"><dir name="Helper"><file name="Data.php" hash="d5ef36c6d48c9f07049383816bb4c9c1"/></dir><dir name="Model"><file name="Observer.php" hash="c19a8efa9855b590037bc16244b47ec9"/></dir><dir name="controllers"><file name="CartController.php" hash="b2f0199f7bdf8508ac1cb15e85209a14"/></dir><dir name="etc"><file name="adminhtml.xml" hash="fa15a41d1ffeec89707d3d4c24f72ab6"/><file name="config.xml" hash="e116d2578bb73629137f72879777869f"/><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="cad65e2da06237c6824c2f82b761d3ae"/></dir></dir><dir name="layout"><file name="unbeatable.xml" hash="4fc711f5c8c2a25192b6ed443b8a3d8a"/></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>
|