您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop品牌页实现分页换页功能的方法
梦松2023-11-23 22:40:52ecshop商城教程已有人查阅
导读最近看到有朋友在论坛问到过此类问题,所以抽空写了下文。“在全部品牌页实现分页换页功能”,对商品品牌较多的朋友也许会有帮助。
最近看到有朋友在论坛问到过此类问题,所以抽空写了下文。“在全部品牌页实现分页换页功能”,对商品品牌较多的朋友也许会有帮助。
1、打开brand.php
找到
在你想要显示换页信息的地方加入下面代码
1、打开brand.php
找到
if (empty($brand_id))
{
再找到
exit();
}
将这两者之间的代码全部替换为下面代码
assign_template();
$position = assign_ur_here('', $_LANG['all_brand']);
$smarty->assign('page_title',$position['title']);// 页面标题
$smarty->assign('ur_here', $position['ur_here']);// 当前位置
$smarty->assign('categories',get_categories_tree()); // 分类树
$smarty->assign('helps', get_shop_help()); // 网店帮助
$smarty->assign('top_goods', get_top10()); // 销售排行
$sql = "SELECT count(*) as brand_count from ( select b.brand_id ".
"FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ".
$GLOBALS['ecs']->table('goods') . " AS g ".
"WHERE g.brand_id = b.brand_id AND is_show = 1 " .
" AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
"GROUP BY b.brand_id ) AS gb";
$brand_count=$GLOBALS['db']->getOne($sql);//品牌(含有商品的)数量
$page = !empty($_REQUEST['page'])&& intval($_REQUEST['page'])> 0 ? intval($_REQUEST['page']): 1;
$size = 3;
$max_page = ($brand_count> 0) ? ceil($brand_count / $size) : 1;
if ($page > $max_page){$page = $max_page;}
$start=($page - 1) * $size;$sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, b.brand_desc, COUNT(*) AS goods_num, IF(b.brand_logo > '', '1', '0') AS tag ".
"FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ".
$GLOBALS['ecs']->table('goods') . " AS g ".
"WHERE g.brand_id = b.brand_id AND is_show = 1 " .
" AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
"GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY tag DESC, b.sort_order ASC limit $start,$size";
$row = $GLOBALS['db']->getAll($sql);
foreach ($row AS $key => $val)
{
$row[$key]['url'] = build_uri('brand', array('cid' => $cat, 'bid' => $val['brand_id']), $val['brand_name']);
$row[$key]['brand_desc'] = htmlspecialchars($val['brand_desc'],ENT_QUOTES);
}
$pager['search'] = array( );
$pager = get_pager('brand.php', $pager['search'], $brand_count, $page, $size);
$pager['display'] = $display;
$smarty->assign('pager', $pager);
$smarty->assign('brand_list', $row); $smarty->display('brand_list.dwt');
2、打开 模板文件 brand_list.dwt在你想要显示换页信息的地方加入下面代码
<!-- #BeginLibraryItem "/library/pages.lbi" --><!-- #EndLibraryItem -->
如果你使用的是官方默认模板,那么在
<div class="dashed"></div>
这行代码下面加
<!-- #BeginLibraryItem "/library/pages.lbi" --><!-- #EndLibraryItem -->
比较合适。
本文标签:
很赞哦! ()
随机图文
-
ecshop去版权标志删除Powered by ecshop
ECSHOP去版权标志删除Powered by ECShop2.7.4 2.7.3 2.7.2。前台部分:1:去掉头部TITLE部分的ECSHOP演示站 Powered by ecshop -
删除ecshop顶部标题栏"Powered by Ecshop"的方法
ECSHOP2.7.2 本来是个不错的网店程序,但由于版权多出加密,有些需要去除版权的朋友会碰到一些困难,本人特整理分享新版ecshop去处版权方法给大家分享: -
ecshop商城首页商品怎么显示商品属
$properties = get_goods_properties($row['goods_id']); // 获得商品的规格和属$goods[$idx]['properties'] = $properties['pro']; -
ecshop商品分类商品怎么调用关联文章
获得指定分类下所有商品的关联文章category.dwt模版页调用:category.php对应程序页调用:
留言与评论 (共有 条评论) |