EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Wrong Setup/UpgradeData.php for version 2.0.1? #170

Closed martijn-bigbridge closed 3 years ago

martijn-bigbridge commented 3 years ago

Is there a special reason that in Setup/UpgradeData.php not all necessary attributes are created anymore when you install the module on version 2.0.1 or higher?

        if (version_compare($context->getVersion(), '2.0.0', '=<')) {
        // ! never executing this, because we are installing 2.0.1
            $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
            $this->ensureCrosssellTemplateAttribute($eavSetup);
            $this->ensureUpsellTemplateAttribute($eavSetup);
            $this->ensureFeaturedTemplateAttribute($eavSetup);
        }

       if (version_compare($context->getVersion(), '2.0.1', '<=')) {
             $this->updateNavigatorBaseUrl();
       }

Without the attributes you can't save settings at category level, for example "Featured products template" settings.

But I'm not sure if this was done intentionally, or if it's simply a bug.

stijnbernards commented 3 years ago

Hi @martijn-bigbridge ,

This shouldn't be the case. $context->getVersion() actually refers to the current setup_module.schema_version database column. Which would mean that if you install the module from scratch this will actually return 0 thus running the installation script properly

It might be that you had errors occurring during setup:upgrade which prompted Magento to update your database and set the module version without actually updating the module.

Let me know if I can help you in any other way.

Cheers.