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>
Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
asked Aug 6, 2014 at 15:52

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>
answered Aug 6, 2014 at 16:21
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.

answered Nov 9, 2014 at 20:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.