There is a way to add specific attributes to a Custom product type via install script like this:

$fieldList = array(

// make these attributes applicable to products of Custom Product type
foreach ($fieldList as $field) {
    $applyTo = explode(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
    if (!in_array('coreproduct', $applyTo)) {
        $applyTo[] = 'customroduct';
        $installer->updateAttribute('catalog_product', $field, 'apply_to', join(',', $applyTo));

Is there a way to apply ALL attributes of, let's say, Simple product (with all created and custom attributes and tabs, not known at the moment of extension installation) via install script to Custom product type? My guess would be something with LIKE statement for 'apply_to' field.

2 Answers 2


To add a attribute to a product type you need to use apply_to.

// Get the current apply_to settings for your attribute
$applyTo = explode(',', $installer->getAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to'));
// If the attribute is not already assigned to your product type
if (!in_array('your_custom_product_type', $applyTo)) {
    // Update apply_to to include your new type
    $applyTo[] = 'your_custom_product_type';
    $installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));

could be like this:

//Get the 'Default' attribute set id
$attributeSets = Mage::getSingleton('catalog/product_attribute_set_api')->items();
foreach ($attributeSets as $set) {
    if ($set['name'] == 'Default') {
        $defaultSetId = $set['set_id'];

//Get the attributes to the 'Default' attribute set
$attributes = Mage::getSingleton('catalog/product_attribute_api')->items($defaultSetId);
$fieldList = array();
foreach($attributes as $attribute){
    $fieldList[] = $attribute['code'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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