2012-11-19 5 views
0

- Magento Pro, ver. 1.11.1.0--Magento Pro 배송 방법로드 중

새로 추가 된 정액 요금 모듈은 Magento의 한 페이지 결제를 위반합니다. 배송지 주소를 설정 한 후에는 "다음 단계로드 중"으로 깜박이지만 다음 단계는 절대로드되지 않습니다. 새 모듈을 비활성화하면 다시 작동합니다. 여기에 관련된 설정 파일은 다음과 같습니다

/app/code/local/TEST/Shipping/etc/config.xml

<?xml version="1.0"?> 
<config> 
    <modules> 
     <TEST_Shipping> 
      <version>0.1.0</version> 
      <depends> 
       <Mage_Shipping /> 
      </depends> 
     </TEST_Shipping> 
    </modules> 
    <global> 
     <models> 
      <gtshipping> 
       <class>TEST_Shipping</class> 
      </gtshipping> 
     </models> 
     <resources> 
      <gtshipping_setup> 
       <setup> 
        <module>TEST_Shipping</module> 
       </setup> 
       <connection> 
        <use>directory_setup</use> 
       </connection> 
      </gtshipping_setup> 
      <gtshipping_read> 
       <connection> 
        <use>local_read</use> 
       </connection> 
      </gtshipping_read> 
     </resources> 
     <sales> 
      <shipping> 
       <carriers> 
        <flatrate2> 
         <class>TEST_Shipping_Model_Carrier_Flatrate2</class> 
        </flatrate2> 
       </carriers> 
      </shipping> 
     </sales> 
    </global> 
    <default> 
     <carriers> 
      <flatrate2> 
       <active>1</active> 
       <sallowspecific>0</sallowspecific> 
       <model>test_shipping_model_carrier_flatrate2</model> 
       <name>Fixed</name> 
       <price>5.00</price> 
       <title>Flat Rate</title> 
       <type>I</type> 
       <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg> 
       <handling_type>F</handling_type> 
      </flatrate2> 
     </carriers> 
    </default> 
</config> 

/응용 프로그램/코드/지역/TEST/배송/etc/system에 .XML

<?xml version="1.0"?> 
<config> 
<sections> 
<carriers> 
<groups> 
<flatrate2 translate="label"> 
        <label>Flat Rate</label> 
        <frontend_type>text</frontend_type> 
        <sort_order>2</sort_order> 
        <show_in_default>1</show_in_default> 
        <show_in_website>1</show_in_website> 
        <show_in_store>1</show_in_store> 
        <fields> 
         <active translate="label"> 
          <label>Enabled</label> 
          <frontend_type>select</frontend_type> 
          <source_model>adminhtml/system_config_source_yesno</source_model> 
          <sort_order>1</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </active> 
         <name translate="label"> 
          <label>Method Name</label> 
          <frontend_type>text</frontend_type> 
          <sort_order>3</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
         </name> 
         <price translate="label"> 
          <label>Price</label> 
          <frontend_type>text</frontend_type> 
          <sort_order>5</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </price> 
         <handling_type translate="label"> 
          <label>Calculate Handling Fee</label> 
          <frontend_type>select</frontend_type> 
          <source_model>shipping/source_handlingType</source_model> 
          <sort_order>7</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </handling_type> 
         <handling_fee translate="label"> 
          <label>Handling Fee</label> 
          <frontend_type>text</frontend_type> 
          <sort_order>8</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </handling_fee> 
         <sort_order translate="label"> 
          <label>Sort Order</label> 
          <frontend_type>text</frontend_type> 
          <sort_order>100</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </sort_order> 
         <title translate="label"> 
          <label>Title</label> 
          <frontend_type>text</frontend_type> 
          <sort_order>2</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
         </title> 
         <type translate="label"> 
          <label>Type</label> 
          <frontend_type>select</frontend_type> 
          <source_model>adminhtml/system_config_source_shipping_flatrate</source_model> 
          <sort_order>4</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </type> 
         <sallowspecific translate="label"> 
          <label>Ship to Applicable Countries</label> 
          <frontend_type>select</frontend_type> 
          <sort_order>90</sort_order> 
          <frontend_class>shipping-applicable-country</frontend_class> 
          <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </sallowspecific> 
         <specificcountry translate="label"> 
          <label>Ship to Specific Countries</label> 
          <frontend_type>multiselect</frontend_type> 
          <sort_order>91</sort_order> 
          <source_model>adminhtml/system_config_source_country</source_model> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
          <can_be_empty>1</can_be_empty> 
         </specificcountry> 
         <showmethod translate="label"> 
          <label>Show Method if Not Applicable</label> 
          <frontend_type>select</frontend_type> 
          <sort_order>92</sort_order> 
          <source_model>adminhtml/system_config_source_yesno</source_model> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>0</show_in_store> 
         </showmethod> 
         <specificerrmsg translate="label"> 
          <label>Displayed Error Message</label> 
          <frontend_type>textarea</frontend_type> 
          <sort_order>80</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
         </specificerrmsg> 
         <model translate="label"> 
           <label>Model</label> 
           <frontend_type>text</frontend_type> 
           <sort_order>900</sort_order> 
           <show_in_default>1</show_in_default> 
           <show_in_website>1</show_in_website> 
         </model> 
        </fields> 
       </flatrate2> 
      </groups> 
     </carriers> 
    </sections> 
</config> 

/app/code/local/TEST/Shipping/Model/Carrier/Flatrate2.php

,
class TEST_Shipping_Model_Carrier_Flatrate2 
    extends Mage_Shipping_Model_Carrier_Abstract 
    implements Mage_Shipping_Model_Carrier_Interface 
{ 

    protected $_code = 'flatrate2'; 
    protected $_isFixed = true; 

    /** 
    * Enter description here... 
    * 
    * @param Mage_Shipping_Model_Rate_Request $data 
    * @return Mage_Shipping_Model_Rate_Result 
    */ 
    public function collectRates(Mage_Shipping_Model_Rate_Request $request) 
    { 
     if (!$this->getConfigFlag('active')) { 
      return false; 
     } 

     $freeBoxes = 0; 
     if ($request->getAllItems()) { 
      foreach ($request->getAllItems() as $item) { 

       if ($item->getProduct()->isVirtual() || $item->getParentItem()) { 
        continue; 
       } 

       if ($item->getHasChildren() && $item->isShipSeparately()) { 
        foreach ($item->getChildren() as $child) { 
         if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) { 
          $freeBoxes += $item->getQty() * $child->getQty(); 
         } 
        } 
       } elseif ($item->getFreeShipping()) { 
        $freeBoxes += $item->getQty(); 
       } 
      } 
     } 
     $this->setFreeBoxes($freeBoxes); 

     $result = Mage::getModel('shipping/rate_result'); 
     if ($this->getConfigData('type') == 'O') { // per order 
      $shippingPrice = $this->getConfigData('price'); 
     } elseif ($this->getConfigData('type') == 'I') { // per item 
      $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price')); 
     } else { 
      $shippingPrice = false; 
     } 

     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice); 

     if ($shippingPrice !== false) { 
      $method = Mage::getModel('shipping/rate_result_method'); 

      $method->setCarrier('flatrate2'); 
      $method->setCarrierTitle($this->getConfigData('title')); 

      $method->setMethod('flatrate2'); 
      $method->setMethodTitle($this->getConfigData('name')); 

      if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) { 
       $shippingPrice = '0.00'; 
      } 


      $method->setPrice($shippingPrice); 
      $method->setCost($shippingPrice); 

      $result->append($method); 
     } 

     return $result; 
    } 

    public function getAllowedMethods() 
    { 
     return array('flatrate2'=>$this->getConfigData('name')); 
    } 

} 

누구나 아이디어가 표시되지 않는 이유는 무엇입니까? 콘솔에 아약스로드 오류가 표시되지 않습니다.

감사합니다.

답변

0

고정! 이는 모델의 이름 지정 때문이었습니다. 테스트를 위해 config의 모델 정의에 대문자로 입력해야했습니다.

관련 문제