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

How do I add the “Tags” block to the right column for all pages? 
 
jm999
Jr. Member
 
Total Posts:  12
Joined:  2007-10-16
 

I’d like to add the “Tags” block to ALL of my pages on the right column. Can someone point me in the right direction?

Also, is there a way to have “featured products” with Magento and have them show up on the home page? It looks like they’re done in plain html in the demo store from the admin, but I was curious if this can be done without the use of the CMS and if it would be fairly simple to implement. Like adding a field in the database for “Featured” and then writing a simple function to display them on the front page.

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

About tags: for now you can edit app/design/frontend/default/default/layout/main.xml, find this text (approx. line 190):

<!-- Mage_Tag -->
        <
reference name="left">
            <
block type="tag/popular" name="tags_popular" template="tag/popular.phtm">
                <
action method="setTemplate"><template>tag/popular.phtml</template></action>
            </
block>
        </
reference>
And update to
<reference name="right">

For the products on home page, i’m not sure how you want it to look like, but for default category tempate:
in app/code/core/Mage/Catalog/Block/Product/List.php replace function _getProductCollection with:

protected function _getProductCollection()
    
{
        
if (is_null($this->_productCollection)) {
            $collection 
Mage::getSingleton('catalog/layer');
            if (
$this->getShowRootCategory()) {
                $categoryId 
Mage::getStoreConfig('catalog/category/root_id');
                
$category Mage::getModel('catalog/category')->load($categoryId);
                
$collection->setCurrentCategory($category);
            
}
            $this
->_productCollection $collection->getProductCollection();
        
}
        
return $this->_productCollection;
    
}
This method will be available in future releases.
Now you can put in admin / CMS page anywhere you like text like:
{{block type="catalog/product_list" show_root_category="true"}}
And it will show products from the root category for the store.
 
Magento Community Magento Community
Magento Community
Magento Community
 
Giorgi
Member
 
Total Posts:  53
Joined:  2007-10-21
 

I dont get it, how can I add to product FEATURED status after that?

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

As far as I understand it (and as far as I would like to do) the above described a way to show the entire root category on the homepage. Although Im not entirely sure how that is done above, I am currently wondering how one would show only certain featured products on the homepage. What would it take to do that? Any specific help is very much appreciated smile I guess i should write my own FeaturedProducts block inside the catalog module? Then add this block in a reference to ‘content’ in the main.xml in the default layout ? Or will it then show up in all cms pages? Then i guess I must somehow make sure that it only shows up on the homepage cms, is this what the above ‘{{block type="catalog/product_list" show_root_category="true"}} ‘ is tryng to do? Actually I dont understand this notation.

Please, any input is very much appreciated smile

Thanks,

Seldon

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

Anyone ?

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

Ok, im understanding it a bit better now. The above way indeed shows the products added to the root category on the homepage (this thus is a way to make products featured: add them to the root category). However, if i would like to add the featured products block via the xml, i would think that could be done by:

<reference name="content">
            <
block type="catalog/product_list" name="catalog.product.list" before="-" show_root_category="true"/>
        </
reference>

This however gives a bunch of errors: somehow the show_root_category property is not correctly set on the block. Magento team, any idea why not? Then if this works, the following question. How to make sure (via the main.xml) that a block *only* shows up on the homepage? Or, but i think this is easier, *only* shows up on cms pages?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@seldon: try this:

<reference name="content">
    <
block type="catalog/product_list" name="catalog.product.list" before="-">
         <
action method="setShowRootCategory"><value>true</value></action>
    </
block>
</
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
 
jmayer
Jr. Member
 
Total Posts:  21
Joined:  2007-09-03
 

Hi Moshe,

I am using the code snippet you mentioned above for featuring items on the home page. Its working for the 13700 release.

{{block type="catalog/product_list" show_root_category="true"}}

As I said this works fine, however I would like to display more columns at a time on the home page and remove things like the add to cart button, etc. Can I isolate those changes for the home page? If so what’s the best place to start looking to tweak the page.

Basically I want a variation of the grid, but I want to customize it only for the home page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@jmayer: In new release you should have Custom Layout XML textarea under Content textarea in CMS page edit.

Here you can put XML layout updates in same format they are in main.xml, and they will affect layout for this specific CMS page.

In default theme Add to cart button is customizable only by changing templates it is shown on.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jmayer
Jr. Member
 
Total Posts:  21
Joined:  2007-09-03
 

Can you post a quick down and dirty sample of this code?

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

Thnx Moshe, I did it a bit differnt now though. I modified the CMS Helper (how can i override helpers?) renderPage method and added the following code:

if ($content $action->getLayout()->getBlock('content')) {
            $block 
$action->getLayout()->createBlock('cms/page')->setPage($page);
            
$content->append($block);

            if (
$page->getIdentifier()===Mage::getStoreConfig('web/default/cms_home_page')){
                $content
->append($action->getLayout()->createBlock('catalog/product_featured''catalog.product.list', array("show_root_category"=>true)));
            
}        
        }

Moreover I created my own block ‘catalog/product/featured, containing:

class Mage_MelrowCatalog_Block_Product_Featured extends Mage_Catalog_Block_Product_List
{
    
public function __construct()
    
{
        parent
::__construct();
        
$this->setTemplate('catalog/product/featured.phtml');
    
}
    
    
protected function _beforeToHtml(){
        parent
::_beforeToHtml();
        
$this->getLayout()->getBlock('product_list.toolbar')->setTemplate('catalog/product/featured/toolbar.phtml');
        return 
true;
    
}    

}

And i needed a modified toolbar template, so i created my own toolbar template.

I hope this helps anyone who wants to do it like this. What do you think of this way Moshe?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bklusek
Jr. Member
 
Total Posts:  1
Joined:  2013-06-18
 

Hi Moshe,
I’m having installing an Magento on an XAMPP lokalhost. And on my folder C:\xampp\htdocs\magento\app\design\frontend\default\default\layout there is no main.xml file. There is only tpss_captcha.xml File.
I found that under the Path: magento\app\design\install\default\default\layout.
Tell me where is the right main.xml file for that example please.

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