• Resolved jaboli

    (@jaboli)


    Hi all.after I installed Dokan Pro plugin there is problem in editor tools on new post and new products this is the file dokan-tmc-button.js that has problem

    jQuery(document).ready(function($) {
    
        tinymce.create('tinymce.plugins.dokan_button', {
            init : function(editor, url) {
                    var menuItem = [];
                    var ds_img = dokan_assets_url +'/images/D.png';
                    $.each( dokan_shortcodes, function( i, val ){
                        var tempObj = {
                                text : val.title,
                                onclick: function() {
                                    editor.insertContent(val.content)
                                }
                            };
    
                        menuItem.push( tempObj );
                    } );
                    // Register buttons - trigger above command when clickeditor
                    editor.addButton('dokan_button', {
                        title : 'Dokan shortcodes', 
                        classes : 'dokan-ss',
                        type  : 'menubutton',
    //                    text  : 'Dokan',
    //                    image : dokan_assets_url +'/images/D.png',
                        menu  : menuItem,
                        style : ' background-size : 18px; background-repeat : no-repeat; background-image: url( '+ ds_img +' );'
                    });
            },   
        });
    
        // Register our TinyMCE plugin
    
        tinymce.PluginManager.add('dokan_button', tinymce.plugins.dokan_button);
    });

    also there is another problem on console that is
    load-scripts.php

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @jaboli,

    Please update your Dokan Plugin to the latest version v2.8.1, It will resolve the issue. Check and let me know the update ??

    Even after I update it to 2.8.1 it is not working. I think it is an issue with Pro version. So i made a temporary solution. Below is the code. put it inside your functions.php

    function dk_shortcode_script($shortcodes){
    
        define('DOKAN_SHORTCODES', $shortcodes);
        
        ?>
        <script>
            var dokan_assets_url = <?php echo json_encode( DOKAN_PRO_PLUGIN_ASSEST ) ?>;
            var dokan_shortcodes = <?php echo json_encode( DOKAN_SHORTCODES ) ?>;
        </script>
        <?php
    
        return $shortcodes;
    }
    add_filter('dokan_button_shortcodes', 'dk_shortcode_script', 10, 1);
    add_action('admin_head', 'dk_shortcode_script');

    remove this once the plugin fixed this.

    you may be confused with why there is a need of “dokan_shortcodes” variable. after fixing the “dokan_assets_url” it says “dokan_shortcodes is undefined.” so i have used their filter of shortcodes and set it up to a variable.

    • This reply was modified 6 years, 10 months ago by achchu93.

    @ahamed Arshad
    Thank you so much! I was having this problem for some time now…
    And I was so lazy to investigate it. I fixed the assets url but “shortcodes” error was killing me.
    I thought it is a conflict with “Tinymce advanced” plugin or tinymce itself.

    The code above solved my problem.

    Hello @achchu93

    Thank you so much.. It’s working fine now.

    @roshni07 Is there any updated in the dokan pro plugin for fixing this issue?

    Please do let us know if you have fixed this issue.

    Thanks

    Hello @ajayghaghretiya1,

    The is already fixed with the update of the plugins. Also in pro. But I am unable to discuss on the pro feature here. Feel free to contact here.

    Thanks ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ReferenceError: dokan_assets_url is not defined’ is closed to new replies.