Reputation: 51
For example, a configurable product with attributes Size and Color, I need to get the attribute codes of the above attributes.
or to be more specific, I need to know whether an attribute is used to configure a configurable product. I need this to check at product list page
Upvotes: 0
Views: 6218
Reputation: 2769
Create an array as shown below:
$attributeValues['additional_options'][$count]['label'] = $aAttr['name'];
$attributeValues['additional_options'][$count]['value'] = $aAttr['value'];
Then pass the array while adding items to the order:
if (!empty($product['product_options'])) {
$orderItem->setProductOptions($product['product_options']);
}
Here $product['product_options']
is the array that we have created in the first step.
Upvotes: 0
Reputation: 4076
try using this code
$config_product = Mage::getModel('catalog/product')->load($config_product_id);
$productAttributeOptions = $config_product->getTypeInstance(true)->getConfigurableAttributesAsArray($config_product);
Upvotes: 4