diff --git a/code/Helper/Url.php b/code/Helper/Url.php
new file mode 100644
index 0000000..d14e5a3
--- /dev/null
+++ b/code/Helper/Url.php
@@ -0,0 +1,23 @@
+
+ */
+class Aoe_Static_Helper_Url extends Mage_Core_Helper_Url
+{
+ public function getEncodedUrl($url=null)
+ {
+ $sessionUrl = Mage::getSingleton('core/session')->getReturnUrl();
+ if ($sessionUrl != NULL) {
+ return $this->urlEncode($sessionUrl);
+ }
+ if (!$url) {
+ $url = $this->getCurrentUrl();
+ }
+ return $this->urlEncode($url);
+ }
+}
\ No newline at end of file
diff --git a/code/controllers/CallController.php b/code/controllers/CallController.php
index c790a0c..2bf9372 100644
--- a/code/controllers/CallController.php
+++ b/code/controllers/CallController.php
@@ -19,6 +19,8 @@ class Aoe_Static_CallController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
// if (!$this->getRequest()->isXmlHttpRequest()) { Mage::throwException('This is not an XmlHttpRequest'); }
+ $returnUrl = $this->getRequest()->getParam('returnUrl');
+ Mage::getSingleton('core/session')->setReturnUrl($returnUrl);
$response = array();
$response['sid'] = Mage::getModel('core/session')->getEncryptedSessionId();
@@ -41,7 +43,9 @@ public function indexAction() {
}
}
}
- $this->getResponse()->setBody(Zend_Json::encode($response));
+ Mage::getSingleton('core/session')->unsReturnUrl();
+
+ $this->getResponse()->setBody(Zend_Json::encode($response));
}
}
diff --git a/code/etc/config.xml b/code/etc/config.xml
index bacc0e7..39a5455 100644
--- a/code/etc/config.xml
+++ b/code/etc/config.xml
@@ -24,6 +24,11 @@
Aoe_Static_Helper
+
+
+ Aoe_Static_Helper_Url
+
+
diff --git a/frontend/template/aoestatic/beforebodyend.phtml b/frontend/template/aoestatic/beforebodyend.phtml
index 807e44d..8585730 100644
--- a/frontend/template/aoestatic/beforebodyend.phtml
+++ b/frontend/template/aoestatic/beforebodyend.phtml
@@ -6,5 +6,6 @@
var CURRENTPRODUCTID = 'getId() ?>';
var CUSTOMERNAME = 'getCustomerName() ?>';
var CARTSUMMARYCOUNT = 'getCartSummaryCount(); ?>';
+ var RETURNURL = 'helper('core/url')->getCurrentUrl() ?>';
//]]>
diff --git a/js/aoestatic/common.js b/js/aoestatic/common.js
index 0bd401c..b289a38 100755
--- a/js/aoestatic/common.js
+++ b/js/aoestatic/common.js
@@ -34,6 +34,7 @@ jQuery(document).ready(function($) {
data.currentProductId = CURRENTPRODUCTID;
}
+ data.returnUrl = RETURNURL;
// E.T. phone home
if (typeof data.currentProductId !== 'undefined' || counter > 0) {
$.get(