Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 249 Vote(s) - 3.61 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module Controller redirects to 404 Prestashop

#1
I have a problem with my Prestashop, i would like to create a webpage in a module without using the CMS.

But when I want to access the controller by using this Url :

[To see links please register here]


I have that message & when i click on the link, i have a 404 error

[Debug] This page has moved
Please use the following URL instead:

[To see links please register here]




My controller looks like this



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");
}
}

Preferences > SEO & URLs

Page: produitsmarchands - productlist
URL: product-list

Reply

#2
You got a few fundamental mistakes.

First of all you should'nt be using FrontController but rather ModuleFrontController. Since you are extending a module not a fully sepearate new controller.

Next thing is that your class is wrong. It should be something similar to this.

YourModuleNameYourControllerNameModuleFrontcontroller

YourModuleName = name of your module

YourControllername = name of your controller and should be located in yourmodule/controllers/front

And last but not least this is completely wrong

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

You should use this

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

That way your file will be located in yourmodule/views/templates/front

And if you have followed all of those guidelines you should be able to set a friendly url for your moduelController in Preferences -> SEO & URL

BR's
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through