Remark out of stock childs with color in in dropdown list

Started by lindapowers, May 07, 2015, 19:19:51 PM

Previous topic - Next topic

lindapowers

Hi

A programmer did a modification for us, I upload file here for devs to check in case they consider it worth core, remove .txt.

administrator/components/com_virtuemart/models/customfields.php



978 :
      $options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value].$priceStr);

replace with :

       if ($available<1)
        $class = 'class="no-stock"';
       else $class = '';

       $options[] = array(
        'value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']),
        'text' => $child[$customfield->customfield_value].$priceStr,
        'attr' => $class);


1002 :
      $virtuemart_category_id .'&virtuemart_product_id='. $selected;
     $html .= JHtml::_ ('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select no-vm-bind" data-dynamic-update="1" ', "value", "text",
      JRoute::_ ($url,false),$idTag);

replace with :
     $attr = array(
      'option.attr' => 'attr',
      'option.key' => 'value',
      'option.text' => 'text',
      'list.select' => JRoute::_ ($url,false),
      'id' => $idTag,
      'list.attr' => 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select no-vm-bind" data-dynamic-update="1" ');
     $html .= JHtml::_ ('select.genericlist', $options, $fieldname, $attr);


In our css template file we add:

<style>.no-stock {
  color: #a33636;
}
</style>


Result is that customers clearly see the out of stock products, works in browse page too:



This was done for vm 3.08 and joomla 3.4.1