Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is location of getChildHTML('content') for custom category pages in magento?

I have a client who has a magento site that loads custom category pages and on one of them $this->getChildHTML('content') is dumping out a bunch of code after it loads the page. it's only on one page and it looks like its dumping out php closing tags.

getCurrentCategory()?> getCurrentChildCategories()?> count()):?> getIsActive()): $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); $layer = Mage::getSingleton('catalog/layer'); $layer->setCurrentCategory($cur_category); $catName = $this->getCurrentCategory()->getName(); if($_imageUrl=!$this->getCurrentCategory()->getImageUrl()):?>


getCurrentCategory()->getImageUrl()):?>

getName()?>

setCurrentCategory($_maincategorylisting); ?>

I can't seem to find the page that has the error on it. I don't know where 'content' in getChildHTML is located. the category pages were made custom, and doesn't show any products, just an image of one of the products. i'd like to change these pages to show products and a whole bunch of other stuff, but i just don't know where these custom category pages reside. there are custom templates for each category, but they all use the same getChildHTML('content') call...

i tried downloading the whole site and doing a text search for bits of code on the category page, but found nothing. please help!

btw....if you could already tell, im new to magento and probably left a lot of important info out, so if you think i need to post more info, please say so.

thanks in advance!

like image 386
afxjzs Avatar asked Mar 05 '12 03:03

afxjzs


2 Answers

"content" is the name given to a block which is defined in page.xml as a core/text_list (Mage_Core_Block_Text_List) block. The purpose of this block is to echo any child blocks assigned to it, and it does this without a template. Any layout file as well as layout updates in the database (see any category's Design tab) can contain instructions which are included on category pages and modify the children of this block.

See Alan Storm's knowledgebase article on MagentoCommerce.com and eventually graduate to his exhaustive book No Frills Magento Layout.

For general information you are in good company at Stack Overflow, and you can also rely on Magento U as a resource.

like image 183
benmarks Avatar answered Nov 15 '22 06:11

benmarks


That depends on the theme, any extensions, and other custom code. Typically, getChildHTML('content') loads the "content" handler for the current layout. This could either be directly in catalog.xml, local.xml, or if it's an extension override, the extension's xml. It could also be a layout update in the Category itself on the backend.

Use Magento's debugging tools to output each block and their location from the Admin:

System -> Configuration Change 'Current Configuration Scope' to the website view Advanced / Developer Debug panel: 'Template Path Hints' and 'Add Block Names to Hints'.

You can also add your IP address to the 'Developer Client Restrictions' section above it to limit this output to just your own IP. Once you save it, you'll see a lot of red-outlines. View your broken category page and find the filename that wraps around the broken code.

like image 36
Morgon Avatar answered Nov 15 '22 06:11

Morgon