Magento Forum

customize category view to product view
 
Webkrebse
Member
 
Avatar
Total Posts:  40
Joined:  2009-02-15
Germany
 

Hi,

I want to replace the category view by the product view of the first product of that category. How do I manage to do this:

First way: (Using CMS)

I created a static block which displays a product view.

{{block type="catalog/product_view" product_id="200" template="catalog/product/view.phtml"}}

How do I get the productId of the first product of the category displaying this static block? Besides this, it does not work at all.

Second way: (Using Layouts)

I tried to display the product view template instead of the category view template in catalog.xml. I assume I need to customize the section “category default layout”. But I had the same problems. See First way.

Third way: (Using Templates)

Implementing and integrating an alternative category view template. I would like to reuse the product view template within that template. What is the easiest way to introduce an alternative template.

Any ideas?

--- Thank you very much ---

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sonja
Jr. Member
 
Total Posts:  8
Joined:  2009-03-15
 

I am looking for this, too. It seems like nobody can help. Maybe this is actually a case for a feature request.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webkrebse
Member
 
Avatar
Total Posts:  40
Joined:  2009-02-15
Germany
 

I posted the request in board Feature request. Please follow post customize category view to product view

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webkrebse
Member
 
Avatar
Total Posts:  40
Joined:  2009-02-15
Germany
 

We solved the problem!

We use the header instruction to branch from the category view to the product view. I do not like this solution very much. But it works.

This is the code of the third if branch in template/catalog/category/view.phtml

<?php $_category=$this->getCurrentCategory() ?>
<?php $_products
=$_category->getProductCollection() ?>
<?php 
foreach ($_category->getProductCollection() as $_product): ?>
    <?php $location 
"Location: ".$_product->getProductUrl(); ?>
       <?php header
($location); exit; ?>
<?php 
endforeach ?>

I would appreciate a more elegant solution to this problem

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top