tags:

views:

53

answers:

2

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.

A: 

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.

Joseph Mastey
I can handle making of the actual pop-up. I was wondering how to create a separate product view layout so I can have like you said a normal page and hover layer. I'm not sure what you mean by change layouts for my layout tag. Would I have to create a new module with a new controller, layout xml, template? I guess the part i'm having trouble with, is that I've made a module before, but the layout and template were all from scratch. So I'm not clear on how to do it based on one that is already there.
dardub
A: 

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.

dardub