문제

내가 노력하고 재정 모델 등을 방지하는 고객의 변화하는 운송 주소 및 방법을 사용(최종)기 위해 검토 단계의 체크 아웃,사용 이 제안.이것은 포인트는 고객에서 반환되는 페이팔을 확인하기 위해서 이해하기 전에 마지막으로 클릭하면'주문'버튼을 클릭합니다.우리가 사전 동의 운송 비용과 함께 우리의 고객을 통해 인용 그래서 그들에게 옵션을 변경하는 방법을 발송하지 않습니다.

이것은 나의 첫 번째 시도에서 이렇게 하는 Magento.그것은 같은 느낌이 나는 이 있지만 그것은 작동하지 않:

Review Order Shipping Method is still editable

면 사람의 경험으로 재정 모델에서 클래스 Magento 수 있을 말해 내가 어디가 잘못된 것이 환상적입니다.

(1)
(a)만들/응용 프로그램/드/local/Lms/Paypal/모델/익스프레스 및 복사/app/code/core/Mage/Paypal/Model/Express/Checkout.php

(b)이름 바꾸기에서 클래스 Checkout.php from:Mage_Paypal_Model_Express_Checkout 하기:Lms_Paypal_Model_Express_Checkout 확장 Mage_Paypal_Model_Express_Checkout

(c)취소 수준의 몸으로 대체 단 이 기능:

/**
 * Check whether order review has enough data to initialize
 *
 * @param $token
 * @throws Mage_Core_Exception
 */
public function prepareOrderReview($token = null)
{
    parent::prepareOrderReview($token);
    $this->_quote->setMayEditShippingAddress(false);
    $this->_quote->setMayEditShippingMethod(false);
    $this->_ignoreAddressValidation();
    $this->_quote->collectTotals()->save();
}

(2)
(a)이제 만들 dir/응용 프로그램/드/local/Lms/Paypal/etc/
(b)만들기 Config.xml 에서 파일을 dir 및 이 코드가 있:

<?xml version="1.0"?>
<config>
    <modules>
        <lms_paypal>
            <version>0.1</version>
        </lms_paypal>
    </modules>
    <global>
       <models>
          <paypal>
              <rewrite>
                  <express>Lms_Paypal_Model_Express</express>
              </rewrite>
          </paypal>
       </models>
    </global>
</config>

(3)
(a)로 이동하/응용 프로그램/etc/modules/
(b)만들기 Lms_Paypal.xml 에서는 dir 과이 Lms_Paypal.xml:

<?xml version="1.0"?>  
<config>  
    <modules>  
        <Lms_Paypal>  
            <active>true</active>  
            <codePool>local</codePool>  
        </Lms_Paypal>  
    </modules>  
</config> 
도움이 되었습니까?

해결책

귀하의 잘못된 길에서 /app/code/local/Lms/Paypal/etc/config.xml 모델 파일

/app/code/local/Lms/Paypal/Model/Express/Checkout.php

대체 config.xml 파일 코드

<?xml version="1.0"?>
<config>
    <modules>
        <lms_paypal>
            <version>0.1</version>
        </lms_paypal>
    </modules>
    <global>
       <models>
          <paypal>
              <rewrite>
                  <express>Lms_Paypal_Model_Express</express>
              </rewrite>
          </paypal>
       </models>
    </global>
</config>

하기

<?xml version="1.0"?>
<config>
    <modules>
        <Lms_Paypal>
            <version>0.1</version>
        </Lms_Paypal>
    </modules>
    <global>
       <models>
          <paypal>
              <rewrite>
                  <express_checkout>Lms_Paypal_Model_Express_Checkout</express_checkout>
              </rewrite>
          </paypal>
       </models>
    </global>
</config>

또한 교체 코드에서 파일 app/code/local/Lms/Paypal/Model/Express/Checkout.php

public function prepareOrderReview($token = null)
{
    parent::prepareOrderReview($token);
    $this->_quote->setMayEditShippingAddress(false);
    $this->_quote->setMayEditShippingMethod(false);
    $this->_ignoreAddressValidation();
    $this->_quote->collectTotals()->save();
}

하기

class Lms_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout
{

    public function prepareOrderReview($token = null)
    {
        $payment = $this->_quote->getPayment();
        if (!$payment || !$payment->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID)) {
            Mage::throwException(Mage::helper('paypal')->__('Payer is not identified.'));
        }
        $this->_quote->setMayEditShippingAddress(false);
        $this->_quote->setMayEditShippingMethod(false);
        $this->_ignoreAddressValidation();
        $this->_quote->collectTotals()->save();
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top