public function init() { $this->name = \Yii::t('skeeks/shop/app', 'Delivery services'); $this->modelShowAttribute = "name"; $this->modelClassName = ShopDelivery::className(); parent::init(); }
public function init() { $this->name = \skeeks\cms\shop\Module::t('app', 'Delivery services'); $this->modelShowAttribute = "name"; $this->modelClassName = ShopDelivery::className(); parent::init(); }
/** * @return \yii\db\ActiveQuery */ public function getDelivery() { return $this->hasOne(ShopDelivery::className(), ['id' => 'delivery_id']); }
</div> <div id="sx-allow-delivery" style="min-width: 500px; max-width: 500px;"> <h2>Доставка:</h2><hr /> <?php $form = \skeeks\cms\base\widgets\ActiveFormAjaxSubmit::begin(['validationUrl' => \skeeks\cms\helpers\UrlHelper::construct(['shop/admin-order/validate', 'pk' => $model->id])->enableAdmin()->toString(), 'action' => \skeeks\cms\helpers\UrlHelper::construct(['shop/admin-order/save', 'pk' => $model->id])->enableAdmin()->toString(), 'afterValidateCallback' => new \yii\web\JsExpression(<<<JS function(jForm, ajax){ new sx.classes.OrderCallback(jForm, ajax); }; JS )]); ?> <?php echo $form->fieldSelect($model, 'delivery_id', \yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopDelivery::find()->active()->all(), 'id', 'name')); ?> <?php echo $form->fieldRadioListBoolean($model, 'allow_delivery'); ?> <button class="btn btn-primary">Сохранить</button> <?php \skeeks\cms\base\widgets\ActiveFormAjaxSubmit::end(); ?> </div>
public function loadDefaultValues($skipIfSet = true) { parent::loadDefaultValues($skipIfSet); if (!$this->site_id) { $this->site_id = \Yii::$app->cms->site->id; } if (!$this->delivery_id) { //$this->delivery_id = \Yii::$app->cms->site->id; } if (!$this->person_type_id && \Yii::$app->shop->shopPersonTypes) { $shopPersonType = \Yii::$app->shop->shopPersonTypes[0]; $this->person_type_id = $shopPersonType->id; } if (!$this->pay_system_id && $this->paySystems) { $paySystem = $this->paySystems[0]; $this->pay_system_id = $paySystem->id; } $deliveries = \skeeks\cms\shop\models\ShopDelivery::find()->active()->all(); if (!$this->delivery_id && $deliveries) { $delivery = $deliveries[0]; $this->delivery_id = $delivery->id; } }
echo $form->field($shopFuser, 'person_type_id')->radioList(\yii\helpers\ArrayHelper::map(\Yii::$app->shop->shopPersonTypes, 'id', 'name'), ['data-form-reload' => 'true'])->label(false); ?> <? if (count(\Yii::$app->shop->shopPersonTypes) <= 1) : ?> </div> <? endif; ?> <? foreach ($widget->shopBuyer->relatedProperties as $property) : ?> <?php echo $property->renderActiveForm($form, $widget->shopBuyer); ?> <? endforeach; ?> <? if ($widget->shopFuser->paySystems) : ?> <?php echo $form->field($widget->shopFuser, 'pay_system_id')->label('Способ оплаты')->radioList(\yii\helpers\ArrayHelper::map($widget->shopFuser->paySystems, 'id', 'name'), ['data-form-reload' => 'true']); ?> <? endif; ?> <?php echo $form->field($widget->shopFuser, 'delivery_id')->label('Способ доставки')->radioList(\yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopDelivery::find()->active()->all(), 'id', 'name'), ['data-form-reload' => 'true']); ?> <?php echo \yii\helpers\Html::button('Отправить', ['class' => 'btn btn-primary', 'type' => 'submit']); ?> <? $form::end(); ?> <? else : ?> Магазин не настроен <? endif; ?> <?php echo \yii\helpers\Html::endTag('div');