What is frontend when creating a product attribute

by Avesh Naik   Last Updated September 18, 2018 17:09 PM

I want to know what is the use of frontend when creating a product attribute using installData or updateData.

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
    $eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
        'sample_attribute',
        [
            'type' => 'int',
            'backend' => '',
            'frontend' => '',
            'label' => 'Sample Atrribute',
            'input' => '',
            'class' => '',
            'source' => '',
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'visible' => true,
            'required' => true,
            'user_defined' => false,
            'default' => '',
            'searchable' => false,
            'filterable' => false,
            'comparable' => false,
            'visible_on_front' => false,
            'used_in_product_listing' => true,
            'unique' => false,
            'apply_to' => ''
        ]
    );


Answers 1


Frontend means how an attribute should be rendered on frontend. You can find complete detail in dev docs that why each parameter / key is used while creating product attribute. Here is the url : https://devdocs.magento.com/videos/fundamentals/add-new-product-attribute/

Naveed
Naveed
September 18, 2018 16:48 PM

Related Questions




Merging Options

Updated May 16, 2015 21:04 PM


How to use a Media Image Attribute

Updated January 11, 2018 13:09 PM