Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to enable search by SKU? #13

Open
wyamout opened this issue Sep 1, 2015 · 5 comments
Open

Is it possible to enable search by SKU? #13

wyamout opened this issue Sep 1, 2015 · 5 comments

Comments

@wyamout
Copy link

wyamout commented Sep 1, 2015

No description provided.

@tharshanlk
Copy link

+1 for this

@singalen
Copy link

+1

@renekorss
Copy link

renekorss commented Apr 3, 2018

I know this is very old issue, but I got it to work with overriding /app/design/frontend/base/default/template/bubble/autocomplete/js.phtml.

Replaced

var engine = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    <?php if ($helper->getUseLocalStorage()): ?>
    prefetch: { url: '<?php echo $this->getUrl('autocomplete/product/json') ?>' },
    <?php else: ?>
    remote: { url: '<?php echo $this->getUrl('autocomplete/product/json') ?>' },
    <?php endif; ?>
    limit: <?php echo $helper->getLimit() ?>,
    ttl: <?php echo $helper->getCacheLifetime() * 1000 ?> // milliseconds
});

with

var engine = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('bubble_search_field'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    <?php if ($helper->getUseLocalStorage()): ?>
    prefetch: {
        url: '<?php echo $this->getUrl('autocomplete/product/json') ?>',
        filter: function (list) {
            return jQuery.map(list, function (item) {
                item['bubble_search_field'] = item.name + ' ' + item.sku;
                return item; 
            });
        }
    },
    <?php else: ?>
    remote: {
        url: '<?php echo $this->getUrl('autocomplete/product/json') ?>',
        filter: function (list) {
            return jQuery.map(list, function (item) {
                item['bubble_search_field'] = item.name + ' ' + item.sku;
                return item; 
            });
        }
    },
    <?php endif; ?>
    limit: <?php echo $helper->getLimit() ?>,
    ttl: <?php echo $helper->getCacheLifetime() * 1000 ?> // milliseconds
});

NB! Don't forget to clear local storage data if that is turned on.

Added filter for creating new property bubble_search_field which concats name and sku. Then changed searching by name to bubble_search_field.

Ofcourse you could name bubble_search_field as you like.

Maybe it helps someone.

@sumeetmobiwebtech
Copy link

sumeetmobiwebtech commented Feb 6, 2019

@renekorss
i just replaced that but it is not working

getting other issue -
when type in numeric in search then data is not coming

@LuizSantos1
Copy link

LuizSantos1 commented Dec 3, 2020

@sumeetmobiwebtech I know it is pretty old, but I got mine to work by ignoring the mods.
Just replaced
<?php echo $this->__('No result') ?>
To
<?php echo $this->__('Hit enter to search') ?>'
So when customer hits enter, catalog search comes to action

One catalog search, to have better results, I have changed to "Full Text"...

It is a very old search tool, but the fastest and lightest the one around.

Does anyone knows how to make it pick up the FinalPrice instead of only the original price?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants