Magento custom module image restore
I have added a module to show the some set of images with text as showcase in the homepage using module creator everything goes fine. And while editing i want to show the already uploaded image on that particular banner. How it is possible in the cu开发者_运维百科stom module of magento.
I found the way to do it. I had just added this for image reload on edit page in the admin banner module...
$object = Mage::getModel('banner/banner')->load( $this->getRequest()->getParam('id'));
$note = false;
if( $object->getFilename() ){
$note = '<br/> <a href="'.Mage::getBaseUrl('media')."banners/".$object->getFilename().'" target="_blank">
<img src="'.Mage::getBaseUrl('media')."banners/".$object->getFilename().'" style="width:240px;height:120px;"/><br/>View it in New window</a>';
}else{
$note = 'Banner Image for the showcase (999px × 430px)';
}
$fieldset->addField('filename', 'file', array(
'label' => Mage::helper('banner')->__('File'),
'required' => false,
'note' => $note,
'name' => 'filename',
));
Hope it will help someone
精彩评论