public function init()
 {
     $this->name = \skeeks\cms\shop\Module::t('app', 'Viewed products');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopViewedProduct::className();
     parent::init();
 }
 public function init()
 {
     $this->name = \Yii::t('skeeks/shop/app', 'Viewed products');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopViewedProduct::className();
     parent::init();
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getShopViewedProducts()
 {
     return $this->hasMany(ShopViewedProduct::className(), ['shop_product_id' => 'id']);
 }
예제 #4
0
파일: _form.php 프로젝트: BMOTech/cms-shop
    <?php 
echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \skeeks\cms\shop\models\ShopBasket::find()->where(['fuser_id' => $fuser->id])]), 'columns' => [['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'created_at'], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'name'], ['class' => \yii\grid\DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Price'), 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
    return \Yii::$app->money->intlFormatter()->format($shopBasket->money);
}], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'quantity'], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'site_id']]]);
?>

<?php 
echo $form->fieldSetEnd();
?>


<?php 
echo $form->fieldSet(\skeeks\cms\shop\Module::t('app', 'Viewed products') . " (" . \skeeks\cms\shop\models\ShopViewedProduct::find()->where(['shop_fuser_id' => $fuser->id])->count() . ")");
?>

    <?php 
echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \skeeks\cms\shop\models\ShopViewedProduct::find()->where(['shop_fuser_id' => $fuser->id])]), 'columns' => [['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Date views')], ['class' => \yii\grid\DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (\skeeks\cms\shop\models\ShopViewedProduct $shopViewedProduct) {
    if ($shopViewedProduct->shopProduct) {
        return $shopViewedProduct->shopProduct->cmsContentElement->name;
    }
    return null;
}]]]);
?>

<?php 
echo $form->fieldSetEnd();
?>

<?php 
echo $form->buttonsCreateOrUpdate($model);
ActiveForm::end();