Open JanWGK opened 6 years ago
Weird! It seems that https://github.com/customgento/CustomGento_ConfigurableTierPrices/blob/da78d7ff28d480840cad386752ff39510bd82375/app/code/community/CustomGento/ConfigurableTierPrices/sql/customgento_configurabletierprices_setup/upgrade-2.0.0-2.1.0.php#L11 is an issue for you. Never heard of that before. Usually, this should work. Did you rename / delete / re-create the General attribute group?
As a quick fix, remove the line and run the setup scripts. Afterwards, add the attribute to each attribute set manually.
Thanks for the fix, that worked. I do not know of somebody changing the general attribute group, but the database has a long history and I noticed that there are several duplicates of system attribute groups in the table...
For your info, I just installed another module which is adding an attribute to all attribute sets without any issues like this:
<?php
$installer = new Mage_Eav_Model_Entity_Setup($this->_resourceName);
$installer->startSetup();
$installer->addAttribute('catalog_product', 'simple_price', array(
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Use price of simple products',
'note' => 'If set to "Yes", full price of associated products of configurables is used for calculations and front end display instead of price difference.',
'input' => 'select',
'class' => '',
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'apply_to' => 'configurable',
'is_configurable' => false,
// 'group' => 'General',
));
$attributeId = $installer->getAttributeId('catalog_product', 'simple_price');
foreach ($installer->getAllAttributeSetIds('catalog_product') as $attributeSetId)
{
try {
$attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, 'General');
} catch (Exception $e) {
$attributeGroupId = $installer->getDefaultAttributeGroupId('catalog_product', $attributeSetId);
}
$installer->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
}
$installer->endSetup();
It may be a good idea to add the attribute like this. I will reopen this, so that I can check this in more detail at some time. Thanks for the report!
Hi Simon,
the module installs without any errors and seems to work, but if I run the setup script manually via n98-magerun I am getting the following error:
Error in file: "/htdocs/app/code/community/CustomGento/ConfigurableTierPrices/sql/customgento_configurabletierprices_setup/upgrade-2.0.0-2.1.0.php" - SQLSTATE[2300 0]: Integrity constraint violation: 1062 Duplicate entry '9-General' for key 'UNQ_EAV_ATTRIBUTE_GROUP_ATTRIBUTE_SET_ID_ATTRIBUTE_GROUP_NAME', query was: INSERT INTO
eav_attribute_group
(a ttribute_set_id
,attribute_group_name
,default_id
,sort_order
) VALUES (?, ?, ?, ?)The same error appears, if I try to clear the cache via Magento admin.
Any ideas?