Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Get Configurable product attribute options in magento programatically
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

Hi,

If you need to get config product attribute values use below code i filter only color you can get all info if u remove that condition

$_product    $this->getProduct();

$product $_product;  
$attrs  $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);  
foreach(
$attrs as $attr{  
    
if(== strcmp("size"$attr['attribute_code'])) {  
        $sizess   
$attr['values'];  
    
}  


foreach($sizess as $size_pick){
$size_name 
$size_pick['label'];
$size_value $size_pick['value_index']
echo 
$size_name.'</br>';
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

To get all in size of product in string you can use this code which may help in product list page

$attrs  $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);  
foreach(
$attrs as $attr{  
    
if(== strcmp("size"$attr['attribute_code'])) {  
        $sizess   
$attr['values'];  
    
}  

echo "<pre>";
$i=0;
foreach(
$sizess as $key=>$value){
$sizestr[$i]
=$value['label'];
$i++;
}
echo implode(',',$sizestr);

and also i attache file which will give u clear idea keep file in root folder that is outside app folder and run in browser before that give correct valid config product iID

File Attachments
getConfigProductsizes.php  (File Size: 1KB - Downloads: 188)
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top