*************** *** 1074,1080 **** $old_vals[] = $obj; } - $result = pager_query($query_select . $query_from . $query_where . $query_order, 20, 0, NULL, $values); $form['original'] = array( '#value' => '

'. t('Default product SKU: @sku', array('@sku' => $model)) .'
', --- 1058,1091 ---- $old_vals[] = $obj; } + $combinations = array(); + $i=1; + foreach ($attribute_ids as $aid){ + $attribute_options = array(); + $result = db_query("SELECT DISTINCT ao.aid AS aid, ao.name AS name, ao.oid AS oid, po.ordering FROM {uc_product_options} AS po LEFT JOIN {uc_attribute_options} AS ao ON po.oid = ao.oid WHERE po.nid = %d AND ao.aid = %d ORDER BY po.ordering ASC",$nid, $aid); + while ($a_o_combo = db_fetch_array($result)){ + $attribute_options[] = array('aid' . $i => $a_o_combo['aid'], 'name' . $i => $a_o_combo['name'], 'oid' . $i => $a_o_combo['oid'], 'ordering' . $i => $a_o_combo['ordering']); + } + $i++; + //First time through, no combinations + if (empty($combinations)){ + $combinations = $attribute_options; + } else { + $bigger_combo= array(); + foreach ($combinations as $existing_combo){ + foreach ($attribute_options as $retrieved_combo){ + $bigger_combo[] = array_merge($existing_combo, $retrieved_combo); + } + } + $combinations = $bigger_combo; + } + + } + + //Pass the combinations into a 'array pager' - this mimics the pager functions without pager_query + //The hardcoded 0 in this function call will cause issues if there's more than one pager on the page.. + //but that was the previous behaviour + $combinations = _uc_attribute_array_pager($combinations, 20, 0, NULL); $form['original'] = array( '#value' => '

'. t('Default product SKU: @sku', array('@sku' => $model)) .'
', *************** *** 1089,1095 **** $form['table']['head'] = array( '#prefix' => '', '#suffix' => '', - '#value' => $attribute_names .''. t('Alternate SKU') .'', '#weight' => 0, ); $form['table']['body'] = array( --- 1100,1106 ---- $form['table']['head'] = array( '#prefix' => '', '#suffix' => '', + '#value' => $attribute_names .'Alternate SKU', '#weight' => 0, ); $form['table']['body'] = array(