Modifying the redirect after editing a product in the cart Planned maintenance scheduled April...
Weaponising the Grasp-at-a-Distance spell
Does traveling In The United States require a passport or can I use my green card if not a US citizen?
Can this water damage be explained by lack of gutters and grading issues?
What is the evidence that custom checks in Northern Ireland are going to result in violence?
Can the van der Waals coefficients be negative in the van der Waals equation for real gases?
Putting Ant-Man on house arrest
"Destructive force" carried by a B-52?
What documents does someone with a long-term visa need to travel to another Schengen country?
What is the definining line between a helicopter and a drone a person can ride in?
Kepler's 3rd law: ratios don't fit data
Like totally amazing interchangeable sister outfit accessory swapping or whatever
Can a Knight grant Knighthood to another?
Etymology of 見舞い
Does using the Inspiration rules for character defects encourage My Guy Syndrome?
What's the difference between using dependency injection with a container and using a service locator?
How is an IPA symbol that lacks a name (e.g. ɲ) called?
Is there a verb for listening stealthily?
Why these surprising proportionalities of integrals involving odd zeta values?
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'
2 sample t test for sample sizes - 30,000 and 150,000
Determine the generator of an ideal of ring of integers
Has a Nobel Peace laureate ever been accused of war crimes?
Why do people think Winterfell crypts is the safest place for women, children & old people?
Modifying the redirect after editing a product in the cart
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Removing the “minimum purchase” noticeDisable redirect after product add to basketCreate invoice and shipment in magento via cron based on store view and order ageExclude a specific categoryWrong tax calculation (hiddentax and rowtax) for b2b on Magento CE 1.9.1.0Magento email queue problemsShopping cart is empty after cancel the payment in magento-1.9.1.1Magento 2: Add a product to the cart programmaticallySOLVED Error “Cannot add the item to shopping cart.” after upgrading to Magento 1.9.3.9Magento 2 not passing minimum QTY when adding related products to cart
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a problem modifying a redirect in magento CE 1.9.2.
Let's say a customer has a configurable product in the cart, and would like to edit that product (ie. changing color or size or something).
After changing the options and clicking the 'update cart' button I want the customer to stay on the same page (ie. the edit product page). However magento always redirect back to the cart page.
I think I've found source of the problem, in CartController.php from the Checkout module:
/**
* Update product configuration for a cart item
*/
public function updateItemOptionsAction()
{
$cart = $this->_getCart();
$id = (int) $this->getRequest()->getParam('id');
$params = $this->getRequest()->getParams();
if (!isset($params['options'])) {
$params['options'] = array();
}
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
$quoteItem = $cart->getQuote()->getItemById($id);
if (!$quoteItem) {
Mage::throwException($this->__('Quote item is not found.'));
}
$item = $cart->updateItem($id, new Varien_Object($params));
if (is_string($item)) {
Mage::throwException($item);
}
if ($item->getHasError()) {
Mage::throwException($item->getMessage());
}
$related = $this->getRequest()->getParam('related_product');
if (!empty($related)) {
$cart->addProductsByIds(explode(',', $related));
}
$cart->save();
$this->_getSession()->setCartWasUpdated(true);
Mage::dispatchEvent('checkout_cart_update_item_complete',
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
);
if (!$this->_getSession()->getNoCartRedirect(true)) {
if (!$cart->getQuote()->getHasError()) {
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
$this->_getSession()->addSuccess($message);
}
$this->_goBack();
}
} catch (Mage_Core_Exception $e) {
if ($this->_getSession()->getUseNotice(true)) {
$this->_getSession()->addNotice($e->getMessage());
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->_getSession()->addError($message);
}
}
$url = $this->_getSession()->getRedirectUrl(true);
if ($url) {
$this->getResponse()->setRedirect($url);
} else {
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
}
} catch (Exception $e) {
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
Mage::logException($e);
$this->_goBack();
}
$this->_redirect('*/*');
}
The call to $this->_goBack()
in the end of the try-block seems to set the redirect URL correctly by looking at settings and a 'return_url' parameter (and I've verified that the code gets this far). But, as you can see, the last line always sets a redirect to */*
no matter what. Just adding a return statement after the _goBack() call fixes the problem but I rather do this without modifying the core files.
Any ideas how I can solve this problem?
magento-1.9 cart redirect magento-ce
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a problem modifying a redirect in magento CE 1.9.2.
Let's say a customer has a configurable product in the cart, and would like to edit that product (ie. changing color or size or something).
After changing the options and clicking the 'update cart' button I want the customer to stay on the same page (ie. the edit product page). However magento always redirect back to the cart page.
I think I've found source of the problem, in CartController.php from the Checkout module:
/**
* Update product configuration for a cart item
*/
public function updateItemOptionsAction()
{
$cart = $this->_getCart();
$id = (int) $this->getRequest()->getParam('id');
$params = $this->getRequest()->getParams();
if (!isset($params['options'])) {
$params['options'] = array();
}
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
$quoteItem = $cart->getQuote()->getItemById($id);
if (!$quoteItem) {
Mage::throwException($this->__('Quote item is not found.'));
}
$item = $cart->updateItem($id, new Varien_Object($params));
if (is_string($item)) {
Mage::throwException($item);
}
if ($item->getHasError()) {
Mage::throwException($item->getMessage());
}
$related = $this->getRequest()->getParam('related_product');
if (!empty($related)) {
$cart->addProductsByIds(explode(',', $related));
}
$cart->save();
$this->_getSession()->setCartWasUpdated(true);
Mage::dispatchEvent('checkout_cart_update_item_complete',
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
);
if (!$this->_getSession()->getNoCartRedirect(true)) {
if (!$cart->getQuote()->getHasError()) {
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
$this->_getSession()->addSuccess($message);
}
$this->_goBack();
}
} catch (Mage_Core_Exception $e) {
if ($this->_getSession()->getUseNotice(true)) {
$this->_getSession()->addNotice($e->getMessage());
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->_getSession()->addError($message);
}
}
$url = $this->_getSession()->getRedirectUrl(true);
if ($url) {
$this->getResponse()->setRedirect($url);
} else {
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
}
} catch (Exception $e) {
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
Mage::logException($e);
$this->_goBack();
}
$this->_redirect('*/*');
}
The call to $this->_goBack()
in the end of the try-block seems to set the redirect URL correctly by looking at settings and a 'return_url' parameter (and I've verified that the code gets this far). But, as you can see, the last line always sets a redirect to */*
no matter what. Just adding a return statement after the _goBack() call fixes the problem but I rather do this without modifying the core files.
Any ideas how I can solve this problem?
magento-1.9 cart redirect magento-ce
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38
add a comment |
I have a problem modifying a redirect in magento CE 1.9.2.
Let's say a customer has a configurable product in the cart, and would like to edit that product (ie. changing color or size or something).
After changing the options and clicking the 'update cart' button I want the customer to stay on the same page (ie. the edit product page). However magento always redirect back to the cart page.
I think I've found source of the problem, in CartController.php from the Checkout module:
/**
* Update product configuration for a cart item
*/
public function updateItemOptionsAction()
{
$cart = $this->_getCart();
$id = (int) $this->getRequest()->getParam('id');
$params = $this->getRequest()->getParams();
if (!isset($params['options'])) {
$params['options'] = array();
}
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
$quoteItem = $cart->getQuote()->getItemById($id);
if (!$quoteItem) {
Mage::throwException($this->__('Quote item is not found.'));
}
$item = $cart->updateItem($id, new Varien_Object($params));
if (is_string($item)) {
Mage::throwException($item);
}
if ($item->getHasError()) {
Mage::throwException($item->getMessage());
}
$related = $this->getRequest()->getParam('related_product');
if (!empty($related)) {
$cart->addProductsByIds(explode(',', $related));
}
$cart->save();
$this->_getSession()->setCartWasUpdated(true);
Mage::dispatchEvent('checkout_cart_update_item_complete',
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
);
if (!$this->_getSession()->getNoCartRedirect(true)) {
if (!$cart->getQuote()->getHasError()) {
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
$this->_getSession()->addSuccess($message);
}
$this->_goBack();
}
} catch (Mage_Core_Exception $e) {
if ($this->_getSession()->getUseNotice(true)) {
$this->_getSession()->addNotice($e->getMessage());
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->_getSession()->addError($message);
}
}
$url = $this->_getSession()->getRedirectUrl(true);
if ($url) {
$this->getResponse()->setRedirect($url);
} else {
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
}
} catch (Exception $e) {
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
Mage::logException($e);
$this->_goBack();
}
$this->_redirect('*/*');
}
The call to $this->_goBack()
in the end of the try-block seems to set the redirect URL correctly by looking at settings and a 'return_url' parameter (and I've verified that the code gets this far). But, as you can see, the last line always sets a redirect to */*
no matter what. Just adding a return statement after the _goBack() call fixes the problem but I rather do this without modifying the core files.
Any ideas how I can solve this problem?
magento-1.9 cart redirect magento-ce
I have a problem modifying a redirect in magento CE 1.9.2.
Let's say a customer has a configurable product in the cart, and would like to edit that product (ie. changing color or size or something).
After changing the options and clicking the 'update cart' button I want the customer to stay on the same page (ie. the edit product page). However magento always redirect back to the cart page.
I think I've found source of the problem, in CartController.php from the Checkout module:
/**
* Update product configuration for a cart item
*/
public function updateItemOptionsAction()
{
$cart = $this->_getCart();
$id = (int) $this->getRequest()->getParam('id');
$params = $this->getRequest()->getParams();
if (!isset($params['options'])) {
$params['options'] = array();
}
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
array('locale' => Mage::app()->getLocale()->getLocaleCode())
);
$params['qty'] = $filter->filter($params['qty']);
}
$quoteItem = $cart->getQuote()->getItemById($id);
if (!$quoteItem) {
Mage::throwException($this->__('Quote item is not found.'));
}
$item = $cart->updateItem($id, new Varien_Object($params));
if (is_string($item)) {
Mage::throwException($item);
}
if ($item->getHasError()) {
Mage::throwException($item->getMessage());
}
$related = $this->getRequest()->getParam('related_product');
if (!empty($related)) {
$cart->addProductsByIds(explode(',', $related));
}
$cart->save();
$this->_getSession()->setCartWasUpdated(true);
Mage::dispatchEvent('checkout_cart_update_item_complete',
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
);
if (!$this->_getSession()->getNoCartRedirect(true)) {
if (!$cart->getQuote()->getHasError()) {
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
$this->_getSession()->addSuccess($message);
}
$this->_goBack();
}
} catch (Mage_Core_Exception $e) {
if ($this->_getSession()->getUseNotice(true)) {
$this->_getSession()->addNotice($e->getMessage());
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->_getSession()->addError($message);
}
}
$url = $this->_getSession()->getRedirectUrl(true);
if ($url) {
$this->getResponse()->setRedirect($url);
} else {
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
}
} catch (Exception $e) {
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
Mage::logException($e);
$this->_goBack();
}
$this->_redirect('*/*');
}
The call to $this->_goBack()
in the end of the try-block seems to set the redirect URL correctly by looking at settings and a 'return_url' parameter (and I've verified that the code gets this far). But, as you can see, the last line always sets a redirect to */*
no matter what. Just adding a return statement after the _goBack() call fixes the problem but I rather do this without modifying the core files.
Any ideas how I can solve this problem?
magento-1.9 cart redirect magento-ce
magento-1.9 cart redirect magento-ce
asked Jul 23 '15 at 14:15
Simon StrandmanSimon Strandman
162
162
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38
add a comment |
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38
add a comment |
1 Answer
1
active
oldest
votes
If you want the customer to say on the update page you could
Use Ajax to post the changes to the server.
Add a
return_url
parameter to your post action (with the current url seeprotected function _goBack()
)Change the global behavior for adding and updatig product in System -> Configuration -> Sales tab -> Checkout and then in the Shopping Cart tab you set the After Adding a Product Redirect to Shopping Cart
Rewrite the controller using a custom module
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f75478%2fmodifying-the-redirect-after-editing-a-product-in-the-cart%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want the customer to say on the update page you could
Use Ajax to post the changes to the server.
Add a
return_url
parameter to your post action (with the current url seeprotected function _goBack()
)Change the global behavior for adding and updatig product in System -> Configuration -> Sales tab -> Checkout and then in the Shopping Cart tab you set the After Adding a Product Redirect to Shopping Cart
Rewrite the controller using a custom module
add a comment |
If you want the customer to say on the update page you could
Use Ajax to post the changes to the server.
Add a
return_url
parameter to your post action (with the current url seeprotected function _goBack()
)Change the global behavior for adding and updatig product in System -> Configuration -> Sales tab -> Checkout and then in the Shopping Cart tab you set the After Adding a Product Redirect to Shopping Cart
Rewrite the controller using a custom module
add a comment |
If you want the customer to say on the update page you could
Use Ajax to post the changes to the server.
Add a
return_url
parameter to your post action (with the current url seeprotected function _goBack()
)Change the global behavior for adding and updatig product in System -> Configuration -> Sales tab -> Checkout and then in the Shopping Cart tab you set the After Adding a Product Redirect to Shopping Cart
Rewrite the controller using a custom module
If you want the customer to say on the update page you could
Use Ajax to post the changes to the server.
Add a
return_url
parameter to your post action (with the current url seeprotected function _goBack()
)Change the global behavior for adding and updatig product in System -> Configuration -> Sales tab -> Checkout and then in the Shopping Cart tab you set the After Adding a Product Redirect to Shopping Cart
Rewrite the controller using a custom module
answered Jul 23 '15 at 14:41
Renon StewartRenon Stewart
12.2k12044
12.2k12044
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f75478%2fmodifying-the-redirect-after-editing-a-product-in-the-cart%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could either override the CartController in a custom module, or find another way around. As far as I know, when you edit a configurable product, it should redirect you to the cart (default behavior) which seems logical because you wanted to change the option, not gaze at the product once more. Why would you want customers to stay on the edit page?
– Julien Lachal
Jul 23 '15 at 14:38