0

Hi in my custom page template i need display attribute catalog, I programmatically create attribute:

<?php require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute_second    = array(
    'group'         => 'Brands',
    'input'         => 'textarea',
    'type'          => 'varchar',
    'label'         => 'Brands',
    'backend'       => '',
    'visible'       => true,
    'required'      => false,
    'visible_on_front' => true,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
);

$installer->addAttribute('catalog_category', 'brand_text_value', $attribute_second);
$installer->endSetup();?>

and then in catalog added tab Brands with textarea field, now need get value in custom page template, can you help, how i can get value in custom page.

Thanks

1 Answer 1

1

I am not sure I understood you correctly, but you could try smth like:

In case of getting default value:

$attributeCode = 'brand_text_value';
$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute('catalog_product', $attributeCode);

form value for certain product:

$attributeCode = 'brand_text_value';
$attributeValue = Mage::getModel('catalog/product')
            ->load($_product->getId())
            ->getAttributeText($attributeCode);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.