Jump to content

Modify searchbar version 1.7


wiscardboard

Recommended Posts

I have modified the search bar to show the product image, but I'm struggling to get it to look the way I want it to. Is there a way to change it to display a table for the search result(s) and make it look like the pictures below? If so can someone please give me a sample code to work with, thank you.

I've attached two images, one of the way it looks now, the other of the way I would like it to look for reference.

 

How it is now:

1355736519_oldsearch.png.4ef6ce00e5ccdd1ee3a888fafcb07dfd.png

 

How I would like it to look. If I can simply get the code for the basic layout, I'm pretty sure I can get the info to display the way I need it to.

882888446_NEWSEARCH.png.ded2988c720b88a2c2ec6bbe04c02fc1.png

Link to comment
Share on other sites

So I've got the image, product name and price in tables aligned next to each other now by modifying the ps_searchbar.js page like so:

 

 $.widget('prestashop.psBlockSearchAutocomplete', $.ui.autocomplete, {
        _renderItem: function (table, product) {


            return $("<table>")
                 .append($("<a>")
.append($('<td rowspan="2"><img src="'+ product.cover.small.url +'" style="width: 52px; height: 52px"/></td>'))
				
                    .append($("<td style='width: 200px'>").html(product.name).addClass("product"))
.append($("</td><td rowspan='2'>").html(product.price).addClass("price"))
                ).appendTo(table)            ;
        }

Can anyone help me figure out where & what I need to modify to get the condition and product category to display as well? Any help is appreciated. Thank you!

Link to comment
Share on other sites

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
×
×
  • Create New...