Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting of products in cart sidebar, compare list and wish list #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions code/Helper/Url.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Data helper
*
* @category Aoe
* @package Aoe_Static
* @author Jakub Cegielka <j.cegielka@macopedia.pl>
*/
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);
}
}
6 changes: 5 additions & 1 deletion code/controllers/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
}

}
5 changes: 5 additions & 0 deletions code/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<aoestatic>
<class>Aoe_Static_Helper</class>
</aoestatic>
<core>
<rewrite>
<url>Aoe_Static_Helper_Url</url>
</rewrite>
</core>
</helpers>
</global>

Expand Down
1 change: 1 addition & 0 deletions frontend/template/aoestatic/beforebodyend.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<?php if (($_product = Mage::registry('product')) == true) : ?>var CURRENTPRODUCTID = '<?php echo $_product->getId() ?>';<?php endif; ?>
var CUSTOMERNAME = '<?php echo $this->getCustomerName() ?>';
var CARTSUMMARYCOUNT = '<?php echo $this->getCartSummaryCount(); ?>';
var RETURNURL = '<?php echo $this->helper('core/url')->getCurrentUrl() ?>';
//]]>
</script>
1 change: 1 addition & 0 deletions js/aoestatic/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down