Set up Script – Product Attribute

This section explains how to add Featured product attribute to magento products page using the installer script.The featured product custom attribute used to display products on the home page.

<?php
$installer = $this;

$installer->startSetup();

$installer->addAttribute('catalog_product', 'new_products', array(
    'group'         => 'General',
    'input'         => 'select',
    'type'          => 'text',
    'label'         => 'New Product',
    'backend'       => '',
    'visible'       => true,
    'required'      => false,
    'visible_on_front' => true,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'source' => 'eav/entity_attribute_source_boolean',
    'sort_order'        => 8,
    'is_configurable' => 0,
    'used_in_product_listing' => 1
));

$installer->endSetup();

Share this Tutorial