[PATCH] Search results page shows empty product type dropdown box (logic flaw)

Started by reinhold, November 15, 2012, 17:47:58 PM

Previous topic - Next topic

reinhold

In  components/com_virtuemart/views/category/view.html.php, function getSearchCustom the array_merge is currently wrongly placed outside the if (!empty..) statement:


$this->options = array_merge(array($emptyOption), $this->options);

if(!empty($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.

Cheers,
Reinhold

[attachment cleanup by admin]

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/