Ecshop里添加多个h1标题
功能:
点击页面右边的两个按钮,切换下面的<div class="form-div">
和表格里的内容
思路:
- 控制器里把$action_link 和 $action_link2赋值到模板里(变量里带连接和标题名字)
- 控制器里把$filter.sn_type的值(1或者2) 赋值到模板里
- 模板里判断$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> </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="images/icon_drop.gif" border="0" height="16" width="16"></a>
</span>
</td>
</tr>
{/foreach}
<tr>
<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="images/icon_drop.gif" border="0" height="16" width="16"></a>
</span>
</td>
</tr>
{/foreach}
<tr>
<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;
}
Ecshop里添加多个h1标题的更多相关文章
- ecshop后台添加栏目
ecshop后台增加模块菜单详细教程 一:ecshop后台管理 admin\includes\inc_menu.php 添加上你要添加的功能admin\includes\inc_priv.php 对应 ...
- ECShop 文章添加缩略图功能
为 ECShop 文章添加缩略图 ECShop 文章不包含缩略图比较遗憾,不过它的文章里包含一个附件上传,而且一般不会用到,这样,我们就可以改动一下,让它成为缩略图. 首先在 includes ...
- visual studio 2019工具里添加开发中命令提示符的方法
最新新装了visual studio 2019,发现默认的没有开发者命令提示符 现将添加步骤描述如下: 从VS2019菜单选择"Tools",然后选择"外部工具" ...
- 在Qt Creator 和在 vs2012 里添加信号和槽
原文地址:http://www.cnblogs.com/li-peng/p/3644812.html 作者:李鹏 出处:http://www.cnblogs.com/li-peng/ 本文版权归作者和 ...
- chart.js 里添加图表的清单:
chart.js 里添加图表的清单: var legend = myDoughnut.generateLegend(); $("#chart_legend").html(legen ...
- RCP:利用actionSet在菜单(menu)里添加内容
eclipse的菜单menu.工具栏toolbar乃至视图的上下文菜单contextmenu都是使用Action或Command实现的. Action即是 org.eclipse.jface.acti ...
- ios 向工程里添加Fonts
ios 向工程里添加Fonts 1.网上搜索字体文件(后缀名为.ttf,或.odf),假如你加入的字体为微软雅黑 2.把字体库导入到工程的resouce中 3.然后在你的工程的Info.plist文件 ...
- iOS 向模拟器里添加照片
iOS 向模拟器里添加照片 模拟器里Photos最开始时是没有照片的,有时我们做Demo时需要Photos里面的照片做测试,这时就需要把Mac上的照片导入到模拟器里.步骤如下: 1,打开模拟器 2,选 ...
- iOS 在类别里添加成员变量的方法:objc_setAssociatedObject
今天在github上查看MJPopupViewController这个项目,发现里面用到了objc_setAssociatedObject,用来为类别添加成员变量. 我百度之后,发现有人是这样说明的: ...
随机推荐
- Maven的安装以及介绍
附录:带阿里源的maven用户设置文件-settings.xml <?xml version="1.0" encoding="UTF-8"?> &l ...
- vscode 插件todo-highlight
简介 Highlight TODO,FIXME or any annotations within your code. 资源 https://marketplace.visualstudio.com ...
- Day1上
上午发挥强差人意.心态不好,编译器一直报错,心里比较慌. t1 每一个P枚举底数 .可二分 T2 暴力30 打标60 x^3-y^3=(x-y)*(x^2+xy+y^2). x-y==1. ! p ...
- springcloud中servcie层调用fegin异常以及异步方法的实现
近日在做业务上的短信推送和APP消息推送,通过调用别的模块的接口来实现,在springcloud中通过fegin进行调用.这里要说明的事情并不是如何开发推送功能,而是在调试过程中碰到的一些小问题.我把 ...
- springboot 学习笔记(七)
(七)springboot整合activemq,消息消费,以及发送对象消息 1.springboot整合activemq发送消息,上一节已经介绍了,现在要对消息队列中的内容进行处理,下面写一个cons ...
- npm warn weex @1.0.0 no repository field
玩weex出现nmp安装问题总是包这个错,但是其实是安装成功的 npm warn weex@1.0.0 no repository field. 看字面意思大概是package.json里缺少repo ...
- Tomcat8
一.Apache Tomcat 8介绍 Tomcat 8.0.0-RC3 (alpha) Released ...
- ajax请求总是返回error的问题
多半是因为返回值格式的问题,在后台返回的应与前台设定的值一直,不然就会进入error,会报404服务器错误,极有可能是后台返回的数据类型不对 public void exitSystem( HttpS ...
- python any all函数
a = [0, 0, 0, 0] b = [0, 0, 0, 1] c = [1, 1, 1, 1] >>> any(a) False >>> any(b) Tru ...
- 利用Theano理解深度学习——Multilayer Perceptron
一.多层感知机MLP 1.MLP概述 对于含有单个隐含层的多层感知机(single-hidden-layer Multi-Layer Perceptron, MLP),可以将其看成是一个特殊的Logi ...