Programmatically update product price per website in Magento

If you want to programmatically update product prices per website (this means that you have many websites and have set a website scope for price in the configuration), then you can use this script: public function updateProductPrices ($sku, $newPrice) { Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $websites = Mage::app()->getWebsites(); $product = Mage::getModel(‘catalog/product’) $productId = $product->getIdBySku($sku); Read more…

Programmatically create order statuses in Magento

If you want to create new order statuses (not states) and assign them to a particular state you need to use the sales/order_status model. It’s pretty easy: $status = Mage::getModel(‘sales/order_status’); $status->setStatus(‘status_code’); $status->setLabel(‘status_label’); Then you can assign the state with the assignState method: $status->assignState(‘processing’); $status->save();