4

So I have a few custom widgets instances that I'd like to include into some theme .xml files. However I'd like these to be added via XML rather than as Layout Updates under New Widget Instance.

I know I can add a widget via XML by also setting all the widget options within the XML, however i'd like to give the client some ability to configure these in the backend themselves.

At the moment the only way I can think of to add a static block and then have a widget added withint the content of that, but this seems a rather unelagant solution compared with just adding a widget instace directly.

Looking for something like below but for a widget rather than a static block

<block type="cms/block" name="cms_footer_links" before="footer_links">
                <action method="setBlockId"><block_id>footer_links</block_id</action>
</block>

2 Answers 2

3

Here an example of adding New Products widgets via catalog.xml (or any other file) layout:

<block
  type="catalog/product_widget_new" name="custom_widget_name"
  template="catalog/product/widget/new/column/new_default_list.phtml">
    <!-- populate widget by options -->
    <action method="setData"><name>products_count</name><value>3</value></action>
    <action method="setData"><name>cache_lifetime</name><value>3600</value></action>
</block>
0

Looks like what I was asking for isn't possible (by default atleast) so I either need to choose to add the widget (and add the values) via XML, or just use a backend widget instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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