付款信息在Magento单页结账中没有显示任何内容

时间:2015-04-01 06:18:28

标签: magento magento-1.9 magento-1.9.1

我正在使用Magento 1.9.1.0版。我想从一页结帐页面中删除送货信息和送货方法步骤。为此,我更改了核心文件中的一些代码,如:

app\code\core\Mage\Checkout\Block\Onepage.php

public function getSteps()
    {

        $steps = array();
        $stepCodes = $this->_getStepCodes();
        /* remove Shipping address and Shipping Method */
        $excludeStep=array_diff($stepCodes,array('shipping','shipping_method'));
        //$excludeStep=$stepCodes;
        if ($this->isCustomerLoggedIn()) {
            $stepCodes = array_diff($excludeStep, array('login'));
        }
        foreach ($excludeStep as $step) {
            $steps[$step] = $this->getCheckout()->getStepData($step);
        }
        return $steps;

    }

并在app\code\core\Mage\Checkout\controllers\OnepageController.php

public function saveBillingAction()
    {
        if ($this->_expireAjax()) {
            return;
        }
        if ($this->getRequest()->isPost()) {
//            $postData = $this->getRequest()->getPost('billing', array());
//            $data = $this->_filterPostData($postData);
            $data = $this->getRequest()->getPost('billing', array());
            $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

            if (isset($data['email'])) {
                $data['email'] = trim($data['email']);
            }
            $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
            /* Force full save Shpping Addredd */
            $resultShipp = $this->getOnepage()->saveShipping($data, $customerAddressId);
            $resultShipMethod = $this->getOnepage()->saveShippingMethod('freeshipping_freeshipping');
            Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()-> setShippingMethod('freeshipping_freeshipping')->save();
            if (!isset($result['error'])) {
                /* check quote for virtual */
                if ($this->getOnepage()->getQuote()->isVirtual()) {
                    $result['goto_section'] = 'payment';
                    $result['update_section'] = array(
                        'name' => 'payment-method',
                        'html' => $this->_getPaymentMethodsHtml()
                    );
                }
else

               {
                    /* force full set of shipping is free */
                        $shipping_method=array('shipping_method'=>'freeshipping_freeshipping');
                        $save_shippingmethod = $this->getOnepage()->saveShippingMethod($shipping_method);          
                        if(!$save_shippingmethod)
                        {
                        $event =    Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
                                        array('request'=>$this->getRequest(),
                                            'quote'=>$this->getOnepage()->getQuote()));
                        $this->getOnepage()->getQuote()->collectTotals();
                        }
                        $this->getOnepage()->getQuote()->collectTotals()->save();
                        $this->getOnepage()->getQuote()->getShippingAddress()->setShippingMethod($shipping_method);
                        /* */
                    $result['goto_section'] = 'payment';
                }
            }
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }

执行上述代码后,过程栏中没有显示送货地址和送货方式。但在付款信息部分,没有付款方式。在删除步骤之前,货到付款的方法即将到来。但现在没有可用的付款方式。

0 个答案:

没有答案