Add to Cart Button on Smart Search.

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
2 weeks 4 days ago #321344

-- HikaShop version -- : 4.2.3
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.2
-- Browser(s) name and version -- : Firefox 77.0.1

We use smart search for product search, and added image of the procuct and its working fine.

we would like to know if it is possible (or what is needed) to add a [Add to cart] button on the smart search also, that adds one unit to the cart, so when the costumer is searching he can add the item to the card easy.

Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 70022
  • Thank you received: 10487
  • MODERATOR
2 weeks 4 days ago #321351

Hi,

Well, there is no easy option to turn on to do that as Joomla's smart search doesn't support that, so it will require some development.
But I guess that if you do an override of the results page of the smart search system, you should be able to add add to cart buttons.
So I suppose you would want to add your custom code in the file default_result.php of the "search" view of com_finder as a view override. You can do that via the Joomla template manager's view override area.
In there, you'll have $this->result with the data of the results. Of course, you can have other results than just HikaShop products, so you need to check on that.
Once you have the product id, you can just echo a content tag as per www.hikashop.com/support/documentation/1...-product-insert.html to display the add to cart button for the product.

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
2 weeks 19 hours ago #321519

OK, thanks for the tips,

I tried to use the filter of the hikashop but, it filters and only shows the item on the last category that has the item... so for example, if I have an item on the first and last category it shows only the last category...

could not figure it out why it happen so we try to use the joomla search

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 70022
  • Thank you received: 10487
  • MODERATOR
2 weeks 13 hours ago #321523

Hi,

The filtering system can display results based only on the products of a category, or based on the products of all the categories. It really depends on how you configure it.
Supposing that you've configured the HikaShop filter module to display your search box (filter), in the settings of the module, you want to activate the "force redirect" option and set the id of a menu item configured via the Joomla menu manager to display all the products of your shop by default (like the "products listing" menu item which is installed by default with HikaShop).
That way, when you use the search box of the filter in that module, it will display the results based on the products displayed by that menu item.

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
1 week 5 days ago #321629

Hi nicolas,

thanks for your tips, I mange to get it working with hikashop filter, and its working nice with some tweaks,

also, in hikashop filter is it possible to add a sort filter? like the hikashop smart search have?
ex: sort by recently added, alphabetic order etc..?

thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 70022
  • Thank you received: 10487
  • MODERATOR
1 week 5 days ago #321633

Hi,

Yes. You want to create a filter of the type "single dropdown" with the "apply on" setting set to "sort" via the menu Display>Filters.

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum