예제 #1
0
 public function actionSearch()
 {
     $keyword = Yii::app()->request->getParam('q');
     if ($keyword == '') {
         $this->redirect(Yii::app()->homeUrl);
     }
     $keyword = Common::RemoveXSS($keyword);
     $order = Yii::app()->request->getParam('order', 1);
     $channel = strtolower(Yii::app()->request->getParam('channel', 'web'));
     $pagesize = 12;
     $count = ProductModel::model()->countsearchProduct($channel, $keyword);
     $page = new CPagination($count);
     $page->pageSize = $pagesize;
     $product_web = ProductModel::model()->searchProduct($channel, $keyword, $order, $page->getLimit(), $page->getOffset());
     $this->render('search', compact('product_web', 'page', 'keyword', 'order', 'channel', 'count'));
 }
예제 #2
0
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
예제 #3
0
" id="thumbnail_number_<?php 
    echo $i;
    ?>
">
				<input type="hidden" value="<?php 
    echo $i;
    ?>
" id="thumb_hidden_id">
				<div class="row">
					<label class="control-label">Ảnh</label>
					<div style="position: relative; width: 360px; height: 210px;left: 125px;">
						<img class="thumb-slider" id="thumb-change-<?php 
    echo $i;
    ?>
" src="<?php 
    echo ProductModel::model()->getCoverUrl($model->id, $i);
    ?>
">
						<a class="pro_remove_img" onclick="remove_img(<?php 
    echo $i;
    ?>
);"><img src="/img/remove.png"></a>
						<label class="thumb-slider-change-text" for="clip_thumbnail_<?php 
    echo $i;
    ?>
">Upload ảnh</label>
						<input class="hidden" type="file" name="clip_thumbnail_<?php 
    echo $i;
    ?>
" id="clip_thumbnail_<?php 
    echo $i;
예제 #4
0
 public function getProductRelate($product_id, $channel, $limit)
 {
     if (strtolower($channel) == 'web') {
         $other_channel = 'app';
     } else {
         $other_channel = 'web';
     }
     $criteria = new CDbCriteria();
     $criteria->condition = 'channel <> :channel and id <> :id';
     $criteria->params = array(':channel' => $other_channel, 'id' => $product_id);
     $criteria->limit = $limit;
     $product = ProductModel::model()->findAll($criteria);
     return $product;
 }
예제 #5
0
 public function actionSorder()
 {
     $id = Yii::app()->request->getParam('id');
     $type = Yii::app()->request->getParam('type');
     $type = trim(strtolower($type));
     $product = ProductModel::model()->findbyPk($id);
     switch ($type) {
         case 'top':
     }
     $this->redirect(array('index'));
 }