Пример #1
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Category;
use app\models\Supplier;
use app\models\Product;
use app\models\Currency;
use yii\helpers\ArrayHelper;
use zxbodya\yii2\galleryManager\GalleryManager;
/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $form yii\widgets\ActiveForm */
$categories = Category::find()->active()->orderBy(['title' => SORT_ASC])->all();
$suppliers = Supplier::find()->active()->orderBy(['name' => SORT_ASC])->all();
$currencies = Currency::labels();
?>

<div class="product-form">

	<?php 
$form = ActiveForm::begin(['enableClientValidation' => false, 'options' => ['enctype' => 'multipart/form-data']]);
?>

	<?php 
echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map($categories, 'id', 'title'));
?>

	<?php 
echo $form->field($model, 'supplier_id')->dropDownList(ArrayHelper::map($suppliers, 'id', 'name'));
?>
Пример #2
0
 /**
  * Get the variant currency label.
  * @return string
  */
 public function getVariantCurrencyLabel()
 {
     return Currency::labels()[$this->variant_currency];
 }