Home » Archive

Articles tagged with: attribute

Magento »

[7 Jan 2010 | One Comment | 355 views]

Suppose, you have the product data.
You can get product from either of the following way:-
$_product = $this->getProduct();
OR,

Magento »

[9 Dec 2009 | No Comment | 399 views]

You can add attribute from Admin Panel -> Catalog -> Attributes -> Manage Attributes.
You can also add attributes from mysql setup file of your module. MySql setup file is present inside “YourModule/sql/yourmodule_setup” directory.

Magento »

[2 Dec 2009 | 3 Comments | 504 views]

Note: The attribute code in the case below is my_attribute.

/**
* get attribute collection
*/
$attribute = $_product->getResource()->getAttribute(‘my_attribute’);
/**
* get attribute type
*/
$attribute->getAttributeType();
/**
* get attribute Label
*/
$attribute->getFrontendLabel();
/**
* get attribute default value
*/
$attribute->getDefaultValue();
/**
* check if the attribute is visible
*/
$attribute->getIsVisible();
/**
* check if the attribute is required
*/
$attribute->getIsRequired();
/**
* get attribute value
*/
$attributeValue = Mage::getModel(‘catalog/product’)->load($_product->getId())->getMyAttribute();

Magento »

[27 Nov 2009 | One Comment | 275 views]

Suppose, you want to delete an attribute. But there is no delete option while you edit the attribute. This means that the attribute is system attribute. System attributes cannot be deleted. Only user defined attributes can be deleted.
To delete the attribute, you have to make it user defined.