2012-11-27 2 views
1

magento에 새로운 배송 방법을 구현하는 모듈을 만들었습니다. 현재 모듈이 잘 작동합니다.Magento : 추가 속성을 사용하여 자체 배송 방법 만들기

배송 방법이 한 페이지 결제에 표시됩니다.

class Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung extends Mage_Shipping_Model_Carrier_Abstract 

이제 기능을 확장하고 싶습니다. 새로운 선적 모듈이 프론트 엔드에 더 이상 보이지 않아야합니다. 따라서 새로운 속성을 모듈에 추가했습니다. (show_frontend)

config.xml에

<default> 
     <carriers> 
      <selbstabholung> 
       <active>1</active> 
       <allowed_methods>selbstabholung</allowed_methods> 
       <methods>selbstabholung</methods> 
       <sallowspecific>0</sallowspecific> 
       <model>Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung</model> 
       <name>Selbstabholung</name> 
       <title>Selbstabholung</title> 
       <specificerrmsg>Zur Zeit ist die Versandmethode nicht verfuegbar</specificerrmsg> 
       <handling>0</handling> 
       <handling_type>F</handling_type> 
       <show_frontend>0</show_frontend> 
      </selbstabholung> 
     </carriers> 

    system.xml 
<show_frontend translate="label"> 
          <label>zeige im Frontend?</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>1</show_in_store> 
         </show_frontend> 

속성 show_frontend 백엔드에 도시 ​​또한 core_config_data 테이블에 저장된다.

큰 문제는 사용자 선택을 위해 한 페이지 체크 아웃에 대한 배송 방법을 가져 오는 중에 개체에 show_frontend 속성이없는 것입니다.

나는 배송 방법 목록에 사용되는 객체가 속도 객체가 show_frontend 속성에 대해 알고, 그래서 내가 무엇을 연장해야합니까

Mage_Sales_Model_Quote_Address_Rate 

생각?

답변

0

별관 :

프런트 엔드에 배송 방법을 표시하고 싶습니다. 백엔드 주문을위한 백엔드에서 나는 그것을 보여주고 싶다.

그래서 collectRates() 메소드에서 다음 조건을 구현했습니다.

if(Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND && 
     !Mage::getStoreConfig('carriers/'.$this->_code.'/show_frontend')){ 

     return false; 
    } 

이제 완벽하게 작동합니다.

1

모듈을 모두 insed하고 있습니까?

그냥 그것을 할 : 당신의 collectRates에

() 메소드는이 코드를 넣어 :

if(!Mage::getStoreConfig('carrier/selbstabholung/show_frontend')) 
    return false; 

이 코드 작업을 수행해야합니다.

안녕하세요.

+0

젠장, 너 rigre! 고마워. 나는 완결을 생각하고 있었다. :-) –

+0

예, 때로는 magento도 간단 할 수 있습니다. ;) Pls는 대답을 오른쪽으로 표시합니다. ~ ^ – Guerra

관련 문제