Reputation: 13333
I am developing a module in prestashop. The module has been hooked into left column and right column and its working fine with that. Now I want to show the module output in product footer page. So for that can someone tell me how to hook my module to the product details page? Any help and suggestions will be really appreciable.
My code for leftColumn and rightColumn is like this
function hookLeftColumn()
{
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
global $cookie, $smarty;
$value=array();
$result="SELECT status,app_id from "._DB_PREFIX_."storeblocks";
$value=Db::getInstance()->ExecuteS($result);
$smarty->assign('array',$value);
$smarty->assign('default',$defaultLanguage);
return $this->display(__FILE__, 'stores.tpl');
}
function hookRightColumn()
{
return $this->hookLeftColumn();
}
Upvotes: 1
Views: 16372
Reputation: 479
notice:this answer is about prestashop 1.5 and also you can use it for prestashop 1.6 too.
if your means about product details page
is the more info tab as i show in bellow image i can help you
step1.you should instal two hook in install function in your module
public function install() {
return parent::install() &&
$this->registerHook('displayProductTab')&&
$this->registerHook('displayProductTabContent')
}
step2:you should use them and return the some html code
i want add a new tab i use.
notice:id
is dynamic you change it but class
is static should be use as the selected
.
also href
is linked to the content id(you see that in step 3)
public function hookDisplayProductTab($params) {
return '<li>
<a id="myid" class="selected"
href="#linked">mytab</a>
</li>'
}
step3:if want when you click on mytab this show the it's content you add an other function. notice:the href="#linked" at previous function is linked to the id="linked".
public function hookDisplayProductTabContent($params){
return <div id="linked" class="rte">
<div class="product-overview-full">
my contents
</div>
</div>
}
advanced:write your html or smarty in your .tpl and return theme weth this code
return $this->display(__FILE__, 'mytpl.tpl') ;
best regards.
Upvotes: 3
Reputation: 5202
For product page, there are several hooks available in PS.
You can use displayLeftColumnProduct hook, which hooks modules just below the image of the product. You can also use displayRightColumnProduct which is for the right side section.
Another set of hooks is displayProductTab and displayProductTabContent , which are used for the tabs on the product page.
If these hooks don't help you, simply, then there are several other ways you can get your results. You can hook your module to any of that hooks which is more suitable for your needs, and then using css position and lft , top etc to move that hook to the required place.
If that is not a choice, then you will need to create your own hook and then using that hook on the product page. Please read this for creating your own hook
http://www.programmingtunes.com/creating-new-prestashop-hook/
Also for a complete list of the hooks in PS, please read this article in PS docs
http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5
Let me know if you still need any other details.
Thank you
Upvotes: 4