I have the code that create new attribute for category
$setup->addAttribute('catalog_category', 'watermark', array(
'group' => 'Category labels',
'input' => 'checkboxes',
'type' => 'int',
'label' => 'Labels',
'source' => 'productlabels/source_watermark_category',
'backend' => '',
'frontend' => '',
'class' => '',
'visible' => 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' => true,
'unique' => false,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
and source model
class Plumrocket_Productlabels_Model_Source_Watermark_Category extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
implements Mage_Eav_Model_Entity_Attribute_Source_Interface
{
public function getAllOptions()
{
$collection = Mage::getModel('productlabels/block')->getCollection();
foreach ($collection as $value) {
$watermark = !empty($value->getCategoryImage()) ? $value->getCategoryImage() : '';
$result[] = ['value' => $value->getId(), 'label' => $value->getTitle(), 'watermark' => $watermark];
}
return $html;
}
}
Why my source model doesn`t working, but if i choose select instead checkboxes it will be good.
'input' => 'checkboxes',
to use'input' => 'checkbox',
?