Magento redirect to checkout after adding to cart
I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.
Is there any way to make it successful?
Please suggest me.
checkout magento-1 redirect
bumped to the homepage by Community♦ 8 hours 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 want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.
Is there any way to make it successful?
Please suggest me.
checkout magento-1 redirect
bumped to the homepage by Community♦ 8 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19
add a comment |
I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.
Is there any way to make it successful?
Please suggest me.
checkout magento-1 redirect
I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.
Is there any way to make it successful?
Please suggest me.
checkout magento-1 redirect
checkout magento-1 redirect
edited Mar 7 '17 at 12:05
7ochem
5,76293768
5,76293768
asked May 8 '16 at 12:42
JamesljJameslj
50639
50639
bumped to the homepage by Community♦ 8 hours 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♦ 8 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19
add a comment |
1
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19
1
1
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19
add a comment |
2 Answers
2
active
oldest
votes
Assume that you have using magento 1.x version
and assume that you does not want access checkout/cart/
at all time.
For this case you can use Magento Event/observer.
This is case use magento event controller_action_predispatch_checkout_cart_index
and from this event observer redirect to checkout/onepage/
page
<global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>
Observer:
<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();
}
}
add a comment |
My final observer:
I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.
public function forceCheckoutRedirect($observer){
$numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
// force redirct to checkout page if cart is not empty
if($numberOfItems > 0) {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('onepage'))
->sendResponse();
exit();
}
else {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('/'))
->sendResponse();
exit();
}
}
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f114443%2fmagento-redirect-to-checkout-after-adding-to-cart%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assume that you have using magento 1.x version
and assume that you does not want access checkout/cart/
at all time.
For this case you can use Magento Event/observer.
This is case use magento event controller_action_predispatch_checkout_cart_index
and from this event observer redirect to checkout/onepage/
page
<global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>
Observer:
<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();
}
}
add a comment |
Assume that you have using magento 1.x version
and assume that you does not want access checkout/cart/
at all time.
For this case you can use Magento Event/observer.
This is case use magento event controller_action_predispatch_checkout_cart_index
and from this event observer redirect to checkout/onepage/
page
<global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>
Observer:
<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();
}
}
add a comment |
Assume that you have using magento 1.x version
and assume that you does not want access checkout/cart/
at all time.
For this case you can use Magento Event/observer.
This is case use magento event controller_action_predispatch_checkout_cart_index
and from this event observer redirect to checkout/onepage/
page
<global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>
Observer:
<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();
}
}
Assume that you have using magento 1.x version
and assume that you does not want access checkout/cart/
at all time.
For this case you can use Magento Event/observer.
This is case use magento event controller_action_predispatch_checkout_cart_index
and from this event observer redirect to checkout/onepage/
page
<global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>
Observer:
<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();
}
}
edited May 8 '16 at 13:34
answered May 8 '16 at 13:24
Amit Bera♦Amit Bera
58.3k1475174
58.3k1475174
add a comment |
add a comment |
My final observer:
I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.
public function forceCheckoutRedirect($observer){
$numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
// force redirct to checkout page if cart is not empty
if($numberOfItems > 0) {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('onepage'))
->sendResponse();
exit();
}
else {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('/'))
->sendResponse();
exit();
}
}
add a comment |
My final observer:
I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.
public function forceCheckoutRedirect($observer){
$numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
// force redirct to checkout page if cart is not empty
if($numberOfItems > 0) {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('onepage'))
->sendResponse();
exit();
}
else {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('/'))
->sendResponse();
exit();
}
}
add a comment |
My final observer:
I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.
public function forceCheckoutRedirect($observer){
$numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
// force redirct to checkout page if cart is not empty
if($numberOfItems > 0) {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('onepage'))
->sendResponse();
exit();
}
else {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('/'))
->sendResponse();
exit();
}
}
My final observer:
I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.
public function forceCheckoutRedirect($observer){
$numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
// force redirct to checkout page if cart is not empty
if($numberOfItems > 0) {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('onepage'))
->sendResponse();
exit();
}
else {
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('/'))
->sendResponse();
exit();
}
}
answered Mar 7 '17 at 11:17
mlavelamlavela
476
476
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f114443%2fmagento-redirect-to-checkout-after-adding-to-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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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
1
magento verision?
– Amit Bera♦
May 8 '16 at 12:56
Want the redirection for after cart or at any time if user hit checkout/cart/
– Amit Bera♦
May 8 '16 at 13:19