Jump to content

Helper override tpl from module


boxybh28

Recommended Posts

part 1.

i make a module named XYZ and put these

xyz.php start code

 public function install()
{


	// Install Tabs
	$parent_tab = new Tab();
	// Need a foreach for the language
	$parent_tab->name[$this->context->language->id] = $this->l('sss');
	$parent_tab->class_name = 'AdminAbc';
	$parent_tab->id_parent = 0; // Home tab
	$parent_tab->add();


	$tab = new Tab();	  
	// Need a foreach for the language
	$tab->name[$this->context->language->id] = $this->l('abc');
	$tab->class_name = 'AdminAbc';
	$tab->id_parent = $parent_tab->id;
	$tab->module = $this->name;
	$tab->add();
......
........
.}

 

now what i get in backoffice menus is SSS then drop down abc

 

if i go to administration->menus and check whats entered in there..

i see

a home tab

name - sss

class - AdminAbc

module -

and its parent is home

 

and if i expand this + home tab i get

 

name - abc

class - AdminAbc

module - XYZ

parent - sss

 

so far so good now i go to my module folder and create folder

controllers\admin\AdminAbcController.php

 

AdminAbcController.php contains the following code

 

<?php
class  AdminAbcController extends  AdminController
{
public function __construct()
{
	$this->className = 'abc';
	$this->table = 'Abc';
	parent::__construct();


}


 public function renderOptions()


{
	  $this->fields_options = array(
		'test' => array(

				'bottom' => '

				<div class="margin-form">
				<input type="button" class="button" name="btEmailTest" id="btEmailTest" value="'.$this->l('Send an e-mail test').'" onclick="verifyMail();" />
				<br />
				<p id="mailResultCheck" style="display:none;"></p></div>

				',
		)
	);

		   return parent::renderOptions();

}

}
?>

 

so far so good i can in the back office see what i put in renderOptions()

 

now my problem is i am trying to override the default options.tpl or add to exisiting and cant get it to work

 

what i have tried

i made a folder abc in

prestashop\admin\themes\default\template\controllers\abc

 

inside this i put helpers and portions etc and looks like following

{extends file="helpers/options/options.tpl"} is in the new options.tpl file

prestashop\admin\themes\default\template\controllers\abc\helpers\options\options.tpl

well this doesnt work

i know i have defined the modules folder but in theat too i try this.

 

prestashop\modules\XYZ\views\templates\admin\abc\helpers\options\options.tpl

 

still dosent work????

 

any one has any clues

Link to comment
Share on other sites

well we can give you a simple solution ))

public function renderOptions()


    {
global $smarty, $cookie;

$domainq =  realpath yaadayadya yada
			  $this->fields_options = array(
				    'test' => array(

								    'bottom' => '
							  '.$this->context->smarty->fetch($domainq.'\options.tpl').'
								    ',
				    )
		    );

					   return parent::renderOptions();

    }

 

i know prestashop people are very vague about it but some workarounds we have developed

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

prestashop\modules\XYZ\views\templates\admin\abc\helpers\options\options.tpl

 

Your example with abc and AdminAbcController should work. If you, however, use CamelCase in your controller name, the default folder name will be lower-case with underscore as word separator.

 

Examples:

AdminAbcController: \views\templates\admin\abc\helpers\options\options.tpl

AdminCamelCaseController: \views\templates\admin\camel_case\helpers\options\options.tpl

 

You can check (and, optionally, change) the directory in your AdminController's override_folder variable (eg $this->override_folder)

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...