0

I have an observer here:

app/code/local/LCMS/CMS/Model/Observer.php

Which contains the following:

class LCMS_CMS_Model_Observer
{
    public function cmsField($observer)
    {

        $model = Mage::registry('cms_page');

        $form = $observer->getForm();
        $form->setEnctype("multipart/form-data");

        $fieldset = $form->addFieldset('lcms_author_fieldset', array('legend'=>Mage::helper('cms')->__('Additional'),'class'=>'fieldset-wide'));

        $fieldset->addField('ogimg', 'image', array(
          'name'      => 'ogimg',
          'label'     => Mage::helper('cms')->__('OG Image'),
          'title'     => Mage::helper('cms')->__('OG Image'),
          'disabled'  => false,
          'value'    => $model->getogimg()
        ));

    }
}

This gives me an 'additional' section on the CMS Page admin, with a file select:

File select screenshot

It allows me to select a file, however it doesn't actually save it.

File selected

How can I get this file to upload/save?

  • Please check getter $model->getogimg() ... think it it should be $model->getOgimg() – sv3n Jun 13 '17 at 8:28
  • $model->getOgimg() still doesn't save the image for me unfortunately – Lee Jun 13 '17 at 8:34
  • This only creates field, you have to make function for it – user00247 Jun 13 '17 at 8:44
  • Where do I make the function? Is there a guide anywhere? I have tried to follow a few tutorials but they don't seem to work – Lee Jun 13 '17 at 9:04
  • Kindly follow this link – user00247 Jun 13 '17 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.