当前位置: 首页>>代码示例>>PHP>>正文


PHP Brand::model方法代码示例

本文整理汇总了PHP中Brand::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Brand::model方法的具体用法?PHP Brand::model怎么用?PHP Brand::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Brand的用法示例。


在下文中一共展示了Brand::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Modelo();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Modelo'])) {
         $model->attributes = $_POST['Modelo'];
         if ($model->save()) {
             if (!empty($_POST['yt1'])) {
                 Yii::app()->user->setFlash('modelo-created', "¡El modelo <b><i>&quot;{$model->name}&quot;</i></b> fue creado exitosamente!");
                 //$this->redirect(array('create'));
                 $modelSaved = $model;
                 $model = new Modelo();
                 $model->equipment_type_id = $modelSaved->equipment_type_id;
                 $model->brand_id = $modelSaved->brand_id;
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (EquipmentType::model()->count('active = 1') == 0 && Brand::model()->count('active = 1') == 0) {
         throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . ' y ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
     } else {
         if (EquipmentType::model()->count('active = 1') == 0) {
             throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . '.');
         } else {
             if (Brand::model()->count('active = 1') == 0) {
                 throw new CHttpException('', 'Primero debe ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
             } else {
                 $this->render('create', array('model' => $model));
             }
         }
     }
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:38,代码来源:ModeloController.php

示例2: actionIndex

 public function actionIndex()
 {
     $product_id = intval($_REQUEST['id']);
     $pInfo = Product::model()->getProductInfoById($product_id);
     if (empty($pInfo)) {
         $this->redirect('/?from=no_goods');
         //跳转到首页
     }
     $brandInfo = '';
     if ($pInfo['brand_id']) {
         $brandInfo = Brand::model()->findByPk($pInfo['brand_id']);
     }
     $stock = Product::model()->getProductStock($product_id, $pInfo['is_multiple']);
     $attrList = ProductAttributes::model()->getProductAttrNameList();
     $extendAttrList = ProductExtend::model()->getProductExtendAttrs($product_id);
     $is_like = Like::model()->getLikeStatus($this->user_id, $product_id);
     $cake = Category::model()->getCakeLine($pInfo['cat_id']);
     //获取商品的面包屑
     $viewData = array();
     $viewData['pInfo'] = $pInfo;
     $viewData['brandInfo'] = $brandInfo;
     $viewData['is_like'] = $is_like;
     $viewData['cake'] = $cake;
     $viewData['stock'] = $stock;
     $viewData['attrList'] = $attrList;
     $viewData['extendAttrList'] = $extendAttrList;
     $this->render('item/index', $viewData);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:28,代码来源:ItemController.php

示例3: actionDetail

 /**
  * 品牌详情页面(带商品列表)
  */
 public function actionDetail()
 {
     $_REQUEST['id'] = intval($_REQUEST['id']);
     if (empty($_REQUEST['id'])) {
         $this->redirect('/?from=brand_empty');
     }
     $brandInfo = Brand::model()->getBrandInfoForWeb($_REQUEST['id']);
     if (empty($brandInfo)) {
         $this->redirect('/?from=brand_empty');
     }
     $result = Brand::model()->getBrandProductByPageForWeb($_REQUEST);
     if (empty($result) || $result['count'] <= 0) {
         $this->redirect('/?from=brand_product_empty');
     }
     $filter = $result['filter'];
     $urlStr = '/brand/' . $_REQUEST['id'];
     $pages = '';
     $pageShort = '';
     if ($result['count'] > 0) {
         $pages = Common::instance()->get_page_list($result['count'], $filter['p'], $filter['page_size'], $urlStr);
         $pageShort = Common::instance()->get_page_short($result['count'], $filter['p'], $filter['page_size'], $urlStr);
     }
     $viewData = array();
     $viewData['brandInfo'] = $brandInfo;
     $viewData['list'] = $result['list'];
     $viewData['count'] = $result['count'];
     $viewData['filter'] = $result['filter'];
     $viewData['pages'] = $pages;
     $viewData['pageShort'] = $pageShort;
     $this->render('brand/detail', $viewData);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:34,代码来源:BrandController.php

示例4: run

 public function run()
 {
     Yii::import($this->import);
     $data = CHtml::listData(Brand::model()->findAll(array('order' => 'title')), 'id', 'title');
     $data[0] = '';
     ksort($data);
     echo CJavaScript::jsonEncode($data);
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:8,代码来源:ajaxBrandsAction.php

示例5: loadModel

 public function loadModel($id)
 {
     $model = Brand::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:8,代码来源:BrandController.php

示例6: actionIndex

 public function actionIndex()
 {
     $brand_id = isset($_GET['brand_id']) ? $_GET['brand_id'] : 0;
     $productCategoryOptions = ProductCategory::model()->byBrandOptions($brand_id);
     // 产品
     $criteria = new CDbCriteria();
     $criteria->compare('t.is_released', 1);
     $productarr = Product::model()->localized()->findAll($criteria);
     $brand = array();
     if ($brand_id != 0) {
         $criteria = new CDbCriteria();
         $criteria->compare('t.brand_id', $brand_id);
         $criteria->order = 'sort_order ASC';
         $brand = Brand::model()->localized()->find($criteria);
         $productCategoryOptions = ProductCategory::model()->byBrandOptions($brand_id);
         // 产品
         $criteria = new CDbCriteria();
         $criteria->compare('t.brand_id', $brand_id);
         $productarr = Product::model()->localized()->findAll($criteria);
     }
     $products = array();
     foreach ($productarr as $model) {
         $products[] = $model->attributes;
     }
     // 广告图
     $criteria = new CDbCriteria();
     $criteria->compare('t.banner_position_id', 1);
     $banner = Banner::model()->localized()->find($criteria);
     $brands = array();
     $criteria = new CDbCriteria();
     $criteria->select = 'brand_id,title';
     $criteria->compare('t.is_released', 1);
     $brandsarr = Brand::model()->localized()->findAll($criteria);
     foreach ($brandsarr as $model) {
         $brands[$model->brand_id] = $model->title;
     }
     $series = array();
     $criteria = new CDbCriteria();
     $criteria->select = 'series_id,title';
     $criteria->compare('t.is_released', 1);
     $seriesarr = ProductSeries::model()->localized()->findAll($criteria);
     foreach ($seriesarr as $model) {
         $series[$model->series_id] = $model->title;
     }
     $categorys = array();
     $criteria = new CDbCriteria();
     $criteria->select = 'category_id,name';
     $criteria->compare('t.is_released', 1);
     $categorysarr = ProductCategory::model()->localized()->findAll($criteria);
     foreach ($categorysarr as $model) {
         $categorys[$model->category_id] = $model->name;
     }
     $this->layout = 'main';
     $this->pageTitle = Yii::t('common', '产品中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
     $this->render('index', array('brand_id' => $brand_id, 'brand' => $brand, 'products' => $products, 'brands' => $brands, 'series' => $series, 'categorys' => $categorys, 'productCategoryOptions' => $productCategoryOptions, 'banner' => $banner));
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:56,代码来源:ProductController.php

示例7: GetCategoryBrands

 /**
  * @static Return brands list for category, sorted by brand goods count
  * @param $category_id
  * @return Brand[] brands, whose goods belongs to the category
  */
 public static function GetCategoryBrands($category_id)
 {
     $brands = Brand::model()->with(array('goodsCount' => array('condition' => 'category_id=' . $category_id)))->findAll();
     foreach ($brands as $i => $brand) {
         if ($brand->goodsCount == 0) {
             unset($brands[$i]);
         }
     }
     usort($brands, 'CAlexHelper::CompareGoodsCount');
     return $brands;
 }
开发者ID:rahmanjis,项目名称:yii-catalog,代码行数:16,代码来源:Brand.php

示例8: actionEdit

 public function actionEdit()
 {
     if (empty($_POST)) {
         $pInfo = Product::model()->findByPk($_REQUEST['id']);
         $categorys = Category::model()->getSelectCategoryForProductEdit();
         //可选分类列表
         $brands = Brand::model()->getSelectBrandForProductEdit();
         //可选品牌列表
         $productAttributes = ProductAttributes::model()->getProductAttrTree();
         $pImages = ProductImage::model()->findAllByAttributes(array('product_id' => $_REQUEST['id']));
         $stocks = ProductStock::model()->findAllByAttributes(array('product_id' => $_REQUEST['id']));
         $attrList = array();
         foreach ($productAttributes as $row) {
             if ($row['child']) {
                 $attrList += $row['child'];
             }
         }
         $viewData = array();
         $viewData['categorys'] = $categorys;
         $viewData['brands'] = $brands;
         $viewData['pInfo'] = $pInfo;
         $viewData['pImages'] = $pImages;
         $viewData['stocks'] = $stocks;
         $viewData['attrList'] = $attrList;
         $viewData['productAttributes'] = $productAttributes;
         $this->render('edit', $viewData);
         exit;
     }
     $res = array('statusCode' => 200, 'message' => '修改成功!');
     $transaction = Yii::app()->shop->beginTransaction();
     try {
         $productId = $this->saveProduct();
         //保存商品的基本信息
         $this->saveProductCategory($productId);
         //保存商品的分类信息
         $this->saveProductExtend($productId);
         //保存商品的扩展信息
         $this->saveProductStock($productId);
         //保存商品的库存信息
         // $this->saveProductAttr($productId); //保存商品的属性信息
         $transaction->commit();
     } catch (exception $e) {
         $transaction->rollback();
         $res['statusCode'] = 300;
         $res['message'] = '修改失败!【' . $e->getMessage() . '】';
     }
     $res['navTabId'] = 'productList';
     $res['callbackType'] = 'closeCurrent';
     $res['forwardUrl'] = '/manage/product/index';
     $this->ajaxDwzReturn($res);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:51,代码来源:ProductController.php

示例9: actionView

 public function actionView()
 {
     $previd = 0;
     // 上一个品牌
     $nextid = 0;
     // 下一个品牌
     $brand = null;
     $prevname = '';
     $nextname = '';
     $products = null;
     if (isset($_GET['id'])) {
         $id = Yii::app()->request->getQuery('id');
         // 浏览数量加1
         $brandModel = Brand::model()->findByPk($id);
         $brandModel->view_count += 1;
         $brandModel->update();
         $brand = Brand::model()->localized()->findByPk($id);
         $criteria = new CDbCriteria();
         $criteria->compare('t.is_released', 1);
         $criteria->compare('t.brand_id', $id);
         $products = Product::model()->localized()->findAll($criteria);
         $criteria = new CDbCriteria();
         $criteria->compare('t.is_released', 1);
         $criteria->order = 'sort_order ASC';
         $brands = Brand::model()->localized()->findAll($criteria);
         foreach ($brands as $key => $value) {
             if ($value->brand_id == $id && $key != 0) {
                 $previd = isset($brands[$key - 1]) ? $brands[$key - 1]['brand_id'] : 0;
                 $nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
                 $prevname = isset($brands[$key - 1]) ? $brands[$key - 1]['title'] : '';
                 $nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
             } else {
                 if ($value->brand_id == $id && $key == 0) {
                     $nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
                     $nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
                 }
             }
         }
     }
     if (empty($brand)) {
         throw new CHttpException(404);
     }
     // 广告图
     $criteria = new CDbCriteria();
     $criteria->compare('t.banner_position_id', 2);
     $banner = Banner::model()->localized()->find($criteria);
     $this->pageTitle = Yii::t('common', '品牌中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
     $this->render('view', array('brand' => $brand, 'banner' => $banner, 'previd' => $previd, 'nextid' => $nextid, 'prevname' => $prevname, 'nextname' => $nextname, 'products' => $products));
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:49,代码来源:BrandController.php

示例10: actionSearch

 public function actionSearch()
 {
     $keyword = $_GET['keyword'] ? trim($_GET['keyword']) : "";
     $num = 0;
     $products = null;
     $brands = null;
     // 品牌搜索
     $criteria = new CDbCriteria();
     $criteria->addSearchCondition('t.title', $keyword, true, 'OR');
     $criteria->addSearchCondition('t.sub_content', $keyword, true, 'OR');
     $criteria->addSearchCondition('t.content', $keyword, true, 'OR');
     if ($_GET['lang'] === 'en') {
         $criteria->addSearchCondition('localized.title', $keyword, true, 'OR');
         $criteria->addSearchCondition('localized.sub_content', $keyword, true, 'OR');
         $criteria->addSearchCondition('localized.content', $keyword, true, 'OR');
     }
     $brands = Brand::model()->localized()->findAll($criteria);
     // 产品搜索
     $criteria = new CDbCriteria();
     $criteria->select = 't.series_id';
     $criteria->addSearchCondition('t.title', $keyword, true, 'OR');
     $criteria->addSearchCondition('t.norms', $keyword, true, 'OR');
     $criteria->addSearchCondition('t.series_model', $keyword, true, 'OR');
     $criteria->addSearchCondition('t.content', $keyword, true, 'OR');
     if ($_GET['lang'] === 'en') {
         $criteria->select = 'localized.owner_id as series_id';
         $criteria->addSearchCondition('localized.title', $keyword, true, 'OR');
         $criteria->addSearchCondition('localized.norms', $keyword, true, 'OR');
         $criteria->addSearchCondition('localized.series_model', $keyword, true, 'OR');
         $criteria->addSearchCondition('localized.content', $keyword, true, 'OR');
     }
     $serieids = ProductSeries::model()->localized()->findAll($criteria);
     $ids = array();
     foreach ($serieids as $key => $value) {
         $ids[] = $value->series_id;
     }
     $criteria = new CDbCriteria();
     if (!empty($ids)) {
         $criteria->addInCondition('t.series_id', $ids);
     }
     $criteria->addSearchCondition('t.name', $keyword, true, 'OR');
     if ($_GET['lang'] === 'en') {
         $criteria->addSearchCondition('localized.name', $keyword, true, 'OR');
     }
     $products = Product::model()->localized()->findAll($criteria);
     $num = count($products) + count($brands);
     $this->pageTitle = Yii::t('common', '首页') . SEPARATOR . Setting::getValueByCode('inside_title', true);
     $this->render('search', array('keyword' => $keyword, 'brands' => $brands, 'products' => $products, 'num' => $num));
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:49,代码来源:SiteController.php

示例11: getSelects

 public static function getSelects()
 {
     static $level = 0;
     $items = array();
     $criteria = new CDbCriteria();
     $criteria->compare('t.is_released', 1);
     $models = self::model()->localized(null, false)->findAll($criteria);
     foreach ($models as $model) {
         $criteria = new CDbCriteria();
         $criteria->compare('region_id', $model->primaryKey);
         $brands = Brand::model()->findAll($criteria);
         if (count($brands) > 0) {
             $items[$model->primaryKey] = $model->title;
         }
     }
     return $items;
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:17,代码来源:Region.php

示例12: actionDetail

 public function actionDetail()
 {
     //$model = Dealer::model()->find("userID=:userID", array(":userID" => $_GET['dealer']));
     $organID = Yii::app()->request->getParam("dealer");
     $model = Organ::model()->with('dealer')->findByPK($organID);
     //主营品牌
     $brands = Brand::model()->findAll("OrganID = {$organID}");
     $data = array();
     foreach ($brands as $key => $brand) {
         $data[$key]['brandname'] = $brand['BrandName'];
     }
     //主营车系
     $dealerv = DealerVehicles::model()->findAll("OrganID=:userID", array(":userID" => $organID));
     //主营品类
     $cpnames = OrganCpname::model()->findAll('OrganID=:userID', array(':userID' => $organID));
     // 机构照片
     $photosql = 'select * from `{{organ_photo}}` where OrganID=' . $organID;
     $organphotos = Yii::app()->jpdb->createCommand($photosql)->queryAll();
     $this->render("detail", array('model' => $model, 'organphotos' => $organphotos, 'dealerv' => $dealerv, 'showcpnames' => $cpnames, 'data' => $data));
 }
开发者ID:zwq,项目名称:unpei,代码行数:20,代码来源:ServicedetailController.php

示例13: actionIndex

 public function actionIndex($id)
 {
     $model = ModelCategory::model()->findAll('category_id = :num', array(':num' => $id));
     $modelBrand = new Brand();
     $modelCategory = new ModelCategory();
     if (isset($_POST['ids'])) {
         ModelCategory::model()->deleteAll('brand_id = :brand_id', array(':brand_id' => $_POST['ids']));
         Brand::model()->findByPk($_POST['ids'])->delete();
         $this->refresh();
     }
     if (isset($_POST['yt0'])) {
         $modelBrand->attributes = $_POST['Brand'];
         $modelBrand->save();
         $modelCategory->category_id = $id;
         $modelCategory->brand_id = $modelBrand->id;
         if ($modelCategory->save()) {
             Yii::app()->user->setFlash('status', 'Бренд добавлен');
         }
         $this->refresh();
     }
     $this->render('index', array('model' => $model, 'modelBrand' => $modelBrand, 'idkey' => $id));
 }
开发者ID:R-thomas,项目名称:shopMob,代码行数:22,代码来源:ModelCategoryController.php

示例14: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $modelsBrands = Brand::model()->findAll();
     $brandsArray = CHtml::listData($modelsBrands, 'id', 'brand_name');
     $modelsPlatforms = Platforms::model()->findAll();
     $platformsArray = CHtml::listData($modelsPlatforms, 'id', 'name');
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['buttonCancel'])) {
         $this->redirect(array('admin'));
     }
     if (isset($_POST['Device'])) {
         $model->attributes = $_POST['Device'];
         /*GARENTE QUE O NOME DO DEVICE SEMPRE SEJA SALVO EM MAIÚSCULO*/
         $model->description = strtoupper($model->description);
         if ($model->save()) {
             $this->redirect(array('admin', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'brandsArray' => $brandsArray, 'platformsArray' => $platformsArray));
 }
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:27,代码来源:DeviceController.php

示例15: actionBatchUnCommend

 public function actionBatchUnCommend()
 {
     $idList = Yii::app()->request->getPost('brand_id', array());
     if (count($idList) > 0) {
         $criteria = new CDbCriteria();
         $criteria->addInCondition('brand_id', $idList);
         $brands = Brand::model()->findAll($criteria);
         $flag = 0;
         foreach ($brands as $brand) {
             $brand->is_recommend = 0;
             if ($brand->save()) {
                 $flag++;
             }
         }
         if ($flag > 0) {
             $this->setFlashMessage('品牌取消推荐成功');
         } else {
             $this->setFlashMessage('品牌取消推荐失败', 'warn');
         }
     } else {
         $this->setFlashMessage('没有记录被选中', 'warn');
     }
     $this->redirect(array('index'));
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:24,代码来源:BrandController.php


注:本文中的Brand::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。