1

I have created a custom module with product multi-select, but I have above 50K products so form taking time to load, so I want to add product chooser in my form, I checked for this and find one post :

Product Chooser in Custom Module

But didn't get how to use in my custom module.

How can I use product chooser in my custom module and save product_id with comma separated?

And similarly, want to add category chooser in a custom module.

0

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.

Path for rules.js is

/js/mage/adminhtml/rules.js

Step-2 -

  • 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 rules.js.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.