Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento - WYSIWYG for promotions descriptions field
    primarykey
    data
    text
    <p>When you set up a sales promotion you have the option to put in some text describing what the offer actually is. I am using this text on the front end by pulling through the collections of the sales and catalog rules, then iterating over them to check they are active, in date and applicable to the customer group. Right now I have this code in a phtml file that I can include with layout update on a special offers page. It summarises the offers including cart 'bogof' and free shipping setups. When an offer expires it automatically drops from the list. The idea is that there is less maintenance needed to put offers up.</p> <p>So far so good, however, I would like to be able to edit this description field with the wysiwyg.</p> EDIT: <p>Here is what I came up with, thanks to the tips kindly given below...</p> <p>In app/design/adminhtml/default/default/layout/promo.xml</p> <p>After</p> <pre><code>&lt;adminhtml_promo_catalog_edit&gt; </code></pre> <p>I added:</p> <pre><code> &lt;update handle="editor"/&gt; </code></pre> <p>After</p> <pre><code>&lt;adminhtml_promo_quote_edit&gt; </code></pre> <p>I added the same 'editor' update layout handle xml tag.</p> <p>Note that this change is not part of an admin design override and will be lost next time an upgrade comes out.</p> <p>I then copied</p> <p>app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php to local and added:</p> <pre><code> protected function _prepareLayout() { Mage::log("Prepare Layout"); parent::_prepareLayout(); if (Mage::getSingleton('cms/wysiwyg_config')-&gt;isEnabled()) { $this-&gt;getLayout()-&gt;getBlock('head')-&gt;setCanLoadTinyMce(true); } } </code></pre> <p>I also copied app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php across to local.</p> <p>At the top of _prepareForm() I added:</p> <pre><code>$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')-&gt;getConfig(array('add_variables' =&gt; false, 'add_widgets' =&gt; false,'files_browser_window_url'=&gt;Mage::getSingleton('adminhtml/url')-&gt;getUrl('*/cms_wysiwyg_images/index'))); </code></pre> <p>And then updated the description field:</p> <pre><code> $fieldset-&gt;addField('description', 'editor', array( 'name' =&gt; 'description', 'label' =&gt; Mage::helper('catalogrule')-&gt;__('Details'), 'title' =&gt; Mage::helper('catalogrule')-&gt;__('Details'), 'style' =&gt; 'width: 50em; height: 20em;', 'config' =&gt; $wysiwygConfig, )); </code></pre> <p>I then did the same for the 'quote' forms, so my new forms in local are:</p> <p>app/code/local/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php app/code/local/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php app/code/local/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php app/code/local/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php</p> <p>This now works a treat.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload