Files
2017-11-14 15:04:59 +01:00

88 lines
3.0 KiB
PHP

<?php
namespace Wowow\Datetimepicker\Setup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(array('setup' => $setup));
$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'vente_flash');
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'vente_flash_start',
[
'group' => 'Custom Attribute',
'label' => 'Vente flash start',
'type' => 'datetime',
'input' => 'date',
'class' => 'validate-date',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => true,
'filterable' => true,
'filterable_in_search' => true,
'visible_in_advanced_search' => true,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'vente_flash_end',
[
'group' => 'Custom Attribute',
'label' => 'Vente flash end',
'type' => 'datetime',
'input' => 'date',
'class' => 'validate-date',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => true,
'filterable' => true,
'filterable_in_search' => true,
'visible_in_advanced_search' => true,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
$setup->endSetup();
}
}