# 关联版式
关联版式
文件路径:shop/controllers/Seller/GoodsCtl.php;
##### 1、版式显示(format())
后台数据获取:
```
<pre class="calibre14">```
$format_rows <span class="token">=</span> $Goods_FormatModel<span class="token">-</span><span class="token">></span><span class="token3">getFormatList</span><span class="token1">(</span>$cond_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $rows<span class="token1">)</span><span class="token1">;</span>
```
```
前台显示:
```
<pre class="calibre14">```
<span class="token"><</span><span class="token">?</span>php foreach <span class="token1">(</span>$data as $key <span class="token">=</span><span class="token">></span> $value<span class="token1">)</span>
<span class="token1">{</span>
<span class="token">?</span><span class="token">></span>
<span class="token"><</span>tr<span class="token">></span>
<span class="token"><</span>td class<span class="token">=</span><span class="token4">"tl"</span><span class="token">></span>
<span class="token"><</span>label class<span class="token">=</span><span class="token4">"checkbox"</span><span class="token">></span><span class="token"><</span>input class<span class="token">=</span><span class="token4">"checkitem"</span> type<span class="token">=</span><span class="token4">"checkbox"</span> name<span class="token">=</span><span class="token4">"chk[]"</span>
value<span class="token">=</span><span class="token4">"<?= $value['id'] ?>"</span><span class="token">/</span><span class="token">></span><span class="token"><</span><span class="token">/</span>label<span class="token">></span>
<span class="token"><</span><span class="token">?</span><span class="token">=</span> $value<span class="token1">[</span><span class="token4">'name'</span><span class="token1">]</span> <span class="token">?</span><span class="token">></span>
<span class="token"><</span><span class="token">/</span>td<span class="token">></span>
<span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span>php <span class="token3">print</span><span class="token1">(</span>$value<span class="token1">[</span><span class="token4">'position_name'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span>
<span class="token"><</span>td<span class="token">></span>
<span class="token"><</span>span class<span class="token">=</span><span class="token4">"edit"</span><span class="token">></span><span class="token"><</span>a
href<span class="token">=</span><span class="token4">"<?php echo Yf_Registry::get('url'); ?>?ctl=Seller_Goods&met=format&act=edit&id=<?= $value['id']; ?>"</span><span class="token">></span><span class="token"><</span>i
class<span class="token">=</span><span class="token4">"iconfont icon-zhifutijiao"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'编辑'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span>
<span class="token"><</span>span class<span class="token">=</span><span class="token4">"del"</span><span class="token">></span><span class="token"><</span>a
data<span class="token">-</span>param<span class="token">=</span><span class="token4">"{'id':'<?= $value['id']; ?>','ctl':'Seller_Goods','met':'deleteGoodsFormat'}"</span>
href<span class="token">=</span><span class="token4">"javascript:void(0)"</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-lajitong"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'删除'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span>
<span class="token"><</span><span class="token">/</span>td<span class="token">></span>
<span class="token"><</span><span class="token">/</span>tr<span class="token">></span>
<span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span>
```
```
##### 2、新增版式 (format())
参数:act=add
视图文件:
```
<pre class="calibre14">```
$this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">setMet</span><span class="token1">(</span><span class="token4">'addformat'</span><span class="token1">)</span><span class="token1">;</span>
```
```
提交表单:
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token4">'name'</span><span class="token1">:</span> <span class="token4">'required;'</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
type<span class="token1">:</span><span class="token4">"POST"</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
Public<span class="token1">.</span><span class="token3">tips</span><span class="token1">(</span><span class="token1">{</span> content<span class="token1">:</span> <span class="token4">"<?=__('操作成功'); ?>"</span><span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span>opener<span class="token1">)</span> <span class="token1">{</span>
opener<span class="token1">.</span><span class="token3">addLayout</span><span class="token1">(</span><span class="token1">{</span>
id<span class="token1">:</span> a<span class="token1">.</span>data<span class="token1">.</span>id<span class="token1">,</span>
name<span class="token1">:</span> $<span class="token1">(</span><span class="token4">"#title"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
position<span class="token1">:</span> $<span class="token1">(</span><span class="token4">"select[name=\"position\"]"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
window<span class="token1">.</span><span class="token3">close</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span>SITE_URL <span class="token">+</span> <span class="token4">"?ctl=Seller_Goods&met=format&typ=e"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
Public<span class="token1">.</span><span class="token3">tips</span><span class="token1">(</span><span class="token1">{</span> content<span class="token1">:</span> <span class="token4">"<?=__('操作失败'); ?>"</span><span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
##### 3、版式编辑(format())
参数:act = edit
视图文件:
```
<pre class="calibre14">```
$this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">setMet</span><span class="token1">(</span><span class="token4">'addformat'</span><span class="token1">)</span><span class="token1">;</span>
```
```
表单提交与2、版式添加中表单提交相同
##### 4、版式删除()
```
<pre class="calibre15">```
<span class="token"><</span>span class<span class="token">=</span><span class="token4">"del"</span><span class="token">></span><span class="token"><</span>a data<span class="token">-</span>param<span class="token">=</span><span class="token4">"{'id':'<?= $value['id']; ?>','ctl':'Seller_Goods','met':'deleteGoodsFormat'}"</span> href<span class="token">=</span><span class="token4">"javascript:void(0)"</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-lajitong"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'删除'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span>
```
```
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 云方案架构
- 负载集群
- 云存储
- 接口
- Api接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- 杂项
- 远程上传图片
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明