AbanteCart Development > Development Help Needed

Hook Category Block Controller

(1/2) > >>

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

abolabo:
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

yonghan:
Hello abolaboi,i have able to hook public functions without problem but seems it doesn't work with private functions.

abolabo:

--- Quote from: handoyo on October 24, 2014, 09:03:17 AM ---Hello abolaboi,i have able to hook public functions without problem but seems it doesn't work with private functions.

--- End quote ---

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

yonghan:
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 and add this code after line 36.


--- Code: ---<?php
                                        $cat=$scat['children'];
                                        foreach ($cat as $ct) { ?>
                                        <li><a href="<?php echo $ct['href']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;<?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 } ?>
--- End code ---


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.

Navigation

[0] Message Index

[#] Next page

Go to full version
Powered by SMFPacks Social Login Mod