$attribute_code = "color";

$attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code);

$options = $attribute_details->getSource()->getAllOptions(false);

Foreach($options as $option){
  echo $option["value"];
  echo $option["label"];
}

The above code does not work if the resource_model is empty. The following snippet does the job:

/** @var $attribute Mage_Eav_Model_Entity_Attribute */

$attribute =Mage::getModel('eav/entity_attribute')->loadByCode(Mage_Catalog_Model_Product::ENTITY,'YOUR_ATTRIBUTE_CODE');

$valuesCollection =Mage::getResourceModel('eav/entity_attribute_option_collection')->setAttributeFilter($attribute->getId())->setStoreFilter(0,false);

 
// use your own attribute code here $attribute_code = "color"; $attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code); $options = $attribute_details->getSource()->getAllOptions(false); Foreach($options as $option){ // print_r($option) and find all the elements echo $option["value"]; echo $option["label"]; } - See more at: http://www.techdilate.com/code/magento-get-attribute-options-of-the-dropdown-type-attribute/#sthash.7gwBrjQe.dpuf

Magento - get Attribute Options of the dropdown type attribute的更多相关文章

  1. Property with 'retain (or strong)' attribute must be of object type

    AFNetworking 2.0 当Deployment Target 低于6.0时,AFURLConnectionOperation.h,AFURLSessionManager.h @propert ...

  2. 基于.Net Framework 4.0 Web API开发(3):ASP.NET Web APIs 异常的统一处理Attribute 和统一写Log 的Attribute的实现

    概述:  ASP.NET Web API 的好用使用过的都知道,没有复杂的配置文件,一个简单的ApiController加上需要的Action就能工作.但是项目,总有异常发生,本节就来谈谈API的异常 ...

  3. ubuntu python opencv3 cv2.cv2 has no attribute 'face' 'cv2.face' has no attribute 'createEigenFaceRecognizer'

    学习opencv过程中遇到错误: 1  cv2.cv2 has no attribute 'face' 经过一顿查,,,各种走弯路 最后一下子就解决了: pip install opencv-pyth ...

  4. jQ1.5源码注释以及解读RE

    jQ作为javascript的库( ▼-▼ ), 尽善尽美, 代码优美,  值得学习.  这一周平常上班没啥事也看jQ1.5的代码, 今天周六差不多看完了(Sizzle部分还没看), 重新看了一下, ...

  5. python 黑魔法收集--已结

    awesome python 中文大全 Fabric , pip, virtualenv 内建函数好文 awesome python 奇技淫巧 一句话求阶乘 from functools import ...

  6. day63-webservice 09.jquery调用ajax

    WebService可以有很多种调用方式,除了之前说的,还可以有jquery.拿原生的Ajax做调用,拿jquery怎么调用啊?原生的能调,jquery指定也能调.原生的Ajax是通过网页直接点HTM ...

  7. Python命令行模块(sys.argv,argparse,click)

    Python作为一门脚本语言,经常作为脚本接受命令行传入参数,Python接受命令行参数大概有三种方式.因为在日常工作场景会经常使用到,这里对这几种方式进行总结. 命令行参数模块 这里命令行参数模块平 ...

  8. Lua 安全调用 metatable 的简单应用

    事情的经过 我们的项目中存在好几个战斗界面,不过界面中的内容略有不同.跟同事出去吃饭的时候,他问我.我们现在的战斗界面.有很多是重复的,但是也有偶尔几个地方不太一样.我在战斗过程中驱动这些界面的时候. ...

  9. 一起聊聊 Swift 3.0

    Swift3.0将会给我们带来哪些改变: 1. 稳定二进制接口(ABI) ABI是什么呢?API大家都知道是应用程序接口 API只是提供函数签名 而ABI是系统和语言层面的 如果ABI稳定 意味着以后 ...

随机推荐

  1. 添加解压缩版Tomcat到系统服务

    一.安装服务 在命令行中进入/Tomcat路径/bin/,执行“service.bat install”: 说明:1.服务名和显示名称:service.bat中设置了默认的服务名称,不同版本分别命名为 ...

  2. HP-UX磁带备份错误收集

    磁带备份命令: make_tape_recovery -Av  默认备份至/dev/rmt/0mn. 如果有多个磁带机,那么需要使用下面命令 make_tape_recovery -Av -a /de ...

  3. 关于SubclassWindow()和SubclassDlgItem

    msdn上的解析 CWnd::SubclassWindowBOOL SubclassWindow( HWND hWnd ); Return Value Nonzero if the function ...

  4. 数据挖掘之clara算法原理及实例(代码中有bug)

    继上两篇文章介绍聚类中基于划分思想的k-means算法和k-mediod算法 本文将继续介绍另外一种基于划分思想的k-mediod算法-----clara算法 clara算法可以说是对k-mediod ...

  5. HttpWebResponse请求状态代码

    HttpWebResponse请求状态代码标识 成员名称 说明 Continue 等效于 HTTP 状态 100.Continue指示客户端可能继续其请求. SwitchingProtocols 等效 ...

  6. Apache启用GZIP压缩网页传输方法

    一.gzip介绍 Gzip是一种流行的文件压缩算法,如今的应用十分广泛,尤其是在Linux平台.当应用Gzip压缩到一个纯文本文件时,效果是很明显的,大约能够降低70%以上的文件大小.这取决于文件里的 ...

  7. Cookie/Session机制具体解释

    会话(Session)跟踪是Web程序中经常使用的技术,用来跟踪用户的整个会话.经常使用的会话跟踪技术是Cookie与Session.Cookie通过在client记录信息确定用户身份,Session ...

  8. 图片占位 css

    手机端图片高度和宽度不能自动比例缩小的问题 <!DOCTYPE html> <html> <head> <meta charset="utf-8&q ...

  9. asp.net 导出excel文件

    之前做过winfrom程序的导出excel文件的功能,感觉非常简单.现在试着做asp.net中导出excel的功能,之前用的是Microsoft.Office.Interop.Excel这个对象来实现 ...

  10. Sybase Power Designer 16.5破解版下载

    http://pan.baidu.com/s/1ddsjs  下载后正常安装,然后将压缩文件里的dll文件拷到安装目录下覆盖原文件,启动Power Designer后,选择help-->abou ...