简体   繁体   中英

How to have default data to wysiwyg editor in magento

I need some data added default in the editor. Like I want a template to get loaded in editor when I click on edit template option.. Can anyone suggest me some tip??

Here you can see how it can be done

$dataa= $this->getTemplate1();

    $fieldset->addField('content', 'editor', array(
        'name' => 'content',
        'label' => Mage::helper('abandonedcart')->__('Content'),
        'title' => Mage::helper('abandonedcart')->__('Content'),
        'style' => 'width:700px; height:500px;',
        'wysiwyg' => true,
        'required' => true,
        'state' => 'html',
        'config' => $wysiwygConfig,
        'value'=> $dataa,

    ));

    if (Mage::getSingleton('adminhtml/session')->getAbandonedcartData()) {
        $form->addValues(Mage::getSingleton('adminhtml/session')->getAbandonedcartData());
        Mage::getSingleton('adminhtml/session')->setAbandonedcartData(null);
    } elseif (Mage::registry('abandonedcart_data')) {
        $form->addValues(Mage::registry('abandonedcart_data')->getData());
    }
    return parent::_prepareForm();
}

and calling a function to have data

public function getTemplate1() {
    $emailTemplate = Mage::getModel('core/email_template')->loadDefault('abandonedcart_abandonedcart_group_email_template');
     $emailTemplate['template_text'];;
       $template_id = Mage::getStoreConfig('abandonedcart/abandonedcart_group/email_template');       
       $emailTemplate = Mage::getModel('core/email_template')->loadDefault($template_id);

 return    $processedTemplate = $emailTemplate->getProcessedTemplate();   



}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM