00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 $installer = $this;
00028
00029
00030 $installer->startSetup();
00031
00032 $applyTo = split(',', $installer->getAttribute('catalog_product', 'weight', 'apply_to'));
00033 if (in_array('downloadable', $applyTo)) {
00034 $newApplyTo = array();
00035 foreach ($applyTo as $key=>$value) {
00036 if ($value != 'downloadable') {
00037 $newApplyTo[] = $value;
00038 }
00039 }
00040 $installer->updateAttribute('catalog_product', 'weight', 'apply_to', join(',', $newApplyTo));
00041 } else {
00042 $installer->updateAttribute('catalog_product', 'weight', 'apply_to', join(',', $applyTo));
00043 }
00044
00045
00046 $attributeId = $installer->getAttributeId('catalog_product', 'weight');
00047 $installer->run("
00048 DELETE FROM {$installer->getTable('catalog_product_entity_decimal')}
00049 WHERE (entity_id in (
00050 SELECT entity_id FROM {$installer->getTable('catalog/product')} WHERE type_id = 'downloadable'
00051 )) and attribute_id = {$attributeId}
00052 ");
00053
00054 $installer->endSetup();