link-in - רשומות קוד

חפש את הקוד שלך >

קוד בדיקה במגנטו

יצירת קובץ בתקיה ראשית

<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);

class TestApp
{
    protected $objectManager;

    public function __construct()
    {
        $this->objectManager = \Magento\Framework\App\ObjectManager::getInstance();

        $this->execute();
    }

    public function execute()
    {
        $eavSetupFactory = $this->objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
        $setup = $this->objectManager->create(\Magento\Framework\Setup\ModuleDataSetupInterface::class);

        /** @var EavSetup $eavSetup */
        $eavSetup = $eavSetupFactory->create(['setup' => $setup]);
        $entityType = $eavSetup->getEntityTypeId('catalog_product');
        $eavSetup->updateAttribute($entityType, 'year', 'is_filterable', 0);
    }
}
new TestApp();

על מנת להריץ  php text.php