链接到一页结帐中的特定步骤 [英] Link to a specific step in onepage checkout

查看:61
本文介绍了链接到一页结帐中的特定步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将浏览器重定向到一页结帐中的第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; ?>');

这篇关于链接到一页结帐中的特定步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆