Skip to content

Instantly share code, notes, and snippets.

@vishy93
vishy93 / all_attribute_options
Created January 31, 2019 15:52 — forked from pierreandreroy/all_attribute_options
Get all possible value (dropdown options) of a product attribute in Magento.
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance) {
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
}
?>
@vishy93
vishy93 / My_Module.xml
Created January 25, 2019 15:31 — forked from AndresInSpace/My_Module.xml
Magento Product Attribute Setup Installer - Add New Product Attribute & Add to All Attribute Sets to Specified Group - Full List of available params used for catalog_product addAttribute installation
filepath: app/etc/modules/
<?xml version="1.0"?>
<config>
<modules>
<My_Module>
<active>true</active>
<codePool>local</codePool>
</My_Module>
</modules>
</config>