Cvp: PS 1.4 versiyonunda nasıl yeni hook oluştururum.
İngilizce:
Took me quite a while and lots of meddling to figure this out? thought I would share with the rest of you guys on how to create a hook so u can NOT waste the number of hours like I did
1. Goto your database and modify ps_hook? (ps_ is what I named my database, so it can be replaced by what you named yours.)
2. find the last id_hook number and insert a new number after with the hook that you want to name e.g. I name it ?cat?
3. goto the php of the pages you want the hook to be in? e.g footer.php
4. insert ?HOOK_CAT? => Module::hookExec(?cat?), into the below
$smarty->assign(array(
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'),
'HOOK_FOOTER' => Module::hookExec('footer'),
'content_only' => intval(Tools::getValue('content_only'))));
$smarty->display(_PS_THEME_DIR_.'footer.tpl');
5. this is the final code?
$smarty->assign(array(
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'),
'HOOK_FOOTER' => Module::hookExec('footer'),
'HOOK_CAT' => Module::hookExec('cat'),
'content_only' => intval(Tools::getValue('content_only'))));
$smarty->display(_PS_THEME_DIR_.'footer.tpl');
6.insert {$HOOK_CAT} into where you want in footer.tpl and you are in business
NOTE : For the hook to appear YOU HAVE TO assign the array in the page?s php? Would be good if we can have a master HOOK array list?
Türkçe:
1- Veritabanınızı phpMyAdmin gibi bir araç ile açınız (Not ps_ ön tnaımlıdır değiştirdiyseniz kendi ön takınızı kullanmalaısınız)
2- Son hook numarasına bakarak yeni bir numara ile yeni ismi kaydedin örnek olarak `alanim`
3- PHP olarak hangi alanda istiyorsak oraya ekleme yapmalıyız. Örn : zemin için footer.php yada üst kısım için header.php
4- Açtığınız dosyanın içine
[code type=php]?HOOK_CAT? => Module::hookExec(?cat?),[/code]
bu kodu alttaki gibi bir alanın içine ekleyin
[code type=php]$smarty->assign(array(
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'),
'HOOK_FOOTER' => Module::hookExec('footer'),
'content_only' => intval(Tools::getValue('content_only'))));
$smarty->display(_PS_THEME_DIR_.'footer.tpl');[/code]
5- Son hali:
[code type=php]$smarty->assign(array(
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'),
'HOOK_FOOTER' => Module::hookExec('footer'),
?HOOK_CAT? => Module::hookExec(?cat?),
'content_only' => intval(Tools::getValue('content_only'))));
$smarty->display(_PS_THEME_DIR_.'footer.tpl');[/code]
Modülleri bu andan itibaren hook_cat içine naklederek sonrada footer.tpl de {$HOOK_CAT} bu şekilde istediğiniz alana oturtabilirsiniz..
Yalnız footer.php ye eklendiği için sadece footer da görünücektir. header.php ye eklenirse tüm alanlarda (ödeme ekranları, ürün inceleme ekranları, ) kullanabilir olucaktır
Bol kazançlar