I have configurable products with 3 super attributes, but now I need only one super attribute, the other two (that has only one option each one) now have to be simple attributes with the value of the only option they have.

**Now:** *super attributes:* size (multiple options), color (only one option), fit (only one option)

**Need:** *super attributes:* size (multiple options) - *simple attributes:* color (for example: 'red'), fit (for example: 'slim')

I'm trying this way:

    $_configurableProducts = Mage::getModel('catalog/product')
            ->getCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('type_id', array('eq' => 'configurable'));
    
    foreach ($_configurableProducts as $key_number => $_product) {
        $productAttributeOptions = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);

				$attributeOptions = array();

				foreach ($productAttributeOptions as $productAttribute) {
				    foreach ($productAttribute['values'] as $attribute) {
				        $attributeOptions[$productAttribute['label']][$attribute['value_index']] = $attribute['store_label'];
				    }
				}

                $attributeOptions = $attributeOptions['Color'];

				$color = array_values($attributeOptions)[0];
				$color_group = $_product->getColorGroup();

				//Get product attributes
				$usedProductAttributeIds = $_product->getTypeInstance()->getUsedProductAttributeIds();
				$configurableAttributesData = $_product->getTypeInstance()->getConfigurableAttributesAsArray();
				$fitValue;

                //Remove Colors and fit from configurable attributes
				for ($i=0; $i <= count($configurableAttributesData); $i++) {

					if ($configurableAttributesData[$i]['label']=='Fit') {
						$fitValue = $configurableAttributesData[$i]['values'][0]['label'];
						unset($configurableAttributesData[$i]);
					}

					if ($configurableAttributesData[$i]['label']=='Color') {
						unset($configurableAttributesData[$i]);
					}
					
				}

				$_product->setCanSaveConfigurableAttributes(true);
				$_product->getTypeInstance()->setUsedProductAttributeIds(array(134));
		        $_product->setConfigurableAttributesData($configurableAttributesData);

		        $_product->setColor($color)
						 ->setFit($fitValue)
						 ->setColorGroup($color_group)
						 ->save();
    }

But after this code color and fit remain as super attributes.

I tried also:

    $sql1 = "DELETE FROM catalog_product_super_attribute WHERE attribute_id = 92;";
    $sql2 = "DELETE FROM catalog_product_super_attribute WHERE attribute_id = 135;";

    $conn->query($sql1);
    $conn->query($sql2);

This way I have size as the only superattribute, but color and fit have no value.