Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    What is functionality of Visible on Product View Page on Front-end

    General Discussion
    3
    4
    437
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Ankit patel last edited by

      What is the functionality of 'Visible on Product View Page on Front-end'. I'm not able to see any effect on the front-end.

      1 Reply Last reply Reply Quote 0
      • P
        prateek-webkul last edited by

        Hello Ankit,

        "Visible on Product View Page on Front-end" functionality is provided to show product attributes under specification accordian on product page.

        visible-on-front.png

        Thanks

        A 1 Reply Last reply Reply Quote 0
        • A
          Ankit patel @prateek-webkul last edited by

          @prateek-webkul got it, thanks a lot!

          1 Reply Last reply Reply Quote 0
          • Mariesmith99
            Mariesmith99 last edited by

            <?php

            namespace Ced\HelloWorld\Setup;

            use Magento\Framework\Setup\ModuleContextInterface;

            use Magento\Framework\Setup\ModuleDataSetupInterface;

            use Magento\Framework\Setup\InstallDataInterface;

            use Magento\Eav\Setup\EavSetupFactory;

            class InstallData implements InstallDataInterface

            {

            private $eavSetupFactory;

            public function __construct(EavSetupFactory $eavSetupFactory) {

              $this->eavSetupFactory = $eavSetupFactory;
            

            }

            public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

            {

              /**** Attribute names and there data*****/
            
               /* [atr-Code, atr-group, atr-type, label, input, required,default] */
            
            
            
            
               $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
            
               $attributes = [
            
                  ['name' => 'custom_attribute',
            
                      'group' => 'Product Details',
            
                      'type' => 'text',
            
                      'label' => 'Custom Attribute',
            
                      'class' => 'validate-number',
            
                      'input' => 'text',
            
                      'is_used_in_grid' => 1,
            
                      'required' => true,
            
                      'sort_order' => 20],
            
                  /*can duplicate the array for more attributes*/
            
               ];
            
              foreach ($attributes as $key => $value) {
            
                  $eavSetup->addAttribute(
            
                      \Magento\Catalog\Model\Product::ENTITY,
            
                      $value['name'],   /* Custom Attribute Code */
            
                       [
            
                          'group' => $value['group'],/* Group name in which you want to display your custom attribute */[.](https://www.theleathermakers.com/arkham-knight-batman-red-hood-leather-jacket/)
            
                          'type' => $value['type'],/* Data type in which formate your value save in database*/
            
                          'backend' => (isset($value['backend'])) ? $value['backend'] : '',
            
                          'frontend' => '',
            
                          'label' => $value['label'], /* lablel of your attribute*/
            
                          'input' => $value['input'],
            
                          'frontend_class' => ((isset($value['class'])) ? $value['class'] : ''),
            
                          'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            
                          'visible' => (isset($value['visible'])) ? $value['visible'] : true,
            
                          'required' => $value['required'],
            
                          'source' => (isset($value['source'])) ? $value['source'] : '',
            
                          'option' => (isset($value['option'])) ? $value['option'] : '',
            
                          'user_defined' => (isset($value['user_defined'])) ? $value['user_defined'] : false,
            
                          'sort_order' => 50,
            
                          'default' => (isset($value['default'])) ? $value['default'] : '',
            
                          'note' => (isset($value['note'])) ? $value['note'] : '',
            
                          'searchable' => true,
            
                          'filterable' => true,
            
                          'comparable' => true,
            
                          'visible_on_front' => false,
            
                          'used_in_product_listing' => true,
            
                          'unique' => false,
            
                          'is_used_in_grid' => (isset($value['is_used_in_grid'])) ? $value['is_used_in_grid'] : 0,
            
                      ]
            
                  );
            
              }
            

            }
            }

            1 Reply Last reply Reply Quote 0
            • First post
              Last post