Widget Frontend Display












2















I managed to develop a custom widget, the problem is that its not displaying in the frontend.



The goal is to add the widget to a static block and then display the block in frontend.



I created the static block and added the widget, for test purposes was added some static text after the widget so to make sure the block is displaying and it does (the static text displays, but the widget content doesn't);



In the Block class in my widget i have the following code.



    class MP_Novidades_Block_Produtos
extends Mage_Core_Block_Template
implements Mage_Widget_Block_Interface
{

public function _toHtml () {
$_data = $this->getData();
return "<a href='#'>Test</a>";
}

}


In the layout file - page.xml i added this block.



 <block type="cms/block" name="banners_block" before="-">
<action method="setBlockId">
<block_id>banners_block</block_id>
</action>
</block>


widget.xml



 <?xml version="1.0"?>
<widgets>
<novidades_nov type="novidades/produtos">
<name>Produtos Novidade</name>
<description type="desc">Cria lista de produtos novidade</description>
<parameters>
<hyperlink>
<required>1</required>
<visible>1</visible>
<value>http://www.maispormenos.eu</value>
<label>URL de ligação</label>
<type>text</type>
</hyperlink>
<button_text>
<required>1</required>
<visible>1</visible>
<value>Ir</value>
<label>Texto do botão</label>
<type>text</type>
</button_text>
<image>
<required>1</required>
<visible>1</visible>
<value>-</value>
<label>Imagem</label>
<type>text</type>
</image>
</parameters>
</novidades_nov>
</widgets>


it's supposed to show that tag, but it doesnt. What can be the causes for this to happen?



Thanks in advance and happy Magento programming!










share|improve this question
















bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • please show widget.xml code here

    – Anil Suthar
    Jul 25 '16 at 11:22











  • @AnilSuthar i edited the question and added the widget.xml structure.

    – Miguel Pinto
    Jul 25 '16 at 11:43
















2















I managed to develop a custom widget, the problem is that its not displaying in the frontend.



The goal is to add the widget to a static block and then display the block in frontend.



I created the static block and added the widget, for test purposes was added some static text after the widget so to make sure the block is displaying and it does (the static text displays, but the widget content doesn't);



In the Block class in my widget i have the following code.



    class MP_Novidades_Block_Produtos
extends Mage_Core_Block_Template
implements Mage_Widget_Block_Interface
{

public function _toHtml () {
$_data = $this->getData();
return "<a href='#'>Test</a>";
}

}


In the layout file - page.xml i added this block.



 <block type="cms/block" name="banners_block" before="-">
<action method="setBlockId">
<block_id>banners_block</block_id>
</action>
</block>


widget.xml



 <?xml version="1.0"?>
<widgets>
<novidades_nov type="novidades/produtos">
<name>Produtos Novidade</name>
<description type="desc">Cria lista de produtos novidade</description>
<parameters>
<hyperlink>
<required>1</required>
<visible>1</visible>
<value>http://www.maispormenos.eu</value>
<label>URL de ligação</label>
<type>text</type>
</hyperlink>
<button_text>
<required>1</required>
<visible>1</visible>
<value>Ir</value>
<label>Texto do botão</label>
<type>text</type>
</button_text>
<image>
<required>1</required>
<visible>1</visible>
<value>-</value>
<label>Imagem</label>
<type>text</type>
</image>
</parameters>
</novidades_nov>
</widgets>


it's supposed to show that tag, but it doesnt. What can be the causes for this to happen?



Thanks in advance and happy Magento programming!










share|improve this question
















bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • please show widget.xml code here

    – Anil Suthar
    Jul 25 '16 at 11:22











  • @AnilSuthar i edited the question and added the widget.xml structure.

    – Miguel Pinto
    Jul 25 '16 at 11:43














2












2








2








I managed to develop a custom widget, the problem is that its not displaying in the frontend.



The goal is to add the widget to a static block and then display the block in frontend.



I created the static block and added the widget, for test purposes was added some static text after the widget so to make sure the block is displaying and it does (the static text displays, but the widget content doesn't);



In the Block class in my widget i have the following code.



    class MP_Novidades_Block_Produtos
extends Mage_Core_Block_Template
implements Mage_Widget_Block_Interface
{

public function _toHtml () {
$_data = $this->getData();
return "<a href='#'>Test</a>";
}

}


In the layout file - page.xml i added this block.



 <block type="cms/block" name="banners_block" before="-">
<action method="setBlockId">
<block_id>banners_block</block_id>
</action>
</block>


widget.xml



 <?xml version="1.0"?>
<widgets>
<novidades_nov type="novidades/produtos">
<name>Produtos Novidade</name>
<description type="desc">Cria lista de produtos novidade</description>
<parameters>
<hyperlink>
<required>1</required>
<visible>1</visible>
<value>http://www.maispormenos.eu</value>
<label>URL de ligação</label>
<type>text</type>
</hyperlink>
<button_text>
<required>1</required>
<visible>1</visible>
<value>Ir</value>
<label>Texto do botão</label>
<type>text</type>
</button_text>
<image>
<required>1</required>
<visible>1</visible>
<value>-</value>
<label>Imagem</label>
<type>text</type>
</image>
</parameters>
</novidades_nov>
</widgets>


it's supposed to show that tag, but it doesnt. What can be the causes for this to happen?



Thanks in advance and happy Magento programming!










share|improve this question
















I managed to develop a custom widget, the problem is that its not displaying in the frontend.



The goal is to add the widget to a static block and then display the block in frontend.



I created the static block and added the widget, for test purposes was added some static text after the widget so to make sure the block is displaying and it does (the static text displays, but the widget content doesn't);



In the Block class in my widget i have the following code.



    class MP_Novidades_Block_Produtos
extends Mage_Core_Block_Template
implements Mage_Widget_Block_Interface
{

public function _toHtml () {
$_data = $this->getData();
return "<a href='#'>Test</a>";
}

}


In the layout file - page.xml i added this block.



 <block type="cms/block" name="banners_block" before="-">
<action method="setBlockId">
<block_id>banners_block</block_id>
</action>
</block>


widget.xml



 <?xml version="1.0"?>
<widgets>
<novidades_nov type="novidades/produtos">
<name>Produtos Novidade</name>
<description type="desc">Cria lista de produtos novidade</description>
<parameters>
<hyperlink>
<required>1</required>
<visible>1</visible>
<value>http://www.maispormenos.eu</value>
<label>URL de ligação</label>
<type>text</type>
</hyperlink>
<button_text>
<required>1</required>
<visible>1</visible>
<value>Ir</value>
<label>Texto do botão</label>
<type>text</type>
</button_text>
<image>
<required>1</required>
<visible>1</visible>
<value>-</value>
<label>Imagem</label>
<type>text</type>
</image>
</parameters>
</novidades_nov>
</widgets>


it's supposed to show that tag, but it doesnt. What can be the causes for this to happen?



Thanks in advance and happy Magento programming!







magento-1.9 php widgets widget






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 25 '16 at 11:42







Miguel Pinto

















asked Jul 25 '16 at 11:13









Miguel PintoMiguel Pinto

113




113





bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 9 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • please show widget.xml code here

    – Anil Suthar
    Jul 25 '16 at 11:22











  • @AnilSuthar i edited the question and added the widget.xml structure.

    – Miguel Pinto
    Jul 25 '16 at 11:43



















  • please show widget.xml code here

    – Anil Suthar
    Jul 25 '16 at 11:22











  • @AnilSuthar i edited the question and added the widget.xml structure.

    – Miguel Pinto
    Jul 25 '16 at 11:43

















please show widget.xml code here

– Anil Suthar
Jul 25 '16 at 11:22





please show widget.xml code here

– Anil Suthar
Jul 25 '16 at 11:22













@AnilSuthar i edited the question and added the widget.xml structure.

– Miguel Pinto
Jul 25 '16 at 11:43





@AnilSuthar i edited the question and added the widget.xml structure.

– Miguel Pinto
Jul 25 '16 at 11:43










2 Answers
2






active

oldest

votes


















0














Best tutorial I have ever found to create custom widgets is http://code.tutsplus.com/tutorials/custom-widget-development-in-magento--cms-23015



Please match your process with this tutorial. I hope it will surely help you.






share|improve this answer































    0














    Have you tried to add output parameter?



    <block type="cms/block" name="banners_block" before="-" output="toHtml">
    <action method="setBlockId">
    <block_id>banners_block</block_id>
    </action>
    </block>





    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f127276%2fwidget-frontend-display%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Best tutorial I have ever found to create custom widgets is http://code.tutsplus.com/tutorials/custom-widget-development-in-magento--cms-23015



      Please match your process with this tutorial. I hope it will surely help you.






      share|improve this answer




























        0














        Best tutorial I have ever found to create custom widgets is http://code.tutsplus.com/tutorials/custom-widget-development-in-magento--cms-23015



        Please match your process with this tutorial. I hope it will surely help you.






        share|improve this answer


























          0












          0








          0







          Best tutorial I have ever found to create custom widgets is http://code.tutsplus.com/tutorials/custom-widget-development-in-magento--cms-23015



          Please match your process with this tutorial. I hope it will surely help you.






          share|improve this answer













          Best tutorial I have ever found to create custom widgets is http://code.tutsplus.com/tutorials/custom-widget-development-in-magento--cms-23015



          Please match your process with this tutorial. I hope it will surely help you.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 25 '16 at 11:20









          Mohit Kumar AroraMohit Kumar Arora

          6,34841532




          6,34841532

























              0














              Have you tried to add output parameter?



              <block type="cms/block" name="banners_block" before="-" output="toHtml">
              <action method="setBlockId">
              <block_id>banners_block</block_id>
              </action>
              </block>





              share|improve this answer




























                0














                Have you tried to add output parameter?



                <block type="cms/block" name="banners_block" before="-" output="toHtml">
                <action method="setBlockId">
                <block_id>banners_block</block_id>
                </action>
                </block>





                share|improve this answer


























                  0












                  0








                  0







                  Have you tried to add output parameter?



                  <block type="cms/block" name="banners_block" before="-" output="toHtml">
                  <action method="setBlockId">
                  <block_id>banners_block</block_id>
                  </action>
                  </block>





                  share|improve this answer













                  Have you tried to add output parameter?



                  <block type="cms/block" name="banners_block" before="-" output="toHtml">
                  <action method="setBlockId">
                  <block_id>banners_block</block_id>
                  </action>
                  </block>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 26 '16 at 4:20









                  Quan LeQuan Le

                  1,3101717




                  1,3101717






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f127276%2fwidget-frontend-display%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      what is the purpose of having a “thru cal” on RF PCB?

                      What does Gandalf whisper to the Moth on the Orthanc in Isengard?

                      magento2 creating a lot of catalogrule_product_temp tables