Jump to content

[SOLVED] Add a file manager to prestashop


need4speed

Recommended Posts

From reading the instructions, it doesn't look very difficult. You could extract all the files into a kcfinder directory in the root of PrestaShop. You would then need to modify kcfinder/config.php and change line 64 from:

//'_tinyMCEPath' => "/tiny_mce",



to:

'_tinyMCEPath' => "/js/tinymce/jscripts/tiny_mce",



You would then need to add a parameter everywhere TinyMCE is called to link to the kcfinder directory. For example, to add the kcfinder to the "Home text editor v1.6" module, edit modules/editorial/editorial.php and add the following after line 133:

file_browser_callback: 'openKCFinder',



then add the following code before the closing script tag on line 163:

function openKCFinder(field_name, url, type, win) {
   tinyMCE.activeEditor.windowManager.open({
       file: '/kcfinder/browse.php?opener=tinymce&type;=' + type,
       title: 'KCFinder',
       width: 700,
       height: 500,
       resizable: "yes",
       inline: true,
       close_previous: "no",
       popup_css: false
   }, {
       window: win,
       input: field_name
   });
   return false;
}



I don't have time to actually test this though.

Link to comment
Share on other sites

Thanks for the tip but I think im doing something wrong since my home editorial page disappers

I have modified the editorial.php code tol:

       function tinyMCEInit(element)
       {
           $().ready(function() {
               $(element).tinymce({
                   file_browser_callback: 'openKCFinder',
                   // Location of TinyMCE script
                   script_url : \''.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js\',


                   // General options
                   theme : "advanced",
                   plugins : "safari,pagebreak,style,layer,table,advimage,advlink,inlinepopups,media,searchreplace,contextmenu,paste,directionality,fullscreen",
                   // Theme options
                   theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
                   theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor",
                   theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
                   theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,pagebreak",
                   theme_advanced_toolbar_location : "top",
                   theme_advanced_toolbar_align : "left",
                   theme_advanced_statusbar_location : "bottom",
                   theme_advanced_resizing : false,
                   content_css : "'.__PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/global.css",
                   width: "582",
                   height: "auto",
                   font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt",
                   // Drop lists for link/image/media/template dialogs
                   template_external_list_url : "lists/template_list.js",
                   external_link_list_url : "lists/link_list.js",
                   external_image_list_url : "lists/image_list.js",
                   media_external_list_url : "lists/media_list.js",
                   elements : "nourlconvert",
                   convert_urls : false,
                   language : "'.(file_exists(_PS_ROOT_DIR_.'/js/tinymce/jscripts/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en').'"
               });
           });
       }
       function openKCFinder(field_name, url, type, win) {
       tinyMCE.activeEditor.windowManager.open({
       file: '/kcfinder/browse.php?opener=tinymce&type;=' + type,
       title: 'KCFinder',
       width: 700,
       height: 500,
       resizable: "yes",
       inline: true,
       close_previous: "no",
       popup_css: false
   }, {
       window: win,
       input: field_name
   });
   return false;
}
       tinyMCEInit(\'textarea.rte\');



Can you maybe take a quick look to see what is wrong?

Link to comment
Share on other sites

  • 6 months later...

bonjour,

j'ai la meme problème aussi.
toute est bien en place juste lorsque je click sur l'image " double-click" URL de l'image ne se charge pas

mon dossier

editeur.html
dossier tinymce
dossier kcfinder

config.php

    

// THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION

  '_check4htaccess' => true,
 '_tinyMCEPath' => "tinymce/jscripts/tiny_mce",



editeur.html

<html >
<head>
<title>Full featured example</title>

<!-- TinyMCE -->
[removed][removed]
<!-- /TinyMCE -->
[removed]
tinyMCE.init({
   mode: "exact",
   elements: "elm1",
   theme: "advanced",
   plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
   theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
   theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
   theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
   theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
   theme_advanced_toolbar_location: "top",
   theme_advanced_toolbar_align: "left",
   theme_advanced_statusbar_location: "bottom",
   theme_advanced_resizing: true,
   style_formats: [
       {title: 'Bold text', inline: 'b'},
       {title: 'Red text', inline: 'span', styles: {color: '#ff0000'[spam-filter],
       {title: 'Red header', block: 'h1', styles: {color: '#ff0000'[spam-filter],
       {title: 'Example 1', inline: 'span', classes: 'example1'},
       {title: 'Example 2', inline: 'span', classes: 'example2'},
       {title: 'Table styles'},
       {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
   ],
   file_browser_callback: 'openKCFinder'
});

function openKCFinder(field_name, url, type, win) {
   tinyMCE.activeEditor.windowManager.open({
       file: 'kcfinder/browse.php?opener=tinymce&type;=' + type,

       title: 'KCFinder',
       width: 700,
       height: 500,
       resizable: "yes",
       inline: true,
       close_previous: "no",
       popup_css: false
   }, {
       window: win,
       input: field_name
   });
   return false;
}
[removed]



</head>
<body>

           <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

           </textarea>

</body>
</html>



merci de m'aider a résoudre cette problème

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...