Jump to content

Edit History

Bugas

Bugas

Hello,

i'm working on module (prestashop 1.7) that creates custom tabs on product page. I have a hook, lets call it displayNewTabs and i would like to assign to it multiple, different .tpl files so it can display on seperate tabs different info without the need of making a new hook.

Ideally it would look something like:

hookDisplayNewTabs($params){
	$array_contact = delivery_info();
	$this->context->smarty->assign($array_contact);
	return $this->display(__FILE__, 'newtabs_contact.tpl');
}

hookDisplayNewTabs1($params){
	$array_other_products = linkproducts();
	$this->context->smarty->assign($array_other_products);
	return $this->display(__FILE__, 'newtabs_other_products.tpl');
}

hookDisplayNewTabs2($params){
	(...)
	return $this->display(__FILE__, 'newtabs2.tpl');
}
hookDisplayNewTabs3($params){
	(...)
	return $this->display(__FILE__, 'newtabs3.tpl');
}

 

Is it possible to do it in such way or should i try a different aproach?

 

EDIT:

OK, i think i've solved it by doing a one .tpl file that will include other .tpl files and pass them an array with required variables. At least I think that it will work.

Bugas

Bugas

Hello,

i'm working on module (prestashop 1.7) that creates custom tabs on product page. I have a hook, lets call it displayNewTabs and i would like to assign to it multiple, different .tpl files so it can display on seperate tabs different info without the need of making a new hook.

Ideally it would look something like:

hookDisplayNewTabs($params){
	$array_contact = delivery_info();
	$this->context->smarty->assign($array_contact);
	return $this->display(__FILE__, 'newtabs_contact.tpl');
}

hookDisplayNewTabs1($params){
	$array_other_products = linkproducts();
	$this->context->smarty->assign($array_other_products);
	return $this->display(__FILE__, 'newtabs_other_products.tpl');
}

hookDisplayNewTabs2($params){
	(...)
	return $this->display(__FILE__, 'newtabs2.tpl');
}
hookDisplayNewTabs3($params){
	(...)
	return $this->display(__FILE__, 'newtabs3.tpl');
}

 

Is it possible to do it in such way or should i try a different aproach?

Bugas

Bugas

Hello,

i'm working on module that creates custom tabs on product page. I have a hook, lets call it displayNewTabs and i would like to assign to it multiple, different .tpl files so it can display on seperate tabs different info without the need of making a new hook.

Ideally it would look something like:

hookDisplayNewTabs($params){
	$array_contact = delivery_info();
	$this->context->smarty->assign($array_contact);
	return $this->display(__FILE__, 'newtabs_contact.tpl');
}

hookDisplayNewTabs1($params){
	$array_other_products = linkproducts();
	$this->context->smarty->assign($array_other_products);
	return $this->display(__FILE__, 'newtabs_other_products.tpl');
}

hookDisplayNewTabs2($params){
	(...)
	return $this->display(__FILE__, 'newtabs2.tpl');
}
hookDisplayNewTabs3($params){
	(...)
	return $this->display(__FILE__, 'newtabs3.tpl');
}

 

Is it possible to do it in such way or should i try a different aproach?

×
×
  • Create New...