Searchable Customfield usecase

Written by Matej Dubovsky on . Posted in Administration & Configuration VirtueMart

Requires VirtueMart 3.0.18 or higher

We recommend VirtueMart sampledata for initial testing.
Keep defaults if not specified or desired to change. Desire to change only if you know what you do.

Before you start:
i. Ensure show search is enabled
ii. Check config of menu item

i. Show search is enabled: browse VirtueMart configuration as shown below vm > configuration > templates
VMcustomfield search sc1 check Search Enabled

ii. Check proper config of Joomla menu item to display Searchable Custom Field. To be sure that the search is displayed, check the proper configuration in the joomla menu item. Browse Joomla > Menu > Select your Shop view, former Store front. Please note both tabs, Details and Virtuemart category view settings as shown in two screenshots below.
VM customfield search sc2 check Joomla Menu Item a

Comment: In case you are still using older VM version with layout Front page please note the former Front page view is deprecated and will be replaced by category layout.
There are as always different solutions how to configure this setting in Joomla and VM, however for this example in VM we enabled search option globally, in Joomla Menu item config we set to use the global setting. 


1. Create new custom field prototype browse /administrator/index.php?option=com_virtuemart&view=custom and create new custom field prototype as displayed below
VM customfield search sc3 list Custom Fields
Comment: You can use already present customfields as well.


2. Configure new Custom prototype for example use these specs as shown in image
VM customfield search sc4 create Customfield
Custom Field Type > String
Title > Color
Published > No // You can keep the customfield proto unpublished, it will hide on productdetails but still be available on search results.
Searchable > Yes // enable this to include this custom proto into search results.
Default Value > Yellow;White;Blue;Brown;Red // this creates a set of strings (colors) to be selectable on product edit
Is a list? > As Admin List // this allows in product customfields to add the color value from a dropdown list.
Save our entry


3. Assign searchable string fields to a couple of products to see some results.
Browse /administrator/index.php?option=com_virtuemart&view=product

For each product browse in product details to the tab Custom Fields and add the new created Customfield Color. Scroll to bottom and select a color. Save the changes.
VM customfield search sc6 Product Add Customfield b


Result: In frontend on category view you should find your searchable customfield shown as dropdown in the search area. Let us try and select yellow - result should be shown after quick reload as shown below
VM customfield search sc7 Home View Selected Yellow
Try it out at demo.virtuemart.net/

Related concepts
https://docs.virtuemart.net/manual/general-concepts/212-customfields.html
https://docs.virtuemart.net/tutorials/product-creation/81-product-custom-fields-without-stock-control.html
https://docs.virtuemart.net/tutorials/multilingual-store/105-using-language-keys-in-form-fields.html