0

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.

2
  • did you try instead of 'input' => 'checkboxes', to use 'input' => 'checkbox', ? Apr 11, 2018 at 10:59
  • yes, it doest't work the same, but i need 'checkboxes'. Apr 11, 2018 at 12:26

1 Answer 1

0

So I just did some research and there is no support for multiple checkboxes as an attribute display in Magento 1.

You would have to make a full custom implementation to make this work.

7

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.