Version Notes
First version for Shopboard private beta.
Request your invite at http://signup.shopboard.eu
Backoffice: https://app.shopboard.eu
More info at http://www.shopboard.eu
Download this release
Release Info
Developer | Sebastien Saunier |
Extension | Shopboard_Tracker |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/Shopboard/Tracker/Block/Sbt.php +29 -0
- app/code/community/Shopboard/Tracker/Helper/Data.php +53 -0
- app/code/community/Shopboard/Tracker/Model/Observer.php +17 -0
- app/code/community/Shopboard/Tracker/etc/adminhtml.xml +22 -0
- app/code/community/Shopboard/Tracker/etc/config.xml +76 -0
- app/code/community/Shopboard/Tracker/etc/system.xml +44 -0
- app/design/frontend/default/default/layout/shopboardtracker.xml +8 -0
- app/design/frontend/default/default/template/shopboardtracker/sbt.phtml +20 -0
- app/etc/modules/Shopboard_Tracker.xml +22 -0
- package.xml +30 -0
app/code/community/Shopboard/Tracker/Block/Sbt.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shopboard Tracker Page Block
|
5 |
+
*
|
6 |
+
* @category Shopboard
|
7 |
+
* @package Shopboard_Tracker
|
8 |
+
*/
|
9 |
+
class Shopboard_Tracker_Block_Sbt extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
protected function _getCartTrackingCode()
|
12 |
+
{
|
13 |
+
return Mage::helper('tracker')->getCartTrackingCode();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Render Shopboard Tracker script
|
18 |
+
*
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
protected function _toHtml()
|
22 |
+
{
|
23 |
+
if (!Mage::helper('tracker')->isShopboardTrackerAvailable()) {
|
24 |
+
return '';
|
25 |
+
}
|
26 |
+
|
27 |
+
return parent::_toHtml();
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Shopboard/Tracker/Helper/Data.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shopboard Tracker data helper
|
4 |
+
*
|
5 |
+
* @category Shopboard
|
6 |
+
* @package Shopboard_Tracker
|
7 |
+
*/
|
8 |
+
class Shopboard_Tracker_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Config paths for using throughout the code
|
12 |
+
*/
|
13 |
+
const XML_PATH_ACTIVE = 'tracker/config/active';
|
14 |
+
const XML_PATH_TRACKING_CODE = 'tracker/config/trackingCode';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Whether Shopboard Tracker is ready to use
|
18 |
+
*
|
19 |
+
* @param mixed $store
|
20 |
+
* @return bool
|
21 |
+
*/
|
22 |
+
public function isShopboardTrackerAvailable($store = null)
|
23 |
+
{
|
24 |
+
$trackingCode = Mage::getStoreConfig(self::XML_PATH_TRACKING_CODE, $store);
|
25 |
+
return $trackingCode && Mage::getStoreConfigFlag(self::XML_PATH_ACTIVE, $store);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getCartTrackingCode() {
|
29 |
+
$code = sprintf("_sbt.push(['setCartTotalValue', %s]);\n", $this->_getCartGrandTotal());
|
30 |
+
$code .= sprintf("_sbt.push(['setCartContent', %s]);", json_encode($this->_getCartItemsArray()));
|
31 |
+
return $code;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function _getCartItemsArray()
|
35 |
+
{
|
36 |
+
$cartItems = $this->_getQuote()->getAllVisibleItems();
|
37 |
+
$shopboardCart = array();
|
38 |
+
foreach ($cartItems as $item) {
|
39 |
+
$shopboardCart[] = (array($item->getName(), $item->getQty()));
|
40 |
+
}
|
41 |
+
return $shopboardCart;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function _getCartGrandTotal()
|
45 |
+
{
|
46 |
+
$quote = $this->_getQuote();
|
47 |
+
return floatval($quote->getGrandTotal());
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function _getQuote() {
|
51 |
+
return Mage::helper('checkout/cart')->getCart()->getQuote();
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Shopboard/Tracker/Model/Observer.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shopboard Tracker module observer
|
4 |
+
*
|
5 |
+
* @category Shopboard
|
6 |
+
* @package Shopboard_Tracker
|
7 |
+
*/
|
8 |
+
class Shopboard_Tracker_Model_Observer
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* TODO: figure out how to inject the javascript with an AJAX update of the cart.
|
12 |
+
*/
|
13 |
+
public function handleUpdateCart(Varien_Event_Observer $observer)
|
14 |
+
{
|
15 |
+
$code = sprintf('<script type="text/javascript">%s</script>', Mage::helper('tracker')->getCartTrackingCode());
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Shopboard/Tracker/etc/adminhtml.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<tracker translate="title" module="tracker">
|
12 |
+
<title>Shopboard Tracker</title>
|
13 |
+
</tracker>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
</children>
|
19 |
+
</admin>
|
20 |
+
</resources>
|
21 |
+
</acl>
|
22 |
+
</config>
|
app/code/community/Shopboard/Tracker/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Shopboard_Tracker>
|
5 |
+
<version>0.0.1</version>
|
6 |
+
</Shopboard_Tracker>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<tracker>
|
11 |
+
<class>Shopboard_Tracker_Model</class>
|
12 |
+
</tracker>
|
13 |
+
</models>
|
14 |
+
<blocks>
|
15 |
+
<tracker>
|
16 |
+
<class>Shopboard_Tracker_Block</class>
|
17 |
+
</tracker>
|
18 |
+
</blocks>
|
19 |
+
<helpers>
|
20 |
+
<tracker>
|
21 |
+
<class>Shopboard_Tracker_Helper</class>
|
22 |
+
</tracker>
|
23 |
+
</helpers>
|
24 |
+
<!--
|
25 |
+
<events>
|
26 |
+
<checkout_cart_add_product_complete>
|
27 |
+
<observers>
|
28 |
+
<tracker>
|
29 |
+
<type>singleton</type>
|
30 |
+
<class>shopboard_tracker_model_observer</class>
|
31 |
+
<method>handleUpdateCart</method>
|
32 |
+
</tracker>
|
33 |
+
</observers>
|
34 |
+
</checkout_cart_add_product_complete>
|
35 |
+
<checkout_cart_update_item_complete>
|
36 |
+
<observers>
|
37 |
+
<tracker>
|
38 |
+
<type>singleton</type>
|
39 |
+
<class>shopboard_tracker_model_observer</class>
|
40 |
+
<method>handleUpdateCart</method>
|
41 |
+
</tracker>
|
42 |
+
</observers>
|
43 |
+
</checkout_cart_update_item_complete>
|
44 |
+
<checkout_cart_update_items_after>
|
45 |
+
<observers>
|
46 |
+
<tracker>
|
47 |
+
<type>singleton</type>
|
48 |
+
<class>shopboard_tracker_model_observer</class>
|
49 |
+
<method>handleUpdateCart</method>
|
50 |
+
</tracker>
|
51 |
+
</observers>
|
52 |
+
</checkout_cart_update_items_after>
|
53 |
+
</events>
|
54 |
+
-->
|
55 |
+
</global>
|
56 |
+
<frontend>
|
57 |
+
<layout>
|
58 |
+
<updates>
|
59 |
+
<tracker>
|
60 |
+
<file>shopboardtracker.xml</file>
|
61 |
+
</tracker>
|
62 |
+
</updates>
|
63 |
+
</layout>
|
64 |
+
</frontend>
|
65 |
+
<adminhtml>
|
66 |
+
<translate>
|
67 |
+
<modules>
|
68 |
+
<Shopboard_Tracker>
|
69 |
+
<files>
|
70 |
+
<default>Shopboard_Tracker.csv</default>
|
71 |
+
</files>
|
72 |
+
</Shopboard_Tracker>
|
73 |
+
</modules>
|
74 |
+
</translate>
|
75 |
+
</adminhtml>
|
76 |
+
</config>
|
app/code/community/Shopboard/Tracker/etc/system.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<tracker translate="label" module="tracker">
|
5 |
+
<label>Shopboard</label>
|
6 |
+
<tab>general</tab>
|
7 |
+
<sort_order>900</sort_order>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<config translate="label">
|
14 |
+
<label>Shopboard Tracker Configuration</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<active translate="label">
|
22 |
+
<label>Enable</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>10</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</active>
|
30 |
+
<trackingCode translate="label">
|
31 |
+
<label>Shopboard Tracking Code</label>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>20</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</trackingCode>
|
38 |
+
</fields>
|
39 |
+
</config>
|
40 |
+
</groups>
|
41 |
+
|
42 |
+
</tracker>
|
43 |
+
</sections>
|
44 |
+
</config>
|
app/design/frontend/default/default/layout/shopboardtracker.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="before_body_end">
|
5 |
+
<block type="tracker/sbt" name="shopboard_tracker" as="shopboard_tracker" template="shopboardtracker/sbt.phtml" />
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
</layout>
|
app/design/frontend/default/default/template/shopboardtracker/sbt.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $trackingCode = Mage::getStoreConfig(Shopboard_Tracker_Helper_Data::XML_PATH_TRACKING_CODE) ?>
|
2 |
+
<!-- BEGIN SHOPBOARD TRACKER CODE -->
|
3 |
+
<script type="text/javascript">
|
4 |
+
//<![CDATA[
|
5 |
+
var _sbt=window._sbt || [];
|
6 |
+
_sbt.push(['setTrackingCode','<?php echo $trackingCode; ?>']);
|
7 |
+
<?php echo $this->_getCartTrackingCode(); ?>
|
8 |
+
|
9 |
+
(function(w, d, s){
|
10 |
+
function sb() {
|
11 |
+
var e = d.createElement(s); e.type = "text/javascript"; e.async = true;
|
12 |
+
e.src = ('https:' === d.location.protocol ? "https://" : 'http://') + 'd2yxzs5acxflvu.cloudfront.net/tracker.min.js';
|
13 |
+
s = d.getElementsByTagName(s)[0]; s.parentNode.insertBefore(e, s);
|
14 |
+
}
|
15 |
+
w.addEventListener ? w.addEventListener("load", sb, false) : w.attachEvent("onload", sb);
|
16 |
+
})(window, document, "script");
|
17 |
+
|
18 |
+
//]]>
|
19 |
+
</script>
|
20 |
+
<!-- END SHOPBOARD TRACKER CODE -->
|
app/etc/modules/Shopboard_Tracker.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Shopboard Tracker
|
5 |
+
*
|
6 |
+
* @category Shopboard
|
7 |
+
* @package Shopboard_Tracker
|
8 |
+
* @copyright Copyright (c) 2012 Shopboard. http://www.shopboard.eu
|
9 |
+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<Shopboard_Tracker>
|
15 |
+
<active>true</active>
|
16 |
+
<codePool>community</codePool>
|
17 |
+
<depends>
|
18 |
+
<Mage_Core/>
|
19 |
+
</depends>
|
20 |
+
</Shopboard_Tracker>
|
21 |
+
</modules>
|
22 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Shopboard_Tracker</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/mit-license.php">MITL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Shopboard is a realtime analytics service to quickly see who's online, and engage with visitors by live chat. </summary>
|
10 |
+
<description>This module introduces a new setting in the configuration page under General | Shopboard. Just copy-pase the tracking code of your shop, and that's it!
|
11 |
+

|
12 |
+
Quickly see who's there, who's wandering, or who's hesitating to convert their carts!
|
13 |
+

|
14 |
+
Shopboard integrates with Olark and SnapEngage for live chat.
|
15 |
+

|
16 |
+
Private beta: http://signup.shopboard.eu</description>
|
17 |
+
<notes>First version for Shopboard private beta.
|
18 |
+

|
19 |
+
Request your invite at http://signup.shopboard.eu
|
20 |
+

|
21 |
+
Backoffice: https://app.shopboard.eu
|
22 |
+

|
23 |
+
More info at http://www.shopboard.eu</notes>
|
24 |
+
<authors><author><name>Sebastien Saunier</name><user>ssaunier</user><email>seb@shopboard.eu</email></author></authors>
|
25 |
+
<date>2012-05-17</date>
|
26 |
+
<time>08:01:16</time>
|
27 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Shopboard_Tracker.xml" hash="8643e2cfca18610f28b1c1a04ae37140"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="shopboardtracker.xml" hash="b6fa048c6c50c2387f767d3da7febdfc"/></dir><dir name="template"><dir name="shopboardtracker"><file name="sbt.phtml" hash="33dd864074e646f2521a77caac414350"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Shopboard"><dir name="Tracker"><dir name="Block"><file name="Sbt.php" hash="98848222581cdd61657b175a713b8ecf"/></dir><dir name="Helper"><file name="Data.php" hash="cf809087583c584e0f6dc93250c9d392"/></dir><dir name="Model"><file name="Observer.php" hash="b727b185f973020932d7015adefee7a0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="460de3855580b10a960e3a0b57d710da"/><file name="config.xml" hash="78cca370e5b9a0919e4de7f7e29fbefe"/><file name="system.xml" hash="be00790498cbb34c405e847d581c36ba"/></dir></dir></dir></target></contents>
|
28 |
+
<compatible/>
|
29 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
+
</package>
|