Warning: You are browsing the documentation for PrestaShop 8, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated version of this page

Learn how to update to the latest version.

TypeaheadCustomerCollectionType

This form class is responsible for selecting a customer.

Type options

Option Type Default value Description

Code example

$builder->add(
    'sp_id_customer',
    TypeaheadCustomerCollectionType::class,
    [
        // "%QUERY" is appended to url in order to avoid "%" sign being encoded into "%25",
        // it used as a placeholder to replace with actual query in JS
        'remote_url' => $this->router->generate('admin_customers_search', ['sf2' => 1]) . '&customer_search=%QUERY',
        'mapping_value' => 'id_customer',
        'mapping_name' => 'fullname_and_email',
        'placeholder' => $this->translator->trans('All customers', [], 'Admin.Global'),
        'template_collection' => '<div class="media-body"><div class="label">%s</div><i class="material-icons delete">clear</i></div>',
        'limit' => 1,
        'required' => false,
        'label' => $this->translator->trans('Add customer', [], 'Admin.Catalog.Feature'),
    ]
)

Preview example

TypeaheadCustomerCollectionType rendered in form using textarea