在使用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 显示下拉菜单属性的更多相关文章

  1. Bootstrap学习笔记(5)--实现Bootstrap导航条可点击和鼠标悬停显示下拉菜单

    实现Bootstrap导航条可点击和鼠标悬停显示下拉菜单 微笑的鱼 2014-01-03 Bootstrap 5,281 次围观 11条评论 使用Bootstrap导航条组件时,如果你的导航条带有下拉 ...

  2. lightinthebox头部分类菜单下拉导航,使鼠标移到See All Categories就显示下拉菜单

    lightinthebox头部分类菜单下拉导航,使鼠标移到See All Categories就显示下拉菜单 打开includes\templates\lightinthebox\common\tpl ...

  3. JQueryEasyUI easyui-combobox 单击文本区域显示下拉菜单

    //单击内容框弹出下拉菜单 $(".combo").click(function (e) { if (e.target.className == 'combo-text valid ...

  4. css实现hover显示下拉菜单

    原理比较简单,首先先隐藏下拉菜单即display:none,当鼠标hover后,设置display:block. <style> .menu-title { postion: relati ...

  5. js 导航栏多项点击显示下拉菜单代码

    <!DOCTYPE html> <html> <head> <title>Dropdown</title> <!--<link ...

  6. bootstrap 导航栏鼠标悬停显示下拉菜单

    在jsp中加入一下代码: .navbar .nav > li:hover .dropdown-menu { display: block;} 全部代码如下所示: <%@ page lang ...

  7. 4 CSS导航栏&下拉菜单&属性选择器&属性和值选择器

    CSS导航栏 熟练使用导航栏,对于任何网站都非常重要 使用CSS你可以转换成好看的导航栏而不是枯燥的HTML菜单 垂直导航栏: <!DOCTYPE html> <html> & ...

  8. js 点击按钮显示下拉菜单

    <li> <a id = "rank" onclick="showGroup()"></a></li><l ...

  9. IE6 下绝对定位position:absolute 与浮动不显示 (IE6 下拉菜单显示)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD& ...

随机推荐

  1. [bzoj4519][Cqoi2016]不同的最小割_网络流_最小割_最小割树

    不同的最小割 bzoj-4519 Cqoi-2016 题目大意:题目链接. 注释:略. 想法: 我们发现这和最小割那题比较像. 我们依然通过那个题说的办法一样,构建最小割树即可. 接下来就是随便怎么处 ...

  2. codevs——1080 线段树练习

    1080 线段树练习  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解       题目描述 Description 一行N个方格,开始每个格子里都有 ...

  3. 洛谷——P1151 子数整数

    P1151 子数整数 题目描述 对于一个五位数a1a2a3a4a5,可将其拆分为三个子数: sub1=a1a2a3 sub2=a2a3a4 sub3=a3a4a5 例如,五位数20207可以拆分成 s ...

  4. 使用Hexo搭建博客

    好长时间没在博客园写东西了,自己搭了一套博客,把自己的一些积累分享给大家,欢迎指正! 博客地址:http://www.baiguangnan.com 使用Hexo搭建自己的博客,可以参考这里:http ...

  5. 学习swift从青铜到王者之字符串和运算符02

    1 字符和字符串初步  var c :Character = "a" 2 构造字符串  let str1 = "hello" let str2 = " ...

  6. 网络学习之OSI七层协议和TCP协议

    OSI七层简单介绍 应用层:提供操作系统和应用程序的接口 表示层:表示数据如何加密.如何压缩的 会话层:将不同应用程序数据分离 传输层:提供可靠和不可靠的数据传输和重传.纠错的功能 网络层:提供IP地 ...

  7. openstack(2) -------RabbitMQ集群部署

    一.RabbitMQ简介 RabbitMQ属于一个流行的开源消息队列系统.属于AMQP( 高级消息队列协议 ) 标准的一个 实现.是应用层协议的一个开放标准,为面向消息的中间件设计.用于在分布式系统中 ...

  8. ASP.NET Boilerplate 学习 AspNet Core2 浏览器缓存使用 c#基础,单线程,跨线程访问和线程带参数 wpf 禁用启用webbroswer右键菜单 EF Core 2.0使用MsSql/MySql实现DB First和Code First ASP.NET Core部署到Windows IIS QRCode.js:使用 JavaScript 生成

    ASP.NET Boilerplate 学习   1.在http://www.aspnetboilerplate.com/Templates 网站下载ABP模版 2.解压后打开解决方案,解决方案目录: ...

  9. cocos2d-x 2.2.3 建project

    2.2以后不再使用模板安装了. 打开终端,进入cocos2d-x文件夹下的tools/project-creator,运行命令 ./create_project.py -project [项目名] - ...

  10. influxDB+telefraf+grafana

    此贴自己记录 下载grafana https://grafana.com/grafana/download?platform=windows 从官网下载influxDB\telefraf的方法 : h ...