ECSHOP全部品牌页实现分页换页功能方法

所属分类: CMS教程 / ecshop 阅读数: 2032
收藏 0 赞 0 分享

最近看到有朋友在论坛问到过此类问题,所以抽空写了下文,“在全部品牌页实现分页换页功能”,对商品品牌较多的朋友也许会有帮助,这个修改教程需要修改ecshop的系统文件,所以修改之前请先备份文件。

修改教程

打开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');

打开 模板文件 brand_list.dwt 在你想要显示换页信息的地方加入下面代码

<!-- #BeginLibraryItem "/library/pages.lbi" --><!-- #EndLibraryItem -->

如果你使用的是官方默认模板,那么在

<div class="dashed"></div>

这行代码下面添加

<!-- #BeginLibraryItem "/library/pages.lbi" --><!-- #EndLibraryItem -->

这样就可以在品牌添加分页代码了。

更多精彩内容其他人还在看

ecshop安装遇到安装数据失败的解决方法

在我第一次安装ecshop时失败了。提示遇到安装数据失败。并报出警告。
收藏 0 赞 0 分享

ECShop显示某商品销售累计效果的实现代码

最近在学习ECShop内容, 想在商品页面中将某一商品的累计销售数量显示出来。
收藏 0 赞 0 分享

ecshopα

ECSHOP
收藏 0 赞 0 分享

ecshop二次开发 购物时为每件商品添加备注信息的修改方法

ecshop二次开发 购物时为每件商品添加备注信息的修改方法,需要的朋友可以参考下。
收藏 0 赞 0 分享

去掉echsop头部和底部的所有的版权的详细步骤

有很多网友在问我怎么去掉echsop的版权问题,今天告诉大家怎么去掉这些版权(这里只针对V2.7.1版本,当然其他版本我没有看过,大家可以找相应的文件
收藏 0 赞 0 分享

ECSHOP去掉版权copyright powered by ecshop 去掉商标志logo

ECSHOP去掉版权copyright powered by ecshop 去掉标志logo
收藏 0 赞 0 分享

ecshop的ucenter同步登陆uc.php 一点错误勘误

在ecshop的会员整合ucenter的set_cookie函数有问题,所以给修正了下,需要的朋友可以参考下。
收藏 0 赞 0 分享

ecshop 同步ucenter,一步登陆discuzX

看到太多的各类系统整合ucenter出现的各种各样的问题,比如无法同步登入,同步退出,注册用户时候出现问题
收藏 0 赞 0 分享

EcShop 创建管理员帐号失败的解决办法

本机安装Ecshop时出现创建管理员帐号失败的解决办法,需要的朋友可以参考下。
收藏 0 赞 0 分享

ECSHOP安装数据库失败date_default_timezone_get()问题

今天在倒腾ECSHOP时遇到的问题,以向导模式安装时遇到具体的PHP警告如下
收藏 0 赞 0 分享
查看更多