$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. android widget->progressbar

    其中的indeterminteDrawable属性就是用来设置进度条颜色等属性的

  2. [x-means] 1.x-means简介

    本文基于<X-means>和<BIC-notes>(原论文中BIC公式有误,这是对BIC的补充) K-means的缺点 每一轮迭代的计算花费大 需要用户指定K 易于收敛到局部最 ...

  3. poj 1273 Drainage Ditches_最大流模版

    #include <iostream> #include<cstdio> #include<queue> #include<cstring> using ...

  4. pushMeBaby,github链接

    https://github.com/stefanhafeneger/PushMeBaby

  5. 一个简单的flask程序

    初始化 所有Flask程序都必须创建一个程序实例. 程序实例是Flask类的对象,经常使用下述代码创建: from flask import Flask app = Flask(__name__) F ...

  6. Html代码seo优化最佳布局实例讲解

    搜索引擎对html代码是非常优化的,所以html的优化是做好推广的第一步.一个符合seo规则的代码大体如下界面所示. 1.<!–木庄网络博客–> 这个东西是些页面注释的,可以在这里加我的& ...

  7. Rescue(bfs)

    Rescue Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submis ...

  8. Java基础:泛型

    Java的泛型是什么呢, 就是类型的參数化,这得类型包含方法參数和返回值.也就是原本该是确定类型的地方换成了变量,把类型的确定时间向后延迟了. 在之前,学过"重载"的概念,重载是什 ...

  9. 比较好用的sql语句

    判断a表中有而b表中没有的记录 select a.* from tbl1 a left join tbl2 b on a.key = b.key where b.key is null 虽然使用in也 ...

  10. JQuery获取Checkbox组的值

    前台: <div id="addtrtr" style="padding:20px; background-color:#F8F8F8;"> < ...