Version Notes
Conversion tracking update
Download this release
Release Info
Developer | NanoRep |
Extension | NanoRep_Widgets_1_1_0 |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- app/code/local/NanoRep/Widgets/Block/Embed.php +1 -1
- app/code/local/NanoRep/Widgets/Helper/Data.php~ +114 -0
- app/code/local/NanoRep/Widgets/Model/Request.php +24 -0
- app/code/local/NanoRep/Widgets/Model/System/Config/Backend/ConversionTracking.php +91 -0
- app/code/local/NanoRep/Widgets/etc/config.xml +6 -3
- app/code/local/NanoRep/Widgets/etc/system.xml +21 -9
- app/design/adminhtml/default/default/layout/nanorepwidgets.xml +2 -2
- app/design/frontend/default/default/template/nanorepwidgets/success.phtml +36 -3
- app/design/frontend/rwd/default/template/nanorepwidgets/success.phtml +36 -3
- app/etc/modules/NanoRep_Widgets.xml +11 -2
- package.xml +5 -5
- skin/frontend/rwd/default/nanorepwidgets/head.css +0 -20
- skin/frontend/rwd/default/nanorepwidgets/head.js +0 -56
app/code/local/NanoRep/Widgets/Block/Embed.php
CHANGED
@@ -67,7 +67,7 @@ class NanoRep_Widgets_Block_Embed extends Mage_Core_Block_Template
|
|
67 |
}
|
68 |
$url = "https://".$server."/common/api/kbExport.xml?byPopularity=".$byPopularity."&username=".$username."&pw=".$password."&kb=".$kb."&skip=".$skip."&maxItems=".$maxItems."&days=".$days."&labelId=".$labelId."&textFilter=".$textFilter."&context=".$contextStr;
|
69 |
|
70 |
-
if(Mage::getStoreConfigFlag('nanorepwidgets/
|
71 |
Mage::log($url, null, "nanorep-embeded-debug.log");
|
72 |
}
|
73 |
|
67 |
}
|
68 |
$url = "https://".$server."/common/api/kbExport.xml?byPopularity=".$byPopularity."&username=".$username."&pw=".$password."&kb=".$kb."&skip=".$skip."&maxItems=".$maxItems."&days=".$days."&labelId=".$labelId."&textFilter=".$textFilter."&context=".$contextStr;
|
69 |
|
70 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
71 |
Mage::log($url, null, "nanorep-embeded-debug.log");
|
72 |
}
|
73 |
|
app/code/local/NanoRep/Widgets/Helper/Data.php~
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NanoRep Widgets Extension
|
4 |
+
*
|
5 |
+
* @package NanoRep_Widgets
|
6 |
+
* @company nanoRep.
|
7 |
+
* @website http://www.nanorep.com
|
8 |
+
* @author Dan Aharon-Shalom
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
+
{
|
14 |
+
public function getAccountName(){
|
15 |
+
return Mage::getStoreConfig("nanorepwidgets/account_settings/account_name");
|
16 |
+
}
|
17 |
+
|
18 |
+
public function isFloatWidgetActiveForCurrentPage(){
|
19 |
+
if(Mage::getStoreConfigFlag("nanorepwidgets/float_widget/active_pages")){
|
20 |
+
$module = Mage::app()->getRequest()->getModuleName();
|
21 |
+
$controller = Mage::app()->getRequest()->getControllerName();
|
22 |
+
return($module == 'catalog' && $controller == 'product');
|
23 |
+
}
|
24 |
+
else{
|
25 |
+
return true;
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getUsername(){
|
31 |
+
return Mage::getStoreConfig("nanorepwidgets/account_settings/username") . '@'. Mage::getStoreConfig("nanorepwidgets/account_settings/account_name");
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getPassword(){
|
35 |
+
return Mage::getStoreConfig("nanorepwidgets/account_settings/password");
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getAttributes(){
|
39 |
+
return (is_null(Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"))) ? array(): explode(',', Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"));
|
40 |
+
}
|
41 |
+
|
42 |
+
public function isEmbededWidgetEnabled(){
|
43 |
+
return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/active");
|
44 |
+
}
|
45 |
+
|
46 |
+
public function isEmbededWidgetQuestionsHidden(){
|
47 |
+
return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/question_hidden");
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
public function getEmbededWidgetWidth(){
|
52 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/width");
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getEmbededWidgetMaxHeight(){
|
56 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/max_height");
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getEmbededWidgetDivCss(){
|
60 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/div_css");
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getEmbededWidgetFaqNum(){
|
64 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/faq_num");
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getEmbededWidgetKb(){
|
68 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/kb");
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getEmbededWidgetSkip(){
|
72 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/skip");
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getEmbededWidgetByPopularity(){
|
76 |
+
return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/by_popularity");
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getEmbededWidgetDays(){
|
80 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/days");
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getEmbededWidgetLabelId(){
|
84 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/label_id");
|
85 |
+
}
|
86 |
+
|
87 |
+
public function getEmbededWidgetTextFilter(){
|
88 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/text_filter");
|
89 |
+
}
|
90 |
+
|
91 |
+
public function getEmbededWidgetProductFaqHeadline(){
|
92 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/product_faq_headline");
|
93 |
+
}
|
94 |
+
|
95 |
+
// public function getEmbededWidgetGeneralFaqHeadline(){
|
96 |
+
// return Mage::getStoreConfig("nanorepwidgets/embed_widget/general_faq_headline");
|
97 |
+
// }
|
98 |
+
|
99 |
+
public function getEmbededWidgetMaxItems(){
|
100 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/max_items");
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getEmbededWidgetCacheTimeout(){
|
104 |
+
return Mage::getStoreConfig("nanorepwidgets/embed_widget/cache_timeout");
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getStoreQueryInCookieUrl(){
|
108 |
+
return Mage::getBaseUrl() . 'nanorep/query/storeQuery';
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getSession(){
|
112 |
+
return Mage::getSingleton('nanorepwidgets/session');
|
113 |
+
}
|
114 |
+
}
|
app/code/local/NanoRep/Widgets/Model/Request.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NanoRep Widgets Extension
|
4 |
+
*
|
5 |
+
* @package NanoRep_Widgets
|
6 |
+
* @company nanoRep.
|
7 |
+
* @website http://www.nanorep.com
|
8 |
+
* @author Dan Aharon-Shalom
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Nanorep_Widgets_Model_Request extends Varien_Object
|
12 |
+
{
|
13 |
+
public function toPostData()
|
14 |
+
{
|
15 |
+
$poststring = "";
|
16 |
+
if($this->hasData()){
|
17 |
+
foreach($this->getData() as $key=>$value){
|
18 |
+
$poststring .= "$key=$value&";
|
19 |
+
}
|
20 |
+
$poststring = substr($poststring, 0, -1);
|
21 |
+
}
|
22 |
+
return $poststring;
|
23 |
+
}
|
24 |
+
}
|
app/code/local/NanoRep/Widgets/Model/System/Config/Backend/ConversionTracking.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* MCI Co.
|
4 |
+
* http://www.mage.co.il
|
5 |
+
*
|
6 |
+
* @package Mci_Core
|
7 |
+
* @copyright Copyright (c) 2014 MCI Co. (http://www.mage.co.il)
|
8 |
+
* @author info@mage.co.il
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Nanorep_Widgets_Model_System_Config_Backend_ConversionTracking extends Mage_Core_Model_Config_Data {
|
12 |
+
|
13 |
+
protected function _afterSaveCommit()
|
14 |
+
{
|
15 |
+
if($this->isValueChanged() || Mage::getStoreConfig('nanorepwidgets/account_settings/conversion_script') == "")
|
16 |
+
{
|
17 |
+
if (function_exists("curl_init")) {
|
18 |
+
$url = "https://my.nanorep.com/api/addconversion";
|
19 |
+
$request = Mage::getModel('nanorepwidgets/request');
|
20 |
+
$request->setData('account', $this->getFieldsetDataValue("account_name"));
|
21 |
+
$request->setData('url', rtrim(Mage::getBaseUrl(),"/"));
|
22 |
+
$request->setData('apikey', $this->getFieldsetDataValue("account_api_key"));
|
23 |
+
$request->setData('ab', '5');
|
24 |
+
$request->setData('name', 'Conversion');
|
25 |
+
$currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
|
26 |
+
if($currencyCode == "ILS"){
|
27 |
+
$currencyCode = "NIS";
|
28 |
+
}
|
29 |
+
$request->setData('currency', $currencyCode);
|
30 |
+
|
31 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
32 |
+
Mage::log("Request: " . $url ."?" . $request->toPostData(), null, "nanorep-conversion-script-debug.log");
|
33 |
+
}
|
34 |
+
|
35 |
+
$CR = curl_init();
|
36 |
+
curl_setopt($CR, CURLOPT_URL, $url);
|
37 |
+
curl_setopt($CR, CURLOPT_POST, 1);
|
38 |
+
curl_setopt($CR, CURLOPT_POSTFIELDS, $request->toPostData());
|
39 |
+
curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
|
40 |
+
curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
|
41 |
+
curl_setopt($CR, CURLOPT_FAILONERROR, true);
|
42 |
+
|
43 |
+
//actual curl execution perfom
|
44 |
+
$result = curl_exec($CR);
|
45 |
+
$error = curl_error($CR);
|
46 |
+
|
47 |
+
if ($error) {
|
48 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
49 |
+
Mage::log("Error: " . $error, null, "nanorep-conversion-script-debug.log");
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
53 |
+
if($result){
|
54 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
55 |
+
Mage::log("Result: " . $result, null, "nanorep-conversion-script-debug.log");
|
56 |
+
}
|
57 |
+
try{
|
58 |
+
if(is_string($result)){
|
59 |
+
$result = stripslashes($result);
|
60 |
+
$result = Zend_Json::decode($result);
|
61 |
+
if($result["result"] == "error"){
|
62 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nanorepwidgets')->__("Faild to create coinversion tracking code, Error: %s", $result["description"]));
|
63 |
+
}
|
64 |
+
elseif($result["result"] == "success"){
|
65 |
+
$config = Mage::getModel("core/config");
|
66 |
+
$script = str_replace("ORDER_ID", "{{order_id}}", str_replace("REVENUE", "{{order_amount}}", $result["script"]));
|
67 |
+
$config->saveConfig('nanorepwidgets/account_settings/conversion_script', $script, "default", 0);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
elseif(is_object($result)){
|
71 |
+
if($result->result == "error"){
|
72 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nanorepwidgets')->__("Faild to create coinversion tracking code, Error: %s", $result->description));
|
73 |
+
}
|
74 |
+
elseif($result->result == "success"){
|
75 |
+
$config = Mage::getModel("core/config");
|
76 |
+
$script = str_replace("ORDER_ID", "{{order_id}}", str_replace("REVENUE", "{{order_amount}}", $result->script));
|
77 |
+
$config->saveConfig('nanorepwidgets/account_settings/conversion_script', $script, "default", 0);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
catch(Zend_Json_Exception $e){
|
82 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nanorepwidgets')->__("Faild to create coinversion tracking code, Error: %s", $e->getMessage()));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
curl_close($CR);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
}
|
app/code/local/NanoRep/Widgets/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<NanoRep_Widgets>
|
15 |
-
<version>2.0.
|
16 |
</NanoRep_Widgets>
|
17 |
</modules>
|
18 |
<global>
|
@@ -54,8 +54,11 @@
|
|
54 |
</global>
|
55 |
|
56 |
<admin>
|
|
|
|
|
|
|
57 |
<routers>
|
58 |
-
<
|
59 |
<use>admin</use>
|
60 |
<args>
|
61 |
<module>NanoRep_Widgets</module>
|
@@ -64,7 +67,7 @@
|
|
64 |
<nanorepwidgets before="Mage_Adminhtml">Nanorep_Widgets_Adminhtml_Order</nanorepwidgets>
|
65 |
</modules>
|
66 |
</args>
|
67 |
-
</
|
68 |
</routers>
|
69 |
</admin>
|
70 |
<adminhtml>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<NanoRep_Widgets>
|
15 |
+
<version>2.0.5</version>
|
16 |
</NanoRep_Widgets>
|
17 |
</modules>
|
18 |
<global>
|
54 |
</global>
|
55 |
|
56 |
<admin>
|
57 |
+
<secure_url>
|
58 |
+
<nanorep>/nanorep/adminhtml_mynanorep/index</nanorep>
|
59 |
+
</secure_url>
|
60 |
<routers>
|
61 |
+
<nanorep>
|
62 |
<use>admin</use>
|
63 |
<args>
|
64 |
<module>NanoRep_Widgets</module>
|
67 |
<nanorepwidgets before="Mage_Adminhtml">Nanorep_Widgets_Adminhtml_Order</nanorepwidgets>
|
68 |
</modules>
|
69 |
</args>
|
70 |
+
</nanorep>
|
71 |
</routers>
|
72 |
</admin>
|
73 |
<adminhtml>
|
app/code/local/NanoRep/Widgets/etc/system.xml
CHANGED
@@ -38,11 +38,23 @@
|
|
38 |
<label>Account Name</label>
|
39 |
<frontend_type>text</frontend_type>
|
40 |
<validate>required-entry</validate>
|
|
|
41 |
<sort_order>2</sort_order>
|
42 |
<show_in_default>1</show_in_default>
|
43 |
<show_in_website>1</show_in_website>
|
44 |
<show_in_store>1</show_in_store>
|
45 |
</account_name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<username translate="label">
|
47 |
<label>Username</label>
|
48 |
<frontend_type>text</frontend_type>
|
@@ -104,6 +116,15 @@
|
|
104 |
<show_in_website>1</show_in_website>
|
105 |
<show_in_store>1</show_in_store>
|
106 |
</crosssells_products>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
</fields>
|
108 |
</account_settings>
|
109 |
<float_widget translate="label">
|
@@ -295,15 +316,6 @@
|
|
295 |
<validate>validate-digits</validate>
|
296 |
<comment>In secondes</comment>
|
297 |
</cache_timeout>
|
298 |
-
<debug translate="label">
|
299 |
-
<label>Debug Log</label>
|
300 |
-
<frontend_type>select</frontend_type>
|
301 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
302 |
-
<sort_order>45</sort_order>
|
303 |
-
<show_in_default>1</show_in_default>
|
304 |
-
<show_in_website>1</show_in_website>
|
305 |
-
<show_in_store>1</show_in_store>
|
306 |
-
</debug>
|
307 |
</fields>
|
308 |
</embed_widget>
|
309 |
<orders_status translate="label">
|
38 |
<label>Account Name</label>
|
39 |
<frontend_type>text</frontend_type>
|
40 |
<validate>required-entry</validate>
|
41 |
+
<backend_model>nanorepwidgets/system_config_backend_conversionTracking</backend_model>
|
42 |
<sort_order>2</sort_order>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
</account_name>
|
47 |
+
<account_api_key translate="label">
|
48 |
+
<label>Account API Key</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<validate>required-entry</validate>
|
51 |
+
<backend_model>nanorepwidgets/system_config_backend_conversionTracking</backend_model>
|
52 |
+
<sort_order>2</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</account_api_key>
|
57 |
+
<conversion_script />
|
58 |
<username translate="label">
|
59 |
<label>Username</label>
|
60 |
<frontend_type>text</frontend_type>
|
116 |
<show_in_website>1</show_in_website>
|
117 |
<show_in_store>1</show_in_store>
|
118 |
</crosssells_products>
|
119 |
+
<debug translate="label">
|
120 |
+
<label>Debug Log</label>
|
121 |
+
<frontend_type>select</frontend_type>
|
122 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
123 |
+
<sort_order>45</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>1</show_in_store>
|
127 |
+
</debug>
|
128 |
</fields>
|
129 |
</account_settings>
|
130 |
<float_widget translate="label">
|
316 |
<validate>validate-digits</validate>
|
317 |
<comment>In secondes</comment>
|
318 |
</cache_timeout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
</fields>
|
320 |
</embed_widget>
|
321 |
<orders_status translate="label">
|
app/design/adminhtml/default/default/layout/nanorepwidgets.xml
CHANGED
@@ -10,12 +10,12 @@
|
|
10 |
*/
|
11 |
-->
|
12 |
<layout version="0.1.0">
|
13 |
-
<
|
14 |
<remove name="footer" />
|
15 |
<reference name="content">
|
16 |
<block type="nanorepwidgets/adminhtml_mynanorep" name="my_nanorep" template="nanorepwidgets/mynanorep.phtml"/>
|
17 |
</reference>
|
18 |
-
</
|
19 |
|
20 |
<adminhtml_sales_order_view>
|
21 |
<reference name="order_tab_info">
|
10 |
*/
|
11 |
-->
|
12 |
<layout version="0.1.0">
|
13 |
+
<nanorep_adminhtml_mynanorep_index>
|
14 |
<remove name="footer" />
|
15 |
<reference name="content">
|
16 |
<block type="nanorepwidgets/adminhtml_mynanorep" name="my_nanorep" template="nanorepwidgets/mynanorep.phtml"/>
|
17 |
</reference>
|
18 |
+
</nanorep_adminhtml_mynanorep_index>
|
19 |
|
20 |
<adminhtml_sales_order_view>
|
21 |
<reference name="order_tab_info">
|
app/design/frontend/default/default/template/nanorepwidgets/success.phtml
CHANGED
@@ -12,6 +12,39 @@
|
|
12 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
$order = Mage::getSingleton('sales/order');
|
14 |
$order->load($lastOrderId);
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
$order = Mage::getSingleton('sales/order');
|
14 |
$order->load($lastOrderId);
|
15 |
+
// getAmount is defined in the parent class and should read
|
16 |
+
// the value from the defined source_field in your config.xml
|
17 |
+
$price = $order->getGrandTotal();
|
18 |
+
$rate = 1;
|
19 |
+
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
|
20 |
+
$currencyCode = $order->getOrderCurrencyCode();
|
21 |
+
|
22 |
+
if($currencyCode != $baseCurrencyCode){
|
23 |
+
// convert price from current currency to base currency
|
24 |
+
$currency = Mage::getModel('directory/currency')->load($currencyCode);
|
25 |
+
$rate = $currency->getRate($baseCurrencyCode);
|
26 |
+
if(!$rate){
|
27 |
+
$currency->load($baseCurrencyCode);
|
28 |
+
$rate = 1 / $currency->getRate($currencyCode);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$baseCurrencyPrice = $price * $rate;
|
33 |
+
|
34 |
+
$script = Mage::getStoreConfig('nanorepwidgets/account_settings/conversion_script');
|
35 |
+
if($script != null && $script != ""){
|
36 |
+
$script = str_replace("{{order_amount}}", $baseCurrencyPrice, $script);
|
37 |
+
$script = str_replace("{{order_id}}", $order->getIncrementId(), $script);
|
38 |
+
|
39 |
+
echo $script;
|
40 |
+
|
41 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
42 |
+
Mage::log("Conversion Script added to Order success page: ". $script, null, "nanorep-conversion-script-debug.log");
|
43 |
+
}
|
44 |
+
}
|
45 |
+
else{
|
46 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
47 |
+
Mage::log("Conversion Script Was not added to order success page: ". $script, null, "nanorep-conversion-script-debug.log");
|
48 |
+
}
|
49 |
+
}
|
50 |
+
?>
|
app/design/frontend/rwd/default/template/nanorepwidgets/success.phtml
CHANGED
@@ -12,6 +12,39 @@
|
|
12 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
$order = Mage::getSingleton('sales/order');
|
14 |
$order->load($lastOrderId);
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
$order = Mage::getSingleton('sales/order');
|
14 |
$order->load($lastOrderId);
|
15 |
+
// getAmount is defined in the parent class and should read
|
16 |
+
// the value from the defined source_field in your config.xml
|
17 |
+
$price = $order->getGrandTotal();
|
18 |
+
$rate = 1;
|
19 |
+
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
|
20 |
+
$currencyCode = $order->getOrderCurrencyCode();
|
21 |
+
|
22 |
+
if($currencyCode != $baseCurrencyCode){
|
23 |
+
// convert price from current currency to base currency
|
24 |
+
$currency = Mage::getModel('directory/currency')->load($currencyCode);
|
25 |
+
$rate = $currency->getRate($baseCurrencyCode);
|
26 |
+
if(!$rate){
|
27 |
+
$currency->load($baseCurrencyCode);
|
28 |
+
$rate = 1 / $currency->getRate($currencyCode);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$baseCurrencyPrice = $price * $rate;
|
33 |
+
|
34 |
+
$script = Mage::getStoreConfig('nanorepwidgets/account_settings/conversion_script');
|
35 |
+
if($script != null && $script != ""){
|
36 |
+
$script = str_replace("{{order_amount}}", $baseCurrencyPrice, $script);
|
37 |
+
$script = str_replace("{{order_id}}", $order->getIncrementId(), $script);
|
38 |
+
|
39 |
+
echo $script;
|
40 |
+
|
41 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
42 |
+
Mage::log("Conversion Script added to Order success page: ". $script, null, "nanorep-conversion-script-debug.log");
|
43 |
+
}
|
44 |
+
}
|
45 |
+
else{
|
46 |
+
if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/debug')){
|
47 |
+
Mage::log("Conversion Script Was not added to order success page: ". $script, null, "nanorep-conversion-script-debug.log");
|
48 |
+
}
|
49 |
+
}
|
50 |
+
?>
|
app/etc/modules/NanoRep_Widgets.xml
CHANGED
@@ -1,10 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<NanoRep_Widgets>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
<depends></depends>
|
8 |
</NanoRep_Widgets>
|
9 |
</modules>
|
10 |
-
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NanoRep Widgets Extension
|
5 |
+
*
|
6 |
+
* @package NanoRep_Widgets
|
7 |
+
* @company Omniscience Co.
|
8 |
+
* @website http://www.omniscience.co.il
|
9 |
+
* @author Dan Aharon-Shalom
|
10 |
+
*/
|
11 |
+
-->
|
12 |
<config>
|
13 |
<modules>
|
14 |
<NanoRep_Widgets>
|
15 |
<active>true</active>
|
16 |
<codePool>local</codePool>
|
|
|
17 |
</NanoRep_Widgets>
|
18 |
</modules>
|
19 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NanoRep_Widgets_1_1_0</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -45,11 +45,11 @@ Agents get a 360
|
|
45 |
degree view of customers’ activity before
|
46 |
working on cases.
|
47 |
</description>
|
48 |
-
<notes>
|
49 |
<authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
|
50 |
-
<date>2014-11-
|
51 |
-
<time>
|
52 |
-
<contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><dir name="Answer"><dir name="Grid"><file name="Export.php" hash="98bed6330628da0056b9281cd0044ab1"/></dir><file name="Grid.php" hash="bda00ac3e4e1d85327eac227949e7bb5"/></dir><file name="Answer.php" hash="2c1b7c5dfdd1485b6c3cd8eb2c134bcd"/><file name="Mynanorep.php" hash="a7aea34f919bc75ca9a2d374a115b3fa"/><dir name="Order"><dir name="Grid"><file name="Export.php" hash="13bc156b3331c9b2dacde70e8483a909"/></dir><file name="Grid.php" hash="a78d4a0d35b0f1575763af33bb7c03e4"/><dir name="View"><file name="Queries.php" hash="7c1c21f3cc8abc848fdf091c8b05d4cf"/></dir></dir><file name="Order.php" hash="39ebfd2fe23db490046ae8e324901b72"/><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Answer"><dir name="Body"><file name="Pretty.php" hash="0a7d01f7ff96b9bace44256e82ab047e"/></dir><file name="Body.php" hash="89f497faa6a03cac040834804439a8d2"/><dir name="Title"><file name="Pretty.php" hash="b47a584daaed1c1e55545877b097f75b"/></dir><file name="Title.php" hash="115ee0a85937406fa07e8d439f1e3dbb"/></dir><dir name="Questions"><file name="Pretty.php" hash="3ffd9f82f2c5c2696eed0f35f7109b9e"/></dir><file name="Questions.php" hash="1a979d2272acde87c1e907aa29816c6c"/><dir name="Results"><file name="Pretty.php" hash="f0c8ba45e792f4cfee6ce4a22a3898fa"/></dir><file name="Results.php" hash="d08aa0325398bc23b335df26ca48c53c"/></dir></dir></dir></dir></dir><file name="Customerhistoryjson.php" hash="2e6a8dc4c0e5c49639ff088ac3910009"/><file name="Embed.php" hash="
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NanoRep_Widgets_1_1_0</name>
|
4 |
+
<version>2.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
|
7 |
<channel>community</channel>
|
45 |
degree view of customers’ activity before
|
46 |
working on cases.
|
47 |
</description>
|
48 |
+
<notes>Conversion tracking update</notes>
|
49 |
<authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
|
50 |
+
<date>2014-11-19</date>
|
51 |
+
<time>21:25:05</time>
|
52 |
+
<contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><dir name="Answer"><dir name="Grid"><file name="Export.php" hash="98bed6330628da0056b9281cd0044ab1"/></dir><file name="Grid.php" hash="bda00ac3e4e1d85327eac227949e7bb5"/></dir><file name="Answer.php" hash="2c1b7c5dfdd1485b6c3cd8eb2c134bcd"/><file name="Mynanorep.php" hash="a7aea34f919bc75ca9a2d374a115b3fa"/><dir name="Order"><dir name="Grid"><file name="Export.php" hash="13bc156b3331c9b2dacde70e8483a909"/></dir><file name="Grid.php" hash="a78d4a0d35b0f1575763af33bb7c03e4"/><dir name="View"><file name="Queries.php" hash="7c1c21f3cc8abc848fdf091c8b05d4cf"/></dir></dir><file name="Order.php" hash="39ebfd2fe23db490046ae8e324901b72"/><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Answer"><dir name="Body"><file name="Pretty.php" hash="0a7d01f7ff96b9bace44256e82ab047e"/></dir><file name="Body.php" hash="89f497faa6a03cac040834804439a8d2"/><dir name="Title"><file name="Pretty.php" hash="b47a584daaed1c1e55545877b097f75b"/></dir><file name="Title.php" hash="115ee0a85937406fa07e8d439f1e3dbb"/></dir><dir name="Questions"><file name="Pretty.php" hash="3ffd9f82f2c5c2696eed0f35f7109b9e"/></dir><file name="Questions.php" hash="1a979d2272acde87c1e907aa29816c6c"/><dir name="Results"><file name="Pretty.php" hash="f0c8ba45e792f4cfee6ce4a22a3898fa"/></dir><file name="Results.php" hash="d08aa0325398bc23b335df26ca48c53c"/></dir></dir></dir></dir></dir><file name="Customerhistoryjson.php" hash="2e6a8dc4c0e5c49639ff088ac3910009"/><file name="Embed.php" hash="c228d0d8d1dce3a975147434ef8f38ea"/><file name="Events.php" hash="5f5f965d626c8b73c072db1fca506d4c"/><file name="Float.php" hash="e51c028ad72498a96dcd1b38ae2f18f7"/><file name="Header.php" hash="88fbe58d72982d15434f4b0d1462942e"/><file name="Login.php" hash="26301dd7a70c4d73937d0e33d027942d"/><file name="Success.php" hash="9383181f50edf203c457872412de7a0c"/></dir><dir name="Helper"><file name="Data.php" hash="9c87dbc1138c4017678203141050eecc"/><file name="Data.php~" hash="f16dda0d1ce9c3e1c2b367c06c88c084"/></dir><dir name="Model"><file name="Answer.php" hash="3931d7299a746e0ac90a6cae4a154982"/><file name="History.php" hash="0ffa4f8d5366abc1f7702e101cc5a90f"/><file name="Observer.php" hash="dec7cbc2f825f40ec18737b6bead79aa"/><file name="Query.php" hash="c4eaf10c4bae492d782b552550570215"/><file name="Request.php" hash="aa581b40cd716654a1f71cc0fe202fcc"/><dir name="Resource"><dir name="Answer"><file name="Collection.php" hash="febae104bf1dd741119b8cf6f168b21d"/></dir><file name="Answer.php" hash="0f79604579c93d4315b62cc23d595a53"/><dir name="Query"><file name="Collection.php" hash="ab7cd2f853a4f21d216ee24748a9b1c8"/></dir><file name="Query.php" hash="ccc5ae9e2e2f144c37fef2245033911c"/><file name="Setup.php" hash="812ef9ae3c38fe84eda2c702890faac5"/></dir><file name="Session.php" hash="63b7e34c1782e8e376936e7f196b0353"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="ConversionTracking.php" hash="7393e0a45dfa6222e40416f6e4fea23b"/></dir><dir name="Source"><file name="Attribute.php" hash="03529194354c0557a881305a69158fa5"/><file name="FloatWidgetActivePages.php" hash="e1f7f28f4e3e13ba13e4293eed61a943"/><file name="OrdersStatusActivePages.php" hash="f098536503386289102acfcc19d016a6"/><file name="ProductIdAttribute.php" hash="03c69b051e8ba54e47f87b6f1495c19e"/></dir></dir></dir></dir><dir name="controllers"><file name="AccountController.php" hash="a0500edbd0a13d11a8e5827a30fa5b20"/><dir name="Adminhtml"><file name="AnswerController.php" hash="c78297d83f113e8e01cc6b39158bdc66"/><file name="MynanorepController.php" hash="b411ddc154ef98ca3f568daab73fd003"/><file name="OrderController.php" hash="b5484dde49a2ebbcc8b0933bcad4c0bb"/></dir><file name="IndexController.php" hash="a88b39a8ee27925df32be3c57f95cbf6"/><file name="OrderController.php" hash="45be95b16ff3bbf928c0e8234a4a3fb2"/><file name="QueryController.php" hash="58145cd9ff89c0bc7ff078c0d11b4d83"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6b796ffd37d982a516efac2d8870c4dc"/><file name="config.xml" hash="65d07d5dcb937c0e7341eb08f35c6bab"/><file name="system.xml" hash="8cad9f521d66e0361e756c57be7e6c11"/></dir><dir name="sql"><dir name="nanorepwidgets_setup"><file name="install-2.0.0.php" hash="df808cb581bb4e2cf8a03687c2969d1b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NanoRep_Widgets.xml" hash="4fbaad20e02fa3ed2147ba15864c3cab"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="690b5ab9ed1d024a27220732a28652f5"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="3a082b0822f143b8e8f7dc1da4137d1c"/><file name="header.phtml" hash="aee72cc5a4e551326c5c8c5931234f0f"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><file name="success.phtml" hash="9db1192b7c1190c07b983431f400d6b2"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="690b5ab9ed1d024a27220732a28652f5"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="3a082b0822f143b8e8f7dc1da4137d1c"/><file name="header.phtml" hash="aee72cc5a4e551326c5c8c5931234f0f"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><file name="success.phtml" hash="9db1192b7c1190c07b983431f400d6b2"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir><dir name="default"><dir name="default"><dir name="template"><dir name="nanorepwidgets"><file name="mynanorep.phtml" hash="ecdbcbdfbe5c4e4ed18aaf74492b5adb"/><dir name="order"><dir name="view"><file name="queries.phtml" hash="0c4e8fdd10069b2c14bb2096585eb866"/><dir name="tab"><file name="info.phtml" hash="b7d4f357da6def4bf1d6889ee95f45bb"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="8b08ea4c0b090dd758bb0cb65bc9a871"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="nanorepwidgets"><file name="head.css" hash="1779a092e2c2a771a0725e1cdd682a46"/><file name="head.js" hash="8bafa94d8432b42e2e6e7f6af91db39e"/></dir></dir></dir></dir></target></contents>
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
skin/frontend/rwd/default/nanorepwidgets/head.css
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
.nR_title_cl {
|
2 |
-
background: url("https://my.nanorep.com/widget/skins/mp_sprites.png") no-repeat scroll 0 5px transparent;
|
3 |
-
padding: 0 0 0 18px;
|
4 |
-
}
|
5 |
-
.nR_title_op {
|
6 |
-
background: url("https://my.nanorep.com/widget/skins/mp_sprites.png") no-repeat scroll 0 -301px transparent;
|
7 |
-
padding: 0 0 0 18px;
|
8 |
-
}
|
9 |
-
.nR_title_text {
|
10 |
-
text-decoration: none;
|
11 |
-
font-size: 15px;
|
12 |
-
color: #090C69;
|
13 |
-
line-height: 24px;
|
14 |
-
cursor: pointer;
|
15 |
-
}
|
16 |
-
.nR_body {
|
17 |
-
display: none;
|
18 |
-
margin: 10px 18px;
|
19 |
-
font-size: 14px;
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/frontend/rwd/default/nanorepwidgets/head.js
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
var nrServer = 'https://my.nanorep.com';
|
2 |
-
|
3 |
-
// show/hide article text
|
4 |
-
function toggleArticle(id, account, kb, _event, el)
|
5 |
-
{
|
6 |
-
// ignore event if it didnt originate from span
|
7 |
-
var e = _event || window.event;
|
8 |
-
var target = e.target || e.srcElement;
|
9 |
-
if (target.parentNode != el && target.parentNode.parentNode != el) return;
|
10 |
-
|
11 |
-
var article = document.getElementById('article_' + id);
|
12 |
-
if (article.style.display == 'block')
|
13 |
-
{
|
14 |
-
el.className = 'nR_title_cl';
|
15 |
-
article.style.display = 'none';
|
16 |
-
}
|
17 |
-
else
|
18 |
-
{
|
19 |
-
el.className = 'nR_title_op';
|
20 |
-
article.style.display = 'block';
|
21 |
-
|
22 |
-
// request img
|
23 |
-
if (!el.statsRequested)
|
24 |
-
{
|
25 |
-
var url = new Array();
|
26 |
-
url.push(nrServer);
|
27 |
-
url.push('/~');
|
28 |
-
url.push(account);
|
29 |
-
url.push('/common/API/kbExportAnswer2.gif?rnd=');
|
30 |
-
url.push(Math.floor(Math.random() * 1000000));
|
31 |
-
url.push('&a=');
|
32 |
-
url.push(id);
|
33 |
-
url.push('&account=');
|
34 |
-
url.push(account);
|
35 |
-
url.push('&kb=');
|
36 |
-
url.push(kb);
|
37 |
-
|
38 |
-
downloadImage(url.join(''));
|
39 |
-
//document.body.appendChild(img);
|
40 |
-
|
41 |
-
el.statsRequested = true;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
function downloadImage(url)
|
46 |
-
{
|
47 |
-
var img = new Image();
|
48 |
-
img.src = url;
|
49 |
-
img.style.width = '1px';
|
50 |
-
img.style.height = '1px';
|
51 |
-
img.style.display = 'none';
|
52 |
-
}
|
53 |
-
function onloadFnc(url)
|
54 |
-
{
|
55 |
-
downloadImage(nrServer + '/common/api/statshello.gif');
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|