Author Topic: Remark out of stock childs with color in in dropdown list  (Read 1582 times)

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Remark out of stock childs with color in in dropdown list
« on: May 07, 2015, 19:19:51 pm »
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 :
     
Code: [Select]
$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 :
     
Code: [Select]
$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:

Code: [Select]
<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