Товарищи! Помогите!
VirtueMart 3.0.2 + Joomla 2.5.14 + vmvendor 1.2.8
На фронте, при добавлении товара в магазин с помощью vmvendor ошибка (Warning: Invalid argument supplied for foreach(/components/com_vmvendor/views/addproduct/tmpl/default.php on line 884))
Вот этот кусочек отвечает за ошибку (с третьей строки). Как видим проблема с дополнительными полями.
Разработчик дописал, что эта ф. еще не доработана.
Давайте попробует решить эту проблему. Мне кажется, что в вер. 1.2.9 или выше этот участок уже в порядке. Если у кого-то есть свежак прошу поделиться, хотя бы этим кусочком кода.
Ну а пока прошу помочь с функцией ($this->core_custom_fields as $core_custom_field)
в файле view.html.php эта функция объявлена таким образом ($this->core_custom_fields = $this->get('corecustomfields')
очень, очень прошу помощи.
////////////////////////////// Core Custom fields support Hasardous place as VirtueMart shared and multivendor custom fields is not totally done yet.
if($enable_corecustomfields){
$i = 0;
foreach ($this->core_custom_fields as $core_custom_field){
$i++;
echo '<tr align="left" class="sectiontableentry2">';
echo $typefield;
echo $core_custom_field;
echo $this->loadTemplate('customfields');
echo '<td>';
//echo 'Under dev: ';
echo $core_custom_field->custom_title;
echo $typefield->custom_title;
if($typefield->custom_tip !='' OR $typefield->custom_field_desc!='' )
echo ' <img src="'.$juri.'components/com_vmvendor/assets/img/info.png" title="'.$typefield->custom_tip.'::'.$typefield->custom_field_desc.'" width="16" height="16" alt="" class="'.$tooltip_class.'"/>';
echo '</td>';
echo '<td >';
switch($typefield->field_type){
case "S": //string
$core_custom_field_custom_value = $core_custom_field->custom_value;
if (JRequest::getVar('get_cf'.$i)!='')
$core_custom_field_custom_value = JRequest::getVar('get_cf'.$i);
echo '<input name="corecustomfield_'.$i.'" type="text" value="'.$core_custom_field_custom_value.'" size="50" ';
if (JRequest::getVar('get_cf'.$i)!='')
echo ' readonly="readonly" ';
echo '/>';
break;
case "I": // integer
echo '<input name="corecustomfield_'.$i.'" type="text" value="'.$core_custom_field->custom_value.'" size="50" />';
break;
case "B": // bolean
echo '<input name="corecustomfield_'.$i.'" id="corecustomfield_'.$i.'_0" type="radio" value="0" ';
if($core_custom_field->custom_value =='0' )
echo ' checked="checked" ';
echo '/> <label for="corecustomfield_'.$i.'_0">'.JText::_('JNo').'</label>
<input name="corecustomfield_'.$i.'" id="corecustomfield_'.$i.'_1" type="radio" value="1"';
if($core_custom_field->custom_value =='1' )
echo ' checked="checked" ';
echo ' /> <label for="corecustomfield_'.$i.'_1">'.JText::_('JYes').'</label>';
break;
case "D": // date
echo JHTML::calendar('','corecustomfield_'.$i ,'corecustomfield_'.$i,'%Y-%m-%d');
break;
case "T": // time
echo '<input name="corecustomfield_'.$i.'" type="text" value="'.$core_custom_field->custom_value.'" size="50" />';
break;
case "M": // image
break;
case "V": // cart variant
echo '<input name="corecustomfield_'.$i.'" type="text" value="'.$core_custom_field->custom_value.'" size="50" />';
break;
case "A": // generic Child variant
//vmdebug('displayProductCustomfieldBE $field',$field);
if(!isset($field->withParent)) $field->withParent = 0;
if(!isset($field->parentOrderable)) $field->parentOrderable = 0;
//vmdebug('displayProductCustomfieldFE',$field);
if (!class_exists('VmHTML')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
$html = JText::_('COM_VIRTUEMART_CUSTOM_WP').VmHTML::checkbox('field[' . $row . '][withParent]',$field->withParent,1,0,'').'<br />';
$html .= JText::_('COM_VIRTUEMART_CUSTOM_PO').VmHTML::checkbox('field[' . $row . '][parentOrderable]',$field->parentOrderable,1,0,'');
$options = array();
// $options[] = array( 'value' => 'product_name' ,'text' =>JText::_('COM_VIRTUEMART_PRODUCT_FORM_NAME')); Is anyway displayed there
$options[] = array('value' => 'product_sku', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_SKU'));
$options[] = array('value' => 'slug', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_ALIAS'));
$options[] = array('value' => 'product_length', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_LENGTH'));
$options[] = array('value' => 'product_width', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_WIDTH'));
$options[] = array('value' => 'product_height', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_HEIGHT'));
$options[] = array('value' => 'product_weight', 'text' => JText::_ ('COM_VIRTUEMART_PRODUCT_WEIGHT'));
$html .= JHTML::_ ('select.genericlist', $options, 'field[' . $row . '][custom_value]', '', 'value', 'text', $field->custom_value). '</td><td>' . $priceInput;
return $html;
// return 'Automatic Childvariant creation (later you can choose here attributes to show, now product name) </td><td>';
// variants
break;
case "X": // editor
jimport( 'joomla.html.editor' );
$editor = &JFactory::getEditor();
$editor_customfield_html = $editor->display("corecustomfield_".$i , $core_custom_field->custom_value , "100%;", '200', '5', '30', false);
echo $editor_customfield_html;
break;
case "Y": // textarea
echo '<textarea name="corecustomfield_'.$i.'" >';
echo $core_custom_field->custom_value;
echo '</textarea>';
break;
}
echo '</td>';
echo '</tr>';
}
}