Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

direct linking to product from category
 
djdjoko
Jr. Member
 
Total Posts:  7
Joined:  2011-10-08
 

Hello all,
I have a magento store with three configurable products. I would like to create for each product a category. When clicking on each category I would like to show the product immediately. Currently when I click on the category all existing products are shown. Since I only have one product per category I would like to spare the users the clicking.
Is this linking somehow possible?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

If you don’t need the categories, why don’t you replace the default menu with one generated from products.
Here is a quick example.

<?php $collection
            
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
            ->
addUrlRewrite();
        
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
?>
<?php 
if ($collection->count()) : ?>
<ul>
<?php foreach ($collection as $product) : ?>
<li><a href="<?php echo $product->getProductUrl();?>"><?php echo $product->getName();?></a></li>
<?php endforeach;?>
</ul>
<?php endif;?>

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
djdjoko
Jr. Member
 
Total Posts:  7
Joined:  2011-10-08
 

Hello Marius,
thank you for you quick reply. I am a complete magento beginner. Could you just tell me to which file to add it?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
djdjoko
Jr. Member
 
Total Posts:  7
Joined:  2011-10-08
 

The other thing I realized is that in the future I will have a standard category with multiple products. So just linking one category name directly to the product would be the best solution (if possible)

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

If you plan to have categories with products also then this approach is not good.
But just in case you can add this to app/design/frontend/{interface}/{theme}/template/catalog/navigation/top.phtml

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