开发者

Magento custom module image restore

开发者 https://www.devze.com 2023-01-24 10:54 出处:网络
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 tha

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

0

精彩评论

暂无评论...
验证码 换一张
取 消