Update Product Inventory Programmatically in Magento

sing our Magento product grid extension or Magento bulk product editing extension can make it easy to update product information. However, sometimes you need ultimate flexibility that is only possible with a script. If you need to update product inventory programmatically you can use the following: $productId = 169; $stockItem = Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($productId); if ($stockItem->getId() > … Read more

Fixing Magento “Service Temporarily Unavailable” error

ometimes Magento will display a “Service Temporarily Unavailable” message. The message will look like the following: The most common cause of this issue is a file located at [Magento root]/maintenance.flag. If this file exists, then Magento will display this message. The purpose of the file is to put the store into maintenance mode when doing … Read more

Direct SQL Queries in Magento

agento includes a database abstraction layer and object relationship manager that is really great at ensuring data integrity and consistent data access. In general, you should avoid writing to the database and instead use a well-written Magento extension that performs the task for you. However, sometimes a direct query needs to be made whether for … Read more