Landing pages module for Magento

One of the most powerful features of Magento is it flexibility. With the CMS functionality you are able to create very SEO friendly static pages in an easy way. There’s one issue though: by default Magento lacks a good way of including a group of products on a page if they are not all products from one single category.

You can include some dynamic content, e.g. all products from one category. Just add the following block to your CMS page to show all products from the category with ID 8 on a static landing page:

{{block type="catalog/product_list" 
    name="product_listing" 
    template="catalog/product/list.phtml" 
    category_id="8" }}

Now wouldn’t it be great if you could also filter the products on attribute value? For instance to show all black cell phones on a static page? Well, now you can! With this new Magento landing page module you will be able to do this in a very easy way. Just download the module and copy it to the root of your Magento install. After this you will be able to show all black cell phones (this example is using the Magento sample data) by simply adding this block to your CMS page:

{{block type="Yoast_Filter/Result" 
    name="filter_result" 
    template="catalog/product/list.phtml"  
    attribute_name="color" 
    value="24" 
    category="8" }}

Go to your newly created CMS page and you will see a page with all black cell phones. Now it is time to optimize your landing page with some good unique content, a nice title, search engine friendly url, some header tags and you will have a very seo friendly Magento landing page. In the same way you can filter all products on attribute value and/or category. So for a optimized landing page for all Apple Computers just create something like this example:

Example of the Magento Landing Pages module, click for larger version.

Example of the Magento Landing Pages module, click for larger version.

Dynamic attribute filter pages

Well designed pages created by hand with unique content will outperform dynamic generated ones, but it is a hell of a job to create 10k landing pages. So another great feature would be the option to create dynamic pages for each value of an attribute. After the installation of the module and the Magento demo data installed you can go to yourmagentoshop.com/f/color/24/ and you will get all black products on one page.

As you can see the url start with /f for calling the module name, /color is the attribute name and /24 is the value of the attribute. For drop-down and multi-select attributes this is a number (the ID of the attribute value), for text attributes it’s the textvalue. An example URL of a text attribute for the Magento demo data would be yourmagentoshop.com/f/country_orgin/italy/.

Extending your Landing Page with static content

A page without content isn’t very SEO friendly. The Magento CMS uses static blocks for text blocks. When you create a block with the identifier landing-$attribute-$value this block will be added to the above the product listing. So for the example above you should create a static block with the identifier landing-color-24 and voila, the static block is added to the page yourmagentoshop.com/f/color/24/.

Layered Navigation for landing pages

Update 11-1-2010 Now it is even possible to add layered navigation to the landing pages. By default this is enabled for the dynamic pages, you can change this by editing the filter.xml. For the CMS pages you should add something like the following code to the XML update (note the setAttributeName and setValue):

<reference name="content"> 
<block type="Yoast_Filter/Result" name="filter_result" template="catalog/product/list.phtml">
<action method="setAttributeName"><attribute_name>color</attribute_name></action>
<action method="setValue"><value>24</value></action>
</block>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager" template="page/html/pager.phtml"></block>  
</block>
 <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</reference>
<reference name="left">
<block type="Yoast_Filter/Layer_View" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"></block>
</reference>

Downloads

So you were probably wondering by now, but You can download the module right here or install it through MagentoConnect.

Need help?

Of course, if you want to use this Landing Page module in your Magento install and would like us to help set it up, use the hire me form and let us know!

Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

59 Responses

  1. Thijs van SchadewijkBy Thijs van Schadewijk on 8 September, 2009

    Great post Joachim – many thanks. This is exactly what we need for the planned 2.0 version of one of the Magento shops we’re managing: http://www.pannen.nl. This will reduce our reliance on coding to create these kind of pages.

    I think it will also allow us to improve our Gifts page if we create a ‘gift’ attribute for each product…? Mmm have to look into that :) Again – thanks for sharing!

  2. Dustin PitcherBy Dustin Pitcher on 8 September, 2009

    Thanks bro! Another hugely useful post, our clients will love this!

  3. Blaine BullmanBy Blaine Bullman on 8 September, 2009

    I’ve just been looking for something like this thanks Joachim.

  4. MarcelBy Marcel on 8 September, 2009

    Thanks, another great magento extension from you. I’m planning to add it to the product page so I can easily display related products from te same color.

  5. VANYABy VANYA on 9 September, 2009

    Absolutely brilliant. Your works continues to amaze me and solve my problems.

    One thing I’m trying to figure out how to list a “Best Selling Products” list. Products contains different categories and descriptions.

    Any ideas?

  6. robinBy robin on 9 September, 2009

    Will it work with TAGS as well?

    • Joachim HoutmanBy Joachim Houtman on 9 September, 2009

      No, it won’t. It will not be very difficult to add a tags block to a CMS page. But you had to use the tag module instead this one.

  7. AlanBy Alan on 9 September, 2009

    Nice extension! Is is possible to filter by multiple attributes? For example, show me ‘black’ ‘GPS devices’ over ‘€100′.

    • Joachim HoutmanBy Joachim Houtman on 9 September, 2009

      No, not for the dynamic pages, yes for the static block but you will need some custom code. Open Yoast\Filter\Block\Result.php and copy the code for the first attribute and modify it to add another attribute. So you will get getAttribute2 and getValue2 etc.

      • Jack001By Jack001 on 5 November, 2009

        hello Joachim,

        very nice extension! I tried to modify the result.php but nothing works. I think i did a mistake.


        _productCollection)) {
        $collection = Mage::getResourceModel('catalog/product_collection');
        Mage::getModel('catalog/layer')->prepareProductCollection($collection);

        if ($this->getValue()){
        $value = $this->getValue();
        } else{
        $value = $this->getRequest()->getParam('filterValue', 0);
        }

        if ($this->getValue2()){
        $value2 = $this->getValue2();
        } else{
        $value2 = $this->getRequest()->getParam('filterValue', 0);
        }

        if ($this->getCategory())
        {
        $categoryId = $this->getCategory();
        }
        else
        {
        $categoryId = $this->getRequest()->getParam('filterCategory', 0);
        }

        if ($this->getAttribute()){
        $attribute = $this->getAttribute();
        } else {
        $attribute = 'color' ;
        }

        if ($this->getAttribute2()){
        $attribute2 = $this->getAttribute2();
        } else {
        $attribute2 = 'color' ;
        }

        $collection->addAttributeToFilter($attribute, $value);

        if ($categoryId) {
        $category = Mage::getModel('catalog/category')->load($categoryId);
        $collection->addCategoryFilter($category, true);
        }

        $this->_productCollection = $collection;
        }

        return $this->_productCollection;
        }
        }

  8. JimmyBy Jimmy on 9 September, 2009

    Wow, this extension is very similar to the one I developed, but have trouble with publishing in the community channel. Here is the info: Magento: Shop by manufacturer/brand/character/etc – Attribute Info Pages
    I am having trouble with the extension submitting process, http://www.magentocommerce.com/boards/viewthread/54110/ would you be kind to help me there? (I think there’s also a possible bug in magento connect)
    Maybe we could join these two extensions… I was working on blocks, like you already have created, but I am very frustrated by this upload problem.

  9. Montana FlynnBy Montana Flynn on 9 September, 2009

    I am developing my first Magento Site, this really opened my eyes to the true power of magento. I have definitely been doing it the hard way.

    Thanks Yoast!

    PS I would love to see more magento stuff from you!

  10. DGBy DG on 10 September, 2009

    Beautifully done! For those of you wondering, this will display products with an attribute that has an “input type” of text as well, NOT JUST for those that you must select from a list (usually required for layered navigation). For example you can put value=”apple”, not just value=”24″. Very nice, absolutely exactly the type of functionality I was looking for. Thank you!

  11. SurusBy Surus on 10 September, 2009

    A fundamental question. I will make e.g. 10 landing pages. Does it make sense for google to make it accessible? If i make, for example, in footer a category called “landing pages” and add links to all landing pages there? Google will indexing all this pages. Is it correct?

    • AdamBy Adam on 10 September, 2009

      Yes, Google will index any page it can reach via any link from the root of the site (index page)

  12. manuel tatoBy manuel tato on 10 September, 2009

    I’m Working in a new version of my ecommerce site, yoast has been very usefull, thanks a lot!

  13. Jimmy JørgensenBy Jimmy Jørgensen on 10 September, 2009

    Hi.

    Thanks for this very useful info. One question tho. Is it possible to use it for showing new products?. If which “code” do i have to enter?.

    • Joachim HoutmanBy Joachim Houtman on 10 September, 2009

      Thanks. No, it will not work for new products. You can give this block a try:

      {{block type="catalog/product_new" template="catalog/product/new.phtml"}}

  14. Jim PressBy Jim Press on 11 September, 2009

    Interesting, I have been tossing up between magento and a couple of other ecommerce open source products. This was one of the areas concerning me. Might just have swung me towards magento, so thanks for this.

  15. DaniilBy Daniil on 15 September, 2009

    Hi, is there a way to display layered navigation on these landing pages so customers can filter by other attributes? Thanks.

    Daniil

    • Joachim HoutmanBy Joachim Houtman on 17 September, 2009

      No, not by default. With some custom coding will it be possible, ofcourse.

      • DaniilBy Daniil on 19 September, 2009

        would you point me in the right direction? I just need to display the layered navi on the landing pages I created. Thanks in advance.

        • Jonathan DayBy Jonathan Day on 7 October, 2009

          Hi Danil, If you have a look at the Layered Nav code under the CatalogSearch module, that will give you some direction. Especially the core\Mage\CatalogSearch\Model\Layer.php file.

          Cheers,
          JD

        • Jonathan DayBy Jonathan Day on 7 October, 2009

          Thanks Joachim, this is awesome. I’ve made a couple of tweaks to your (nice) code to help those who want to use a word other than “f” as the Filter prefix. In Router.php, insert the following:
          const FILTER_URL_PREFIX = 'browse'; immediately before initControllerRouters, and then change line 10 to be:
          $front->addRouter(self::FILTER_URL_PREFIX, $filter);
          and line 23 to be:
          $route = self::FILTER_URL_PREFIX;

          I’m trying to work out how to use the attribute values in the URL for multi-select/drop-down values, that would be perfect for SEO.

          Thanks again!
          JD

          • Jonathan DayBy Jonathan Day on 8 October, 2009

            Hi again, I found an extra step that is required. In the config.xml, the frontName of the router needs to be changed to whatever value FILTER_URL_PREFIX is, otherwise this can cause issues with further development. This is on line 40.

            I’m working on the Layered Nav, though I think it’s going to be quite a challenge!

            Cheers, JD

  16. KenBy Ken on 17 September, 2009

    Thank you so much for this!!! It has solved a big issue for us so thanks!
    I have one question though, is it possible to add a sorting value in this string? I want to show products by attribute X and sort them by Atrribute date for example. Looking forward hearing from you.

    • Joachim HoutmanBy Joachim Houtman on 17 September, 2009

      Yes that is possible but you will need to add some custom code. You should extend Yoast/Filter/Block/View.php with some code to sort the products by date. Something like

      $collection->setOrder('date', 'ASC');
  17. Jason VanceBy Jason Vance on 26 September, 2009

    Has anyone used this to redirect an advanced search query such as: http://brewforia.com/catalogsearch/advanced/result/?manufacturer=1 to http://brewforia.com/Abita-Beers

    I love the idea of using the URL Rewrite management to rewrite the advanced query. However, I’m having no luck with what should be in the ID Path & Request Path.

    Anyone whom could point me in the right direct?

    I love the extension!

  18. HardikBy Hardik on 29 September, 2009

    Thanks Joachim!

    We needed to filter products by brand attribute ( Reebok,Puma,adidas… )..

    it worked perfectly as we needed.

    -Hardik

  19. KenBy Ken on 1 October, 2009

    Thank you Joachim,

    I was wondering if it possible to create a layered navigation that shows accurate results even after filtering with yoast? Which will be custom code ofcourse.
    When i yoast filter with black it shows all black items, but the layared navigation still allows me to filter accurately through the filterd items in the CMS landing page.

    Look forward hearing from you.

  20. RalfBy Ralf on 1 October, 2009

    Thanks for this great extension! But I have a problem with it. I have installed the newest Magento version. I have an multiple select attribute with more than one options selected. If I try to filter for one of this option with your extension I will retrieve no result. If I have only one option selected within the product zhe product is shown properly. I hope you understand my issue. Can you give me help with this? Thanks in advance!

  21. BryanBy Bryan on 4 October, 2009

    I’ve just started using magento and this will surely be a big help to me. Thanks for this!

    Really love what magento can do. Hope to see more article about magento.

  22. ForrestBy Forrest on 4 October, 2009

    Thank you as this module fills in a major hole our websites functionality.
    Sadly I am having trouble implementing it on out test site. The module loads the designated category, but does not appear to be filtering the list by the designated attribute. If I remove the category it loads the entire catalog. I am using the following block. “{{block type=”Yoast_Filter/Result” name=”filter_result” template=”catalog/product/list.phtml” attribute=”manufacturer” value=”101″}}” I get the same result if I navigate to “/f/manufacturer/101/” On the other hand if I navigate using layered navigation it works.

    Again thanks for the extension and thanks for any help in advance!

  23. Jonathan DayBy Jonathan Day on 7 October, 2009

    Hi again,

    Worked out how to allow multi-select/drop-down option values in the URL, replace the last line of View.php with the following:

    		
                   $optionID = array_search($value,$this->getAttributeValues());
    		if(!$optionID): 
    			return $value;
    		endif;
    		return $optionID;
    	}
    	
    	public function getAttributeValues()
    	{
    		$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $this->getAttribute());
    		foreach ( $attribute->getSource()->getAllOptions(true, true) as $option)
    		{
    			$attributeArray[$option['value']] = $option['label'];
    		}
    		return $attributeArray;
    	}
    

    That will still search by option ID if the option Value is not found.

    Cheers,
    JD

    • FredBy Fred on 16 November, 2009

      Hi Jonathan,

      The ability to use multi-select attributes that you added perfectly matches my need.
      But I can’t find the View.php file I’m supposed to edit : the file included in Joachim’s extension doesn’t seem to be the right one or am I wrong ?

      Could You please give me a hint / path as to which exact file I should edit to make it work ?

      Thanks,
      Fred

    • FredBy Fred on 26 November, 2009

      Thanks Jonathan for republishing your code.

      I edited the View.php with these lines.

      With this addition, the module seems to work for multi-select attributes if only one option is selected for a particular product.
      Any product with several options selected in a multi-select attribute won’t be found using the following syntax :
      yourmagentoshop.com/f/attribute/value

      If you could solve this last problem, the module would be really useful for the site I’m working on.

      Hope to read you soon !

      Fred

  24. Thijs van SchadewijkBy Thijs van Schadewijk on 7 October, 2009

    Hi Jonathan – you’re extremely helpful with your comments. Many thanks – will update the code in order to allow multi-select. This makes the extension much more useful for certain shops.

    Thanks again!

    Thijs

  25. VasilisBy Vasilis on 13 October, 2009

    Perfect module. Can anyone please tell me where can i found the files that control that module so
    i will change local launguage messages? Thank you

  26. Magento DeveloperBy Magento Developer on 26 October, 2009

    I am working on new shopping cart website which built with Magento ecommerce. Your Post is very helpful for our SEO Department for Landing page development in Magento. Thanks for writing magento SEO tips.

  27. PJBy PJ on 1 November, 2009

    Seems easy enough. I’ve uploaded all the files in a default magento install with the sample data and can’t get anything to show up. The block to show all products in category_id=8 works fine, but nothing shows with
    {{block type=”Yoast_Filter/Result” name=”filter_result” template=”catalog/product/list.phtml” attribute=”color” value=”24″ category=”8″ }}.
    And if I go to /f/color/24/, I get a 404 error.
    Any ideas?

    • Joachim HoutmanBy Joachim Houtman on 5 November, 2009

      Are you sure you cleared your cache?

  28. paulBy paul on 5 November, 2009

    hi there. LOVE this extension. really what i needed. Anyways on the dynamic loading pages, the category title isn’t in english. here’s what i’m talking about

    http://www.redmousecomputers.com/f/manufacturer/Motorola

    • Joachim HoutmanBy Joachim Houtman on 5 November, 2009

      Thanks, you were right. The module is updated to English.

  29. Florian KrebberBy Florian Krebber on 5 November, 2009

    Having the same problem as PJ here. Getting a 404 error if i am trying to use dynamic pages. Do i have to create a cms page first for this or what? Thanks a lot for replies.

    • Florian KrebberBy Florian Krebber on 5 November, 2009

      Sorry, overred the cache thing. Now it works just fine!

  30. zeraxBy zerax on 9 November, 2009

    Can i use the block code {{block ... elsewhere then in a CMS block ?
    Can i use it in a Static block ? it seems not…

    Thks for your extension whch is very usefull for me : i can really manage easily my home-page with a simple attribute : appear on home page :)

    • zeraxBy zerax on 10 November, 2009

      I try to use this extension to make a list of products in the footer. Is it possible to do so ?

      • zeraxBy zerax on 18 November, 2009

        I’ve found my mistake… I can’t use it in a static block, but if i use it in a layout then i can desactivate it where i want …
        Thks for your very usefull extension :)

  31. AndreBy Andre on 11 November, 2009

    Nice work, nice extension!

  32. GaryBy Gary on 11 November, 2009

    Very useful addtion – thanks making it available to the community. Would like to be able to show multiple categories on one landing page. Is this possible somwhow?

    • Joachim HoutmanBy Joachim Houtman on 12 November, 2009

      Without a category_id value the modules filter all your products. To filter on more than one, e.g. two categories is not possible or you should change the way Magento Core handles the category values.

  33. Steve LBy Steve L on 17 November, 2009

    Hi There,

    We have used this to form several landing pages we use the SKU to pull in individual products. The problem is I fear it may be causing a memory leak as since using our memory usage on the magento site has shot up. We are using this around 9 times on the page. Could this cause the problem?

    THanks

  34. FredBy Fred on 23 November, 2009

    Hi,

    I’m trying to make the module work for multi-select/drop-down option values as Jonathan’s addition should allow it but I can’t find the line I am supposed to replace with his code.

    When editing the end of the View.php file it doesn’t work and I’ve been looking at the different files for a few days without being able to find out what to do.

    Would anyone please help ?

    Thanks

    Fred

  35. DavidBy David on 23 November, 2009

    Hey there, thanks for a great plugin. Just thought I´d mention that I would really like to have this module featured as a Magento widget. That would be absolutely beautiful!

  36. SoamBy Soam on 29 November, 2009

    Hey buddy,
    Im trying to do my Brands Listing on my sidebar, so that all of my Brands get this type of URL,
    http://www.domain.com/canon/

    http://www.domain.com/nikon/

    http://www.domain.com/kodak/

    http://www.domain.com/sony/

    So, can we do it with this ?
    Let me know please. Thanks..

  37. paulBy paul on 2 December, 2009

    is there way to automatically create landing pages for the manufacturers listed in my store?

Trackbacks