在使用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. UVA 437_The Tower of Babylon

    题意: 一堆石头,给定长宽高,每种石头均可以使用无数次,问这堆石头可以叠放的最高高度,要求下面的石头的长和宽分别严格大于上面石头的长和宽. 分析: 采用DAG最长路算法,由于长宽较大,不能直接用于表示 ...

  2. P1028 数的计算 洛谷

    https://www.luogu.org/problem/show?pid=1028 题目描述 我们要求找出具有下列性质数的个数(包含输入的自然数n): 先输入一个自然数n(n<=1000), ...

  3. P1340 兽径管理 洛谷

    https://www.luogu.org/problem/show?pid=1340 题目描述 约翰农场的牛群希望能够在 N 个(1<=N<=200) 草地之间任意移动.草地的编号由 1 ...

  4. 遍历ArrayList数组时可能存在的问题

    我们都知道ArrayList类中有个重要的方法是Add(),该方法用于向集合中添加元素,它有一个object类型的参数,表示通过该方法可以向集合中添加任意类型的项,由于ArrayList动态数组中的元 ...

  5. operamasks-omGrid的使用

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="personTab.aspx ...

  6. 选择器的使用(nth-child和nth-last-child选择器)

    <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta ...

  7. 【CV论文阅读】An elegant solution for subspace learning

    Pre: It is MY first time to see quite elegant a solution to seek a subspace for a group of local fea ...

  8. Chromium硬件加速渲染的UI合成过程分析

    在Chromium中.Render端和WebGL端绘制出来的UI终于是通过Browser端显示在屏幕上的.换句话说.就是Browser端负责合成Render端和WebGL端的UI.这涉及到不同Open ...

  9. ZOJ问题(2010浙江大学研究生复试上机题目[找规律] hdoj 3788)

    ZOJ问题 pid=3788">点击打开链接 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

  10. MVC4中给TextBoxFor设置默认值和属性(同时设置js事件)

    例如:(特别注意在设置初始值的时候 Value 中的V要大写) @Html.TextBoxFor(model => model.CustomerCode, new { Value="  ...