Hi all,

This thread is the following of a discussions about module improvement and port to 6.x.

Actually, in uc_discounts_conditions_table() and uc_discounts_actions_table(), we have 2 callback that should not be there IMHO :

in uc_discounts_conditions_table()

    // get product type
    if (isset($condition_info[$condition->property]['product_class_callback'])) {
      $product_class_callback = $condition_info[$condition->property]['product_class_callback'];
      $class = $product_class_callback($condition->item_id);
    }
    else {
      $class = '';
    }

in uc_discounts_actions_table()

    // get class name
    if (isset($action_info[$action->property]['product_class_callback'])) {
      $class_name_callback = $action_info[$action->property]['product_class_callback'];
      $class = $class_name_callback($action->item_id);
    }
    else {
      $class = $action->item_id;
    }

Indeed, these callback are related to one submodule : uc_discounts_product_class.module. The core module should not have specific functions related to only one submodules. There is already a function dedicated to return items id from the database to items name, it's 'item_name_callback'. Submodules should use that and only that to convert an idea into name. If it's not possible, it means that the function is not extensible enought, but do not add some specific callback that apply to only one module.

So my advice is to remove this callback and modify the uc_discounts_product_class.module file to make it via the item name callback.