0

I've having issue when creating a new attribute set based on the existing one.

When you try to do this, it creates the new set but fails to bring over the attributes - it’s as if you simply created a blank set.

I'm trying hard looking into many database tables and class but can't find the actual problem.

any one has any experience in this issue, Please help

Thanks

1

Create new product attribute set script

$newSetName = 'Apple';
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$attributeSetID = Mage::getModel('catalog/product')->getDefaultAttributeSetId();
$installer->startSetup();
$entityTypeId = (int) $installer->getEntityTypeId('catalog_product');

$attributeSet = Mage::getModel('eav/entity_attribute_set')
    ->setEntityTypeId($entityTypeId)
    ->setAttributeSetName($newSetName);

if ($attributeSet->validate()) {
     $attributeSet->save()
     ->initFromSkeleton($attributeSetID)
     ->save();
}
else {
    die('Attributeset with name ' . $newSetName . ' already exists.');
}

$installer->endSetup();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.