0

I have created custom attribute type - file upload of type ravi_file in magento2.

public function execute(\Magento\Framework\Event\Observer $observer){
    $response = $observer->getEvent()->getResponse();
    $types = $response->getTypes();
    $types[] = array(
        'value' => 'ravi_file',
        'label' => __('File Upload by Ravi'),
        'hide_fields' => array(
            'is_unique',
            'is_required',
            'frontend_class',
            'is_configurable',
            '_default_value',

            'is_searchable',
            'is_visible_in_advanced_search',
            'is_filterable',
            'is_filterable_in_search',
            'is_comparable',
            'is_used_for_promo_rules',
            'position',
            'used_in_product_listing',
            'used_for_sort_by',
        )
    );
    $response->setTypes($types);
    return $this;  }

an attribute is created successfully. I assigned file upload attribute to default attribute set. I am getting following error on edit product.Error Log

I have created backend and frontend module by referring the https://community.magento.com/t5/Programming-Questions/Product-custom-attribute-file-upload/td-p/29460

I need a way to get the attribute listed on the product page where we can upload the file for the specific product. Please help, Thanks in advance.

Used events:

  1. file_upload_add FileAttributeType => for adding custom file type in dropdown of the Catalog Input Type for Store Owner

  2. catalog_entity_attribute_save_before => want to call file upload functionality

  • How you created custom attribute via script or from backend ,if script it may be w omg with your attribute creation – Sairam Sigirisetty Sep 16 '18 at 3:31
0

Create a custom option with the product for file upload. That's it![enter image description here]1

  • It supposed to be an attribute. we can enable disable at any point of time and it will be displayed on frontend. – user2800404 May 4 '17 at 2:58
  • check this extension available in 1.9 magentocommerce.com/magento-connect/file-upload-attribute.html , I want an exactly same extension. I am trying to convert. But stuck at - to show file upload option on product edit page. refer my error log. – user2800404 May 4 '17 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.