Need private packages and team management tools?Check out npm Teams »

vtex-custom-autocomplete

1.0.0 • Public • Published

vtexCustomAutoComplete

This function listen the event of the input and handles the auto complete resquest at any vtex based e-commerce.

Parameters

  • options object an object is required by parameter with the followings keys and content:
    • options.shelfId string the hash id of the shelf that should be rendered
    • options.appendTo jQuery a jQuery object of the container where the results will be placed
    • options.notFound function a callback function that returns a valid html text or an jQuery object, this result will be appended into the container when no results returns from the search
    • options.limit number the number of the itens that should be placed at once

Getting started

  • First find the shelfId at vtex admin/a -> template de prateleiras

Image 01

Image 02

Image 03

Than call the vtexCustomAutoComplete on your input by following the example bellow

Examples

$('#myInput').vtexCustomAutoComplete({
  shelfId: '37a38486-2baa-4df1-9b0e-02f96f08fa73',
  appendTo: $('#results'),
  notFound: function(){ return 'not found' },
  limit: 3
});

Install

npm i vtex-custom-autocomplete

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar