Jump to content

Prestashop 1.7.6.2 How to use TypeaheadProductCollectionType in Category edit form in BO?


viki
 Share

Recommended Posts

I have try to add TypeaheadProductCollectionType field in my module what using hookActionCategoryFormBuilderModifier for adding specific related products for category for my task.

I have add to category edit form this field:

$formBuilder->add('related_products', TypeaheadProductCollectionType::class, [
                'remote_url' =>  $this->context->link->getLegacyAdminLink('AdminProducts', true, ['ajax' => 1, 'action' => 'productsList', 'forceJson' => 1, 'disableCombination' => 1, 'exclude_packs' => 0, 'excludeVirtuals' => 0, 'limit' => 20]) . '&q=%QUERY',
                'mapping_value' => 'id',
                'mapping_name' => 'name',
                'mapping_type' => 'product',
                'placeholder' => $this->getTranslator()->trans('Search and add a related product', [], 'Admin.Catalog.Help'),
                'template_collection' => '<span class="label">%s</span><i class="material-icons delete">clear</i>',
                'required' => false,
                'label' => $this->getTranslator()->trans('Accessories', [], 'Admin.Catalog.Feature'),
            ]);  

After this related products field is appeared in category edit form but not working. As I can see this form not get all needing JS events for working...

Please help me. What am I doing wrong?

 

Edited by viki (see edit history)

Share this post


Link to post
Share on other sites

  • viki changed the title to Prestashop 1.7.6.2 How to use TypeaheadProductCollectionType in Category edit form in BO?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More