Eepohs_Snoobi - Version 1.0.2

Version Notes

Changes 1.0.1 -> 1.0.2
* (CHANGE) Improved string handling for javascript (line breaks will now be removed)
* (CHANGE) Error handling if order or address not found
* (CHANGE) Snoobi code for orders now at the bottom of the page - should make it easier to use with old templates (after_body_start -> before_body_end)

Download this release

Release Info

Developer Magento Core Team
Extension Eepohs_Snoobi
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

Eepohs_Snoobi/English Magento Snoobi E-commerce Analytics.pdf DELETED
Binary file
Eepohs_Snoobi/Svenska Magento Snoobi E-commerce Analytics.pdf DELETED
Binary file
app/code/community/Eepohs/Snoobi/Block/Order.php CHANGED
@@ -11,9 +11,19 @@ class Eepohs_Snoobi_Block_Order extends Mage_Core_Block_Text
11
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
12
if ($orderId) {
13
$order = Mage::getModel('sales/order')->load($orderId);
14
- $address = $order->getShippingAddress();
15
} else {
16
- Mage::log('No orderid!');
17
return parent::_toHtml();
18
}
19
$customer = Mage::getSingleton('customer/session')->getCustomer();
@@ -33,23 +43,30 @@ class Eepohs_Snoobi_Block_Order extends Mage_Core_Block_Text
33
var snoobiTrans = new SnoobiTrans();
34
var snoobiOrder = snoobiTrans.order("' . $order->getIncrementId() . '");
35
snoobiOrder.total = "' . $order->getBaseGrandTotal() . '";
36
- snoobiOrder.currency ="' . $order->getOrderCurrencyCode() . '";
37
snoobiOrder.discount = "' . $order->getDiscountAmount() . '";
38
snoobiOrder.discountPct = "' . $discountPct . '";
39
snoobiOrder.tax = "' . $order->getBaseTaxAmount() . '";
40
- snoobiOrder.country = "' . $this->jsQuoteEscape($address->getCountry(), '"') . '";
41
- snoobiOrder.city = "' . $this->jsQuoteEscape($address->getCity(), '"') . '";
42
- snoobiOrder.address = "' . $this->jsQuoteEscape($address->getStreetFull(), '"') . '";
43
- snoobiOrder.area = "' . $this->jsQuoteEscape($address->getRegion(), '"') . '";
44
- snoobiOrder.zip = "' . $address->getPostcode() . '";
45
- snoobiOrder.customername = "' . $this->jsQuoteEscape($customerName, '"') . '";
46
- snoobiOrder.customeremail ="' . $this->jsQuoteEscape($customerEmail, '"') . '";
47
snoobiOrder.customerid = "' . $customerId . '";
48
snoobiOrder.shippingcost = "' . $order->getBaseShippingAmount() . '";
49
- snoobiOrder.payment_method = "' . $order->getPayment()->getMethod() . '";
50
- snoobiOrder.shipping_method = "' . $order->getShippingMethod() . '";
51
- snoobiOrder.coupons = "' . $order->getCouponCode() . '";
52
');
53
54
foreach ($order->getAllItems() as $item) {
55
if ($item->getParentItemId()) {
@@ -70,19 +87,19 @@ class Eepohs_Snoobi_Block_Order extends Mage_Core_Block_Text
70
}
71
$this->addText('
72
var snoobiItem = snoobiOrder.item("' . $this->jsQuoteEscape($item->getSku(), '"') . '");
73
- snoobiItem.name = "' . $this->jsQuoteEscape($item->getName(), '"') . '";
74
snoobiItem.price = "' . $item->getBasePrice() . '";
75
- snoobiItem.currency = "' . $order->getOrderCurrencyCode() . '";
76
snoobiItem.amount = "' . $item->getQtyOrdered() . '";
77
snoobiItem.discount = "' . $item->getDiscountAmount() . '";
78
snoobiItem.discountPct = "' . $item->getDiscountPercent() . '";
79
- snoobiItem.categoryName = "' . $categoryName . '";
80
snoobiItem.categoryId = "' . $categoryId . '";
81
');
82
83
if (count($categoryAllNames) > 1) {
84
$this->addText('
85
- snoobiItem.categoryAllNames = "' . implode(":",$categoryAllNames) . '";
86
snoobiItem.categoryAllIds = "' . implode(":",$categoryAllIds) . '";
87
');
88
}
11
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
12
if ($orderId) {
13
$order = Mage::getModel('sales/order')->load($orderId);
14
+ if ($order) {
15
+ $address = $order->getShippingAddress();
16
+ if (!$address) {
17
+ $address = $order->getBillingAddress();
18
+ }
19
+ } else {
20
+ Mage::log('Eepohs_Snoobi: Could not load order!');
21
+ $this->addText('<!-- Eepohs_Snoobi: Could not load order -->');
22
+ return parent::_toHtml();
23
+ }
24
} else {
25
+ Mage::log('Eepohs_Snoobi: No order ID!');
26
+ $this->addText('<!-- Eepohs_Snoobi: No order ID -->');
27
return parent::_toHtml();
28
}
29
$customer = Mage::getSingleton('customer/session')->getCustomer();
43
var snoobiTrans = new SnoobiTrans();
44
var snoobiOrder = snoobiTrans.order("' . $order->getIncrementId() . '");
45
snoobiOrder.total = "' . $order->getBaseGrandTotal() . '";
46
+ snoobiOrder.currency =' . json_encode($order->getOrderCurrencyCode()) . ';
47
snoobiOrder.discount = "' . $order->getDiscountAmount() . '";
48
snoobiOrder.discountPct = "' . $discountPct . '";
49
snoobiOrder.tax = "' . $order->getBaseTaxAmount() . '";
50
+ snoobiOrder.customername = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($customerName, '"'))) . ';
51
+ snoobiOrder.customeremail =' . json_encode($this->jsQuoteEscape($customerEmail, '"')) . ';
52
snoobiOrder.customerid = "' . $customerId . '";
53
snoobiOrder.shippingcost = "' . $order->getBaseShippingAmount() . '";
54
+ snoobiOrder.payment_method = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $order->getPayment()->getMethod())) . ';
55
+ snoobiOrder.shipping_method = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $order->getShippingMethod())) . ';
56
+ snoobiOrder.coupons = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $order->getCouponCode())) . ';
57
');
58
+ if ($address) {
59
+ $this->addText('
60
+ snoobiOrder.address = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($address->getStreetFull(), '"'))) . ';
61
+ snoobiOrder.city = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($address->getCity(), '"'))) . ';
62
+ snoobiOrder.area = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($address->getRegion(), '"'))) . ';
63
+ snoobiOrder.zip = ' . json_encode($address->getPostcode()) . ';
64
+ snoobiOrder.country = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($address->getCountry(), '"'))) . ';
65
+ ');
66
+ } else {
67
+ $this->addText('
68
+ <!-- Eepohs_Snoobi: Could not get address -->');
69
+ }
70
71
foreach ($order->getAllItems() as $item) {
72
if ($item->getParentItemId()) {
87
}
88
$this->addText('
89
var snoobiItem = snoobiOrder.item("' . $this->jsQuoteEscape($item->getSku(), '"') . '");
90
+ snoobiItem.name = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $this->jsQuoteEscape($item->getName(), '"'))) . ';
91
snoobiItem.price = "' . $item->getBasePrice() . '";
92
+ snoobiItem.currency = ' . json_encode($order->getOrderCurrencyCode()) . ';
93
snoobiItem.amount = "' . $item->getQtyOrdered() . '";
94
snoobiItem.discount = "' . $item->getDiscountAmount() . '";
95
snoobiItem.discountPct = "' . $item->getDiscountPercent() . '";
96
+ snoobiItem.categoryName = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", $categoryName)) . ';
97
snoobiItem.categoryId = "' . $categoryId . '";
98
');
99
100
if (count($categoryAllNames) > 1) {
101
$this->addText('
102
+ snoobiItem.categoryAllNames = ' . json_encode(ereg_replace("(\r\n|\n|\r)", " ", implode(":",$categoryAllNames))) . ';
103
snoobiItem.categoryAllIds = "' . implode(":",$categoryAllIds) . '";
104
');
105
}
app/code/community/Eepohs/Snoobi/etc/config.xml CHANGED
@@ -1,7 +1,7 @@
1
<config>
2
<modules>
3
<Eepohs_Snoobi>
4
- <version>1.0.0</version>
5
</Eepohs_Snoobi>
6
</modules>
7
1
<config>
2
<modules>
3
<Eepohs_Snoobi>
4
+ <version>1.0.2</version>
5
</Eepohs_Snoobi>
6
</modules>
7
app/design/frontend/default/default/layout/snoobi.xml CHANGED
@@ -8,7 +8,7 @@
8
<reference name="head">
9
<block type="page/html_head" name="snoobi_js" as="snoobi_js" template="snoobi/js.phtml" />
10
</reference>
11
- <reference name="after_body_start">
12
<block type="snoobi/order" name="snoobi_order" as="snoobi_order" />
13
</reference>
14
</checkout_onepage_success>
@@ -16,7 +16,7 @@
16
<reference name="head">
17
<block type="page/html_head" name="snoobi_js" as="snoobi_js" template="snoobi/js.phtml" />
18
</reference>
19
- <reference name="after_body_start">
20
<block type="snoobi/order" name="snoobi_order" as="snoobi_order" />
21
</reference>
22
</checkout_multishipping_success>
8
<reference name="head">
9
<block type="page/html_head" name="snoobi_js" as="snoobi_js" template="snoobi/js.phtml" />
10
</reference>
11
+ <reference name="before_body_end">
12
<block type="snoobi/order" name="snoobi_order" as="snoobi_order" />
13
</reference>
14
</checkout_onepage_success>
16
<reference name="head">
17
<block type="page/html_head" name="snoobi_js" as="snoobi_js" template="snoobi/js.phtml" />
18
</reference>
19
+ <reference name="before_body_end">
20
<block type="snoobi/order" name="snoobi_order" as="snoobi_order" />
21
</reference>
22
</checkout_multishipping_success>
package.xml CHANGED
@@ -1,18 +1,21 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Eepohs_Snoobi</name>
4
- <version>1.0.1</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Snoobi&#x2019;s e-Commerce Analytics module is a Magento extension that seamlessly integrates Snoobi&#x2019;s paid analytics service with web stores.</summary>
10
<description>Snoobi&#x2019;s e-Commerce Analytics module is a free of charge Magento extension that seamlessly integrates Snoobi&#x2019;s paid analytics service with web stores, requiring no technical knowledge and very little experience with either Magento or Snoobi&#x2019;s service. Its features include page tracking, shopping cart tracking, product tracking, coupon tracking and the analysis of visitors to increase sales.</description>
11
- <notes>First public release.</notes>
12
- <authors><author><name>Marie Fischer</name><user>auto-converted</user><email>marie.fischer@eepohs.com</email></author><author><name>Tanel Raja</name><user>auto-converted</user><email>tanel.raja@eepohs.com</email></author><author><name>Eepohs Consulting</name><user>auto-converted</user><email>info@eepohs.com</email></author></authors>
13
- <date>2011-01-26</date>
14
- <time>01:27:45</time>
15
- <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="snoobi"><file name="snoobi_logo.gif" hash="8816153cb8687e9c8827898d78f6ad5e"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Eepohs"><dir name="Snoobi"><dir name="Block"><file name="Info.php" hash="9e647cd9ceaa0f7ced9ab1d9b421b15a"/><file name="Order.php" hash="049453a98d03bb244699c8b11666fdb0"/><file name="Tag.php" hash="3416a0cf8b11abbf9d146f98c51eb15e"/></dir><dir name="controllers"><file name="IndexController.php" hash="ba39d8b3656cb43c0099ed52933b1ad2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5a2c761b911570a3fc805b5330984532"/><file name="config.xml" hash="be0dd42e46df32c80dc76fe751cfb3f4"/><file name="system.xml" hash="84322aeaf253d48a602560ada8d1d09e"/></dir><dir name="Helper"><file name="Data.php" hash="a8591bdd702e3cba5f39265283683816"/></dir></dir></dir></target><target name="mage"><dir name="Eepohs_Snoobi"><file name="English Magento Snoobi E-commerce Analytics.pdf" hash="69b678cd5bfe2093b0b1e754b3b3fe67"/><file name="Svenska Magento Snoobi E-commerce Analytics.pdf" hash="8394473c12b63faad77dab1c51c930a9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Eepohs_Snoobi.csv" hash="631f85d7faa14f9dd8fe5d45539fa3f9"/></dir><dir name="et_EE"><file name="Eepohs_Snoobi.csv" hash="72883c0f49b59e40739eaf553a89466f"/></dir><dir name="fi_FI"><file name="Eepohs_Snoobi.csv" hash="e64cdeb2e368cb2ab1fe276880deed30"/></dir><dir name="nl_NL"><file name="Eepohs_Snoobi.csv" hash="f1d0f9161b9eba33c38f15d9d6b16f0d"/></dir><dir name="sv_SE"><file name="Eepohs_Snoobi.csv" hash="06592e7a451344f09c01f8017138e654"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="snoobi.xml" hash="3a5f1ed4a809b2eca73a70b2575bf4b0"/></dir><dir name="template"><dir name="snoobi"><file name="js.phtml" hash="a87dacb2466c18d48c48914bd82909ac"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eepohs_Snoobi.xml" hash="eb97d10b18ca825860bc5bd134d42ee9"/></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Eepohs_Snoobi</name>
4
+ <version>1.0.2</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Snoobi&#x2019;s e-Commerce Analytics module is a Magento extension that seamlessly integrates Snoobi&#x2019;s paid analytics service with web stores.</summary>
10
<description>Snoobi&#x2019;s e-Commerce Analytics module is a free of charge Magento extension that seamlessly integrates Snoobi&#x2019;s paid analytics service with web stores, requiring no technical knowledge and very little experience with either Magento or Snoobi&#x2019;s service. Its features include page tracking, shopping cart tracking, product tracking, coupon tracking and the analysis of visitors to increase sales.</description>
11
+ <notes>Changes 1.0.1 -&gt; 1.0.2&#xD;
12
+ * (CHANGE) Improved string handling for javascript (line breaks will now be removed)&#xD;
13
+ * (CHANGE) Error handling if order or address not found&#xD;
14
+ * (CHANGE) Snoobi code for orders now at the bottom of the page - should make it easier to use with old templates (after_body_start -&gt; before_body_end)</notes>
15
+ <authors><author><name>Eepohs Consulting</name><user>auto-converted</user><email>all@eepohs.com</email></author><author><name>Marie Fischer</name><user>auto-converted</user><email>marie@eepohs.com</email></author><author><name>Tanel Raja</name><user>auto-converted</user><email>tanel.raja@eepohs.com</email></author></authors>
16
+ <date>2011-05-18</date>
17
+ <time>12:45:18</time>
18
+ <contents><target name="magecommunity"><dir name="Eepohs"><dir name="Snoobi"><dir name="Block"><file name="Info.php" hash="9e647cd9ceaa0f7ced9ab1d9b421b15a"/><file name="Order.php" hash="4611fa9ffa930edbe491afc1055096db"/><file name="Tag.php" hash="3416a0cf8b11abbf9d146f98c51eb15e"/></dir><dir name="Helper"><file name="Data.php" hash="a8591bdd702e3cba5f39265283683816"/></dir><dir name="controllers"><file name="IndexController.php" hash="ba39d8b3656cb43c0099ed52933b1ad2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5a2c761b911570a3fc805b5330984532"/><file name="config.xml" hash="e7b793d46fcffc87b66c045cbd531c9f"/><file name="system.xml" hash="84322aeaf253d48a602560ada8d1d09e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="snoobi.xml" hash="a19c719fbf9c89dd00715d45831e92dd"/></dir><dir name="template"><dir name="snoobi"><file name="js.phtml" hash="a87dacb2466c18d48c48914bd82909ac"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eepohs_Snoobi.xml" hash="eb97d10b18ca825860bc5bd134d42ee9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Eepohs_Snoobi.csv" hash="631f85d7faa14f9dd8fe5d45539fa3f9"/></dir><dir name="et_EE"><file name="Eepohs_Snoobi.csv" hash="72883c0f49b59e40739eaf553a89466f"/></dir><dir name="nl_NL"><file name="Eepohs_Snoobi.csv" hash="f1d0f9161b9eba33c38f15d9d6b16f0d"/></dir><dir name="sv_SE"><file name="Eepohs_Snoobi.csv" hash="06592e7a451344f09c01f8017138e654"/></dir><dir name="fi_FI"><file name="Eepohs_Snoobi.csv" hash="e64cdeb2e368cb2ab1fe276880deed30"/></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>
skin/adminhtml/default/default/images/snoobi/snoobi_logo.gif DELETED
Binary file