News:

Support the VirtueMart project and become a member

Main Menu

Empty select in frontend with stockable plugin

Started by gain, November 12, 2014, 14:06:20 PM

Previous topic - Next topic

gain

Hi,
I'm on VirtueMart 2.6.0 and I use the stockable plugin with child products.
In the parent backend I have something like this

and in frontend the "select" tag is empty.

I've found that in stockable.php there is this part of code:
                foreach ($selects as $keys =>$options) {
                        $selectname = 'selectname'.$i;
                        $listname = $field->$selectname;
                        if (!empty($listname)) {
                                $optionName = 'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.']['.$keys.']';
                                $option = array();
                                $show_select = false;
                                foreach ($options as $key => $val) {
                                        if (!empty($val)) {
                                                if (1 == $i) {
                                                        $option[] = JHTML::_('select.option', $val, JText::_( $val ));
                                                }
                                                $show_select = true;
                                        }
                                }
                                if ($show_select) {
                                        $html .='<div style="width:200px;"><span style="vertical-align: top;width:98px; display: inline-block;color:#000;">'.JTEXT::_($listname).'</span>';
                                        $html .= JHTML::_('select.genericlist', $option,$optionName ,'class="attribute_list no-vm-bind customfield_id_'.$js_suffix.'" style="width:100px !important;"','value','text',reset($options),'selectoptions'.$i,false)."</div>\n";
                                } else $html .='<input id="'.$keys.'" class="attribute_list" type="hidden" value="'.$val.'" name="'.$optionName.'">' ;
                        }
                        $i++;
                }


If I comment the if (1 == $i) the select in frontend works fine.

Why there is that if?
And can I use stockable leaving first 2 options empty and using only the third as in the screenshot?
I have other products that has all 3 options selected.

Thanks in advance

gain