AbanteCart Community
AbanteCart Development => Development Help Needed => Topic started by: yonghan on October 24, 2014, 08:05:24 AM
-
Hi admins,i'm trying to extend the Category Block Controller without editing the core file,the function i want to override is the private functions.Is it possible to do that?Thanks a lot.
-
Hello.
You can look into file public_html/extensions/default_pp_pro/core/default_pp_pro.php to see how hook works.
More details here http://www.abantecart.com/document_wiki/index.php/AbanteCart_Extension%E2%80%99s_Developer_Guide#Hooks
we recommends to use our developer tools extension.
You can download and install developer tools and generate new extension with prebuilded files.
https://github.com/abantecart/developer_tools_extension
-
Hello abolaboi,i have able to hook public functions without problem but seems it doesn't work with private functions.
-
Hello abolaboi,i have able to hook public functions without problem but seems it doesn't work with private functions.
sure. You can't to hook private methods. You should to change it's output.
Also you can get variables from "view" via $this->baseobject->view->getData('some var name'); inside _initUpdate() hook and rewrite it
-
Hi abolabo,i have found the way to do what i'm trying to do without modifying the core file or hook it.Actually what i want to achieve is to display the 2nd level child in category_top block.Here is what i have done in case someone want to use it too.I just edit the https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default_html5/template/blocks/category_top.tpl (https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default_html5/template/blocks/category_top.tpl) and add this code after line 36.
<?php
$cat=$scat['children'];
foreach ($cat as $ct) { ?>
<li><a href="<?php echo $ct['href']; ?>"> <?php echo $ct['name'];?></a>
<img class="sub_cat_image" style="display:none" src="<?php echo $ct['thumb']; ?>"
alt="<?php echo $ct['name']; ?>"
title="<?php echo $ct['name']; ?>">
</li>
<?php } ?>
Thanks a lot.By the way please help me to take a look at my thread too regarding extension update script if you don't mind and have the time too.
-
I am also not able to display categories in Categories block.
Can someone throw some light on this issue?
Thanks