Search code examples
phphtmljoomlavirtuemartjoomla-extensions

How can I add "Filter by Category" dropdown to a Virtuemart shop.browse page?


The default Browse page in VirtueMart (shop.browse) is formatted like so:

The title "Browse"
A "Sort-by" dropdown
Table containing available products in row/column format

The default Sort-by dropdown provides sorting options like "by name", "by SKU", and so on. It is not a filter of any sort.

I would like to add a dropdown which allows me to FILTER by CATEGORY, so that my resultant page looks like:

The title "Browse"
A "Filter-by Category" dropdown
A "Sort-by" dropdown
Table containing available products in row/column format

My problem is this: I know enough PHP to do basic debugs or alterations of other people's code, but not remotely enough write my own. My coding questions are these:

  1. How do I code a dropdown to pull Category info from VirtueMart and load that into its dropdown options?
  2. How do I tell VM to reload the products based on the dropdown option chosen?

I'm starting to realize that this looks suspiciously like one of those "write my code for me, cuz I don't know how to" types of questions. I hate those sorts of questions because it implies laziness on the part of the author. I'm not that guy, so let me state in advance that I'd be just as happy for some pointers in the right direction as much as I would actual code. I've researched this fairly well, but haven't found much helpful on the web.


Solution

  • This is quite an extensive request that would require an entire component to accomplish the task without really hacking up the VM core. Lucky for you someone has already done it.

    http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-products-search/10285

    http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-products-search/10968

    Both of these would probably work for what you want to do. They are commercial but reasonably priced.