magento Grid 显示下拉菜单属性
在使用grid时自己新建了几个属性,然后其中有一个是下拉单,即deal_status
protected function _prepareCollection()
{
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('price')
->addAttributeToSelect('special_price')
->addAttributeToSelect('name')
->addAttributeToSelect('is_deal')
->addAttributeToSelect('deal_status')
->addAttributeToFilter('is_deal', true, 'left'); $this->setCollection($collection); parent::_prepareCollection();
return $this;
}
解决方案:
$this->addColumn('deal_status',
array(
'header'=> Mage::helper('catalog')->__('Deal Status'),
'width' => '70px',
'index' => 'deal_status',
'type' => 'options',
'options' => $this->_getProductAttributeOptions('deal_status')
));
protected function _getProductAttributeOptions($attributeName) {
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product',$attributeName);
/* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
$attributeOptions = $attribute->getSource()->getAllOptions();
$options = array();
// options in key => value Format bringen
foreach ($attributeOptions as $option) {
$options[$option['value']] = $option['label'];
}
return $options;
}
magento Grid 显示下拉菜单属性的更多相关文章
- Bootstrap学习笔记(5)--实现Bootstrap导航条可点击和鼠标悬停显示下拉菜单
实现Bootstrap导航条可点击和鼠标悬停显示下拉菜单 微笑的鱼 2014-01-03 Bootstrap 5,281 次围观 11条评论 使用Bootstrap导航条组件时,如果你的导航条带有下拉 ...
- lightinthebox头部分类菜单下拉导航,使鼠标移到See All Categories就显示下拉菜单
lightinthebox头部分类菜单下拉导航,使鼠标移到See All Categories就显示下拉菜单 打开includes\templates\lightinthebox\common\tpl ...
- JQueryEasyUI easyui-combobox 单击文本区域显示下拉菜单
//单击内容框弹出下拉菜单 $(".combo").click(function (e) { if (e.target.className == 'combo-text valid ...
- css实现hover显示下拉菜单
原理比较简单,首先先隐藏下拉菜单即display:none,当鼠标hover后,设置display:block. <style> .menu-title { postion: relati ...
- js 导航栏多项点击显示下拉菜单代码
<!DOCTYPE html> <html> <head> <title>Dropdown</title> <!--<link ...
- bootstrap 导航栏鼠标悬停显示下拉菜单
在jsp中加入一下代码: .navbar .nav > li:hover .dropdown-menu { display: block;} 全部代码如下所示: <%@ page lang ...
- 4 CSS导航栏&下拉菜单&属性选择器&属性和值选择器
CSS导航栏 熟练使用导航栏,对于任何网站都非常重要 使用CSS你可以转换成好看的导航栏而不是枯燥的HTML菜单 垂直导航栏: <!DOCTYPE html> <html> & ...
- js 点击按钮显示下拉菜单
<li> <a id = "rank" onclick="showGroup()"></a></li><l ...
- IE6 下绝对定位position:absolute 与浮动不显示 (IE6 下拉菜单显示)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD& ...
随机推荐
- 解方程(codevs 3732)
题目描述 已知多项式方程: a0+a1x+a2x^2+..+anx^n=0 求这个方程在[1, m ] 内的整数解(n 和m 均为正整数) 输入输出格式 输入格式: 输入文件名为equation .i ...
- 服务器Centos7.4 下jdk1.8环境配置、mysql环境搭建,mysql找回(重置)密码看这篇就够了
最近一直帮我的同学搭建自己的服务器,其中涉及到了以下知识点,经过查询博客资料等方式,再加上多重实践,我成功总结出了完整的配置一个简单服务器环境的步骤: (来自 ZYXS 的CSDN 博客 ,全文地址请 ...
- component and slot
component and slot 使用: 1.component panel <article class="message"> <div class=&qu ...
- 【SSH进阶之路】Hibernate搭建开发环境+简单实例(二)
Hibernate是很典型的持久层框架,持久化的思想是很值得我们学习和研究的.这篇博文,我们主要以实例的形式学习Hibernate,不深究Hibernate的思想和原理,否则,一味追求,苦学思想和原理 ...
- [Typescript Kaop-ts] Use AOP in Vue Components with TypeScript and Kaop-ts
Aspect Oriented Programming, AOP, allows to reuse logic across an entire app in a very neat way, dec ...
- HTML5超科幻个人主页
在线演示地址:http://me.cpwl.site 备用地址:http://cpwl.sinaapp.com 部分截图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkb ...
- kvm 安装
一. 虚拟化 是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机.在一台计算机上同时运行多个逻辑计算机,每个逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立的空间内运行而互相不影响,从而 ...
- 数组/矩阵转换成Image类
Python下将数组/矩阵转换成Image类 原创 2017年04月21日 19:21:27 标签: python / 图像处理 3596 先说明一下为什么要将数组转换成Image类.我处理的图像是F ...
- Java中的Nested Classes和Inner Classes
Java中的Nested Classes和Inner Classes Java有嵌套类(Nested Classes)和内部类(Inner Classes)的概念. 嵌套类(Nested Classe ...
- Class 与 new的配合使用
class Type{ // 定义新的类型Type /// ...... }; Type a; Type b; // 像int a; int b;那样使用, 定义a和b为Type类型的变量 in ...