remove step2 billing information

remove step2 billing information
有點部分與ttp://www.excellencemagentoblog.com/magento-onestep-checkout-remove-payment-method-step相同
checkout
block  onepage.php
    public function getSteps()
    {
        $steps = array();

        if (!$this->isCustomerLoggedIn()) {
            $steps['login'] = $this->getCheckout()->getStepData('login');
        }

        $stepCodes = array( 'shipping', 'shipping_method', 'payment', 'review');

        foreach ($stepCodes as $step) {
            $steps[$step] = $this->getCheckout()->getStepData($step);
        }
        return $steps;
    }

    public function getActiveStep()
    {
        return $this->isCustomerLoggedIn() ? 'shipping' : 'login';
    }

controllers onepage.php
    public function saveShippingAction()
    {
        if ($this->_expireAjax()) {
            return;
        }
        if ($this->getRequest()->isPost()) {
            
            $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);
            
            $data = $this->getRequest()->getPost('shipping', array());
            $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
            $result = $this->getOnepage()->saveShipping($data, $customerAddressId);

            if (!isset($result['error'])) {
                $result['goto_section'] = 'shipping_method';
                $result['update_section'] = array(
                    'name' => 'shipping-method',
                    /**
                     * FIXME: 修改了郵寄費輸出格式SaveShipping
                     */
                    'html' => preg_replace("/(>cn)|(>us)/i",'>',$this->_getShippingMethodsHtml())
                );
            }
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }
opcheckout.js
        this.steps = ['login', 'shipping', 'shipping_method', 'payment', 'review'];

    由於使用的是prototype必須保證模板裏面billing和shipping相同,也是把shipping模板中缺少的部分,從billing模板複製過來,放在對應的位置。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章