3

I'm trying to create a simple custom widget to insert into a newsletter template which just gets x amount of products from a category and displays them.

Not really too sure how I do this so just starting off by trying to get the widget recognised in the newsletter template widget drop down list.

I've just copied the Catalog/Product/New.php and Catalog/Product/Widget/New.php blocks into my module and renamed them Range.php.

This is what I have so far, but can't get it to display in the newsletter template widget drop down list after you click 'insert widget'. Any ideas?

config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Mode_Newsletter>
            <version>0.1.0</version>
        </Mode_Newsletter>
    </modules>
    <blocks>
        <newsletter>
            <class>Mode_Newsletter_Block</class>
        </newsletter>
    </blocks>
</config>

widget.xml:

<widgets>
    <range_products type="newsletter/catalog_product_widget_range" translate="name description" module="newsletter">
        <name>Catalog Range Products List</name>
        <description>List of Products that are set as Range</description>
        <is_email_compatible>1</is_email_compatible>
        <parameters>
            <products_count translate="label">
                <required>1</required>
                <visible>1</visible>
                <value>5</value>
                <label>Number of Products to Display</label>
                <type>text</type>
            </products_count>
            <template>
                <required>1</required>
                <visible>1</visible>
                <label>Template</label>
                <type>select</type>
                <value>catalog/product/widget/new/content/new_grid.phtml</value>
                <values>
                    <default translate="label">
                        <value>catalog/product/widget/new/content/new_grid.phtml</value>
                        <label>New Products Grid Template</label>
                    </default>
                    <list translate="label">
                        <value>catalog/product/widget/new/content/new_list.phtml</value>
                        <label>New Products List Template</label>
                    </list>
                </values>
            </template>
            <cache_lifetime translate="label description">
                <label>Cache Lifetime (Seconds)</label>
                <description>86400 by default, if not set. To refresh instantly, Clear the Blocks HTML Output Cache.</description>
                <visible>1</visible>
                <type>text</type>
            </cache_lifetime>
        </parameters>
    </range_products>
</widget>

1 Answer 1

1

Closing tag in widget.xml should be </widgets> not </widget>.

Your Answer

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

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