magento中的OnepageController.php中的条件检查和设置

magento中的OnepageController.php中的条件检查和设置,magento,cart,shipping,review,Magento,Cart,Shipping,Review,在我的magento站点中,我有价格为0.00的产品 所以我在结账时隐藏了付款信息 也就是说,我在app/code/core/Mage/Checkout/Block/Onepage/Abstract.php中更改了代码 在这个函数中_getStepCodes() 我将代码替换为以下内容: $sub = Mage::getSingleton('checkout/cart')->getQuote()->getData(); $subtotal = $sub['base_s

在我的magento站点中,我有价格为0.00的产品

所以我在结账时隐藏了付款信息

也就是说,我在app/code/core/Mage/Checkout/Block/Onepage/Abstract.php中更改了代码

在这个函数中_getStepCodes()

我将代码替换为以下内容:

$sub = Mage::getSingleton('checkout/cart')->getQuote()->getData();
        $subtotal = $sub['base_subtotal'];
        if($subtotal == 0){
            return array('login', 'billing', 'shipping', 'shipping_method', 'review');
        }else{
            return array('login', 'billing', 'shipping', 'shipping_method', 'payment', 'review');
        }
因此,
支付信息
不会显示

那么我想在这里做的是:

如果产品总价为零,则在单击
装运方法后转到
订单审核

如果产品价格不为零,则正常获取付款信息

所以我在app/code/core/Mage/Checkout/controllers/OnepageController.php中编写代码

在本页中,我更改了功能,并更新了:

public function saveShippingMethodAction()
{
    if ($this->_expireAjax()) {
        return;
    }
    if ($this->getRequest()->isPost()) {
        $data = $this->getRequest()->getPost('shipping_method', '');
        $result = $this->getOnepage()->saveShippingMethod($data);
        /*
        $result will have erro data if shipping method is empty
        */
        if(!$result) {
            Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
                    array('request'=>$this->getRequest(),
                        'quote'=>$this->getOnepage()->getQuote()));
            $this->getOnepage()->getQuote()->collectTotals();
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
            $sub = Mage::getSingleton('checkout/cart')->getQuote()->getData();
            $subtotal = $sub['base_subtotal'];
            if($subtotal == 0){
                 $this->loadLayout('checkout_onepage_review');
                $result['goto_section'] = 'review';
                $result['update_section'] = array(
                    'name' => 'review',
                    'html' => $this->_getReviewHtml()
                );
            }else{
                $result['goto_section'] = 'payment';
                $result['update_section'] = array(
                    'name' => 'payment-method',
                    'html' => $this->_getPaymentMethodsHtml()
                );
        }
        $this->getOnepage()->getQuote()->collectTotals()->save();
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
    }
}
}

当产品价格大于零时,它工作正常

但如果产品价格为零,则不会进入步骤
订单审核

但在fre-bug中有
json
代码的
Order-Review

这有什么问题

它在
firebug
中加载了
json
Order Review
代码,但没有在站点中加载


如何解决此问题?

存在零小计结账。这对你不起作用吗?这对我不起作用…所以你的zerosubtotal签出应该起作用,如果你签入干净的magento版本是否起作用?但我想在我的核心文件中签入它。我不需要Zero Subtotal签出