So I’ve been looking for a way to change the Stock Availability back to In Stock when the quantity field is greater than 0. The system already automatically changes the Stoc
Just create cron job with that code snippet:
public function setBackInStock()
{
$collection = Mage::getResourceModel('cataloginventory/stock_item_collection');
$outQty = Mage::getStoreConfig('cataloginventory/item/options_min_qty');
$collection->addFieldToFilter('qty', array('gt' => $outQty));
$collection->addFieldToFilter('is_in_stock', 0);
foreach($collection as $item) {
$item->setData('is_in_stock', 1);
}
$collection->save();
}
Small note, you can set cron job for every minute, because if there are no results job won't be consuming time/resources