2012-09-24 3 views
4

내가이 설정으로 OnepageController을 확장하려고 시도하고있어 확장하는 방법 :젠토 1.7 - 코어 컨트롤러에게

응용 프로그램은/etc/모듈/Custom_Checkout.xml

<config> 
    <modules> 
     <Custom_Checkout> 
      <active>true</active> 
      <codePool>local</codePool> 
     </Custom_Checkout> 
    </modules> 
</config> 

응용 프로그램/지역/사용자 정의/체크 아웃을 /etc/config.xml

<?xml version="1.0" encoding="UTF-8"?> 
<config> 
    <modules> 
     <Custom_Checkout> 
      <version>0.0.1</version> 
     </Custom_Checkout> 
    </modules> 
    <frontend> 
     <routers> 
      <checkout> 
       <args> 
        <modules> 
         <custom_checkout before="Mage_Checkout">Custom_Checkout</custom_checkout> 
        </modules> 
       </args> 
      </checkout> 
     </routers> 
    </frontend> 
</config> 

응용 프로그램/지역/사용자 정의/체크 아웃/컨트롤러/OnepageController.php

require_once("Mage/Checkout/controllers/OnepageController.php"); 

class Custom_Checkout_OnepageController extends Mage_Checkout_OnepageController 
{ 

    public function indexAction() 
    { 
    echo "Index overidden"; 
    } 

} 

나는이 본 적이 : Extend magento core controller (Checkout/OnepageController)

http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller

플러스 좀 더 내가 게시 할 수 있지만, 위의 방법 중 어느 것도 제대로 작동하지 않습니다. 그것은 단지 컨트롤러를 덮어 쓰지 않습니다.

왜 이것이 덮어 쓰지 않는지에 대한 아이디어가 있습니까?

+0

캐시를 새로 고쳤습니까? – ivantedja

+0

당신의'app/local /'경로는'app/code/local'이어야합니다. –

+0

동일한 문제가 있었고 디버깅 후에 다른 모듈이 이미 OnPageCntroller.php에 과부하가 걸린 것을 발견했습니다. 심지어로드. 설치된 다른 모듈도 확인하는 것이 좋습니다. – KoviNET

답변

0

나는 해결책이 올바른 경우라고 생각합니다. 대신에 :

<custom_checkout before="Mage_Checkout">Custom_Checkout</custom_checkout> 

는 주문한다 :

<Custom_Checkout before="Mage_Checkout">Custom_Checkout</Custom_Checkout> 
1

이있다, 불행하게도, 잘못된 여기에있을 수있는 수많은 일들, 그리고 게시물에 충분한 정보를 추적 할 수 있습니다. 대답 대신 디버깅 팁이 있습니다. _validateControllerClassName 함수를 살펴보십시오. 각 return false

protected function _validateControllerClassName($realModule, $controller) 
{ 
    $controllerFileName = $this->getControllerFileName($realModule, $controller); 
    if (!$this->validateControllerFileName($controllerFileName)) { 
     return false; 
    } 

    $controllerClassName = $this->getControllerClassName($realModule, $controller); 
    if (!$controllerClassName) { 
     return false; 
    } 

    // include controller file if needed 
    if (!$this->_includeControllerClass($controllerFileName, $controllerClassName)) { 
     return false; 
    } 

    return $controllerClassName; 
} 

는 마 젠토는 요청에 대한 컨트롤러 클래스를 사용하지 않으 수있는 상태입니다. if 문 안팎에있는 $controllerFileName, $controllerClassName의 일부 로깅 또는 var_dump 인을 추가해보십시오. 보통 파일 경로 이름이나 클래스의 작은 실수 (대소 문자, 문자 누락 등)를 지적하기에 충분합니다.

Custom_Checkout과 관련된 정보가 전혀 없다면 Magento가 모듈을 볼 수 없으므로 디버깅을 시작해야 함을 의미합니다.