一段分类代码--产品分类的!

<?php
02 $c=Mage::getModel('catalog/category');

//根据属性得到一个模型集合。
03 $pc=$c->loadByAttribute('name','选购礼盒');
04 if($pc->hasChildren()) {
05 $ids = $pc->getChildren();

//得到所有产品的分类集合。
06 $subCategories = Mage::getModel('catalog/category')->getCollection();

//使用getSelect()方法和where() 方法重新选取。
07 $subCategories->getSelect()->where("e.entity_id in ($ids)");
08 $subCategories->addAttributeToSelect('*');
09 $subCategories->load();
10 }
11 ?>

layout中的标签<cms_page_read>就是当weburl/cms/page/read 为访问路径的时候加载的layout handle,layout为默认的!!好强大,今晚让我想出来了!!




//装载缓存。
$this->loadLayout();
//得到block实例。
$block=Mage::getBlockSingleton('profile/profile');
//load profile
//$block->getProfile()----------Return a collection of profiles.
$profile = $block->getProfile();
if($profile) {
//操作layout中的参数(通过方法),好灵活!!
$this->getLayout()->getBlock('head')->setTitle($profile->getData("content_heading"))
->setDescription($profile->getData("meta_description"))
->setKeywords($profile->getData("meta_keywords"));
}
//画出来!!
$this->renderLayout();


//Return a collection of profiles.


public function getProfiles($category_id) {
$profiles = Mage::getModel('profile/profile')->getCollection()
//下面的在细细研究!!
->addStoreFilter(Mage::app()->getStore()->getId());
$profiles->addFieldToFilter('category_id', $category_id);
$profiles->setOrder("creation_time", "DESC");
return $profiles;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值