It's not possible out of the box, but with some coding is possible.
First of all you need to have that attribute as a textarea with WYSIWYG support and allow html on frontend. You can set these values from Catalog->Attributes->Manage Attributes
.
Then you need to allow media directives in product attributes.
You can do that from System->Configuration->Catalog->Frontend
. Set the value for Allow Dynamic Media URLs in Products and Categories
to Yes
.
Now you need to change the template processor for the catalog attributes.
By default the textarea attribute values are parsed by the class Mage_Catalog_Model_Template_Filter
.
This is defined in the config.xml
file of the catalog module.
<config>
....
<global>
...
<catalog>
...
<content>
<tempate_filter>catalog/template_filter</tempate_filter><!-- this defines the template processor-->
</content>
...
</catalog>
...
</global>
...
</config>
You have 2 options here.
Option 1.
Rewrite the class Mage_Catalog_Model_Template_Filter
and add a new method called blockDirective
that you can copy from Mage_Core_Model_Email_Template_Filter
.
You can choose this method if you want more control or if you want to add extra modifications to the {{}}
directive parsing.
But I wouldn't use that. I would go with ...
Option 2..
Change the template processor. Make the catalog use the same processor that is used for cms blocks and pages because they already have support for {{block}}
directives.
An even better idea would be to use the template processor for widgets. This will allow you to use {{widget}}
directives in addition to {{block}}
directives.
To do that, just create a new module. Let's call it Easylife_Directive
.
You can even use one of the modules you have if you don't want to create a new one just for this.
If you create a new module you will need this file. (If you use an existing module you can skip it).
app/etc/modules/Easylife_Directive.xml
- the declaration file
<?xml version="1.0"?>
<config>
<modules>
<Easylife_Directive>
<codePool>local</codePool>
<active>true</active>
<depends>
<Mage_Catalog /><!-- Should be loaded after the catalog module -->
</depends>
</Easylife_Directive>
</modules>
</config>
app/code/local/Easylife/Directive/etc/config.xml
- the config file where you change the template processor.
<?xml version="1.0"?>
<config>
<modules>
<Easylife_Directive>
<version>1.0.0</version>
</Easylife_Directive>
</modules>
<global>
<catalog>
<content>
<tempate_filter>widget/template_filter</tempate_filter><!-- change the template filter -->
</content>
</catalog>
</global>
</config>
If you want to use one of your existing modules just copy this inside the <global>
tag of the config.xml
file of the module.
<catalog>
<content>
<tempate_filter>widget/template_filter</tempate_filter><!-- change the template filter -->
</content>
</catalog>