Author Topic: [PATCH] Search results page shows empty product type dropdown box (logic flaw)  (Read 1174 times)


  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 204
In  components/com_virtuemart/views/category/view.html.php, function getSearchCustom the array_merge is currently wrongly placed outside the if (!empty..) statement:

Code: [Select]
$this->options = array_merge(array($emptyOption), $this->options);
  // render List of available groups
  $this->searchCustomList = JText::_('COM_VIRTUEMART_SET_PRODUCT_TYPE').' '.JHTML::_('select.genericlist',$this->options, 'custom_parent_id', 'class="inputbox"', 'virtuemart_custom_id', 'custom_title', $this->custom_parent_id);
  } else {

Of course, the options array will never be empty, because we just added the $emptyOption! I think the array_merge needs to be inside the if (!empty(..)) check, because otherwise the search page will display a combo box with no real values to be selected for the product types. That combobox should only be shown when there is a real choice of product types available.

Attached is a patch (relative to current svn trunk), which moves the array_merge inside the if loop. With this patch applied, the search result page looks correct now.


[attachment cleanup by admin]


  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Very reasonable, thank you.
I should fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: