I just recently encountered a problem when adding a new Option Values (to an Option Name). Here is the error message I receive:

1062 Duplicate entry '0' for key 1
in:
[insert into products_options_values_to_products_options (products_options_id, products_options_values_id) values ('5', '208')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

And to answer some of the questions pertinent to any bug report:

* What version of Zen Cart are you using?
ANSWER: 1.3.9a

* Has your site been upgraded? When? From what version(s)?
ANSWER: No, new install (for testing)

* What addons have you installed? When?
ANSWER:
1 - Recover_Cart_Sales
2 - Encrypted_Master_Password_1.2
3 - Stock_by_Attributes
4 - Dynamic_DropDowns_for_SBA
5 - Super_Orders_20_rev48
6 - PDF_Order_Center_v1.2.1

* In what ways is your site customized or different from a brand new uncustomized install?
ANSWER: basically just a re-skin (aka templating)

Here is what I've done to FIX the problem:

MySQL myPHPadmin FIX #1 (for immediate resolution): I re-ran the SQL Insert with this:

insert into products_options_values_to_products_options (products_options_values_to_products_options_id, products_options_id, products_options_values_id) values ('208', '5', '208');

options_values_manager.php FIX #2 (a more permanent fix!):

// Start FIX: Fix for Inserts when adding new Option Values:
// Here is the Original code:
// $db->Execute("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . "
// (products_options_id, products_options_values_id)
// values ('" . (int)$option_id . "', '" . (int)$value_id . "')");
// Here is the Modified Code:
$db->Execute("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . "
(products_options_values_to_products_options_id, products_options_id, products_options_values_id)
values ('" . (int)$value_id . "', '" . (int)$option_id . "', '" . (int)$value_id . "')");
// End FIX

COMMENTS: I don't think that the table "products_options_values_to_products_options" has AUTO-INCREMENT set for the field "products_options_values_to_products_options_id". Either AUTO-INCREMENT should be set or the code is modified as suggested above.

Kind regards,

Chris Lemke
(aka Mega Moonshine)