Working on a project where I need the ability to show a static block widget on all products of a particular category. So as an example the block might be instructions on how to measure yourself for a particular type of shirt so for all the shirts in the "button down" category I want this widget to show, but it won't show up on t-shirts.

My first thought is to modify the widget filter so that in addition to SKU and Name you can filter it by category, you could then choose the "button down" category to filter the list then do a select all on all the products in that category.

Before I go too deep down this hole I thought I'd throw it out there and see if anyone has any better suggestions?


One way that I like to do this sort of thing, but which does require access to code, is to create a new dropdown attribute such as size_fit (tip: don’t forget to add it to your attribute set).

Next you add the options to the attribute. The trick here is to give it a label such as “Button Down” in the Admin View, then the ID of your static block in the appropriate Store View(s).

Now that your new attribute has been set up, you will choose the appropriate Size/Fit option in your product administration that corresponds to the static block you want to display for that product.

All that is left is a little layout coding and your products that have their Size/Fit attribute configured will show a new tab on their product display pages:

Create a new template file at: app/design/frontend/base/default/template/catalog/product/view/size_fit.phtml

<?php $block_id = $this->getProduct()->getAttributeText('size_fit'); ?>
<?php if ($block_id): ?>
<div class="box-size_fit">
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($block_id)->toHtml(); ?>
<?php endif; ?>

That will load and display the static block that corresponds to your product’s attribute value (if any).

Lastly, you just need to add this new block to your product display page by adding the following to your catalog.xml or local.xml layout file.

    <reference name="product.info.tabs">
        <action method="addTab" translate="title" module="catalog">

Using an extension such as Mass Product Actions in the linked blog article makes it very easy to configure your products with the new attribute value.


Here is a way to do it without overriding templates:

  1. Go to CMS -> Static Blocks -> Add new. Create new static block with following content:

    {{block type="catalog/product_list" category_id="CATEGORY_ID" template="catalog/product/list.phtml" column_count="5" products_count="10"}}

Replace CATEGORY_ID with numeric category id.

  1. Go to CMS -> Widgets -> Add New Widget Instance

Widget Type: CMS Static Block

Design Package/Theme: Select your current theme

See the configuration for this widget: enter image description here

In "Widget Options" tab, select the Static block that we created in Step 1.

Now refresh the Home page. Clear cache if needed. You should see the category products on page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.