0

I have created a widget and I don't know how to set the phtml template for the widget.

2
  • Can you please explain your question? Nov 19, 2018 at 17:02
  • I need to set the template for the widget. Which part you don't understand?
    – glafche
    Nov 20, 2018 at 9:41

1 Answer 1

1

Inside your widget.xml, your widget looks like:


<widget_name type="module_name/new_widget" translate="name description" module="module_name">

So your block class is:

app/code/local/VendorName/ModuleName/Block/New/Widget.php


class VendorName_ModuleName_Block_New_Widget
    extends Mage_Core_Block_Template
    implements Mage_Widget_Block_Interface
{
    /**
     * Internal constructor
     *
     */
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('module_name/template.phtml');
    }
}

You can check app/code/core/Mage/Catalog/etc/widget.xml as an example.

3
  • /** * Internal constructor * */ protected function _construct() { parent::_construct(); $this->setTemplate('fsm/advertisingbanner/index.phtml'); } This is the location of index.phtml Fsm_AdvertisingBanner/app/design/frontend/base/default/fsm/advertisingbanner/index.phtml
    – glafche
    Nov 20, 2018 at 11:55
  • but still nothing
    – glafche
    Nov 20, 2018 at 11:58
  • Change like: app/design/frontend/base/default/template/fsm/advertisingbanner/index.phtml
    – Sohel Rana
    Nov 20, 2018 at 13:07

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.