-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaddAttributeOption.php
33 lines (28 loc) · 1.08 KB
/
addAttributeOption.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
$eavSetupFactory = $this->_objectManager->create('\Magento\Eav\Setup\EavSetupFactory');
$eavSetup = $eavSetupFactory->create(['setup' => $setup]);
$attributeId = $eavSetup->getAttributeId('catalog_product', 'manufacturer');
$options = [
'values' => [
'1' => 'brand 1',
'2' => 'brand 2',
'3' => 'brand 3',
],
'attribute_id' => $attributeId ,
];
$eavSetup->addAttributeOption($options);
echo 'Done';
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);