If you do not know how to get the simple product , Bundle product, configurable product and Grouped product attribute value in magento than don't worry this magento blog or magento tutorial will tell you how to get the product Attribute value in magento.
Using this code You can get custom Attribute or default attribute value and label.
Open the template file “view.phml” from path template/catalog/product/
Find below code in the file.
<?php $_product = $this->getProduct(); ?>
Put below code and check on frontend.
<?php
echo '<pre>';
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute)
{
//if ($attribute->getIsVisibleOnFront()) {
echo "<br/>".$attribute->getName();
echo "<br/>Apply To = ".$attribute->getData('apply_to');
// print_r($attribute->getData()); // get All product attribute value
echo "<br/>Attribute Value = ".$attribute->getFrontend()->getValue($_product); // get product Attribute value
echo "<br/>Attribute Label value = ".$_product->getAttributeText($attribute->getAttributeCode()) ;
// display value only select checkbox and drop down only
echo "<br/>";
//}
}
echo '</pre>';
?>
Using this code You can get custom Attribute or default attribute value and label.
Open the template file “view.phml” from path template/catalog/product/
Find below code in the file.
<?php $_product = $this->getProduct(); ?>
Put below code and check on frontend.
<?php
echo '<pre>';
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute)
{
//if ($attribute->getIsVisibleOnFront()) {
echo "<br/>".$attribute->getName();
echo "<br/>Apply To = ".$attribute->getData('apply_to');
// print_r($attribute->getData()); // get All product attribute value
echo "<br/>Attribute Value = ".$attribute->getFrontend()->getValue($_product); // get product Attribute value
echo "<br/>Attribute Label value = ".$_product->getAttributeText($attribute->getAttributeCode()) ;
// display value only select checkbox and drop down only
echo "<br/>";
//}
}
echo '</pre>';
?>
Great information to say the least. I really do appreciate everything so much from this great website. Website Development Company in Bangalore | Web Design Company in Bangalore | Web Development Company in Bangalore
ReplyDelete