Your question is too broad, but I can suggest you the steps the way I have added category chooser in my custom module. You can follow the same. I have followed the way it is done in Magento for Catalog Price Rules while adding conditions.
Step-1 - You have to include
rules.js file in head on the page you want to display chooser.
- In the edit page add html using renderer for the input field and add
chooser image after the input field.
- Also add a div in which you will display the chooser.
- On the chooser image click you have to make an ajax call. You can follow the
showChooserElement function of
For category chooser below is ajax url, for product chooser you can check the Catalog Price rule feature.
<?php $url = Mage::helper('adminhtml')->getUrl('adminhtml/promo_widget/chooser/attribute/category_ids'); ?>
- You will get the category tree html in the response of this ajax call, you have to append this response to the div you have added for chooser. You may need to override
_processSuccess function from
rules.js in your template for this.