Question

I installed a free magento extension on two magento sites. both sites are working fine after install, but one site i notice missing some features (the tab in edit category page and it's page)

Then i compare two databases and found there have some missing values on one site,

then i tried to disable extension, rename extension xml file and revert but it still not adding fields to database. it's hard to manually add those becoz it gone across few tables with foreign key relationships.

extension url https://github.com/EmicoEcommerce/Magento1Tweakwise

Here are the setup files

mysql4-upgrade-1.4.3-1.4.4.php

/**
 * @copyright (c) Emico 2014
 */
/** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Setup $installer */
$installer = $this;

$installer->startSetup();
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

$installer->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'tweakwise_template', [
    'type' => 'int',
    'label' => 'Tweakwise template',
    'input' => 'select',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => true,
    'required' => false,
    'source' => 'emico_tweakwise/system_config_source_template',
    'is_html_allowed_on_front' => false,
    'user_defined' => false,
    'default' => null,
]);
$installer->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'tweakwise_template', 100);

$installer->endSetup();

mysql4-upgrade-1.6.5-1.7.0.php

/**
 * @copyright (c) Emico 2014
 */
/** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Setup $installer */
$installer = $this;

$installer->startSetup();

$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, Emico_Tweakwise_Helper_Data::UPSELL_TEMPLATE_ATTRIBUTE, [
    'type' => 'int',
    'label' => 'Tweakwise upsell template',
    'input' => 'select',
    'source' => 'emico_tweakwise/system_config_source_recommendationProduct',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'default' => '',
    'searchable' => false,
    'filterable' => false,
    'comparable' => false,
    'visible_on_front' => false,
    'unique' => false,
]);

$installer->endSetup();

mysql4-upgrade-1.7.0-1.8.0.php

/**
 * @copyright (c) Emico 2014
 */
/** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Setup $installer */
$installer = $this;

$installer->startSetup();

$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, Emico_Tweakwise_Helper_Data::RELATED_TEMPLATE_ATTRIBUTE, [
    'type' => 'int',
    'label' => 'Tweakwise cross sell template',
    'input' => 'select',
    'source' => 'emico_tweakwise/system_config_source_recommendationProduct',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'default' => '',
    'searchable' => false,
    'filterable' => false,
    'comparable' => false,
    'visible_on_front' => false,
    'unique' => false,
]);

$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

$installer->addAttribute(Mage_Catalog_Model_Category::ENTITY, Emico_Tweakwise_Helper_Data::FEATURED_TEMPLATE_ATTRIBUTE, [
    'type' => 'int',
    'label' => 'Tweakwise featured product template',
    'input' => 'select',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => true,
    'required' => false,
    'source' => 'emico_tweakwise/system_config_source_recommendationFeatured',
    'is_html_allowed_on_front' => false,
    'user_defined' => false,
    'default' => null,
]);
$installer->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, Emico_Tweakwise_Helper_Data::FEATURED_TEMPLATE_ATTRIBUTE, 101);

$installer->endSetup();

mysql4-upgrade-1.10.5-1.10.6.php

  /**
     * @author : Edwin Jacobs, email: ejacobs@emico.nl.
     * @copyright : Copyright Emico B.V. 2017.
     */
    /** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Setup $installer */
    $installer = $this;
    $installer->startSetup();

    $setId = Mage::getSingleton('eav/config')->getEntityType('catalog_category')->getDefaultAttributeSetId();
    $categoryEntityType = Mage_Catalog_Model_Category::ENTITY;

    $tweakwiseGroupId = 'Tweakwise';
    //Add Tweakwise Attribute group
    $installer->addAttributeGroup(
        'catalog_category',
        $setId,
        $tweakwiseGroupId
    );

    $installer->addAttribute($categoryEntityType, Emico_Tweakwise_Helper_Data::UPSELL_TEMPLATE_ATTRIBUTE, [
        'type' => 'int',
        'label' => 'Tweakwise upsell template',
        'input' => 'select',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible' => true,
        'required' => false,
        'source' => 'emico_tweakwise/system_config_source_recommendationFeatured',
        'is_html_allowed_on_front' => false,
        'user_defined' => false,
        'default' => null,
    ]);

    $installer->addAttribute($categoryEntityType, Emico_Tweakwise_Helper_Data::RELATED_TEMPLATE_ATTRIBUTE, [
        'type' => 'int',
        'label' => 'Tweakwise cross sell template',
        'input' => 'select',
        'source' => 'emico_tweakwise/system_config_source_recommendationProduct',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible' => true,
        'required' => false,
        'user_defined' => false,
        'default' => null,
    ]);

    // Move existing tweakwise category attributes to new Tweakwise group
    $installer->addAttributeToGroup(
        $categoryEntityType,
        $setId,
        $tweakwiseGroupId,
        'tweakwise_template'
    );
    $installer->addAttributeToGroup(
        $categoryEntityType,
        $setId,
        $tweakwiseGroupId,
        'tweakwise_featured_template'
    );

    $installer->addAttributeToGroup(
        $categoryEntityType,
        $setId,
        $tweakwiseGroupId,
        Emico_Tweakwise_Helper_Data::UPSELL_TEMPLATE_ATTRIBUTE
    );

    $installer->addAttributeToGroup(
        $categoryEntityType,
        $setId,
        $tweakwiseGroupId,
        Emico_Tweakwise_Helper_Data::RELATED_TEMPLATE_ATTRIBUTE
    );




    $installer->endSetup();

is there anyway to run this one one install extension fields, the other options of extension is already works fine, just need to run this and show tab on category edit page

Was it helpful?

Solution

check in your setup folder any extra file is there like mysql4-upgrade-1.10.5-1.10.6-copy.php if so delete it and try to delete setup entry from core_resources and try again.

it may happen because of magento function it excludes using - from file name and when it found more than 2 array element it skips upgrade install for that particular module.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top