Still applies on 1.6. The

qrios's picture
Offline
Cool profile pic award.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 554
Still applies on 1.6. The

Still applies on 1.6.

The SKU's are loaded from uc_product_adjustments table.
The weights are stored in uc_product_options table.

So, I want this...:

function uc_stock_skus($nid) {
  $node = node_load($nid);

  if (is_null($node->model)) {
    return FALSE;
  }

  $skus = array($node->model);

  if (module_exists('uc_attribute')) {
    $models = db_query("SELECT model FROM {uc_product_adjustments} WHERE nid = %d", $node->nid);
    while ($model = db_fetch_object($models)) {
      if (!in_array($model->model, $skus)) {
        $skus[] = $model->model;
      }
    }
  }

  return $skus;
}

...to return the array sorted by the "weight" column of the uc_product_options table.

It's very strange to have the options displayed in the order of inserting, not in the order of option weights.

uc_stock_skus does not use option weights By: qrios (4 replies) Wed, 09/17/2008 - 14:54