問題描述
是否可以將瀏覽器重定向到單頁結帳的第 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; ?>');
這篇關于鏈接到單頁結帳中的特定步驟的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!