Magento Forum

   
Custom Category View
 
WorldWideDev
Jr. Member
 
Total Posts:  17
Joined:  2008-09-30
 

First off excuse me for being a newbie, Im trying but am I end with this code trying to get it to work like I need to.

/catalog/category/view.phtml

I have this art of code at beginning.

<?php
    $_helper           
$this->helper('catalog/output');
    
$_category         $this->getCurrentCategory();
    
$_categoryParentId $_category->getParentId();
    
$_rootCategoryId   = (int) Mage::app()->getStore()->getRootCategoryId();
    
$_video            $_category->getCategoryVideo();
    
$_description      $_category->getDescription();
    
//Merging arrays to make it work on both - local machines and server
    
$_filterState      array_merge(Mage::getSingleton('catalog/layer')->getState()->getFilters(),
                            
Mage::getSingleton('enterprise_search/catalog_layer')->getState()->getFilters());

    
$_imgHtml   '';
    if (
$_imgUrl $_category->getImageUrl()) {
        $_imgHtml 
'<div class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></div>';
        
$_imgHtml $_helper->categoryAttribute($_category$_imgHtml'image');
    
}

    $_listHtml 
'';

    if(!
$this->isContentMode()) {
        
if ($_rootCategoryId == $_categoryParentId && !(sizeof($_filterState))) {
            $_listHtml 
$this->getChildHtml('subcategory.list');
        
else {
            $_listHtml 
$this->getProductListHtml();
        
}
    }
?>

This allow when a user click on main navigation they land on main category page which has sub categories, (I did not originally code this)
This works fine like this, the sub category images are displayed. then when they click into sub category that shows products.

What I am trying to figure out or if possible, can there be an IF statement here to say for example, if the main category has products to show the products and not the sub categories?

when I try this as with the code above, I get blank category page even though there is products assigned, the layered navigation on left works, I can click an option then products get displayed.

any help would be appreciated it. Please let me know if you need any additional info.

Thanks

Craig

 
Magento Community Magento Community
Magento Community
Magento Community
 
WorldWideDev
Jr. Member
 
Total Posts:  17
Joined:  2008-09-30
 

bump, no one out there wanna try to help on this issue?

c’mon.. surely its not that complicated

 
Magento Community Magento Community
Magento Community
Magento Community
 
WorldWideDev
Jr. Member
 
Total Posts:  17
Joined:  2008-09-30
 

Trying one last time to see if anyone could help out on this issue or even take a look and make suggestions..

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  638
Joined:  2009-08-22
 

In fact, Magento search is not perfect. Very often a user doesn’t find what he was looking for and leaves the store. Good decision is to integrate the Sphinx search engine. It greatly improves the quality and relevance of search results. Look at http://mirasvit.com/magento-extensions/magento-advanced-search-for-shared-hosting.html

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