PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 6, 2024
Let's talk code, commerce and open source.

Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

TypeaheadProductPackCollectionType

This form class allows you to select a product to be included in a pack of products.

Type options

Option Type Default value Description

Code example

$builder->add('inputPackItems', TypeaheadProductPackCollectionType::class, [
    'remote_url' => $this->context->getLegacyAdminLink('AdminProducts', true, ['ajax' => 1, 'action' => 'productsList', 'forceJson' => 1, 'excludeVirtuals' => 1, 'limit' => 20]) . '&q=%QUERY',
    'mapping_value' => 'id',
    'mapping_name' => 'name',
    'placeholder' => $this->translator->trans('Search for a product', [], 'Admin.Catalog.Help'),
    'template_collection' => '
        <h4>%s</h4>
        <div class="ref">REF: %s</div>
        <div class="quantity text-md-right">x%s</div>
        <button type="button" class="btn btn-danger btn-sm delete"><i class="material-icons">delete</i></button>
    ',
    'required' => false,
    'label' => $this->translator->trans('Add products to your pack', [], 'Admin.Catalog.Feature'),
])

Preview example

TypeaheadProductPackCollectionType rendered in form using textarea