How to show configurable product with preselected options if requested url is for simple product?
For example:
Simple product #1 has:
Color: Red
URL: /simple-red.html
Simple product #2 has:
Color: Green
URL: /simple-green.html
Configurable product has:
URL: /config.html
If user visits /simple-red.html
it should be loaded configurable product with pre-selected option Color: Red
If user visits /simple-green.html
it should be loaded configurable product with pre-selected option Color: Green
Successfully solved the problem:
Extended
ProductController
, to replace product id of simple product by product id of parent configurable product. Used SO Answer:Magento Catalog ProductController rewrite
Code in custom
ProductController
:PreSelect configurable product options depending on simple product. Used link to tutorial given by Vishal Sharma
Result (sorry can't post images): Screenshot