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


PHP Products::createProduct方法代码示例

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


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

示例1: actionCreate

 public function actionCreate()
 {
     self::validateAdmin();
     $platformList = Platform::getPlatformListByAdmin();
     $genreList = Genre::getGenresListByAdmin();
     if (isset($_POST['submit'])) {
         $option['code'] = $_POST['code'];
         $option['name'] = $_POST['name'];
         $option['price'] = $_POST['price'];
         $option['platform_id'] = $_POST['platform_id'];
         $option['genre_id'] = $_POST['genre_id'];
         $option['brand'] = $_POST['brand'];
         $option['description'] = $_POST['description'];
         $option['availability'] = $_POST['availability'];
         $option['is_recomend'] = $_POST['is_recomend'];
         $option['is_new'] = $_POST['is_new'];
         $option['status'] = $_POST['status'];
         $errors = false;
         if (!isset($option['name']) || empty($option['name'])) {
             $errors[] = "Введите имя товара";
             print_r($errors);
         }
         if ($errors == false) {
             $id = Products::createProduct($option);
             if ($id) {
                 if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                     move_uploaded_file($_FILES['image']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . "/upload/images/products/(" . $id . ").png");
                 }
             }
             header("Location: /evkazolinAdminka/product/");
         }
     }
     require_once ROOT . '/views/admin_product/create.php';
     return true;
 }
开发者ID:Evkazolinium,项目名称:Eshop_for_example,代码行数:35,代码来源:AdminProductController.php

示例2: actionSpec

 /**
  * 商品规格
  */
 public function actionSpec()
 {
     $goods_id = $this->get('goods_id');
     $goods_row = Goods::model()->find('goods_id = :goods_id', array(':goods_id' => $goods_id));
     if ($_POST) {
         $product_attributes = $this->post('Product');
         $Product = new Products();
         $result = $Product->createProduct($goods_id, $goods_row, $product_attributes);
         if ($result) {
             $this->message('success', '编辑成功', $this->createUrl('index'));
         } else {
             $this->message('error', '编辑失败', $this->createUrl('index'));
         }
     }
     //商品规格
     $GoodsTypeSpec = new GoodsTypeSpec();
     $items = $GoodsTypeSpec->TypeSpecValue($goods_row['type_id']);
     $spec_list_t = $GoodsTypeSpec->ProductSpecList($goods_id);
     $spec_list = array();
     foreach ($spec_list_t as $v) {
         $spec_list[$v['spec_id']] = $v;
     }
     //货品列表
     $product_list = Products::model()->findAll('goods_id = :goods_id AND spec_desc <> :spec_desc AND disabled = :disabled', array(':goods_id' => $goods_id, ':spec_desc' => '', ':disabled' => 'false'));
     echo $this->render('spec', array('items' => $items, 'spec_list' => $spec_list, 'goods_row' => $goods_row, 'product_list' => $product_list));
 }
开发者ID:ShuiMuQinHua,项目名称:yiishop,代码行数:29,代码来源:DefaultController.php


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