Example #1
0
 public function safeUp()
 {
     $newTag = Kiwi::getTag();
     $newTag->name = '首页标签';
     /** @var  $tagModel \creocoder\behaviors\NestedSet */
     $tagModel = Kiwi::getTag()->find()->where(['root' => 1])->one();
     $tagModel->append($newTag);
     $this->createTable('{{%customer_seller}}', ['customer_id' => Schema::TYPE_INTEGER . ' PRIMARY KEY ', 'money' => Schema::TYPE_DECIMAL . '(10, 2) NOT NULL', 'pin_password' => Schema::TYPE_STRING . ' NOT NULL', 'referrer' => Schema::TYPE_STRING . ' NOT NULL', 'status' => Schema::TYPE_INTEGER, 'integral' => Schema::TYPE_DECIMAL . '(10, 2)', 'reference_no' => Schema::TYPE_INTEGER, 'level' => Schema::TYPE_INTEGER . ' NOT NULL']);
     $this->createTable('{{%seller_money_log}}', ['seller_money_log_id' => Schema::TYPE_INTEGER, 'money' => Schema::TYPE_DECIMAL . '(10, 2) NOT NULL', 'type' => Schema::TYPE_STRING . ' NOT NULL', 'info' => Schema::TYPE_STRING . ' NOT NULL', 'created_at' => Schema::TYPE_STRING . ' NOT NULL']);
 }
Example #2
0
$fields = [];
$fields[] = $form->field($model, 'original_price')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'price')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'stock_qty')->textInput();
$fields[] = $form->field($model, 'min_sale_qty')->textInput();
$fields[] = $form->field($model, 'max_sale_qty')->textInput();
$fields[] = $form->field($model, 'weight')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'shipping_fee')->textInput(['maxlength' => 10]);
$fields[] = $form->field($model, 'is_free_shipping')->checkbox();
$fieldGroups[] = ['label' => 'Price & Stock', 'content' => implode('', $fields)];
$fields = [];
$fields[] = $form->field($model, 'pictures')->widget(InputFile::className(), ['multiple' => true, 'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default']]);
$categories = \kiwi\Kiwi::getCategory()->find()->all();
$categories = ArrayHelper::map($categories, 'id', 'name');
$fields[] = $form->field($model, 'categoryIds')->widget(Select2::classname(), ['data' => $categories, 'language' => 'en', 'options' => ['placeholder' => 'Select a state ...'], 'options' => ['multiple' => true]]);
$tags = \kiwi\Kiwi::getTag()->find()->all();
$tags = ArrayHelper::map($tags, 'id', 'name');
$fields[] = $form->field($model, 'tagIds')->widget(Select2::classname(), ['data' => $tags, 'language' => 'en', 'options' => ['placeholder' => 'Select a state ...'], 'options' => ['multiple' => true]]);
$fieldGroups[] = ['label' => 'Picture & Category & Tag', 'content' => implode('', $fields)];
echo Tabs::widget(['items' => $fieldGroups]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Example #3
0
 public function treeModel()
 {
     return Kiwi::getTag();
 }
Example #4
0
                <div class="col-sm-6 pagination-block">
                    <?php 
echo LinkPager::widget(['pagination' => $pages]);
?>
                </div>
            </div>
            <!-- Pagination & Results Ends -->
        </div>
        <!-- Primary Content Ends -->
        <!-- Sidebar Starts -->
        <div class="col-md-3">
            <!-- Categories Links Starts -->
            <h3 class="side-heading">目录</h3>
            <div class="list-group">
                <?php 
$tag = Kiwi::getTag()->find()->where(['name' => '首页标签'])->one();
$childrenTags = $tag->children()->all();
foreach ($childrenTags as $childrenTag) {
    ?>
                    <a href="<?php 
    echo Url::to(['/tag/list', 'name' => $childrenTag->name]);
    ?>
" class="list-group-item">
                        <i class="fa fa-chevron-right"></i>
                        <?php 
    echo $childrenTag->name;
    ?>
                    </a>
                <?php 
}
?>