Question

I'd like to create a popup window for products instead of directing to another page. I'm looking for advice on the best way to basically make a copy of the product view template to modify for my needs without having to create separate models and blocks. I'm using version 1.3.2.2. Let me know if anything needs clarification.

I realize there are modules that do this, but I'd like to do it myself. Partly for learning.

Was it helpful?

Solution

As a general approach, you could use Javascript to change the product page links to open in a popup (not clear if you mean an AJAX layer or a "real" popup, which many users' browsers will block). Then, modify the layout XML files to add or remove any blocks that you need.

If you want to have both the normal page and a hovered 'layer', then create a new controller and have it inherit from the catalog view layout (IIRC, $this->loadLayout('catalog_product_view') should do it). Then, once again, change layouts for your layout tag to add and remove as necessary.

OTHER TIPS

Joseph's answer wasn't quite clear to me, but this is what I did. I created a new module for the popup with a new controller that extended the ProductController. I made a copy of the viewAction and renamed it to popupAction in my new controller.

Then I made a copy of the catalog.xml and renamed it according to my module. Then deleted everyting not pertaining to the product view page. I made a copy of the view template and set that as the template in my xml layout. Then I made the necessary changes within either the xml layout or the new view template.

I couldn't get $this->loadLayout('catalog_product_view') to work for me.

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