ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
:-: 商品规格 文件路径:shop/controllers/Seller/Goods/SpecCtl.php; 商品类别: //获取路径: url: SITE_URL + '?ctl=Goods_Cat&met=cat&typ=json&type_number=goods_cat&is_delete=2&filter=true', //如果存在父类 $data_rows = $Goods_CatModel->getCatTreeData($cat_parent_id, false, 1); if (is_array($cat_parent_id)) { $cond_row = array('cat_parent_id:in' => $cat_parent_id); $cache_key = $this->_cacheKeyPrefix . 'cat_parent_id|' . implode(':', $cat_parent_id); } else { $cond_row = array('cat_parent_id' => $cat_parent_id); $cache_key = $this->_cacheKeyPrefix . 'cat_parent_id|' . $cat_parent_id; } //设置cache $Cache = Yf_Cache::create('base'); //如果有缓存 if ($cat_rows = $Cache->get($cache_key)) { } else { $cat_rows = $this->getByWhere($cond_row, array('cat_displayorder' => 'ASC')); $Cache->save($cat_rows, $cache_key); } //不存在父类 $data = $Goods_CatModel->getCatTree(); $Cache = Yf_Cache::create('base'); if ($data_rows = $Cache->get($this->treeAllKey)) { } else { $data_rows = $this->getCatTreeData($cat_parent_id, $recursive, $level); $Cache->save($data_rows, $this->treeAllKey); } 添加/修改规格值(spec()) 表单提交: $('#form').prop('action', SITE_URL + "?ctl=Seller_Goods_Spec&met=saveSpecValue&typ=json&spec_id=" + param_data.spec_id); //如果存在旧数据 foreach ($old_data as $key => $val) { $update_data['spec_value_displayorder'] = $val['displayorder']; $update_data['spec_value_name'] = $val['spec_value_name']; $flag = $this->goodsSpecValueModel->editSpecValue($key, $update_data); } //如果存在新数据 $update_data['spec_id'] = $spec_id; foreach ($new_data as $key => $val) { $update_data['spec_value_displayorder'] = $val['displayorder']; $update_data['spec_value_name'] = $val['spec_value_name']; $this->goodsSpecValueModel->addSpecValue($update_data); } //商城添加规格值 $spec_value_id = $this->goodsSpecValueModel->addSpecValue($update_data, true); 删除规格值: $('.delete').click(function(){ var _this = $(this); $.dialog.confirm('<?=__("删除的数据将不能恢复,请确认是否删除")?>?',function(){ spec_value_id = _this.children('a').data('id'); if (typeof spec_value_id != 'undefined') { $.post( SITE_URL + "?ctl=Seller_Goods_Spec&met=removeSpecValue&typ=json", { spec_value_id: spec_value_id}, function(data) { }) } else { _this.parent().parent().remove(); } }); }); $spec_value_id = request_int('spec_value_id'); $flag = $this->goodsSpecValueModel->removeSpecValue($spec_value_id);