您现在的位置是:首页 > 网站建设网站建设

ecshop中category.php显示全部ID内容

江湖快报网2023-02-03 02:09:29【网站建设】人已围观

简介你是想有一个页面调出所有商品吧?
告诉你一个方法:用search.php页面,你在搜索框里搜索空白,然后点击搜索出来的页面就是所有商品的页面。

如果坚持用category.php只能修改代码

你是想有一个页面调出所有商品吧?
告诉你一个方法:用search.php页面,你在搜索框里搜索空白,然后点击搜索出来的页面就是所有商品的页面。

如果坚持用category.php只能修改代码了。

ecshop中首页获取了一个分类的cat_id,怎么调用它的以及它子类的商品?

$children = get_children($cat_id); 获得指定分类同级的所有分类以及该分类下的子分类

/**
* 获得分类下的商品
*
* @access public
* @param string $children
* @return array
*/
function category_get_goods($children, $brand, $min, $max, $ext, $size, $page, $sort, $order)

看看category.php 是怎么用的

ecshop分类下的商品怎么添加栏目

您好,您是想添加什么栏目,详细说明一下。如果是模板中没有的内容,要自己添加的话,您可以右键审查元素,查看关键词,根据关键词,找到相应的文件,即可进行添加。

怎么实现ecshop调用指定分类下级子分类导航

在文件 includes/lib_goods.php 最后加上
//*** 调用商品分类指定分类下级分类
function get_parent_id_tree($parent_id)
{
$three_c_arr = array();
$sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('category') . WHERE parent_id = '$parent_id' AND is_show = 1 ;
if ($GLOBALS['db']->getOne($sql))
{
$child_sql = 'SELECT cat_id, cat_name, parent_id, is_show ' .
'FROM ' . $GLOBALS['ecs']->table('category') .
WHERE parent_id = '$parent_id' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC;
$res = $GLOBALS['db']->getAll($child_sql);
foreach ($res AS $row)
{
if ($row['is_show'])
$three_c_arr[$row['cat_id']]['id'] = $row['cat_id'];
$three_c_arr[$row['cat_id']]['name'] = $row['cat_name'];
$three_c_arr[$row['cat_id']]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
}
}
return $three_c_arr;
}

声明后用$smarty调用,就是在index.php中加上下面一句:

$smarty->assign('get_parent_id16_tree', get_parent_id_tree(16));//调用父级分类6的下级分类

最后就可以在index.dwt模板文件里开始调用了
<!--{foreach from=$get_parent_id16_tree item=list}-->
<a href={$list.url} target=_blank>{$list.name|truncate:15:true}</a>
| <!--{/foreach}--></div>
呵呵,这样就解决了,希望对你有用处

Tags:分类   下级   调用

很赞哦! ()

文章评论

    共有条评论来说两句吧...

    用户名:

    验证码:

本站推荐