<div id="item_prop_values"> <?php use yii\helpers\Html; if ($model && $model->props) { $itemPropValues = json_decode($model->props, true); } if (!isset($itemProps)) { $itemProps = \star\catalog\models\ItemProp::findAll(['category_id' => $tree_id]); } $i = 0; /** @var \star\catalog\models\ItemProp $itemProp */ foreach ($itemProps as $itemProp) { if (!$itemProp->is_sale_prop) { $propValues = $itemProp->propValues; $propValueData = array(); foreach ($propValues as $propValue) { $propValueData[$propValue->value_id] = $propValue->value_name; } $itemPropValue = ''; if (isset($itemPropValues[$itemProp->prop_id])) { if (is_array($itemPropValues[$itemProp->prop_id])) { $itemPropValue = array(); foreach ($itemPropValues[$itemProp->prop_id] as $value) { $values = explode(':', $value); $itemPropValue[] = $values[1]; } } else { $values = explode(':', $itemPropValues[$itemProp->prop_id]); $itemPropValue = $values[1]; } }
public function actionItemProps($category_id, $item_id = 0, $tree_id) { $itemProps = ItemProp::findAll(['category_id' => $category_id]); $model = Item::findOne(['item_id' => $item_id]); return $this->renderPartial('_form_prop', array('itemProps' => $itemProps, 'model' => $model, 'tree_id' => $tree_id)); }