Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 1 of 2
How to use FCKeditor with Magento
 
winzippy
Member
 
Avatar
Total Posts:  75
Joined:  2008-02-08
Fairport, NY, USA
 

First download FCKeditor and uploaded it to ./fckeditor/.

Next insert this code wherever you want to use it (using the replace textarea method)

<script type="text/javascript" src="path/to/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor'id_of_the_textarea_you_want_to_attach_fck_to' ) ;
oFCKeditor.BasePath "path/to/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>

I have FCKeditor attached to the CMS, Category, and Product pages. It works great! I still haven’t figured out how to resize it so you can see more of what you’re editing, but c’est la vie.

 Signature 

Ifolo Media

 
Magento Community Magento Community
Magento Community
Magento Community
 
dane.lowe
Jr. Member
 
Total Posts:  1
Joined:  2008-02-18
 

Try the following:

Look for \magento\skin\adminhtml\default\default\boxes.css

Replace

.columns .form-list td.value             { width:270pxpadding-right:5px}

With

.columns .form-list td.value             { width:270pxpadding-right:5px}
#page_tabs_main_section_content  td.value  { width:100%; padding-right:5px; }

Then, find your fckeditor.js and look for

this.Height            height        || '200' ;

Put a value like 800 in there instead.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nabuhonodozor
Member
 
Avatar
Total Posts:  38
Joined:  2008-03-27
 

Hi,
Could You please tell which files to modify to have cms, product and categories editable with wisywyg? I am trying to search all files for textarea field but I am afraid that Ill mess somethng up. It would be also great if you could post whole file to see how You’ve done it.
Best regards,
Piotr

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sean Yeomans
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2008-04-02
Winnipeg
 
winzippy - 02 April 2008 06:56 AM

I have FCKeditor attached to the CMS, Category, and Product pages. It works great! I still haven’t figured out how to resize it so you can see more of what you’re editing, but c’est la vie.

can you specifiy which files you threw this FCK code into? Can’t find athe specific files that draw the textboxes it seems

 Signature 

Sean Yeomans | visit my site

 
Magento Community Magento Community
Magento Community
Magento Community
 
warriorgov9791
Jr. Member
 
Total Posts:  6
Joined:  2008-04-08
Hawaii
 
Sean Yeomans - 10 April 2008 05:05 AM

can you specifiy which files you threw this FCK code into? Can’t find the specific files that draw the textboxes it seems

The Wiki will point you in the right direction - Wiki - WYSIWYG A How-to. See the “Where to insert it” section.

My question is how do I figure this part out?
‘id_of_element_where_you_want_to_attach_fckeditor’

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Member
 
Avatar
Total Posts:  75
Joined:  2008-02-08
Fairport, NY, USA
 

What i did was use FireBug (the most awesome Firefox extension EVAR) and inspected the text area. It gave the id.

For product editiing, you need the id’s to be “description” and “short_description.”

For category editing, it has to be “_generaldescription.

For CMS editing, use the following:

public function getElementHtml()
    
{
        
if( $this->getWysiwyg() === true )
        
{
            $element 
= ($this->getState() == 'html') ? '' $this->getHtmlId();
            
#############
            # EDIT
            #############
            
$html '
                <textarea name="'
.$this->getName().'" title="'.$this->getTitle().'" id="'.$this->getHtmlId().'" class="textarea '.$this->getClass().'" '.$this->serialize($this->getHtmlAttributes()).' >'.$this->getEscapedValue().'</textarea>
                <script type="text/javascript" src="http://www.coffeeriot.com/magento/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( "' 
$element .'" ) ;
oFCKeditor.BasePath = "http://www.coffeeriot.com/magento/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>'
;
            
#############
            # EDIT
            #############

 Signature 

Ifolo Media

 
Magento Community Magento Community
Magento Community
Magento Community
 
warriorgov9791
Jr. Member
 
Total Posts:  6
Joined:  2008-04-08
Hawaii
 

Thanks! Will pass the info on to my programming buddy and try it out.

Update:
Turned on the wysiwyg in the Main.php file - it works! Tried to re-size the textarea in the CSS file as suggested by the Wiki. For the first line, I tried #page_content .textarea required-entry. No change.

Here’s what I see in my source code:

<textarea name="content" title="Content" id="page_content" class="textarea  required-entry" title="Content" style="width: 98%; height: 600px;" type="wysiwyg" class=" required-entry" >

You’ve been great thus far, any more suggestions for this noob? Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tropikai
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2008-04-09
 

I dont understand where to put the code you wrote...Sorry...i’m totaly noob out here smile

 Signature 

Hidrorema.lt
Valymo priemonės
Jaukus kampas

 
Magento Community Magento Community
Magento Community
Magento Community
 
warriorgov9791
Jr. Member
 
Total Posts:  6
Joined:  2008-04-08
Hawaii
 
warriorgov9791 - 12 April 2008 04:13 PM

Update:
Turned on the wysiwyg in the Main.php file - it works! Tried to re-size the textarea in the CSS file as suggested by the Wiki. No change.

dane’s solution above worked for me! Width in .js file needed to be changed from percentage to absolute value in pixels.

Thanks guys! Will now try to add FCK to Manage Products page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
warriorgov9791
Jr. Member
 
Total Posts:  6
Joined:  2008-04-08
Hawaii
 

Update: Got FCKeditor attached to ‘description’ on products page. Would like to know exactly how to attach it also to ‘short_description’, please?

Mahalo & Aloha!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Member
 
Avatar
Total Posts:  71
Joined:  2008-05-08
China
 

I did it like this : (though it’s quite brutal)

....
var 
oFCKeditor = new FCKeditor'description' ) ;
oFCKeditor.BasePath "http://localhost/magento/js/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;

var 
oFCKeditor2 = new FCKeditor'short_description' ) ;
oFCKeditor2.BasePath "http://localhost/magento/js/fckeditor/" ;
oFCKeditor2.ReplaceTextarea() ;
....

By the way, does anyone know how to change the look of textarea in product , category, and CMS all in different ways ???
in the fckconfig , i defined the height to 600. it looks beautiful in CMS. but then, in product, and category it looks.... inappropriate.
It is awfully narrow there and long there.

i know from the page source :

<table cellspacing="0" class="form-list">
            <
tbody>
       

<
tr class="hidden">
    <
td class="label"><label for="description">Description <span class="required">*</span></label></td>

    <
td class="value"><textarea id="description" name="product[description]" class=" required-entry required-entry textarea" type="textarea" >blablabla</textarea></td>
    <
td class="scope-label">[STORE VIEW]</td>
        <
td><small></small></td>
</
tr>


<
tr class="hidden">
    <
td class="label"><label for="short_description">Short Description <span class="required">*</span></label></td>
    <
td class="value"><textarea id="short_description" name="product[short_description]" class=" required-entry required-entry textarea" type="textarea" >blablabla</textarea></td>

    <
td class="scope-label">[STORE VIEW]</td>
        <
td><small></small></td>
</
tr>
            </
tbody>
        </
table>
    </
fieldset>

so, anyone with deeper CSS maybe can help me with these?

Image Attachments
screenshot.JPG
 Signature 

Hope it helps ! And please share with us if it is ! Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Thice
Jr. Member
 
Total Posts:  3
Joined:  2008-05-18
 

In response to Yoke Lee’s post:

If you need to change width or height only, you can use some optional parameters for the FCKeditor() constructor:

var oFCKeditorMain = new FCKeditor"ds_main_content""100%""300px" );
var 
oFCKeditorCMS = new FCKeditor"ds_cms_content""100%""600px" );

The second parameter ist width, the third is height.

With best regards,
Andy

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Member
 
Avatar
Total Posts:  71
Joined:  2008-05-08
China
 

HEY!!  I SOLVE IT !!

notice the height and width ?

oFCKeditor.BasePath "http://localhost/magento/js/fckeditor/" ;
oFCKeditor.Height "300";
oFCKeditor.Width "500";
oFCKeditor.ReplaceTextarea() ;

This way we can do every customization without changing CSS ! Hahaha…
How foolish I am… actually, I got the whole code while implementing the FCK in one of these forum, but I forgot from who… LOL

 Signature 

Hope it helps ! And please share with us if it is ! Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Member
 
Avatar
Total Posts:  71
Joined:  2008-05-08
China
 
Thice - 19 May 2008 01:56 AM

In response to Yoke Lee’s post:

If you need to change width or height only, you can use some optional parameters for the FCKeditor() constructor:

var oFCKeditorMain = new FCKeditor"ds_main_content""100%""300px" );
var 
oFCKeditorCMS = new FCKeditor"ds_cms_content""100%""600px" );

The second parameter ist width, the third is height.

With best regards,
Andy

Hey thanks Andy!
I’ll try that !

Know more methods is never a disadvantage,rite?

 Signature 

Hope it helps ! And please share with us if it is ! Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
I'm Done
Member
 
Total Posts:  32
Joined:  2008-05-08
 

I’ve added this element as described, but now I get a wierd pop-up error when creating a new product (Add Product page) the message says..

Error: The TEXTAREA with id or name set to “description” was not found.

Then I click OK and it goes to the normal Create Product Settings page. Then upon creating a new product, that new field with the FCKeditor has text in it, however upon trying to save the newly created product, a red message at the bottom of that text field pops up and says: This is a required field. ..and won’t let me save the product. Anybody experiencing this or know why it’s doing this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Member
 
Avatar
Total Posts:  71
Joined:  2008-05-08
China
 

Yeah, i’m having the same problem.

However, it works well within edit product.

 Signature 

Hope it helps ! And please share with us if it is ! Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53144 users|474 users currently online|107144 forum posts