Modification: Core Controller
I am trying to find a way to redirect the url for a simple product to go to the corresponding configurable product. For example if I have a link to a small blue t-shirt, it would go to the main t-shirt page where the attributes are available to select.
You will need to modify the ProductController to make it look for a configurable product and display it when someone asks for a simple product.
The file you need to modify is /app/code/core/Mage/Catalog/controllers/ProductController and the method name is _initProduct().
Find the code which retrieves the product to be displayed:
$product = Mage::getModel(‘catalog/product’)
And add this code after it:
That’s it, simple and elegant.