function inStock($skus){ if ($skus->getSize()) { $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('sku', array('in' => $skus)); foreach ($collection as $product) { $quantity = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty(); if ($quantity < $sku->getRequiredQuantity()) { return false; } } } else { return false; } return true; }