Interesting question. With default Magento, you can't. But there are ways. I'd recommend creating an extension that listens to the catalog_product_save_before event in the adminhtml scope.
Create the file app/etc/modules/Your_Module.xml
with the following content;
<?xml version="1.0"?>
<config>
<modules>
<Your_Module>
<active>true</active>
<codePool>local</codePool>
</Your_Module>
</modules>
</config>
Next up, app/code/local/Your/Module/etc/config.xml
, where we declare the event to listen for and which method to execute;
<?xml version="1.0"?>
<config>
<modules>
<Your_Module>
<version>0.1.0</version>
</Your_Module>
</modules>
<adminhtml>
<events>
<catalog_product_load_after>
<observers>
<your_module>
<class>Your_Module_Model_Observer</class>
<method>setDefaultWeightValue</method>
</your_module>
</observers>
</catalog_product_load_after>
</events>
</adminhtml>
<global>
<models>
<your_module>
<class>Your_Module_Model</class>
</your_module>
</models>
</global>
</config>
And finally, app/code/local/Your/Module/Model/Observer.php
, where we set the predefined weights for the different attribute set IDs and where we assign the value to the product currently opened;
<?php
class Your_Module_Model_Observer {
// This is the default value you would like to use
const DEFAULT_WEIGHT = 50;
// Change this if you have set a default value on the attribute other than empty
const DEFAULT_WEIGHT_SETTING_MAGENTO = '0.0000';
public function setDefaultWeightValue($observer) {
$_product = $observer->getProduct();
if($_product->getWeight() == self::DEFAULT_WEIGHT_SETTING_MAGENTO) {
$_product->setWeight(
$this->getWeightsPerAttributeSet($_product->getAttributeSetId())
);
}
}
public function getWeightsPerAttributeSet($attributeSetId) {
$weightsPerAttribuetSet = array(
4 => 100,
5 => 200,
6 => 300
);
if(isset($weightsPerAttribuetSet[$attributeSetId])) {
return $weightsPerAttribuetSet[$attributeSetId];
} else {
return self::DEFAULT_WEIGHT;
}
}
}
This will only work for existing products, since new products aren't loaded and thus won't fire the event.