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 remove sort by on toolbar.phtml but for homepage only? 
 
lindaw
Sr. Member
 
Total Posts:  201
Joined:  2007-12-25
 

Hi guys,

I am using list.phtml on the homepage and it calls the toolbar (<?php echo $this->getToolbarHtml() ?>) but on the homepage I want to remove the Sort By option.

I assume I need to create a custom template for toolbar.phtml and I tried saving it as, taking out the sort by and calling the new version in list.phtml but I am obviously missing something else.

Can anyone help me with this? I guess I just need to know what other files need to be modified.

Thanks in advance,
Linda

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

hey linda,

ok i think you need to modify the core.
But maybee you should push this out to local to save overwrites when upgrading…

try
app/code/core/mage/catalog/block/product/list/toolbar.php

look around line ~108 for sort order. Asc/Desc

hth
Brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
lindaw
Sr. Member
 
Total Posts:  201
Joined:  2007-12-25
 

Thanks, will give this a go.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JasonLee
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-12-18
San Francisco, CA
 

Since this is showing up in the search on top of the CORRECT information:

DO NOT EDIT CORE CODE - unless you want things to break when you upgrade.

How to correctly remove the Sort By (as well as Per Page):
app/design/frontend/ [ your interface name] / [your theme name] /template/catalog/product/list/toolbar.phtml.

(Found on)
http://www.magentocommerce.com/boards/viewthread/21791/

 
Magento Community Magento Community
Magento Community
Magento Community
 
branko_ajzele
Member
 
Avatar
Total Posts:  35
Joined:  2008-06-18
Croatia
 

As JasonLee already said, DO NOT EDIT CORE CODE.

Most easy and most INSTANT solution for you would be to use CSS to simple hide it.

My question is, how exactly did you manage to make it show on home page? This is not the default Magento option so my guess is some custom code?

Anyhow… little changes to layout files should do the trick. Calling something like <remove name="some_block_name"> on proper place should do.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BDC
Jr. Member
 
Total Posts:  13
Joined:  2009-07-14
 
branko - 08 May 2009 10:35 AM

As JasonLee already said, DO NOT EDIT CORE CODE.

Most easy and most INSTANT solution for you would be to use CSS to simple hide it.

My question is, how exactly did you manage to make it show on home page? This is not the default Magento option so my guess is some custom code?

Anyhow… little changes to layout files should do the trick. Calling something like <remove name="some_block_name"> on proper place should do.

Hello branko,

I managed to have products on my homepage doing it like this:

1) I created a new category to which I assigned some product (e.g. Bestsellers)
2) I marked this category as not active so that it doesn’t show up amongst the other categories
3) I’ve added next line to my CMS homepage:

<h3>Bestsellers</h3
{{block type="catalog/product_list" category_id="49" template="catalog/product/list.phtml"}}

It is important that you write down the id of your newly created category and replace it in the code
In this case it was 49

Hope this helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
sahuspilwal
Member
 
Avatar
Total Posts:  37
Joined:  2009-08-02
Hastings, United Kingdom
 

If you are using custom block code on your CMS home page.....like this:

{{block type="catalog/product_list" category_id="831" template="catalog/product/list.phtml"}}

to display best seller / featured products being a non active category on the home page then read on:

To achieve removal of the sort by and show xxx per page on the home page you could do as described by AITOC however to achieve the removal of these two features ONLY on the home page and not sub category pages do the following:

1/ Go to your theme and locate app/design/frontend/ [ your interface name] / [your theme name] /template/catalog/product/list.phtml

2/ Take a copy of this and rename homepage-list.phtml

3/ Remove this code <?php echo $this->getToolbarHtml() ?> from around line 39 and 131 and save

4/ Update your CMS home page to this {{block type="catalog/product_list" category_id="831" template="catalog/product/homepage-list.phtml"}}

5/ Refresh your page

Viola you should have removed your sort by and show xxx controls from just the home page wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
inikolay
Jr. Member
 
Total Posts:  25
Joined:  2009-12-19
 

sahuspilwal, thank you for this tutorial!

But another question is how to limit number of products on home page from 9 to 6?
For me

<reference name="content">
  <
block type="catalog/product_list_random" name="product_random" template="catalog/product/list_new.phtml">
    <
action method="setProductsCount"><count>6</count></action>
  </
block>
</
reference>
does not work, I still have 9 products showing.
 
Magento Community Magento Community
Magento Community
Magento Community
 
Sajid iqbal
Jr. Member
 
Total Posts:  14
Joined:  2009-12-08
 
sahuspilwal - 11 December 2009 12:49 PM

If you are using custom block code on your CMS home page.....like this:

{{block type="catalog/product_list" category_id="831" template="catalog/product/list.phtml"}}

to display best seller / featured products being a non active category on the home page then read on:


To achieve removal of the sort by and show xxx per page on the home page you could do as described by AITOC however to achieve the removal of these two features ONLY on the home page and not sub category pages do the following:

1/ Go to your theme and locate app/design/frontend/ [ your interface name] / [your theme name] /template/catalog/product/list.phtml

2/ Take a copy of this and rename homepage-list.phtml

3/ Remove this code <?php echo $this->getToolbarHtml() ?> from around line 39 and 131 and save

4/ Update your CMS home page to this {{block type="catalog/product_list" category_id="831" template="catalog/product/homepage-list.phtml"}}

5/ Refresh your page

Viola you should have removed your sort by and show xxx controls from just the home page wink

Thanks this worked for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ravi Goswami
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2010-03-11
 

I was searching for the path of toolbar.phtml to make some designing changes. Here is the path

/app/design/frontend/yourtemplate/yourtheme/catalog/product/list/toolbar.phtml

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lenster
Jr. Member
 
Total Posts:  16
Joined:  2011-11-24
 

I know this was a while ago but thanks sahuspilwal, this has really helped me out!

I started here:
http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/cms_and_home_page/add_featured_products_to_home_page

Then the toolbar tip tidied up the page and I can then use the same css throughout the site which I found was much more efficient than a featured product widget.

cool smile

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