Where in Mage Core is a product's status set?

I'm trying to extend the core to change how magento sets the status on products. Essentially, when an admin user tries to change the status of a product to disabled, I want it to check to see if the product is in stock in their EPOS system, and if it is, throw an error.

To do this, I was going to extend the model where the product status is set and rewrite that function. The problem is, I can't find this anywhere. There is nothing in magento_core_model_product. I found a function in mage_catalog_model_product_status called updateProductStatus, but this doesn't seem right either.

Does anybody know where I need to be looking to find this function?

Answers


After a bit of research, I found that Magento generates all the getters and setters pragmatically, through extensive use of the __call() function, which is called when a function that isn't defined is called.

To modify functionality of a getter or setter, simply define the function you want to modify in your rewrite of the class, and this will be called before the __call(), essentially rewriting the default functionality, in a roundabout way.


Need Your Help

Asp.Net MVC 2 - Bind a model's property to a different named value

c# asp.net-mvc asp.net-mvc-2

Update (30th April 2012) - Note to people stumbling across this question from searches etc - the accepted answer is not how I ended up doing this - but I left it accepted because it might have work...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.