Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top