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

products on mainpage
 
papricek
Jr. Member
 
Total Posts:  19
Joined:  2007-11-19
 

Hi, having trouble with listing all products at mainpage. Probably not completely “in” the magento blocks and templates system…
The technique described here: http://www.magentocommerce.com/boards/viewthread/801 simply doesn`t work. I add this to app/design/frontend/default/default/layout/main.xml

<block type="catalog/category_view" name="category.products">
 <
action method="setTemplate"><template>catalog/category/homepage_view.phtml</template></action>
</
block>
, I add this to app/design/frontend/default/default/template/catalog/category/homepage_view.phtml

<div id="leftcontent">
        <
h2><?=$this->getCurrentCategory()->getName()?></h2>
        
<?if($_description=$this->getCurrentCategory()->getDescription()):?>
            
<p><?=$_description?></p>
        
<?endif;?>
    
</div>
    <
div id="centercontent">
        
<?if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
            
<img src="<?=$_imageUrl?>alt="<?=$this->getCurrentCategory()->getName()?>" />
        
<?endif;?>
    
</div>

and modified app\code\core\Mage\Catalog\Block\Category\View.php

public function getCurrentCategory()
    
{
        $_currentCategory 
Mage::registry('current_category');
        
        
//START  EDIT
        
if (isset($_currentCategory)){
            
return Mage::registry('current_category');
        
else 
            $categoryId 
Mage::getSingleton('core/store')->getConfig('catalog/category/root_id');
            
$category Mage::getModel('catalog/category')->load($categoryId);
            
Mage::register('current_category'$category);
            
            return 
Mage::registry('current_category');
        
}
        
//END EDIT
    
}

That is all I’ve done, and nothing shows… The url to my shop is http://www.fsas.cz ... What am I doing wrong?

Thanks…

 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Where did you add the block in main.xml ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
papricek
Jr. Member
 
Total Posts:  19
Joined:  2007-11-19
 

<block type="core/text_list" name="content" as="content"/>
            <
block type="catalog/category_view" name="category.products">
            <
action method="setTemplate"><template>catalog/category/homepage_view.phtml</template></action>
            </
block>
 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Hmm…

 
Magento Community Magento Community
Magento Community
Magento Community
 
papricek
Jr. Member
 
Total Posts:  19
Joined:  2007-11-19
 

I have no idea what is wrong and what else should I do…

 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

It seems allright to me, have you tried echoing/verdumping certain vars to see where it goes wrong? Does it ever reach the getCurrentCategory function?

 
Magento Community Magento Community
Magento Community
Magento Community
 
papricek
Jr. Member
 
Total Posts:  19
Joined:  2007-11-19
 

now it gives me this error:

Notice: Undefined variable: path in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Catalog/Helper/Data.php on line 60
[0] in Mage_Catalog_Helper_Data->getBreadcrumbPath(NULL) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Catalog/Block/Breadcrumbs.php on line 38
[1] in Mage_Catalog_Block_Breadcrumbs->_prepareLayout() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Block/Abstract.php on line 185
[2] in Mage_Core_Block_Abstract->setLayout(Mage_Core_Model_Layout) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 325
[3] in Mage_Core_Model_Layout->createBlock("catalog/breadcrumbs") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Catalog/Block/Category/View.php on line 33
[4] in Mage_Catalog_Block_Category_View->_prepareLayout() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Block/Abstract.php on line 185
[5] in Mage_Core_Block_Abstract->setLayout(Mage_Core_Model_Layout) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 349
[6] in Mage_Core_Model_Layout->addBlock("Mage_Catalog_Block_Category_View", “category.products") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 189
[7] in Mage_Core_Model_Layout->_generateBlock(Mage_Core_Model_Layout_Element, Mage_Core_Model_Layout_Element) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 158
[8] in Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 159
[9] in Mage_Core_Model_Layout->generateBlocks() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Action.php on line 270
[10] in Mage_Core_Controller_Varien_Action->generateLayoutBlocks() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Cms/Helper/Page.php on line 52
[11] in Mage_Cms_Helper_Page->renderPage(Mage_Cms_IndexController, “home") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Cms/controllers/IndexController.php on line 26
[12] in Mage_Cms_IndexController->indexAction() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Action.php on line 325
[13] in Mage_Core_Controller_Varien_Action->dispatch("index") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php on line 149
[14] in Mage_Core_Controller_Varien_Router_Standard->match(Zend_Controller_Request_Http) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Front.php on line 166
[15] in Mage_Core_Controller_Varien_Front->dispatch() in /var/www/fsascz/web/fsas.cz/www/app/Mage.php on line 380
[16] in Mage::run("base") in /var/www/fsascz/web/fsas.cz/www/index.php on line 28

Warning: Invalid argument supplied for foreach() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Catalog/Block/Breadcrumbs.php on line 39
[0] in Mage_Catalog_Block_Breadcrumbs->_prepareLayout() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Block/Abstract.php on line 185
[1] in Mage_Core_Block_Abstract->setLayout(Mage_Core_Model_Layout) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 325
[2] in Mage_Core_Model_Layout->createBlock("catalog/breadcrumbs") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Catalog/Block/Category/View.php on line 33
[3] in Mage_Catalog_Block_Category_View->_prepareLayout() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Block/Abstract.php on line 185
[4] in Mage_Core_Block_Abstract->setLayout(Mage_Core_Model_Layout) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 349
[5] in Mage_Core_Model_Layout->addBlock("Mage_Catalog_Block_Category_View", “category.products") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 189
[6] in Mage_Core_Model_Layout->_generateBlock(Mage_Core_Model_Layout_Element, Mage_Core_Model_Layout_Element) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 158
[7] in Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Model/Layout.php on line 159
[8] in Mage_Core_Model_Layout->generateBlocks() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Action.php on line 270
[9] in Mage_Core_Controller_Varien_Action->generateLayoutBlocks() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Cms/Helper/Page.php on line 52
[10] in Mage_Cms_Helper_Page->renderPage(Mage_Cms_IndexController, “home") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Cms/controllers/IndexController.php on line 26
[11] in Mage_Cms_IndexController->indexAction() in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Action.php on line 325
[12] in Mage_Core_Controller_Varien_Action->dispatch("index") in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php on line 149
[13] in Mage_Core_Controller_Varien_Router_Standard->match(Zend_Controller_Request_Http) in /var/www/fsascz/web/fsas.cz/www/app/code/core/Mage/Core/Controller/Varien/Front.php on line 166
[14] in Mage_Core_Controller_Varien_Front->dispatch() in /var/www/fsascz/web/fsas.cz/www/app/Mage.php on line 380
[15] in Mage::run("base") in /var/www/fsascz/web/fsas.cz/www/index.php on line 28

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