目录

  • 功能:
  • 思路:
  • 效果:
  • pageheader_list.htm里
  • product_sn_list.htm模板里
  • 控制器里


功能:

点击页面右边的两个按钮,切换下面的<div class="form-div">和表格里的内容

思路:

  1. 控制器里把$action_link 和 $action_link2赋值到模板里(变量里带连接和标题名字)
  2. 控制器里把$filter.sn_type的值(1或者2) 赋值到模板里
  3. 模板里判断$filter.sn_type eq 1还是$filter.sn_type eq 2 来切换显示的内容

效果:

pageheader_list.htm里

D:\phpStudy\WWW\work\wdm\trunk\www.wdmcake.cn\www\admin\templates\pageheader_list.htm

{/if}
<h1>
{if $action_link}
<span class="action-span"><a href="{$action_link.href}">{$action_link.text}</a></span>
{/if}
{if $action_link2}
<span class="action-span"><a href="{$action_link2.href}">{$action_link2.text}</a>&nbsp;&nbsp;</span>
{/if}
<span class="action-span1"><a href="index.php?act=main">{$lang.cp_home}</a> </span><span id="search_id" class="action-span1">{if $ur_here} - {$ur_here} {/if}</span>
<div style="clear:both"></div>
</h1>

product_sn_list.htm模板里

D:\phpStudy\WWW\work\wdm\trunk\www.wdmcake.cn\www\admin\templates\product_sn_list.htm

{include file="pageheader_list.htm"} <!--  引入头模板 -->{if $filter.sn_type eq 1}<div class="form-div"><form action="javascript:searchproduct();" name="addForm"  id="addForm"><!-- 分类 -->选择城市<select name="city" id="city" onchange="get_city();"><option value="-1">所在城市</option>{html_options options=$goods_city}</select><select name="sn_gid" id="sn_gid" onchange="get_products();" style="width:135px;"><option value="0">请选择商品</option>{foreach from=$goods_list item=goods}<option value="{$goods.goods_id}">{$goods.goods_sn}  {$goods.goods_name}</option>{/foreach}</select><!-- 商品:<input type="text" name="sn_name" value="" size="12" /> --><select name="sn_pid" id="sn_pid"><option value="0">请选择规格</option>{foreach from=$products item=product}<option value="{$product.product_id}">{$product.product_name}</option>{/foreach}</select><select name="sn_pizi" id="sn_pizi"><option value="0">请选择坯子</option>{foreach from=$pizi_list item=pizi}<option value="{$pizi.title}">{$pizi.title}</option>{/foreach}</select><!-- sn_type --><input type="hidden" name="sn_type" id="sn_type" value="1" size="15" /><!-- 半成品品号 --><input type="hidden" name="semi_sn" value="" size="5" /><!-- 半成品品名 --><input type="hidden" name="sn_name" value="" size="5" />成品品号<input type="text" name="sn_sn" value="" size="15" /><!-- 新货品 --><input type="hidden" name="sn_newsn" value="" size="5" />货品价格<input type="text" name="sn_price" value="" size="5" /><input type="button" value="添加成品" class="button" onclick="add_sn();" /><input type="submit" value="搜索" class="button"/></form><!-- 批量导入对应关系 --><!--  <form action="product_sn.php?act=batchAddGoods_relate" method="post" enctype="multipart/form-data" name="excel" target="_blank"><input type="file" name="file" value=""><input type="submit" value="Excel导入批量导入对应关系" class="button" /></form> --><!-- 批量导入对应关系 --></div><!-- 添加货品 -->
{/if}
{if $filter.sn_type eq 2}<div class="form-div"><form action="javascript:searchproduct();" name="addForm"  id="addForm"><!-- 分类 -->选择城市<select name="city" id="city" onchange="get_city();"><option value="-1">所在城市</option>{html_options options=$goods_city}</select><select name="sn_gid" id="sn_gid" onchange="get_products();" style="width:135px;"><option value="0">请选择商品</option>{foreach from=$goods_list item=goods}<option value="{$goods.goods_id}">{$goods.goods_sn}  {$goods.goods_name}</option>{/foreach}</select><select name="sn_pid" id="sn_pid"><option value="0">请选择规格</option>{foreach from=$products item=product}<option value="{$product.product_id}">{$product.product_name}</option>{/foreach}</select><select name="sn_pizi" id="sn_pizi"><option value="0">请选择坯子</option>{foreach from=$pizi_list item=pizi}<option value="{$pizi.title}">{$pizi.title}</option>{/foreach}</select><!-- sn_type --><input type="hidden" name="sn_type" id="sn_type" value="2" size="15" />     <!-- 半成品品号 --><input type="hidden" name="semi_sn" id="semi_sn" value="" size="15" />半成品品名<input type="text" name="sn_name" id="sn_name" value="" size="15" />半成品品号<input type="text" name="sn_sn" id="sn_sn" value="" size="15" /><!-- 新货品 --><input type="hidden" name="sn_newsn" value="" size="5" /><!-- 货品价格 --><input type="hidden" name="sn_price" value="" size="5" /><input type="button" value="添加半成品" class="button" id="add_semi_sn" /><input type="submit" value="搜索" class="button"/>    </form><form action="product_sn.php?act=batchAddGoodsSemi_sn" method="post" enctype="multipart/form-data" name="excel" target="_blank"><input type="file" name="file" value=""><input type="submit" value="Excel导入批量新建半成品" class="button" /><span><a href="http://www.wdmcake.cn/data/demo_batchAddGoodsSemi_sn.xlsx" alt="" target="">导入模板下载</a></span></form></div><!-- 添加货品 -->
{/if}{/if}<div class="list-div" style="margin-bottom: 5px; margin-top: 10px;" id="listDiv"><form method="post" action="goods.php" name="listForm" id="listForm" >{if $filter.sn_type eq 1}<table width="100%" cellpadding="3" cellspacing="1" id="table_list"><tr><td class="label_2"  style="width: 5%">ID</td> <td class="label_2" style="width: 20%">产品名</td><td class="label_2" style="width: 10%">规格</td><td class="label_2" style="width: 10%">坯子</td><td class="label_2" style="width: 8%">品号</td><td class="label_2" style="width: 150px;" id="newgoodsn">关联半成品</td><td class="label_2" style="width: 5%">品号价格</td><td class="label_2" style="width: 5%">{$lang.handler}</td></tr>{foreach from=$product_list item=sn}<tr><td class="td_1">{$sn.id}</td><td class="td_1">{$sn.goods_name} {$sn.goods_sn}</td><td class="td_1">{$sn.product_name} </td><td class="td_1">{$sn.pizi}</td>      <td class="td_1"><span onclick="listTable.edit(this, 'edit_sn', {$sn.id})">{$sn.sn}</span></td><!--     <td class="td_1"><span onclick="listTable.edit(this, 'edit_newsn', {$sn.id})">{$sn.newsn|default:点击修改}</span></td> --><td class="td_1 add_semi_sn">  <div class="select2div"></div><select  class="js-example-basic-multiple add_semi_sn_relate" name="sn_type[]" sn_id="{$sn.id}" multiple="multiple"> {foreach from=$semi_sninfo item=v}<option value="{$v.sn}" {if in_array($v.sn,$sn['semi_sn_arr'])}selected="selected"{/if} >{$v.sn_name}</option> {/foreach}            <!--  <option value="111" >111</option> <option value="222" >2222</option> <option value="333" >333</option>  --></select>       </td><td class="td_1"><span onclick="listTable.edit(this, 'edit_sn_price', {$sn.id})">{$sn.sn_price}</span></td><td align="center"><span><a href="javascript:;" onclick="listTable.remove({$sn.id}, '删除品号?', 'remove')" title="{$lang.remove}"><img src="data:images/icon_drop.gif" border="0" height="16" width="16"></a></span></td></tr>{/foreach}<tr>&nbsp;<td align="right" nowrap="true" colspan="8">{include file="page.htm"}</td></tr>    </table>{/if}{if $filter.sn_type eq 2}<table width="100%" cellpadding="3" cellspacing="1" id="table_list"><tr><td class="label_2">ID</td>      <td class="label_2">半成品品名</td>  <td class="label_2">半成品品号sn</td><td class="label_2">商品号goods_sn</td> <td class="label_2">{$lang.handler}</td></tr>{foreach from=$product_list item=sn}<tr><td class="td_1">{$sn.id}</td>       <td class="td_1">{$sn.goods_name}</td>               <td class="td_1"><span onclick="listTable.edit(this, 'edit_sn', {$sn.id})">{$sn.sn}</span></td><td class="td_1">{$sn.goods_sn}</td><!--     <td class="td_1"><span onclick="listTable.edit(this, 'edit_newsn', {$sn.id})">{$sn.newsn|default:点击修改}</span></td> --><!--  <td class="td_1"><span onclick="listTable.edit(this, 'edit_sn_price', {$sn.id})">{$sn.sn_price}</span></td> --><td align="center"><span><a href="javascript:;" onclick="listTable.remove({$sn.id}, '删除品号?', 'remove')" title="{$lang.remove}"><img src="data:images/icon_drop.gif" border="0" height="16" width="16"></a></span></td></tr>{/foreach}<tr>&nbsp;<td align="right" nowrap="true" colspan="8">{include file="page.htm"}</td></tr>    </table>{/if} </form>{if $full_page}{include file="pagefooter.htm"}{/if}
</div>
<!-- end 添加货品 -->

控制器里

D:\phpStudy\WWW\work\wdm\trunk\www.wdmcake.cn\www\admin\product_sn.php

/* 取商品的货品 */
$product = product_sn_list();$smarty->assign('ur_here',      $product['filter']['sn_type']==1?'成品品号列表':'半成品品号列表');
$smarty->assign('action_link2',  array('href' => 'product_sn.php?act=list&sn_type=1', 'text' =>'成品品号列表'));
$smarty->assign('action_link',  array('href' => 'product_sn.php?act=list&sn_type=2', 'text' => '半成品品号列表'));$smarty->assign('product_list', $product['list']);
$smarty->assign('goods_id',     $goods_id);
$smarty->assign('filter',       $product['filter']);
$smarty->assign('full_page',    1);
$smarty->assign('record_count', $product['record_count']);
$smarty->assign('page_count', $product['page_count']);/***  获取货号列表信息** @access  public* @param** @return void*/
function product_sn_list()
{$result = get_filter();wdmlog('第'.__LINE__.'行','product_sn','product_sn_list');wdmlog($result,'product_sn','product_sn_list');if ($result === false){/* 过滤信息 */$filter['gid'] = isset($_REQUEST['gid']) ? intval($_REQUEST['gid']) : 0;$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']);$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);$filter['pizi'] = isset($_REQUEST['pizi']) ? intval($_REQUEST['pizi']) : 0;$filter['sn'] = empty($_REQUEST['sn']) ? '' : trim($_REQUEST['sn']);$filter['newsn'] = empty($_REQUEST['newsn']) ? '' : trim($_REQUEST['newsn']);$filter['sn_price'] = empty($_REQUEST['sn_price']) ? '0' : trim($_REQUEST['sn_price']);$filter['sn_name'] = empty($_REQUEST['sn_name']) ? '' : trim($_REQUEST['sn_name']);$filter['goods_city'] = isset($_REQUEST['goods_city']) ? intval($_REQUEST['goods_city']) : -1;$filter['sn_type'] = isset($_REQUEST['sn_type']) ? intval($_REQUEST['sn_type']) : 1;$where = '';if ($filter['gid']){$where .= " AND s.goods_id ='" . $filter['gid'] . "'";}if ($filter['pizi']){$where .= " AND s.pizi ='" . $filter['pizi'] . "'";}if ($filter['sn']){$where .= " AND s.sn ='" . $filter['sn'] . "'";}if ($filter['newsn']){$where .= " AND s.newsn ='" . $filter['newsn'] . "'";}if ($filter['sn_price']){$where .= " AND s.sn_price ='" . $filter['sn_price'] . "'";}if ($filter['sn_name']){$where .= " AND g.goods_name like '%" . $filter['sn_name'] . "%'";}   if ($filter['goods_city'] != -1){$where .= " AND g.goods_city ='" . $filter['goods_city'] . "'";}if(isset($_SESSION['city_id']) && $_SESSION['city_id'] >0 ){$where .= " AND g.goods_city='$_SESSION[city_id]'";  }if ($filter['sn_type']){$where .= " AND s.sn_type ='" . $filter['sn_type'] . "'";}/* 分页大小 */$filter['page'] = empty($_REQUEST['page']) || (intval($_REQUEST['page']) <= 0) ? 1 : intval($_REQUEST['page']);if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0){$filter['page_size'] = intval($_REQUEST['page_size']);}elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0){$filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);}else{$filter['page_size'] = 15;}/* 记录总数 */$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('product_sn') . " AS s left join  " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id =s.goods_id left join  " . $GLOBALS['ecs']->table('products') . " as p on p.product_id =s.product_id where 1  $where ";$filter['record_count']   = $GLOBALS['db']->getOne($sql);$filter['page_count']     = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;/* 查询 */$sql = "SELECT s.*, g.goods_name, g.goods_sn, p.product_sn, p.product_name FROM " . $GLOBALS['ecs']->table('product_sn') . " AS s left join  " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id =s.goods_id left join  " . $GLOBALS['ecs']->table('products') . " as p on p.product_id =s.product_id where 1  $where ORDER BY $filter[sort_by] $filter[sort_order]  LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",$filter[page_size]";set_filter($filter, $sql);}else{$sql    = $result['sql'];$filter = $result['filter'];}$rows = $GLOBALS['db']->getAll($sql);foreach($rows as $k=>$v){$rows[$k]['semi_sn_arr'] = array();if(!empty($v['semi_sn'])){$rows[$k]['semi_sn_arr'] = explode(',',$v['semi_sn']);}}wdmlog('第'.__LINE__.'行','product_sn','rows');wdmlog($rows,'product_sn','rows');$list = array('list' => $rows, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);return $list;
}

转载于:https://www.cnblogs.com/haima/p/9700802.html

Ecshop里添加多个h1标题相关推荐

  1. 计算机在表格顶端添加标题,Excel表格图标上方显示数据-怎样在excel图标里添加图表元素?...

    桌面的EXCEL表格文件图标变成这样了,怎么恢复? 桌面的EXCEL表格文件图标恢复正常的具体步骤如下: 我们需要准备的材料分别是:电脑.EXCEL表格文件图标. 1.首先我们打开电脑,点击打开计算机 ...

  2. 在线文本替换工具 、支持正则表达式(博客园文章里添加Javascript或<script>语句)

    概况与介绍 在博客园发布一篇文章,文章就是<在线文本替换工具 .支持正则表达式>https://www.cnblogs.com/lsllll44/articles/15522697.htm ...

  3. mfc中在vector里添加控件类型的数据时出现C2248错误

    @mfc中在vector里添加控件类型的数据时出现C2248错误 这是我在.h文件中定义的2个容器 public:vector<CComboBox*> cbx;vector <CSt ...

  4. 如何在计算机桌面上添加小工具,怎么在电脑的桌面小工具里添加便签

    原标题:怎么在电脑的桌面小工具里添加便签 用便签小工具记事,是很多用电脑用户的常规操作.有的人找不到电脑便签,打开电脑开始菜单栏一看,记事工具居然只有记事本. 用记事本很多人不愿意,毕竟记事本比较适合 ...

  5. 如何在视频里添加文字?3个方法教你给视频添加文字

    在现今数字化的社会中,视频已经成为了我们生活和工作中不可或缺的一部分,而在视频制作和编辑过程中,添加文字是一个非常常见的操作,尤其是在一些商业和宣传广告视频中.例如当我们需要制作一个介绍产品或服务的视 ...

  6. mac word页眉添加章节号和标题

    效果图如下: 首先,添加标题下的横线 双击页眉,进入页眉编辑界面 选择Home,下划线,标题下的横线则添加成功 然后,添加章节号 选择Header&Footer==>Field 选择S开 ...

  7. R语言ggplot2可视化分面图(faceting)、设置每个分面的标题在右侧(right side)、并在右侧分面图的外侧添加整图的标题信息(facet title)

    R语言ggplot2可视化分面图(faceting).设置每个分面的标题在右侧(right side).并在右侧分面图的外侧添加整图的标题信息(facet title) 目录

  8. MailBee.NET Objects撰写邮件教程(一):添加和删除自定义标题

    MailBee.NET Objects是一款为创建.发送.接收以及处理电子邮件而设计的健壮.功能丰富的.NET控件.几行代码便可为应用程序添加E-Mail支持,简单高效.具备"必需" ...

  9. 往map里的vector添加_往鱼缸里添加硝化细菌,这些事项我们还是要注意的!

    图文/养鱼老道 原创 关于往鱼缸里添加硝化细菌一说,养鱼老道只是认为一般的时候没有这个必要,但不是说不可以适当添加,因为以前养鱼老道也会经常这么干的,只是一个是由于现在的假货太多,即使有真的我也不爱去 ...

最新文章

  1. coverage代码覆盖率测试工具:基本原理分析与使用
  2. 【重磅】Tensorflow2.0实现29种深度强化学习算法大汇总
  3. Kali渗透测试——UPNP网关发现工具Miranda
  4. sublime配置全攻略
  5. “懒”的妙用——浅析图片懒加载技术
  6. java jdom进行xml的增删改差_java使用DOM对XML文档进行增删改查操作实例代码
  7. 20200224:跳跃游戏(leetcode55)
  8. LDA模型训练与得到文本主题、困惑度计算(含可运行案例)
  9. mysql 夏令时_MySQL日期时间字段和夏时制-如何引用“额外”小时?
  10. 第十五章 Caché WebSocket
  11. OpenStack挂载ISO,安装原版windows
  12. ❀工信工实验参考——《模电课设人体感应LED灯》
  13. 数学之路(4)-数学基础-幂函数图像与函数平移
  14. 论文《Image Recoloring Based on Object Color Distributions》整理笔记
  15. 截图软件:Snipaste for Mac中文(2.6.4beta官方)
  16. 今天安装了VS2008中文版SP1。
  17. 加州洛杉矶计算机研究生,加州洛杉矶计算机硕士文书要求
  18. 你的孤独,虽败犹荣 很喜欢的句子
  19. 分享12张企业数据中台架构图
  20. Verilator简介与使用

热门文章

  1. mysql5.6.19安装图解_mysql5.6.19安装说明
  2. python设计思路怎么写_初中信息技术 初识Python教学设计
  3. python网络编程基础知识_python网络编程基础
  4. java中native的详解
  5. Java集合框架:ArrayList扩容机制解释
  6. C++ STL 文件内容的显示和追加
  7. C++的STL标准库学习(stack)栈
  8. ssh集群服务器免密登录
  9. python数据分析系列教程——NumPy全解
  10. 图片转化为base64编码python版本