Widget Frontend Display
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
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.
add a comment |
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
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 showwidget.xmlcode 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
add a comment |
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
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
magento-1.9 php widgets widget
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 showwidget.xmlcode 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
add a comment |
please showwidget.xmlcode 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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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>
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jul 25 '16 at 11:20
Mohit Kumar AroraMohit Kumar Arora
6,34841532
6,34841532
add a comment |
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
answered Jul 26 '16 at 4:20
Quan LeQuan Le
1,3101717
1,3101717
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
please show
widget.xmlcode 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