default state of custom option for simple products
I don't know if recommending an extension counts as a valid answer (for a question with a bounty) but someone claims here that he wrote an extension that does exactly what you need. Extension can be downloaded from here. I haven't tested it but, as soon as I do, I will post and update. I only looked through the code and there is a lot of it. I lost interest after 2 files. I hope it works for you.
[EDIT]
I've got my interest back. I tested the extension on ce-1.7.0.2 and it (almost) works.
If you use it with developer mode on you will get some errors. Here is what you need to change to make it work.
in /app/code/local/Magebuzz/Customoption/controllers/Adminhtml/CustomoptionController.php
on line 28 there is this:
$model->setData('value['.$option_id.']',$value[0]['option_type_id']);
This shows an 'undefined index' warning. To avoid it, wrap it in an if
statement.
if (isset($value[0])){
$model->setData('value['.$option_id.']',$value[0]['option_type_id']);
}
In /app/code/local/Magebuzz/Customoption/Block/Adminhtml/Customoption/Edit/Tab/Form.php
on line 129 there is this:
foreach ($values as $value) {
$valuesArr[$value['option_type_id']]=$value['title'];
}
$values
may be null so change the code to this:
if (is_array($values)){
foreach ($values as $value) {
$valuesArr[$value['option_type_id']]=$value['title'];
}
}
Now it should work.
Now some review.
- PRO. Works perfectly for dropdown and radio custom options
- Neurtal. Kind of works for multiple select and checkbox custom options. You can select only one value for the available values.
- Inconvenient but I can overlook it. in order to set the default values you have to click on an other menu item in the backend and look for your product in the list.
- Con. It doesn't work for text, textarea, date, datetime, time, file custom options. But with a little work it can be changed to work correctly for all types (maybe except file).