2014-01-26 8 views
1

hostjars 스타터 파일을 사용하여 첫 번째 Opencart (1.5.6) 플러그인을 개발했습니다.Opencart 사용자 정의 모듈이 프론트 엔드에 표시되지 않습니다.

관리 섹션이 아름답게 작동하며 모든 프론트 엔드 코드가 배치되었습니다. 그러나 어떤 이유로 관리자가 위치가 정의되어 있어도 웹 페이지에 모듈이 표시되지 않습니다.

<?php class ControllerModulebevyspecials extends Controller { 
protected function index($setting) { 
    //Load the language file 
    $this->language->load('module/bevy_specials'); 

    //Load the models 
    $this->load->model('module/bevy_specials'); 

    //Get the title from the language file 
    $this->data['heading_title'] = $this->language->get('heading_title'); 

    //Retrieve Checkout Special Products 
    $products = $this->model_module_bevy_specials->getBevySpecials(); 
    if(Count($products)>0){   
     foreach ($products as $product) { 
      $product_info = $this->model_catalog_product->getProduct($product['product_id']); 
      $this->data['title'] = $product['title']; 
      if (isset($product_info)) { 
       $this->data['products'][] = array(
        'product_id' => $product_info['product_id'], 
        'name'   => $product_info['name'], 
        'discount'  => $product['discount'] 
       ); 
      } 
     } 
    } 
    else{ 
     $this->data['noRecord'] = true; 
    } 

    //Choose which template to display this module with 
    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/bevy_specials.tpl')) { 
     $this->template = $this->config->get('config_template') . '/template/module/bevy_specials.tpl'; 
    } else { 
     $this->template = 'default/template/module/bevy_specials.tpl'; 
    } 

    //Render the page with the chosen template 
    $this->render(); 
} } ?> 

나는 어떤 특정 코드 표시가 실종 : 아래

은 (내가 아마도 컨트롤러가 호출이나 뭐하고 있지 않은지 생각하게 참고로, 오류가 발생하지 않습니다) 참조 용 프론트 엔드 컨트롤러 코드 웹 페이지의 모듈?

모듈 개발과 관련하여 Opencart 설명서는 매우 미비합니다. 웹에서 솔루션을 검색해 보았지만 확실한 답을 찾을 수 없었습니다.

모든 입력 사항을 매우 높이 평가할 것입니다. 미리 감사드립니다!

MORE INFO : 내가 (예 : 연락처 페이지 및 "콘텐츠 탑"에 대한에 "열 왼쪽"을 추가 한 모듈에 대해 2 개 이상의 레이아웃을 추가 할 때 한 가지 문제는 관리자 패널에서 .....하지만 발견 계정 페이지)를 들어, 프론트 엔드는 다음과 같은 오류를 보여줍니다

Warning: Invalid argument supplied for foreach() in D:\xampp171\htdocs\opencart\catalog\controller\common\column_left.php on line 49 
+0

관리자 패널을 통해 모듈을 설치 했습니까? – Hassan

+0

@Hassan .... 그렇습니다. 설치, 구성 및 사용 가능합니다. 여기에서 관리자 패널의 스냅을 볼 수 있습니다. http://www.bevysolutions.com/stackoverflow/snap-26jan2014.jpg –

+0

설치/제거 방법은 어디에서 정의 했습니까? 모듈을 설치할 때 opencart 설정에 항목을 삽입한다고 가정합니다. 당신은 그렇게 않았다 방법 ? 출처 : http://docs.opencart.com/pages/page/viewpage.action?pageId=754759 – Hassan

답변

0

문제 해결 내가 hostjars 파일을 시작 사용하기 때문에, 내가 코드 ABIT을 개정했고, 문제가 해결되었다. 모듈의 관리 컨트롤러에서

1), 내가 코멘트하는 단면 제거 :

"//This code handles the situation where you have multiple instances of this module, for different layouts." 

2)의 관리보기 .tpl 파일에서를, 레이아웃의 위치를, 내가 제대로 형식을했다 몇몇 html 꼬리표. 예 : <select name="my_module_<?php echo $module_row; ?>_layout_id">이 올바른 형식 <select name="banner_module[<?php echo $module_row; ?>][layout_id]"> ...으로 바뀌 었습니다. 이렇게하면 여러 레이아웃을 관리자 제어판에 저장할 수 있습니다. (.tpl 파일에서 .tpl 파일에 8 개의 위치가 있어야합니다.)

3) 마지막으로 2 단계를 올바르게 수행하면 레이아웃이 올바르게 직렬화되어 데이터베이스의 oc_settings에 저장됩니다. 표 (이전에는 제 레이아웃이 직렬화 된 형식으로 저장되지 않았습니다).

희망 사항은 다른 사람들에게도 도움이되기를 바랍니다.

감사합니다.

관련 문제