1

It code from */*/sql/*_setup/install-1.0.0.php

$installer = $this;

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();

$setup->addAttribute('catalog_product', 'product_label_attribute', array(
'group'         => 'Product labels',
'input'         => 'select',
'type'          => 'int',
'label'         => 'Labels',
'source'        => 'productlabels/source_labels',
'visible'       => true,
'visible_on_front' => true,
'required'      => false,
'user_defined'  => true,
'searchable'    => true,
'filterable'    => true,
'comparable'    => true,
'used_in_product_listing' => true,
'visible_on_front' => true,
'visible_in_advanced_search'  => true,
'is_html_allowed_on_front' => false,
'unique'        => false,
'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

Why when after create attriute i got

enter image description here enter image description here

Why all attributes selected 'No'?

1 Answer 1

0

Try to use this code in your sql setup file

$installer = $this;
$installer->startSetup();
$installer->addAttribute("catalog_product", "product_label_attribute",  
    array(
    "type"     => "int",
    "backend"  => "",
    "frontend" => "",
    "label"    => "Labels",
    "input"    => "select",
    "class"    => "",
    "source"   => "productlabels/source_labels",
    "global"   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    "visible"  => true,
    "required" => false,
    "user_defined"  => true,
    "default" => "",
    "searchable" => true,
    "filterable" => true,
    "comparable" => true,
    "group"         => "Product labels",
    "visible_on_front"  => true,
    "used_in_product_listing" => true,
    "unique"     => false,
    "visible_in_advanced_search"  => true,
    "is_html_allowed_on_front"   => false,
    "note"       => ""
  ));
$installer->endSetup();
3
  • I think the question is related to a product attribute, while this is used to create a category attribute. Mar 26, 2018 at 4:15
  • sorry it was a mistake i updated it to category product Mar 26, 2018 at 4:18
  • Also it would be better what is the real difference b/w your code and the code in the question. Specifically how your code going to fix OP's issue Mar 26, 2018 at 4:20

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.