Magento对属性集进行筛选得到属性值
来源:互联网 发布:淘宝打印助手在哪里 编辑:程序博客网 时间:2024/06/11 06:49
- 一级属性集type所在的数据表:eav_entity_type
- 一级属性集下的二级属性集所在的数据表:eav_attribute_set
- 二级属性集下的三级属性集所在的数据表:eav_attribute
在magento中存在着eav模型,而eav模型中存在着很多属性集,大概有三级属性集,如下:
- 在一级属性中是像用户属性集、用户地址属性集、产品分类属性集和产品属性集等;
后台位置:Catalog->Manage Categories->Default Category
- 在一级属性集下是对应的二级属性集,例如:产品属性集下包括Shoes、Bottoms、Tops等;
后台位置:Catalog->Attribute->Manage Attribute Sets
- 在二级属性集下就是三级属性,比如size、color等属于三级属性,这个就不是属性集,是单个的属性;
后台位置:Catalog->Attribute->Manage Attribute Sets属性下
下面的代码就是在商品的属性集过滤筛选出对应商品的属性:
$category= Mage::getModel('catalog/category')->load($category_id);$attribute_set = $category->getAttributeSet();$sizeAttribute= Mage::getResourceModel('catalog/product_attribute_collection') ->setAttributeSetFilter($attribute_set) ->addFieldToFilter('attribute_code',array('like' => '%size')) ->getFirstItem();
- 第一行代码是通过分类ID得到该分类ID下的分类信息;
- 第二行代码通过该分类ID来得到attribute_set值,进而判断该商品属于哪个类型的ID;
- 第三行代码是得到Product属性集集合;
- 第四行代码是通过类型的ID过滤出属于product属性集下的哪个属性集;
- 第五行代码是在上面得到的属性集里通过模糊查询size;
- 第六行代码是去模糊查询到的第一个值。
阅读全文
0 0
- Magento对属性集进行筛选得到属性值
- Magento 属性与属性集
- Magento 中产品属性筛选器的使用
- magento 属性与属性集配置attributes
- Magento获得产品属性集
- JS运用id得到其他的属性值及jquery对相同属性的class扫描
- 反射得到指定属性值
- iOS 根据数组里的model的属性进行筛选
- magento获取相应名字的属性集
- magento -- 获取产品的属性值
- magento更新产品属性值 eg. visibility
- 在magento前端显示自定义属性值
- magento -- 根据属性名获得产品的属性值
- magento 获取自定义产品属性和属性值
- magento 获取自定义产品属性和属性值
- magento 获取自定义产品属性和属性值
- magento 创建属性
- magento 属性管理
- node Unexpected token import
- JavaScript插件之Tab选项卡
- 1、kvm基础篇—环境搭建及基本使用
- openGL之glsl入门5--缓冲对象vbo、vao及ebo
- poj1887 Testing the CATCHER
- Magento对属性集进行筛选得到属性值
- 2017.11.13笔记
- Java中的static关键字解析
- upstream prematurely closed connection while reading response header from upstream分析与解决
- 开关
- Windows消息机制
- git pull all branch
- 常见HTTP状态码
- 解决memory bound算法的一些建议