kaushalsingh Posted February 17, 2013 Share Posted February 17, 2013 (edited) I'm running a grocery shop, using prestashop 1.5.3.1. I need to add 'add to cart' button directly into search drop down, so that user can directly add product to cart without going into product page. My complete Idea is: - When user queries about any product, an 'add to cart' button is also there (on right align) in search result drop down, which is being shown just beneath the search text box. -After clicking 'add to cart' button the product page would not be loaded, instead that one more text field appear on right of seach button, where user can feed for quantity. Then one final button to add to cart. - for example, as currently on querying 'ipod' into search input field one of search result is 'ipods > ipod Nano' in result drop down. Now what i want is to display few details of product, for example. on searching 'rice' result should like: 'Basmati Rice 1Kg Pack 2$ add button'. Any suggestion or idea to implement these features would be great. ThankYou Edited February 17, 2013 by kaushalsingh (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 17, 2013 Share Posted February 17, 2013 What you're looking for is not easy as it might seem. You have to edit 2 files basically: 1- in the blocksearch module:blocksearch-instantsearch.tpl 2. controllers/searchcontroller.php The process is a bit long to explain here, I'll try to write a tutorial on this today and publish it tomorrow Basically, you need to edit the "ajaxSearch" part in the tpl's javascript, but you need to retrieve ALL product data before you can do that, and therefore you must absolutely remove the ajax = true (last parameter passed) at line 63 of the searchcontroller. Stay tuned, I'll see what i can do for the tut 1 Link to comment Share on other sites More sharing options...
kaushalsingh Posted February 18, 2013 Author Share Posted February 18, 2013 Thankyou sir, I am trying to implement things at my end, also looking forward for the tutorial. Link to comment Share on other sites More sharing options...
NemoPS Posted February 18, 2013 Share Posted February 18, 2013 (edited) I'm investigating. It's more complex than I thought, since when i try to click the "add to cart" it just skips to the product page, or does nothing if the link is removed. I guess the autocomplete plugin should be heavily modified to achieve what you ask Edited February 18, 2013 by Nemo1 (see edit history) 1 Link to comment Share on other sites More sharing options...
kaushalsingh Posted February 23, 2013 Author Share Posted February 23, 2013 Thanx for the reply, Now I dropped the plan of using the default search block. Now I am trying to write individual module for my purpose. Will add a search input field, onkeyup ajax search, using keyword search in database, using 'like' keyword of mysql. For this can you help me for: what parameters required for add to cart API, and how to call add to cart api. So that I can search for product and directly add to cart from there without going to product page. Hope this wont take much time of you, but i have to do too much research if i do it by myself. Thank you Link to comment Share on other sites More sharing options...
Plain Posted February 23, 2013 Share Posted February 23, 2013 Hi, Please keep us posted on your progress. This could be relevant for many Prestashop users. Kind regards, V http://plainindustry.dk Link to comment Share on other sites More sharing options...
kaushalsingh Posted February 25, 2013 Author Share Posted February 25, 2013 I am working on this module but due to little knowledge of prestashop hooks and file architecture got stuck. Here is the link of the part i completed, its not too muchjust a start : https://www.dropbox.com/s/qteyq8arpwvntkq/search.zip To use this, you have to change database settings in dbconf.php Things to be implemented: -In dropdown search result unit of price is not being displayed as now, the unit should be according to the currency setting of user -If you look into mysql query, its not specific about the language. So now this is searching for product in every language. It should be specific to the language setting of user. -During testing keep opened the javascript console, after product selection final parameters to be passed to add to cart api is being printed there. (this is printed from javascript add function) Also i dont know how to integrate this with prestashop. It would be great if some one work on it further. Thanks Link to comment Share on other sites More sharing options...
sandy8m Posted December 25, 2014 Share Posted December 25, 2014 Hi Team, Any solution for this ? If so, please update us. Link to comment Share on other sites More sharing options...
sandy8m Posted March 31, 2015 Share Posted March 31, 2015 Hi Team, If anyone is having a solution for this.... Please post us... Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 Sandy At the moment, when searching products and just press enter (that is, you don't make any choice from the suggestions it shows), a 'product-list' of all products that fulfil the required search are displayed. There you can just add to cart without going to the product page first. Is that sort of what you need/look for? My 2 cents, pascal. Link to comment Share on other sites More sharing options...
sandy8m Posted March 31, 2015 Share Posted March 31, 2015 Hi Pascal, Now, in the basic version of the prestashop, we can search the product and select it. And after we select the product, we can add to cart. Is there any way that we can have a cart button in the search results itself. If so, please let us know. Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 Hi Sandy, as said, if you DON'T choose one single product from the search result list, but just press Enter, you get more products that match the search. This is similar to a product list, where you can just press add to cart directly without going into the product detail page. So what you could do is then just remove the search drop down list while searching, but force the user to add the search string and press enter. (to achieve this, in back office, in Preferences->search, turn OFF Ajax search, and turn ON instant search: To really add the add to cart button in the pop up search result menu is indeed much more work, as people mentioned above. Maybe my idea is a good compromise? My 2 cents, pascal 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now