博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
magento获取指定目录分类的子分类
阅读量:4200 次
发布时间:2019-05-26

本文共 653 字,大约阅读时间需要 2 分钟。

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
if
(
$category
->hasChildren()) { 
//判断是否有子目录
 
$ids
=
$category
->getChildren();  
//提取子目录id清单
 
$subCategories
= Mage::getModel(
'catalog/category'
)->getCollection();
 
$subCategories
->getSelect()->where(
"e.entity_id in ($ids)"
); 
//提取指定目录ids的上当清单
 
$subCategories
->addAttributeToSelect(
'name'
); 
//指定查找目录名称
 
$subCategories
->load();
 
foreach
(
$subCategories
AS
$item
) {
 
echo
" - "
;
 
echo
'<a href="'
.
$item
->getUrl() .
'">'
;  
//获取目录链接
 
echo
$item
->getName();  
//获取目录名
 
echo
"</a>("
;
 
echo
$item
->getProductCount();  
//获取目录下的产品数量
 
//echo $item->getChildrenCount();  //获取目录下子目录数量
 
echo
")"
;
 
echo
"<br/>"
;
 
}
 
}

转载地址:http://mdcli.baihongyu.com/

你可能感兴趣的文章
magento rest api 调用
查看>>
magento rest api 调用!
查看>>
magento rest api get Token key and secret
查看>>
谷歌获取货币汇率代码
查看>>
安装nginx
查看>>
手动6 - 隐藏Nginx版本号
查看>>
手动7 - nginx 日志切割
查看>>
magento - 使用后台设置的时间用法
查看>>
Linux常用命令
查看>>
清除文件中的.svn文件
查看>>
手动11 -nginx 优化配置
查看>>
php加速器 - zendopcache
查看>>
手动12 - 安装php加速器 Zend OPcache
查看>>
set theme -yii2
查看>>
yii2 - 模块(modules)的view 映射到theme里面
查看>>
yii2 - controller
查看>>
yii2 - 增加actions
查看>>
网站加载代码
查看>>
php图像处理函数大全(缩放、剪裁、缩放、翻转、旋转、透明、锐化的实例总结)
查看>>
magento url中 uenc 一坨编码 base64
查看>>