Jump to content

Custom Page Controller Missing Seo Title


Recommended Posts

I have developed a few modules with custom page controller based on this tutorial: http://nemops.com/creating-new-pages-in-prestashop/

Everything works fine but I cannot get the meta Title and Description to display in the HTML. SEO & URL rewrite is active and works fine for regular pages.

 

Help anyone?

 

Here is the custom controller code, also attached the full module

<?php

class testmoduleAllproductsModuleFrontController extends ModuleFrontController {
	
	public function init() {
		$this->page_name = 'allproducts'; // page_name and body id		
		$this->display_column_left = false;
		$this->display_column_right = false;
		parent::init();
	}
	
	
	public function initContent() {
		parent::initContent();
		
		$products_partial = Product::getProducts($this->context->language->id, 0, 5, 'name', 'asc');
		$products = Product::getProductsProperties($this->context->language->id, $products_partial);
		
		$this->context->smarty->assign(array(
			'products' => $products,
			'homeSize' => Image::getSize('home_default')
		));
		$this->setTemplate('allproducts.tpl');
	}
		
}

testmodule.zip

Edited by Bluedge (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

In case someone else hit the same issue, the solution is pretty simple. The page_name property in the init method of the module must be set properly.

If your module is called "bestsellers" and your front controller is called "best" the page_name will be set as follow : 'module-bestsellers-best'.

Note : thanks to the Prestashop customer support service for this.

public function init() {
    $this->page_name = 'module-bestsellers-best';
    parent::init();
}
Edited by Bluedge (see edit history)
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...