A$products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToSort('position', 'ASC'); ->load();
B$products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addOrder('position', 'ASC'); ->load();
Cfunction cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->load(); usort($products, "cmp");
Dfunction mySortByPosition($a, $b) { if ($a['position'] == $b['position']) { return 0; } return ($a['position'] < $b['position']) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addSorter(mySortByPosition) ->load();