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


PHP obj::modifyGoods方法代码示例

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


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

示例1: product

 /**
  * 产品显示页面
  * 
  */
 private function product()
 {
     require_once "shopGoods.class.php";
     $obj_shop_goods = new ShopGoodsClass();
     /*当前产品信息*/
     $condition['goods_id'] = intval($this->_input['id']);
     if ($condition['goods_id'] == 0) {
         header("Location:index.php");
         exit;
     }
     $condition['no_state'] = 1;
     $product_array = $this->obj_product->getProductInfo($condition);
     /*产品颜色,产品规格*/
     $c_array = @explode('|', $product_array['goods_color']);
     $s_array = @explode('|', $product_array['goods_size']);
     $color_select = $product_array['goods_color'] != '' ? Common::Select('goods_color', array_combine($c_array, $c_array)) : '';
     $size_select = $product_array['goods_size'] != '' ? Common::Select('goods_size', array_combine($s_array, $s_array)) : '';
     $this->output('color_select', $color_select);
     //颜色输出
     $this->output('size_select', $size_select);
     //规格输出
     /*产品多图*/
     require_once 'goods.class.php';
     $goods = new GoodsClass();
     if ($product_array['shop_goods_id'] != '') {
         $product_array['more_image'] = $goods->getGoodsImage($product_array['shop_goods_id']);
     } else {
         $product_array['more_image'] = $goods->getGoodsImage($product_array['goods_id']);
     }
     $this->output('more_image_num', count($product_array['more_image']) + 1);
     $this->output('product_array', $product_array);
     /*浏览量*/
     $goods_click = intval($product_array['goods_click']) + 1;
     $this->obj_goods->modifyGoods($goods_click, $condition['goods_id'], "goods_click");
     /*推荐产品*/
     $commend_array = $this->obj_product->getProductSpecific(array('goods_commend' => 1, 'goods_state' => 1));
     $this->output('commend_array', $commend_array);
     /*产品属性*/
     $goods_attr_body = @unserialize($product_array['goods_attr_body']);
     //商品内的属性
     include 'goodsClass.class.php';
     //载入产品分类文件
     $goods_class = new GoodsClassClass();
     $goods_type_id = $goods_class->getGoodsClassInfo(array('class_id' => $product_array['class_id']), 'goods_type_id,class_other_attr');
     if ($goods_type_id[0] != '') {
         include 'goodsType.class.php';
         $goods_type = new GoodsTypeClass();
         $type_array = $goods_type->getTypeInfo(array('goods_type_id' => $goods_type_id[0]));
         /*判断商品类型状态,如果关闭则不执行*/
         if ($type_array['goods_type_state'] == 1) {
             $attr_array = $goods_type->goodsAttrArray(array('txt_goods_type_id' => $type_array['goods_type_id']));
             $goods_attr = array();
             $i = 0;
             foreach ($attr_array as $val) {
                 if (!empty($goods_attr_body['class_attr'][$val['attribute_id']])) {
                     $goods_attr[$i]['title'] = $val['attribute_name'];
                     $goods_attr[$i]['vaule'] = $goods_attr_body['class_attr'][$val['attribute_id']];
                     $i++;
                 }
             }
             $this->output('goods_attr', $goods_attr);
         }
     }
     /*产品所在分类独有属性*/
     if (is_array($goods_type_id['class_other_attr']) and count($goods_type_id['class_other_attr']) > 0) {
         $goods_other_attr = array();
         foreach ($goods_type_id['class_other_attr'] as $key => $value) {
             if (!empty($goods_attr_body['class_other_attr'][$key])) {
                 $goods_other_attr[] = array('attr_name' => $value, 'attr_value' => $goods_attr_body['class_other_attr'][$key]);
             }
         }
     }
     $this->output('goods_other_attr', $goods_other_attr);
     /*相关商品*/
     if ($product_array['goods_link_goods'] != '') {
         if (intval($product_array['shop_goods_id']) == 0) {
             $goods_link_goods = $this->obj_goods->ajaxGoodsSearch(array('goods_id_str' => $product_array['goods_link_goods'], 'other_action' => 'modify_link'), '*');
         }
         $this->output('goods_link_goods', $goods_link_goods);
     }
     /*相关文章*/
     if ($product_array['goods_link_article'] != '') {
         include 'article.class.php';
         $article = new ArticleClass();
         $goods_link_article = $article->ajaxArticleSearch(array('article_id_str' => $product_array['goods_link_article'], 'other_action' => 'modify_link'));
         $this->output('goods_link_article', $goods_link_article);
     }
     /*产品导航条*/
     include BasePath . "/share/" . NC_SHOP_DIR . "goods_class_show.php";
     $array = array();
     foreach ($node_cache as $k => $v) {
         if ($v[0] == intval($product_array['class_id'])) {
             $array['class_id'] = $v[0];
             $array['class_top_id'] = $v[1];
             $array['key_id'] = $k;
             break;
//.........这里部分代码省略.........
开发者ID:jn7163,项目名称:ShopNC,代码行数:101,代码来源:product.php

示例2: delGoodsClass

 /**
  * 删除商品分类
  *
  */
 private function delGoodsClass()
 {
     /*权限检查*/
     $this->checkAdmin('goods_class_move');
     $class_id = intval($this->_input['id']);
     $select_value = intval($this->_input['select']);
     $productClassArray = $this->obj_goods_class->listClassDetail("");
     switch ($select_value) {
         case 1:
             // 删除当前分类包括当前分类的子分类和商品
             //查出所有子集分类
             $sub_class = $this->obj_goods_class->getArrayById($productClassArray, $result, $class_id);
             $sub_class[] = $class_id;
             $rs = $this->obj_goods_class->delGoodsClass($sub_class, "class_id");
             if ($rs) {
                 $rs = $this->obj_goods->delGoods($sub_class, "class_id");
                 if ($rs) {
                     $this->obj_goods_class->createGoodsClassArray();
                     /*日志保存*/
                     $log_array = array();
                     $log_array['log_info'] = $this->_lang['admin_goods_class_goods_del_ok'];
                     $this->obj_log->inLog($log_array);
                     $this->adminMessage($this->_lang['admin_goods_class_goods_del_ok'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
                 } else {
                     /*日志保存*/
                     $log_array = array();
                     $log_array['log_info'] = $this->_lang['admin_goods_class_goods_del_false'];
                     $this->obj_log->inLog($log_array);
                     $this->adminMessage($this->_lang['admin_goods_class_goods_del_false'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
                 }
             } else {
                 /*日志保存*/
                 $log_array = array();
                 $log_array['log_info'] = $this->_lang['admin_goods_class_goods_del_false'];
                 $this->obj_log->inLog($log_array);
                 $this->adminMessage($this->_lang['admin_goods_class_goods_del_false'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
             }
             break;
         case 2:
             //删除当前分类,移动子分类和商品
             $class_top_id = $this->_input['txt_class_top_id' . $class_id . "_2"];
             if ($class_top_id == 0) {
                 $this->adminMessage($this->_lang['admin_goods_class_list_select_error'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
             }
             $input_param['class_top_id'] = intval($class_top_id);
             $sub_one_class = $this->obj_goods_class->getArrayById($productClassArray, $result, $class_id);
             /* 检查修改的分类topid是否是当前分类的下级,如果是返回错误,不是的话,正常进行 */
             $sub_one_class[] = $class_id;
             if ($sub_one_class != null) {
                 if (in_array($class_top_id, $sub_one_class)) {
                     $this->adminMessage($this->_lang['admin_goods_class_list_del_error1'], $this->refer_url, 1, 3000);
                 }
             }
             /* 查出下一级分类 */
             $sub_one_class = array();
             $sub_one_class = $this->obj_goods_class->getOneArrayById($productClassArray, $result, $class_id);
             $sub_one_class_string = empty($sub_one_class) ? $class_id : @implode(",", $sub_one_class) . ',' . $class_id;
             /* 移动子类 */
             $update_class = $this->obj_goods_class->modifyMoreGoodsClass($input_param, array("more_id" => $sub_one_class_string));
             /* 移动当前类商品 */
             $update_goods = $this->obj_goods->modifyGoods($class_top_id, $class_id, "class_id", "class_id");
             /* 删除当前类 */
             $input['class_id'] = $class_id;
             $del_goods_class = $this->obj_goods_class->delGoodsClass($input, "class_id");
             if ($del_goods_class) {
                 $this->obj_goods_class->createGoodsClassArray();
                 $this->adminMessage($this->_lang['admin_goods_oper_succ'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
             }
             break;
         case 3:
             //删除当前分类和子分类,只移动商品
             $class_top_id = $this->_input['txt_class_top_id' . $class_id . "_2"];
             if ($class_top_id == 0) {
                 $this->adminMessage($this->_lang['admin_goods_class_list_select_error'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
             }
             //查出所有子集分类
             $sub_class = $this->obj_goods_class->getArrayById($productClassArray, $result, $class_id);
             $sub_class[] = $class_id;
             /* 检查修改的分类topid是否是当前分类的下级,如果是返回错误,不是的话,正常进行 */
             if ($sub_class != null) {
                 if (in_array($class_top_id, $sub_class)) {
                     $this->adminMessage($this->_lang['admin_goods_class_list_del_error'], $this->refer_url, 1, 3000);
                 }
             }
             $sub_class_string = @implode(",", $sub_class);
             $rs = $this->obj_goods_class->delGoodsClass($sub_class, "class_id");
             if ($rs) {
                 $input_param['class_id'] = $class_top_id;
                 $this->obj_goods->moveGoods($input_param, array("more_id" => $sub_class_string));
                 $this->obj_goods_class->createGoodsClassArray();
                 $this->adminMessage($this->_lang['admin_goods_oper_succ'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
             } else {
                 $this->adminMessage($this->_lang['admin_goods_oper_fill'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 4000);
             }
             break;
     }
//.........这里部分代码省略.........
开发者ID:jn7163,项目名称:ShopNC,代码行数:101,代码来源:admin_goods_class.php


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