在Magento管理产品网格添加类别栏
来源:互联网 发布:外网端口telnet不通 编辑:程序博客网 时间:2024/05/16 05:26
Add a column and filter to catalog product grid which has SEVERAL values
->joinField('category_ids', 'catalog/category_product_index', 'category_id', 'product_id=entity_id', null, 'left')
which gives me an error:a:5:{i:0;s:72:"Item (Mage_Catalog_Model_Product) with the same id "16243" already exist"
In prepareColumns I'm adding:
$this->addColumn('category_ids', array( 'header'=> Mage::helper('catalog')->__('Categories'), 'index' => 'category_ids', 'width' => '150px' ));
How can I fix my query so I won't get the error?Is it possible to show and filter by category names instead of ids?
a forum post show a similar code but I couldn't make it work with categorieshttp://www.magentocommerce.com/boards/viewthread/44534/
static protected $COLUMN_ID_TRADE_REFERENCES = 'ref_text';protected function _prepareCollection(){ $store = $this->_getStore(); $collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('name') ->addAttributeToSelect('attribute_set_id') ->addAttributeToSelect('type_id') ->addAttributeToSelect('ref_text') ->joinTable('productreferences/reference', 'product_id=entity_id', array('ref_text'), null, 'left') ->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left') ->addStaticField('ref_text') ->addExpressionAttributeToSelect(self::$COLUMN_ID_TRADE_REFERENCES, 'GROUP_CONCAT(ref_text SEPARATOR " ; ")', 'ref_text') ->groupByAttribute('entity_id');
Thanks
0 0
- 在Magento管理产品网格添加类别栏
- 在Magento产品管理中添加额外信息
- 在magento产品内页添加tab
- Magento导航栏添加非产品菜单
- Magento 获取某类别下的产品
- Magento 获取某类别下的产品
- magento首页调用类别中的产品和随机产品
- Magento分类中添加产品
- Magento根据产品(Product)获取类别(Category)名字及URL
- Magento根据产品(Product)获取类别(Category)名字及URL
- magento 在首页左边栏添加分类目录
- Magento前台不显示添加的产品
- magento添加产品[有quote/无quote]
- magento分类添加超过1000个产品
- Magento后台产品管理,删除产品同时删除图片
- 图书管理系统3 ---图书类别添加
- magento -- 如何在magento中实现产品的批量上传
- magento -- 如何在magento中进行产品的批量上传
- 模式匹配-KMP算法
- Stockbroker Grapevine(最短路_floyd())
- WEB测试资料
- 那些关于LruCache的事儿
- android用shape画虚线,怎么也不显示
- 在Magento管理产品网格添加类别栏
- textedit 密码输入
- 正则清除HTML标签但保留其中一部分标签
- [LeetCode] 3Sum Closest
- Android源码编译后,再重编译所需要做的清理工作
- Bimmer7 Android教程 入门系列之:Manifest介绍(二)
- 抽象类与接口的区别
- 以双斜杠//开头的URL – 依赖协议的URL
- 如何使用SecureCRT连接ubuntu