Ejemplo n.º 1
0
 public function actionView($id)
 {
     $modelUser = User::findOne(['id' => $id, 'status' => User::STATUS_ACTIVE]);
     $modelUserProfile = UserProfile::findOne(['user_id' => $modelUser->id]);
     $queryProducts = CatalogProducts::find()->where(['published' => true]);
     $queryProducts->andWhere(['createdby' => $modelUser->id]);
     $pagination = new Pagination(['defaultPageSize' => 10, 'totalCount' => $queryProducts->count()]);
     $elements = $queryProducts->orderBy('publishedon' . ' ' . 'desc')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('viewOwner', ['modelUser' => $modelUser, 'modelUserProfile' => $modelUserProfile, 'elements' => $elements, 'pagination' => $pagination]);
 }
Ejemplo n.º 2
0
 public function actionSearch($q, $sortname = 'price', $sortdirection = 'asc', $pageSize = 20, $condition = '', $render = 'index', $tpl = 'main')
 {
     $ajax = Yii::$app->request->post('ajax');
     $q_lower = mb_strtolower($q, 'UTF-8');
     $qstring = " LOWER (`name`) LIKE '%{$q_lower}%'";
     $qstring .= " OR LOWER (`price`) LIKE '%{$q_lower}%'";
     $qstring .= " OR LOWER (`introtext`) LIKE '%{$q_lower}%'";
     $qstring .= " OR LOWER (`content`) LIKE '%{$q_lower}%'";
     $query = CatalogProducts::find()->where(['isparent' => false, 'status' => CatalogProducts::STATUS_PUBLISHED]);
     $query->andWhere($condition);
     $query->andWhere($qstring);
     $pagination = new Pagination(['defaultPageSize' => $pageSize, 'totalCount' => $query->count()]);
     $elements = $query->orderBy($sortname . ' ' . $sortdirection)->offset($pagination->offset)->limit($pagination->limit)->all();
     if ($ajax) {
         return $this->renderAjax($render, ['elements' => $elements, 'pagination' => $pagination, 'parent' => $parent, 'sortname' => $sortname, 'sortdirection' => $sortdirection, 'tpl' => $tpl, 'condition' => $condition, 'search' => $q]);
     } else {
         return $this->render($render, ['elements' => $elements, 'pagination' => $pagination, 'parent' => $parent, 'sortname' => $sortname, 'sortdirection' => $sortdirection, 'tpl' => $tpl, 'condition' => $condition, 'search' => $q]);
     }
 }
Ejemplo n.º 3
0
            <div class="top-nav">		
                <ul class="megamenu skyblue">
                    <?php 
foreach (ArrayHelper::map(CatalogProducts::findAll(['parent' => 0, 'isparent' => true, 'status' => CatalogProducts::STATUS_PUBLISHED]), 'id', 'name') as $category_id => $category_name) {
    ?>
                    <li class="active grid"><a  href="#"><?php 
    echo $category_name;
    ?>
</a>
                        <div class="megapanel">
                            <div class="row">
                                <div class="col1">
                                    <div class="h_nav">
                                        <ul>
                                            <?php 
    $count = CatalogProducts::find()->where(['parent' => $category_id, 'isparent' => true, 'status' => CatalogProducts::STATUS_PUBLISHED])->count() / 2;
    $i = 0;
    foreach (ArrayHelper::map(CatalogProducts::findAll(['parent' => $category_id, 'isparent' => true, 'status' => CatalogProducts::STATUS_PUBLISHED]), 'id', 'name') as $element_id => $element_name) {
        ?>
                                                    <?php 
        if ($i++ >= $count) {
            ?>
                                                        </ul>
                                                        </div>
                                                        </div>
                                                        <div class="col1">
                                                        <div class="h_nav">
                                                        <ul>
                                                    <?php 
            $count = 0;
        }
Ejemplo n.º 4
0
}
?>
                       
                    </div>
                </figure>
                <!--Bestsellers-->
                <figure class="widget shadow r_corners wrapper m_bottom_30">
                    <figcaption>
                        <h3 class="color_light">Наши товары</h3>
                    </figcaption>
                    <div class="widget_content">
                        <?php 
$first = true;
?>
                        <?php 
foreach (CatalogProducts::find()->where(['isparent' => false, 'status' => CatalogProducts::STATUS_PUBLISHED])->orderBy('RAND()')->limit(4)->all() as $model) {
    ?>
                            <?php 
    echo $first ? '<hr class="m_bottom_15">' : '';
    ?>
 
                            <?php 
    $first = false;
    ?>
                            <div class="clearfix m_bottom_15">
                                <?php 
    echo Html::img(Image::thumb($model->image, 80, 80), ['class' => 'f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0']);
    ?>
                                <?php 
    echo Html::a($model->name, ['/catalog/site/view-by-url', 'url' => $model->seo_url], ['class' => 'color_dark d_block bt_link']);
    ?>
Ejemplo n.º 5
0
                        </a>
                    </div>
                <?php 
}
?>
            </section>
            <!--/products-->
        </div>

        <div class="clearfix m_bottom_10 m_sm_bottom_20" style="padding-top:30px;">
            <h2 class="tt_uppercase color_dark f_left heading2 animate_fade f_mxs_none m_mxs_bottom_15">Акция дня <b>-30%</b></h2>
        </div>

        <section class="products_container a_type_2 clearfix m_bottom_25">
            <?php 
foreach (CatalogProducts::find()->where(['isparent' => false, 'status' => CatalogProducts::STATUS_PUBLISHED, 'discont' => true])->limit(4)->all() as $model) {
    ?>
            <!--product item-->
            <div class="product_item w_xs_full">
                <figure class="r_corners photoframe animate_ftb type_2 t_align_c tr_all_hover shadow relative">
                    <a href="#" class="d_block relative pp_wrap m_bottom_15">
                        <?php 
    echo Html::img(File::thumb($model->image, 242, 242), ['class' => 'tr_all_hover']);
    ?>
                    </a>
                    <figcaption>
                        <h5 class="m_bottom_10"><?php 
    echo Html::a($model->name, ['/catalog/site/view-by-url' => $model->seo_url], ['class' => 'color_dark']);
    ?>
</h5>
                        <div class="clearfix m_bottom_15">
Ejemplo n.º 6
0
//use kartik\datecontrol\DateControl;
use common\themes\admin\widgets\ActiveForm;
use andreosoft\summernote\Summernote;
use common\modules\catalog\models\CatalogProducts;
use common\modules\catalog\models\CatalogCategorys;
use common\modules\filemanager\widgets\Image;
use yii\grid\CheckboxColumn;
use yii\widgets\ListView;
use common\themes\admin\widgets\GridView;
use common\themes\admin\widgets\GridViewEdited;
use common\modules\comments\models\CommentsSearch;
use common\modules\gallery\models\GallerySearch;
use common\modules\gallery\widgets\Galleryinline;
use common\themes\admin\widgets\ActionColumn;
use common\modules\filemanager\widgets\ImageColumn;
use yii\helpers\Url;
?>

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

<?php 
echo Tabs::widget(['options' => ['class' => 'nav-tabs-custom'], 'items' => [['label' => \Yii::t('catalog/main', 'Main'), 'content' => $form->field($model, 'name')->textInput(['maxlength' => 255]) . $form->field($model, 'introtext')->widget(Summernote::className(), ['editorOptions' => ['height' => 200]]) . $form->field($model, 'content')->widget(Summernote::className(), ['editorOptions' => ['height' => 400]]), 'active' => true], ['label' => \Yii::t('catalog/main', 'Info'), 'content' => $form->field($model, 'tag')->textInput(['maxlength' => 255]) . $form->field($model, 'image')->widget(Image::className()) . $form->field($model, 'price')->textInput(['maxlength' => 11]) . $form->field($model, 'price_d')->textInput(['maxlength' => 11]) . $form->field($model, 'discont')->dropDownList([0 => Yii::t('catalog/main', 'No'), 1 => Yii::t('catalog/main', 'Yes')])], ['label' => \Yii::t('catalog/main', 'Seo'), 'content' => $form->field($model, 'seo_url')->textInput(['maxlength' => 255]) . $form->field($model, 'seo_title')->textInput(['maxlength' => 255]) . $form->field($model, 'seo_description')->textarea() . $form->field($model, 'seo_keyword')->textInput(['maxlength' => 255])], ['label' => \Yii::t('catalog/main', 'Manager'), 'content' => $form->field($model, 'isparent')->dropDownList([0 => Yii::t('catalog/main', 'No'), 1 => Yii::t('catalog/main', 'Yes')]) . $form->field($model, 'parent')->dropDownList(ArrayHelper::merge(['0' => 'No'], ArrayHelper::map(CatalogProducts::find()->where(['isparent' => '1'])->all(), 'id', 'fullname'))) . $form->field($model, 'status')->dropDownList(CatalogProducts::getStatusArray()) . $form->field($model, 'publishedondate')->widget(DatePicker::className()) . $form->field($model, 'publishedontime')->textInput() . $form->field($model, 'sort')->textInput()], ['label' => 'Comments', 'content' => isset($model->id) ? \common\themes\admin\widgets\GridViewEdited::widget(['dataProvider' => (new CommentsSearch())->search(['CommentsSearch' => ['table_name' => 'catalog', 'table_id' => $model->id]]), 'actionUpdate' => Url::to(['/comments/backend/update']), 'createModel' => new \common\modules\comments\models\Comments(), 'defaultValue' => ['Comments[table_id]' => $model->id, 'Comments[table_name]' => 'catalog'], 'columns' => [['attribute' => 'status', 'value' => function ($model) {
    return Html::activeDropDownList($model, 'status', ['Unpublished', 'Published'], ['class' => 'form-control', 'style' => 'width:100%;', 'prompt' => 'Выберите']);
}], ['attribute' => 'content'], ['class' => \common\themes\admin\widgets\ActionColumn::className(), 'template' => '{delete}', 'controller' => '/comments/backend']]]) : '<div class="alert alert-warning alert-dismissable">' . '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . '<h4><i class="icon fa fa-warning"></i> Внимение!</h4>' . \Yii::t('catalog/main', 'Save befor use it') . '</div>' . Html::submitButton('Save', ['class' => 'btn btn-success'])], ['label' => \Yii::t('catalog/main', 'Gallery'), 'content' => isset($model->id) ? \common\themes\admin\widgets\GridViewEdited::widget(['dataProvider' => (new \common\modules\gallery\models\GallerySearch())->search(['GallerySearch' => ['table_name' => 'catalog', 'table_id' => $model->id]]), 'actionUpdate' => Url::to(['/gallery/backend/update']), 'createModel' => new \common\modules\gallery\models\Gallery(), 'defaultValue' => ['Gallery[table_id]' => $model->id, 'Gallery[table_name]' => 'catalog'], 'columns' => [['class' => common\modules\filemanager\widgets\ImageColumn::className(), 'attribute' => 'image'], ['attribute' => 'status', 'value' => function ($model) {
    return Html::activeDropDownList($model, 'status', \common\modules\gallery\models\Gallery::getStatusArray(), ['class' => 'form-control', 'style' => 'width:100%;', 'prompt' => 'Выберите']);
}], 'content', 'sort', ['class' => \common\themes\admin\widgets\ActionColumn::className(), 'template' => '{delete}', 'controller' => '/gallery/backend']]]) : '<div class="alert alert-warning alert-dismissable">' . '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . '<h4><i class="icon fa fa-warning"></i> Внимение!</h4>' . \Yii::t('catalog/main', 'Save befor use it') . '</div>' . Html::submitButton('Save', ['class' => 'btn btn-success'])]]]);
?>
        <?php 
ActiveForm::end();
Ejemplo n.º 7
0
use common\modules\catalog\models\CatalogProducts;
use yii\helpers\Html;
use andreosoft\image\Image;
?>

<div class="wrapper" style="padding-top: 70px;">
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="kopa-related-posts">
                <h3 class="widget-title style7">Недавние работы</h3>
                <div class="row">
                    <div style="opacity: 1; display: block;">

<?php 
foreach (CatalogProducts::find()->where(['parent' => 1, 'isparent' => false, 'status' => CatalogProducts::STATUS_PUBLISHED])->limit(3)->orderBy('publishedon desc')->all() as $model) {
    ?>
                            <div class="col-md-4 col-sm-4 col-xs-12">
                                <div class="item">
                                    <article class="entry-item">
                                        <div class="entry-thumb">
                                            <div class="entry-thumb-inner">
                                                <?php 
    echo Html::a('', ['/catalog/site/view-by-url', 'url' => $model->seo_url], ['class' => 'thumb-hover']);
    ?>
                                                <?php 
    echo Html::img(Image::thumb($model->image, 303, 205));
    ?>
                                            </div>
                                        </div>
                                        <div class="entry-content">
Ejemplo n.º 8
0
<hr class="mt-0 mb-0 "/>
<!-- End Divider -->


<!-- Related Products -->
<section class="small-section blockup">
    <div class="container relative">

        <h2 class="section-title font-alt mb-70 mb-sm-40">
            Смотрите также
        </h2>

        <!-- Products Grid -->
        <div class="row multi-columns-row">
        <?php 
foreach (CatalogProducts::find()->where(['status' => CatalogProducts::STATUS_PUBLISHED, 'parent' => $model->parent])->andWhere('id <> ' . $model->id)->orderBy('RAND()')->limit(4)->all() as $model) {
    ?>
            <!-- Shop Item -->
            <div class="col-md-3 col-lg-3 mb-xs-40">
                <div class="post-prev-img">
                    <?php 
    echo Html::a(Html::img(Image::thumb($model->image, 370, 472)), ['view-by-url', 'url' => $model->seo_url]);
    ?>
                </div>
                <div class="post-prev-title font-alt align-center">
                    <?php 
    echo Html::a($model->name, ['view-by-url', 'url' => $model->seo_url]);
    ?>
                </div>
            </div>
            <!-- End Shop Item -->