问题描述
是否可以将浏览器重定向到单页结帐的第 n 步?如果是这样,人们将如何去做?
Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it?
我正在开发一个付款模块,并且有一种取消"操作,我希望将用户返回到您选择付款方式的结帐步骤.
I'm working on a payment module and have a sort of "cancel" action that i would like to return the user to the step in checkout where you choose the payment method.
我目前将用户返回到结帐的第一步,如下所示:
I currently return the user to the first step of the checkout like so:
$this->_redirect('checkout/onepage', array('_secure'=>true));
另一个问题是我不是一直都在工作,在某些浏览器中,我真的不想将这种作品命名为有时".这是众所周知的和/或普遍接受的吗?我对此的实际信息很少,但我收到了客户对这种行为的投诉.他们通常不会给我任何细节,所以这是一个死胡同.
Another issue with this is that i does not work all the time, in certain browsers i'd really not like to name this sort of works "sometimes". Is that something that is known and/or commonly accepted? I have very little actual information regarding this, but i've had complaints from customers about this behaviour. They generally won't give me any specifics so it's kind of a dead end.
推荐答案
checkout/onepage.phtml:
在 PHP 中
$step = Mage::app()->getRequest()->getParam('step');
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
if (($step) && (in_array($step,$stepCodes)) && ($this->getActiveStep() == 'billing')) {
$checkout = Mage::getSingleton('checkout/type_onepage');
$checkout->saveBilling(Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->toArray(),false);
$checkout->saveShipping(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->toArray(),false);
$checkout->saveShippingMethod(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod());
$activestep = Mage::app()->getRequest()->getParam('step');
}
else
if($this->getActiveStep()) {
$activestep = $this->getActiveStep();
}
在 JavaScript 中
accordion.openSection('opc-<?php /* edit */ echo $activestep; ?>');
这篇关于链接到单页结帐中的特定步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!