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& ...
随机推荐
- 微信浏览器video
<style> /* 解决上下有黑边,不能全屏 */ video{object-fit: fill;} </style> <video id="videoID& ...
- response的作用
response.addCookies(),添加Cookie. response.sendRedirect()页面跳转,客户端跳转.(能够取到request)
- Codeforces Round #414
A =w= B qvq C(贪心) 题意: Alice和Bob分别有长度为n(n<=1e5)的字符串,Alice先手,每次从自己的字符串中抽出一个字母放到新字符串的某个位置,一共轮流n次,也就是 ...
- 第一个Spring程序(DI的实现)
一,依赖注入:Dependency Injection(DI)与控制反转(IoC),不同角度但是同一个概念.首先我们理解一点在传统方式中我们使用new的方式来创建一个对象,这会造成对象与被实例化的对象 ...
- Ext-js使用指南(总结)
一.获取元素(Getting Elements) 1.Ext.get var el = Ext.get('myElementId');//获取元素,等同于document.getElementById ...
- Ionic3 填坑记录 - java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
1 错误:Unable to merge dex 执行打包命令时 ionic cordova build android --prod 报如下错误 2 原因 重复引用了同一个包 如上图所示, com ...
- scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld
scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld 学习了: http://blog.csdn.net/wangmuming/article/details/3407911 ...
- 编程算法 - 最小的k个数 代码(C)
最小的k个数 代码(C) 本文地址: http://blog.csdn.net/caroline_wendy 题目: 输入n个整数, 找出当中的最小k个数. 使用高速排序(Quick Sort)的方法 ...
- xenserver PXE安装系统错误的解决
刚开始在xenserver里找pxe启动安装系统找了半天,最后在NEW VM里的template里选择other install media 里找到pxe启动,启动之后加载映像,安装到一半又停止了, ...
- Cocos2dx--开发环境搭建
配置文档下载:http://pan.baidu.com/s/1rja8I 有些文件比較大的自己去下,这里列一下全部用到的文件 adt-bundle-windows-x86-20140321.zip a ...