magento 1.8.1中的送货方式无效?

时间:2015-07-03 10:11:23

标签: magento-1.8

magento 1.8.1中的送货方式无效?

当我的购物车价值在950 - 999 INR但低于950或高于999时工作正常吗?

下面是一页控制器代码。

请帮助我

onePageController.php

<?php

require_once Mage::getModuleDir('controllers', 'Mage_Checkout').DS.'OnepageController.php';

class Webly_QuickCheckout_OnepageController extends Mage_Checkout_OnepageController
{
    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']);
            }
            $data['use_for_shipping'] = 1;
            $result = $this->getOnepage()->saveBilling($data, $customerAddressId);

            if (!isset($result['error'])) {

                if (!isset($result['error'])) {

                    if ($this->getOnepage()->getQuote()->isVirtual()) {
                        $result['goto_section'] = 'payment';
                        $result['update_section'] = array(
                            'name' => 'payment-method',
                            'html' => $this->_getPaymentMethodsHtml()
                        );
                    } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {

                        $quote =$this->getOnepage()->getQuote();
                        $quote->getBaseGrandTotal();
                        $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
                        if ($quote->getBaseGrandTotal() < 1000) {
                            $method = 'inchoo_shipping_fixed';
                        } else {
                            $method = 'inchoo_shipping_free';
                        }

//                        $method = 'flatrate_flatrate';


                        $result = $this->getOnepage()->saveShippingMethod($method);
                        Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()-> setShippingMethod($method)->save();
                        $result['update_section'] = array(
                            'name' => 'payment-method',
                            'html' => $this->_getPaymentMethodsHtml()
                        );
                        $result['goto_section'] = 'payment';
                    } else {
                        $result['goto_section'] = 'shipping';
                    }
                }
            }

            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }
}

0 个答案:

没有答案