Each time the adjustments form is submitted, new entries are created in the uc_dependent_attributes table even if identical entries already exist, thus creating duplicate entries.

Changing uc_dependent_attributes.module from:

    db_query("UPDATE {uc_dependent_attributes} SET enabled = 0 WHERE nid = %d AND combination = '%s'", $form_state['values']['nid'], $value['combo_array']);
      if (!db_affected_rows()) {
        db_query("INSERT INTO {uc_dependent_attributes} (nid, combination, enabled) VALUES (%d, '%s', 0)", $form_state['values']['nid'], $value['combo_array']);
      }

to :

        db_query("DELETE FROM {uc_dependent_attributes} WHERE nid = %d AND combination = '%s'", $form_state['values']['nid'], $value['combo_array']);
        db_query("INSERT INTO {uc_dependent_attributes} (nid, combination, enabled) VALUES (%d, '%s', 0)", $form_state['values']['nid'], $value['combo_array']);

Solves the issue.

CommentFileSizeAuthor
uc_dependent_attributes.patch1.05 KBcybis

Comments

summit’s picture

Hi, is this patch committed already?
greetings, Martijn

cybis’s picture

No.