`
kirenenko04
  • 浏览: 152319 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

Check the category is a child of another category or not

 
阅读更多
	public function isUnderApparel($cate_id, $parent_id) {
		$collection = Mage::getModel('catalog/category')->getCollection()
		->addAttributeToFilter('entity_id', array('eq' => $parent_id)); // 服装分类的ID
		foreach ($collection as $c) {
			$parent = $c;
			break;
		}
		$sub_cateids = array();
		$sub_cateids = $this->retrieveAllChilds($parent->getId());
		return in_array($cate_id, $sub_cateids);
	}

	public function retrieveAllChilds($id = null) {
		$category = Mage::getModel('catalog/category')->load($id);
		return $category->getResource()->getChildren($category, true);
	}

 

分享到:
评论

相关推荐

    控制台报错object is not a function的解决方法

    打开控制台发现报错:object is not a function。 感觉很奇怪,这块的功能最新没动过怎么会突然出问题了呢?上线时主流浏览器都测试过了呀。 虽然奇怪,但是还的解决问题。看着代码发现一个radio对象的name属性和一...

    a project model for the FreeBSD Project.7z

    This, combined with the vast amount of dependencies in the kernel and that it is not easy to see all the consequences of a kernel change, demands developers with a relative full understanding of the ...

    Senfore_DragDrop_v4.1

    Drop Component Suite is in widespread use, there's a good chance another user can help you. I recommend the following newsgroups for issues regarding this library (or COM based Drag/Drop in general): ...

    计算机网络第六版答案

    An ISP earns its money by charging each of the the ISPs that connect to the IXP a relatively small fee, which may depend on the amount of traffic sent to or received from the IXP. 15. Google's ...

    微软内部资料-SQL性能优化3

    Another type of table lock is a schema stability lock (Sch-S) and is compatible with all table locks except the schema modification lock (Sch-M). The schema modification lock (Sch-M) is incompatible ...

    2009 达内Unix学习笔记

    [] 匹配中括号里的内容[a-z][A-Z][0-9]。 ! 事件。 $ 取环境变量的值。 | 管道。把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    connector's end point moving, the link is breaks if the move was not on one of the flex-controls connection points. Contain False as default. - ADD Added ControlDocRect parameter in event ...

    7-Zip压缩软件 7-Zip is open source software. Most of the source code is under the GNU LGPL license. The unRAR code is under a mixed license: GNU LGPL + unRAR restrictions. Check license information here: 7-Zip license.

    7-Zip压缩软件7-Zip is open... Most of the source code is under the GNU LGPL license. The unRAR code is under a mixed license: GNU LGPL + unRAR restrictions. Check license information here: 7-Zip license.

    微软内部资料-SQL性能优化5

    Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...

    polycom宝利通视频会议软件3.9 2018

    “CONCURRENT USER” is a type of license and means the number of personal devices, endpoints, applications or any other authorized means of access that may concurrently use or access the SOFTWARE ...

    Java邮件开发Fundamentals of the JavaMail API

    The creation of protocol-specific providers is not covered in this course because Sun provides a sufficient set for free. Fundamentals of the JavaMail API Page 3 Presented by developerWorks, ...

    Vagaa哇嘎画时代--体验群体智慧的力量!

    7.5 You agree that Vagaa is not responsible or liable for any loss or damage of any sort incurred as the result of any such dealings or as the result of the presence of such advertisers on Vagaa and/ ...

    CHECK THIS OUT! This is a really cool effect. Stand in the m

    CHECK THIS OUT! This is a really cool effect. Stand in the middle of a 3D world and use the mouse to rotate the camera around. All running at over 60 frames per second

    Tesseract-OCR.rar

    Note that this is a text-only and possibly out-of-date version of the wiki ReadMe, which is located at: http://code.google.com/p/tesseract-ocr/wiki/ReadMe Introduction ============ This package ...

    BUS Hound

    This option is useful for keeping the size of the captured data to a minimum. <br>Stop When... <br>These are triggers that allow the capture to automatically stop when the specified condition ...

    squashfs1.3r3.tar.gz

    This is the default action if dest does not exist, or if no filesystem is on it -keep-as-directory If one source directory is specified, create a root directory containing that directory, ...

    cppcheck source code

    cppcheck是一款开源的静态代码分析工具,主要用于C、C++编程语言。它的主要目标是检测出源代码中的潜在错误,比如未初始化的变量、空指针解引用、数组越界、悬空指针、内存泄漏等问题,从而提高软件的质量和稳定性。...

    二级减速器课程设计说明书reducer design specification.doc

    But because the gear relative to the bearing of the two-stage cylindrical gear reducer is arranged asymmetrically, the load distribution along the tooth direction is uneven, and the shaft stiffness ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    Ideally, one should check VsIsReady() using a timer or the like to wait efficiently, so that the host PC is free to do other tasks while waiting for the VariSpec. The VariSpec always processes each ...

Global site tag (gtag.js) - Google Analytics