|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / Infortis / UltraMegamenu / Setup / |
Filename | /home/dev2.destoffenstraat.com/app/code/Infortis/UltraMegamenu/Setup/UpgradeData.php |
Size | 2.42 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 06-Apr-2021 18:06 |
Last accessed | 21-Aug-2025 22:42 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace Infortis\UltraMegamenu\Setup;
use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\App\ProductMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* Category setup factory
*
* @var \Magento\Catalog\Setup\CategorySetupFactory
*/
private $categorySetupFactory;
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @var ProductMetadataInterface
*/
protected $productMetadata;
/**
* Init
*
* @param \Magento\Catalog\Setup\CategorySetupFactory $categorySetupFactory
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(
\Magento\Catalog\Setup\CategorySetupFactory $categorySetupFactory,
EavSetupFactory $eavSetupFactory,
ProductMetadataInterface $productMetadata
) {
$this->categorySetupFactory = $categorySetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->productMetadata = $productMetadata;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$magentoVersion = $this->productMetadata->getVersion();
if (version_compare($context->getVersion(), '2.1.2') < 0)
{
if (version_compare($magentoVersion, '2.1.0', '>='))
{
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$categorySetup->updateAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'umm_dd_proportions',
'note',
'Proportions between 3 sections of drop-down: Left Block, Subcategories, Right Block. Enter 3 numbers separated by semicolon, e.g.: 3;6;3; Width is expressed in grid units (number between 0 and 12). Sum has to equal 12. See User Guide, chapter: 13. Menu'
);
}
}
$setup->endSetup();
}
}
namespace Infortis\UltraMegamenu\Setup;
use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\App\ProductMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* Category setup factory
*
* @var \Magento\Catalog\Setup\CategorySetupFactory
*/
private $categorySetupFactory;
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @var ProductMetadataInterface
*/
protected $productMetadata;
/**
* Init
*
* @param \Magento\Catalog\Setup\CategorySetupFactory $categorySetupFactory
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(
\Magento\Catalog\Setup\CategorySetupFactory $categorySetupFactory,
EavSetupFactory $eavSetupFactory,
ProductMetadataInterface $productMetadata
) {
$this->categorySetupFactory = $categorySetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->productMetadata = $productMetadata;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$magentoVersion = $this->productMetadata->getVersion();
if (version_compare($context->getVersion(), '2.1.2') < 0)
{
if (version_compare($magentoVersion, '2.1.0', '>='))
{
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$categorySetup->updateAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'umm_dd_proportions',
'note',
'Proportions between 3 sections of drop-down: Left Block, Subcategories, Right Block. Enter 3 numbers separated by semicolon, e.g.: 3;6;3; Width is expressed in grid units (number between 0 and 12). Sum has to equal 12. See User Guide, chapter: 13. Menu'
);
}
}
$setup->endSetup();
}
}