Hi,
I am developing a custom widget where we can the particular product by product id (admin end) and show the product on front end.
Problem is that i can't get the data from admin portion that means $this->getData('productId');
product id as a parameter declared in widget.xml.
Here is my code on Topseraches.php under Block directory.
class Rstar_RsWidget_Block_Topsearches
extends Mage_Core_Block_Template
implements Mage_Widget_Block_Interface
{
protected function _toHtml()
{
$productId=$this->getData('productId');
print_r($productId);
}
}
widget.xml
<?xml version="1.0"?>
<widgets>
<RsWidget_topsearches type="RsWidget/topsearches" translate="name description" module="RsWidget">
<name>Newly Added Product</name>
<description type="desc">Newly Added Product</description>
<parameters>
<productId>
<label>Product Id</label>
<visible>1</visible>
<required>1</required>
<type>text</type>
<description>Enter product Id</description>
</productId>
</parameters>
</RsWidget_topsearches>
</widgets>
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Rstar_RsWidget>
<version>0.1.0</version>
</Rstar_RsWidget>
</modules>
<global>
<blocks>
<RsWidget>
<class>Rstar_RsWidget_Block</class>
</RsWidget>
</blocks>
<helpers>
<RsWidget>
<class>Rstar_RsWidget_Helper</class>
</RsWidget>
</helpers>
<models>
<RsWidget>
<class>Rstar_RsWidget_Model</class>
</RsWidget>
</models>
</global>
</config>
Please check where is my issue.