Vendexo_TrackerBeacon - Version 1.0.0

Version Notes

First release.

Download this release

Release Info

Developer S. Brooks
Extension Vendexo_TrackerBeacon
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Vendexo/TrackerBeacon/Block/beacon.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Vendexo_TrackerBeacon_Block_Beacon extends Mage_Core_Block_Template {
3
+ // This is a backing object referenced in the tracking beacon
4
+ // template (.phtml) file to obtain dynamic content such
5
+ // as the shop code, vxt code, order id and order amount.
6
+
7
+ private function getLastOrder() {
8
+ $order = null;
9
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
10
+ if ($orderId) {
11
+ $order = Mage::getModel('sales/order')->load($orderId);
12
+ }
13
+ return $order;
14
+ }
15
+
16
+ public function getShopCode() {
17
+ return Mage::getStoreConfig('sales_affiliate_networks/vendexo/affiliate_program_code');
18
+ }
19
+
20
+ public function getVxtCode() {
21
+ return Mage::getStoreConfig('sales_affiliate_networks/vendexo/vxt_code');
22
+ }
23
+
24
+ public function getOrderId() {
25
+ $order = $this->getLastOrder();
26
+ if ($order) {
27
+ return $order->getIncrementId();
28
+ } else {
29
+ return null;
30
+ }
31
+ }
32
+
33
+ public function getOrderAmount() {
34
+ $order = $this->getLastOrder();
35
+ if ($order) {
36
+ return $order->getBaseSubtotal();
37
+ } else {
38
+ return null;
39
+ }
40
+ }
41
+
42
+ public function getCurrencyCode() {
43
+ $order = $this->getLastOrder();
44
+ if ($order) {
45
+ return $order->getBaseCurrencyCode();
46
+ } else {
47
+ return null;
48
+ }
49
+ }
50
+
51
+
52
+ }
53
+ ?>
app/code/community/Vendexo/TrackerBeacon/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <sales_affiliate_networks>
15
+ <title>Affiliate Network Tracker Configuration</title>
16
+ </sales_affiliate_networks>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
26
+
app/code/community/Vendexo/TrackerBeacon/etc/config.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Vendexo_TrackerBeacon>
5
+ <version>1.0.0</version>
6
+ </Vendexo_TrackerBeacon>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <vendexo_trackerbeacon>
11
+ <class>Vendexo_TrackerBeacon_Block</class>
12
+ </vendexo_trackerbeacon>
13
+ </blocks>
14
+ </global>
15
+ <frontend>
16
+ <layout>
17
+ <updates>
18
+ <vendexo_trackerbeacon module="Vendexo_TrackerBeacon">
19
+ <file>vendexo_trackerbeacon.xml</file>
20
+ </vendexo_trackerbeacon>
21
+ </updates>
22
+ </layout>
23
+ </frontend>
24
+ </config>
app/code/community/Vendexo/TrackerBeacon/etc/system.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <sales_affiliate_networks translate="label" module="sales">
5
+ <label>Affiliate Networks</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>10001</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <groups>
13
+ <vendexo translate="label">
14
+ <label>Vendexo Affiliate Network</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>0</show_in_store>
20
+ <fields>
21
+ <affiliate_program_code translate="label">
22
+ <label>Affiliate program id code</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>50</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>0</show_in_store>
28
+ </affiliate_program_code>
29
+ <vxt_code translate="label">
30
+ <label>Vxt Code</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>60</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>0</show_in_store>
36
+ </vxt_code>
37
+ </fields>
38
+ </vendexo>
39
+ </groups>
40
+ </sales_affiliate_networks>
41
+ </sections>
42
+ </config>
43
+
app/design/frontend/base/default/layout/vendexo_trackerbeacon.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <checkout_onepage_success>
4
+ <reference name="before_body_end">
5
+ <block type="vendexo_trackerbeacon/beacon"
6
+ name="vendexo_trackerbeacon_beacon"
7
+ template="vendexo_trackerbeacon/beacon.phtml" />
8
+ </reference>
9
+ </checkout_onepage_success>
10
+ </layout>
app/design/frontend/base/default/template/vendexo_trackerbeacon/beacon.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- begin Vendexo Affiliate Network tracking -->
2
+ <script type="text/javascript">
3
+ /* <![CDATA[ */
4
+ (function() {
5
+ var lOrderRef = encodeURIComponent("<?php echo($this->getOrderId()); ?>");
6
+ var lAmount = "<?php echo($this->getOrderAmount()); ?>";
7
+ // If this contains a currency symbol or thousands separator add code to remove them.
8
+ lAmount = lAmount.replace(/,/g, '');
9
+ var lCurrency = "<?php echo($this->getCurrencyCode()); ?>"; // Or specify an empty string to use shop's native currency.
10
+ var lVersion = "v1";
11
+ var lShopCode = "<?php echo($this->getShopCode()); ?>";
12
+ var lVxTCode = "<?php echo($this->getVxtCode()); ?>";
13
+ var lProtocol;
14
+ if (window.location.protocol.toLowerCase() == 'https:') {
15
+ lProtocol = 'https:';
16
+ } else {
17
+ lProtocol = 'http:';
18
+ }
19
+ var lUrl = lProtocol + "//track.vendexo.com/aff/track/sale/" + lVersion + "/js/" + lShopCode + "/" + lVxTCode + "/?orderRef=" + lOrderRef + "&amp;amount=" + lAmount;
20
+ if (lCurrency) {
21
+ lUrl += '&amp;currency=' + lCurrency;
22
+ }
23
+ document.write('<scr' + 'ipt type="text/javascript" src="' + lUrl + '"></scr' + 'ipt>');
24
+ })();
25
+ /* ]]> */
26
+ </script>
27
+ <noscript><img src="http://track.vendexo.com/aff/track/sale/v1/img/<?php echo($this->getShopCode()); ?>/<?php echo($this->getVxtCode()); ?>/?orderRef=<?php echo($this->getOrderId()); ?>&amp;amount=<?php echo($this->getOrderAmount()); ?>&amp;currency=<?php echo($this->getCurrencyCode()); ?>" alt="." /></noscript>
28
+ <!-- end Vendexo Affiliate Network tracking -->
29
+
app/etc/modules/Vendexo_TrackerBeacon.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Vendexo_TrackerBeacon>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Vendexo_TrackerBeacon>
7
+ </modules>
8
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Vendexo_TrackerBeacon</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://gnu.org/licenses/gpl.html">GNU GPL version 3</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This enables the merchant to have an affiliate program with vendexo.com to help get extra visitors to their online shop.</summary>
10
+ <description>This places a beacon-type tracker on the onepage_success page. If the buyer was referred via the Vendexo.com Affiliate Network, this enables the vendexo.com software to pay a sales commission to the affiliate who referred the customer to the merchant's shop.</description>
11
+ <notes>First release.</notes>
12
+ <authors><author><name>Stephen Brooks</name><user>smbrooks</user><email>s.brooks@vendexo.com</email></author></authors>
13
+ <date>2013-08-02</date>
14
+ <time>19:42:35</time>
15
+ <contents><target name="magecommunity"><dir name="Vendexo"><dir name="TrackerBeacon"><dir name="Block"><file name="beacon.php" hash="dd5676ffb84dbc41fcbb7037df8b8111"/></dir><dir name="etc"><file name="adminhtml.xml" hash="fd4480d9a9919fef7ab8614929a5f78f"/><file name="config.xml" hash="c8e4b3b572a1d05e792fb83940198a8a"/><file name="system.xml" hash="f29b13d986934819890b83e2fe0275df"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="vendexo_trackerbeacon.xml" hash="151393bf702771fa556984c93c80fa47"/></dir><dir name="template"><dir name="vendexo_trackerbeacon"><file name="beacon.phtml" hash="b415a9135a9a86ffcdfd7f6af5ea9167"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vendexo_TrackerBeacon.xml" hash="dc9917c450f7240b2bb41d0f781c6b82"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>10.0.0</max></php></required></dependencies>
18
+ </package>