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