문제

Prestashop에 문제가 있으므로 CMS를 사용하지 않고 모듈에 웹 페이지를 만들고 싶습니다.

그러나이 URL을 사용하여 컨트롤러에 액세스하려는 경우 : http://example.com/ 비교 / 모듈 / produitsmarchand / productlist

나는 그 메시지가 있고 링크를 클릭하면 404 오류가 있습니다

[Debug] This page has moved
Please use the following URL instead: http://example.com/comparateur/index.php?controller=ProductList&module=ProduitsMarchand
.

내 컨트롤러가 다음과 같습니다

class ProduitsMarchandProductListModuleFrontController extends ModuleFrontController {

    public $php_self ="ProductList";
    /**
     *  Initialize controller
     *  @see FrontController::init()
     */
    public function init() {
        parent::init();
    }

    /**
     *  Assign template vars related to page content
     *  @see FrontController::initContent()
     */
    public function initContent() {
        parent::initContent();

        $this->setTemplate("ProductList.tpl");
    }
}
.

환경 설정> SEO & URL

Page: produitsmarchands - productlist
URL: product-list
.

도움이 되었습니까?

해결책

몇 가지 기본적인 실수를 얻었습니다.

먼저 FrontController를 사용하지만 ModuleFrontController를 사용해야합니다.모듈을 완전히 SepeARate 새 컨트롤러가 아닌 모듈을 확장하기 때문에

다음은 수업이 잘못되었다는 것입니다.그것은 이와 비슷한 것과 비슷해야합니다.

yourmodulenameyourcontrollernamemodulefrontController

yourmodulename= 모듈 이름

yourtontrollername= 컨트롤러의 이름과 해당 모듈 / 컨트롤러 / 전면

에 위치해야합니다.

와 마지막으로 이것이 완전히 잘못된 것입니다

$this->setTemplate(__FILE__.'/../../../views/templates/front/ProductList.tpl');
.

이 기능을 사용해야합니다

$this->setTemplate('ProductList.tpl');
.

해당 파일이 귀하의 파일이 귀하의 모듈 / 뷰 / 템플릿 / 전면

에 있습니다.

및 모든 지침을 따르면 환경 설정에서 ModuelController에 대한 친숙한 URL을 설정할 수 있어야합니다. -> SEO & URL

BR의

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top