一个得到添加属性(下拉条)brandss,某一特定值下的所有产品的例子
来源:互联网 发布:淘宝促销价格怎么添加 编辑:程序博客网 时间:2024/06/08 10:02
<?php
class MyCompany_Catalog_Block_Product_Featured extends Mage_Catalog_Block_Product_Abstract
{
public function getFeaturedProducts(){
$ids = $this->_getFeaturedProductsIds();
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->getSelect()->where('e.entity_id in (?)', $ids);
$collection->addAttributeToSelect('*');
$productList = $collection->load();
return $productList;
}
public function _getFeaturedProductsIds(){
// instantiate database connection object
$categoryId = $this->getRequest()->getParam('id', false);
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('catalog_read');
$categoryProductTable = $resource->getTableName('catalog/category_product');
//$productEntityIntTable = $resource->getTableName('catalog/product_entity_int'); // doesn't work
$productEntityIntTable = (string)Mage::getConfig()->getTablePrefix().'catalog_product_entity_int';
$eavAttributeTable = $resource->getTableName('eav/attribute');
$eavAttributeTable1 = $resource->getTableName('eav/attribute_option_value');
// Query database for featured product
$select = $read->select()
->from(array('cp'=>$categoryProductTable))
->join(array('pei'=>$productEntityIntTable),'pei.entity_id=cp.product_id', array())
->joinNatural(array('ea'=>$eavAttributeTable))
->join(array('ea1'=>$eavAttributeTable1),'pei.value=ea1.option_id',array())
->where('cp.category_id=?', $categoryId)
// ->where('pei.value=1')
->where('ea1.value="brand1"')
->where('ea.attribute_code="brandss"');
$rows = $read->fetchAll($select);
$ids = array();
foreach($rows AS $row) {
$ids[] = $row['product_id'];
}
$ret = implode(',', $ids);
return $ids;
}
}
?>
- 一个得到添加属性(下拉条)brandss,某一特定值下的所有产品的例子
- 找出具有特定属性值的所有产品
- 得到小于某一个数的所有素数
- 遍历一个实例的所有属性,得到属性的名称和值
- 如何遍历一个实例的所有属性,得到属性的名称和值
- 如何遍历一个实例的所有属性,得到属性的名称和值
- 如何遍历一个实例的所有属性,得到属性的名称和值
- C++查找一个目录下所有特定扩展名的文件
- 1.请使用sun 内省api得到某一个bean的所有属性,并操作bean的其中一个属性(给属性赋值,以及得到属性的值) 。
- 请使用sun 内省api得到某一个bean的所有属性,并操作bean的其中一个属性(给属性赋值,以及得到属性的值
- java 递归得到某一文件夹下所有的文件 统计文件个数
- 把数据库中的所有记录以一个特定格式的字符显示出来的一个例子
- c++中 打开一个文件夹下的所有特定格式的文件(如JPG)
- Oracle 查询数据库中包含某一特定值的所有字段名,以及表名
- magento -- 下拉框时获取产品的属性值
- php 返回一个数组中特定值的所有下标
- 得到类型的所有公共属性名称
- 得到对象实例的所有属性内容
- 【转】Berkeley DB介绍
- 发现430F2001不太稳定
- windows下配置SVN
- 如何在word2007中插入mathtype
- 产品数据库表结构分析
- 一个得到添加属性(下拉条)brandss,某一特定值下的所有产品的例子
- 第七天_基础加强(2),反射
- spring3.0 之 ajax 使用
- sicily 1342
- 我的寒假开始了
- 扫地老太太
- BIOS IDE 改 AHCI
- gentoo 配置内核过程
- 老太太版本