Jump to content

[SOLVED]Create a module in a separate page, without using hook?


__fabrice

Recommended Posts

I just wanted to know if I can create a module that will open in a separate page, a single page. Without using an hook.

For example, in the footer, I have a link that will display using the module "blocklink" (blocklink.tpl actually)

For the moment this module (blocklink) is using an "hookHome".

We can do without here?, But the module will remain manageable of course.

Thank you for your help.

Fabrice

Link to comment
Share on other sites

Hi,

I have some problems with your module :

#1 : an js error in the ajax-cart.js, in the updateCart: function(jsonData) { }
this alert shows : alert(errors + " updateCart:function : ");

#2 in your module, you can configure only the hook, the block (hookRight).

But I want to configure the page, in your case, bought-product.php (and .tpl) and not the blockboughtproductsnc.*

For example, in the module "blocklink" I want to display, and configure, all the links in a separate page, NOT in a block (hook).

It's possible ?

Fabrice

Link to comment
Share on other sites

Finaly, i find the answer.

About the "blocklink" module, I simply create an another page (.php and .tpl), and I use the getLinks() function in my new php file. An so on. Quite simple.

But i'm not sure that it can be applicable in the others modules...

Thanks a lot.
Fabrice

Link to comment
Share on other sites

  • 9 months later...

Hi I'm trying to achieve the same thing, basically trying to get the jgalleryview 2 module to display in a separate page. Could you please tell me how you did it? I tried to download Rocky's module but it won't let me. It would help a lot if you could give me steps on how to make the module display on a page of its own since I'm not good at programming.

Thanks

Link to comment
Share on other sites

  • 6 years later...

Just create a controller with the name you want for the page, and put it in /overrides/controllers/front/. The name of the controller must be NameyouwantforthepageController.php

Here is a basic class that will work:

class MyPageController extends FrontController {

/**
* 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(_PS_THEME_DIR_.'my-page.tpl');
}

}

Take a look at the FrontController to see what method you need to override to add functionnalities, for example setMedia() to add CSS / JS files.

You will then be able to add a pretty url in the back office in the SEO panel.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...