Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • forhair Friend
    #1019775

    Hi, when i click on extended fields it shows the results page but ajax keeps loading…i am getting a js error as well.(see scrrenshots)


    1. Screen-Shot-2017-03-19-at-2.02.22
    forhair Friend
    #1020113

    Hi, when i click to filter with extended fields it loads and shows the results page but ajax stay and keeps loading …i am getting a js error as well.(see screenshots)


    1. Screen-Shot-2017-03-19-at-2.02.22-1
    Saguaros Moderator
    #1020146

    Hi @forhair,

    You can share the credentials of your site ( URL, Admin + FTP account), we will take a look.

    Regards

    forhair Friend
    #1020166
    This reply has been marked as private.
    forhair Friend
    #1020623

    ??????

    Mo0nlight Moderator
    #1020805

    Hi,

    I tried to access thru your site but could not find the page you’re using JA K2 Filter, could you send me URL of that page?

    forhair Friend
    #1021032
    This reply has been marked as private.
    Mo0nlight Moderator
    #1021465

    Hi.

    It’s seem your site had cache plugin. I could not edit.
    You could try edit the file :
    modules/mod_jak2filter/assets/js/jak2filter.js

    Look for

    if(typeof(jQuery.fn.highlight) == 'function') {

    Change to

    if(typeof(jQuery.fn.highlight) == 'function' && searchword != undefined) {
    forhair Friend
    #1021694

    thanks, seems like fix it. will it override in next update?
    also, i have a problem were the k2 links for this category are not what i want and do not include the category in the URL (using sh404sef)
    is there a chance i can replace the k2 filter with the mega filter that can be used on joomla content?

    Mo0nlight Moderator
    #1022386

    Hi,

    Don’t worry, the fix will be included in the next update.

    With the sh404sef extension, unfortunately JA K2 Filter is not compatible with it at this moment.

    You can using both JA K2 Filter and Mega Filter at the same time.

    forhair Friend
    #1086087

    Hi , i upgraded again and the js error is showing again, looks like a cache issue again although the code in the js file is the same as your second line fix…here is the error:
    "TypeError: undefined is not an object (evaluating ‘cache[data]’)"
    pointing to this code line:
    if (cache[data]) {

    Can you please help me ASAP!!!

    Saguaros Moderator
    #1086262

    Hi,

    I’ve shared with the developer for further checking on this, pls stay tuned.

    Saguaros Moderator
    #1086270

    Hi,

    It due to the override layout of template, it’s not up-to-date with the core module of this extension: jak2filter/tmpl/default.php

    We updated for you and it’s working now, kindly check.

    Regards

    forhair Friend
    #1086303
    This reply has been marked as private.
    Saguaros Moderator
    #1086412

    Hi,

    We added the JS script at the end of this file: root/templates/(your_default_template)//html/mod_jak2filter/default.php

    <script type="text/javascript">
        /*<![CDATA[*/
    
        var $required_fields<?php echo $module->id; ?> = <?php echo $required_fields; ?>;
        var $required_warning = "<?php echo JText::_('JAK2_REQUIRED_WARNING'); ?>";
        var $cache<?php echo $module->id ?> = {};
        //validate date function
        function isDate(txtDate) {
            var reg = /^(\d{4})([\/-])(\d{1,2})\2(\d{1,2})$/;
            return reg.test(txtDate);
        }
    
        //validate startdate and enddate before submit form
        function validateDateRange(obj) {
            var from, to, field;
            obj = jQuery(obj);
    
            if (isDate(obj.val())) {
                obj.removeClass('date-error');
            } else {
                obj.addClass('date-error');
                return;
            }
    
            field = obj.data('field');
            if (obj.hasClass('k2datefrom')) {
                from = obj;
                to = jQuery('.k2dateto[data-field="'+field+'"]');
            } else if (obj.hasClass('k2dateto')) {
                from = jQuery('.k2datefrom[data-field="'+field+'"]');
                to = obj;
            } else {
                return;
            }
            <?php if($auto_filter): ?>
            if (from.val() && to.val()) {
                jQuery('#<?php echo $formid; ?>').trigger('filter.submit'); 
            }
            <?php endif; ?>
        }
    
        // calculate clear both horizontal layout.
        function horizon_calculate<?php echo $module->id; ?>() {
            var $ja_column = <?php echo $params->get('ja_column'); ?>;
            var $ja_columnw = '';
            <?php if($ja_stylesheet == 'horizontal-layout' && $params->get('ja_column') && $params->get('ja_column') > 0){ ?>
            $ja_columnw = 'width:<?php echo round(100/$params->get("ja_column"),2) ?>%;';
            <?php } ?>
    
            jQuery('#jak2filter<?php echo $module->id;?> > li').each(function($j){
                var $style='';
                var $clear='';
                $ja_column=parseInt($ja_column);
                var sum = $j % $ja_column;
                if ($ja_column > 0 && sum == 0) {
                    $clear = "clear:both;";
                }
                if ($ja_column || $clear!="") {
                    $style = $ja_columnw + $clear;
                }
                if (!jQuery(this).hasClass('last-item'))jQuery(this).attr('style', $style);
            });
        }
    
        jQuery(document).ready(function () {
            jQuery('#ja-extra-field-accordion-<?php echo $module->id;?>').find('.ui-accordion-disabled.ui-state-disabled').each(function(){
                if (jQuery(this).next().find('.chzn-container.chzn-container-single').length)
                    jQuery(this).next().find('.chzn-container.chzn-container-single').attr('style', 'width:auto;');
            });
    
            jQuery('.fsname').each(function () {
                jQuery(this).text(jQuery('#jak2filter<?php echo $module->id;?>').find('option[value=' + jQuery(this).text() + ']').text());
            });
    
            jQuery("#jak2filter<?php echo $module->id;?>").sortable({
                itemSelector: "li.fssorts",
                handle: ".title",
                onDrop: function ($item, container, _super, event) {
                    $item.sortable('enable');
                    _super($item, container);
                    <?php if($ja_stylesheet == 'horizontal-layout' && $params->get('ja_column') && $params->get('ja_column') > 0){ ?>horizon_calculate<?php echo $module->id; ?>();<?php } ?>
                   <?php if($auto_filter): ?> jQuery('#<?php echo $formid; ?>').trigger('filter.submit'); <?php endif; ?>
                }
            });
    
            jQuery('#jak2filter<?php echo $module->id;?> #ordering').change(function () {
                if (jQuery(this).val() && !jQuery('#jak2filter<?php echo $module->id;?>').find('li[data-of=' + jQuery(this).val() + ']').length) {
                    var strout = '';
    
                    if (jQuery.inArray(jQuery(this).val(), ['zelevance', 'best', 'modified', 'publishUp', 'zdate', 'featured']) === -1) {
                        strout = '<div class="group-controls">'+
                            '<div class="controls">'+
                                '<input <?php if($auto_filter): ?>onclick="jQuery(\'#<?php echo $formid; ?>\').trigger(\'filter.submit\');"<?php endif; ?> type="radio" checked="" name="orders[' + jQuery(this).val() + ']" value="' + jQuery(this).val() + '" /><p class="ascending"><?php echo JText::_("JAK2ASC"); ?></p>'+
                            '</div>';
                        if (jQuery.inArray(jQuery(this).val(), ['adate']) === -1)
                            strout += '<div class="controls">'+
                                '<input <?php if($auto_filter): ?>onclick="jQuery(\'#<?php echo $formid; ?>\').trigger(\'filter.submit\');"<?php endif; ?> type="radio" name="orders[' + jQuery(this).val() + ']" value="r' + jQuery(this).val() + '" /><p class="decrease"><?php echo JText::_("JAK2DESC"); ?></p>'+
                            '</div>';
                        strout += '</div>';
                    } else {
                        strout = '<div class="group-controls"><div class="controls"><input <?php if($auto_filter): ?>onclick="jQuery(\'#<?php echo $formid; ?>\').trigger(\'filter.submit\');"<?php endif; ?> type="radio" checked="checked" name="orders[' + jQuery(this).val() + ']" value="r' + jQuery(this).val() + '" /><p class="decrease"><?php echo JText::_("JAK2DESC"); ?></p></div></div>';
                    }
                    jQuery(this).parents('li').after('<li class="fssorts" style="<?php echo $ja_column; ?>" data-of="' + jQuery(this).val() + '"> ' +
                        '<div class="subclass">'+
                            '<div class="title" style="cursor:move"><h6>' + jQuery(this).find('option:selected').html() + '</h6></div>' +
                            strout+ 
                            '<div class="controls"><button type="button" class="delete" onclick="jQuery(this).parents(\'li\').remove();<?php if($auto_filter): ?>jQuery(\'#<?php echo $formid; ?>\').trigger(\'filter.submit\');<?php endif; ?>"><?php echo JText::_("JAK2DELETE"); ?></button></div>'+
                        '</div>'+
                    '</li>');
                }
                jQuery(this).val('').trigger("liszt:updated");
                <?php if($ja_stylesheet == 'horizontal-layout' && $params->get('ja_column') && $params->get('ja_column') > 0){ ?>horizon_calculate<?php echo $module->id; ?>();<?php } ?>
                <?php if($auto_filter): ?>
                    // if auto_filter we submit form.
                    jQuery('#<?php echo $formid; ?>').trigger('filter.submit');
                <?php endif; ?>
            });
    
            if ( jQuery.browser.msie ) {
                jQuery('#searchword<?php echo $module->id;?>').on('keyup', function(event) {
                    var keycode = event.keyCode ? event.keyCode : event.which;
                    if(keycode == 13 ) {
                        jQuery('#<?php echo $formid; ?>').trigger('filter.submit')
                    }
                });
            }
    
            function resetChildren($current, $next) {
                if ($next) {
                    var $data = $jak2depend[parseInt($next.data('exfield'))][$current.val()];
                    if ($data != undefined && $data != 'undefined') {
                        $next.html('');
                        $next.append('<option value="">'+$next.data('extitle')+'</option>');
                        for (var i=0;i<$data.length;i++) {
                            $next.append('<option value="'+$data[0]+'">'+$data[1]+'</option>');
                        }
                        $next.chosen("destroy").chosen();
                    } else {
                        $next.html('');
                        $next.append('<option value="">'+$next.data('extitle')+'</option>');
                        $next.chosen("destroy").chosen();
                    }
                    var $_next = '#K2ExtraField_'+$next.data('exfield')+'_'+(parseInt($next.data('dependlv'))+1);
                    if (jQuery($_next).length) resetChildren($next, jQuery($_next));
                }
            }
    
            jQuery('#jak2filter<?php echo $module->id;?> .jak2depend').change(function() {
                var elm, dependlv, exfield, autofield, $next, $prev, $ar, moduleid, dependarray, dependtxt, form;
                elm  = jQuery(this);
                dependlv = elm.data('dependlv');
                exfield = elm.data('exfield');
                autofield = elm.data('autofield');
                moduleid = <?php echo $module->id;?>;
                $next = jQuery('#jak2filter'+moduleid+' #K2ExtraField_'+exfield+'_'+(dependlv + 1));
                if ($next.length) resetChildren(elm, $next);
    
                dependarray = jQuery('#jak2filter'+moduleid+' #xf_'+ exfield +'_array');
                dependarray.val('');
    
                jQuery('#jak2filter<?php echo $module->id;?> .jak2depend[data-exfield="'+exfield+'"]').each(function(){
                    $ar = dependarray.val();
                    if (jQuery(this).val() != '')
                        $ar += jQuery(this).val()+',';
                    dependarray.val($ar);
                });
    
                dependtxt = jQuery('#jak2filter'+moduleid+' #xf_'+exfield+'_txt');
                dependtxt.val(elm.val());
    
                if (elm.val() == '') { // get the prev value if choose no value at current.
                    $prev = jQuery('#jak2filter'+moduleid+' #K2ExtraField_'+exfield+'_'+(dependlv-1));
                    if ($prev.length) {
                        dependtxt.val($prev.val());
                    }
                }
    
                <?php if($auto_filter): ?>
                form = jQuery('#<?php echo $formid; ?>')
                if (elm.data('autofield') == 'all') {
                    // always submit form if all defined.
                    form.trigger('filter.submit'); 
                } else if (dependlv == autofield) { 
                    // submit form at number defined
                    form.trigger('filter.submit');
                } else if (!$next.length) {
                    // if auto_filter and the last one choose we submit form.
                    form.trigger('filter.submit');
                }
                <?php endif; ?>
            });
    
            if (jQuery('#jak2filter<?php echo $module->id;?>').find('#category_id').length) {
                jak2DisplayExtraFields(<?php echo $module->id;?>, jQuery('#jak2filter<?php echo $module->id;?>').find('#category_id'), <?php echo $selected_group; ?>);
            }
    
            <?php if($auto_filter): ?>
            var f = jQuery('#<?php echo $formid; ?>');
            f.find('input').each(function () {
                var el = jQuery(this);
                el.on('change', function () {
                    if (el.hasClass('k2datefrom') || el.hasClass('k2dateto') || el.hasClass('date-error')) return; // handle date range on other place
    
                    jQuery('#<?php echo $formid; ?>').trigger('filter.submit');
                });
            });
            f.find('select').each(function () {
                var el = jQuery(this);
                el.on('change', function () {
                    if (el.hasClass('jak2depend') || el.attr('id') == 'ordering') {
                        // handle change depend filter and ordering on other place
                        return;
                    }
                    if (el.attr('id') == 'dtrange' && el.val() == 'range') {
                        var sDate = jQuery('#sdate_<?php echo $module->id; ?>');
                        var eDate = jQuery('#edate_<?php echo $module->id; ?>');
                        if (sDate.val() & eDate.val()) {
                            if (isDate(sDate.val())) {
                                sDate.removeClass('date-error');
                            } else {
                                sDate.addClass('date-error');
                                return;
                            }
    
                            if (isDate(eDate.val())) {
                                eDate.removeClass('date-error');
                            } else {
                                eDate.addClass('date-error');
                                return;
                            }
    
                            if (sDate.val() && eDate.val()) {
                                jQuery('#<?php echo $formid; ?>').trigger('filter.submit');
                            }
                        }
                    } else {
                        jQuery('#<?php echo $formid; ?>').trigger('filter.submit');
                    }
                });
            });
            f.find('textarea').each(function () {
                var el = jQuery(this);
                el.on('change', function () {
                    jQuery('#<?php echo $formid; ?>').trigger('filter.submit');
                });
            });
            <?php endif; ?>
    
            <?php if($ajax_filter): ?>
            jQuery('#<?php echo $formid; ?>').on('filter.submit', function () {
                var $check = checkrequired($required_fields<?php echo $module->id; ?>, "<?php echo $formid; ?>");
                if ($check == true) {
                    jak2AjaxSubmit(this, '<?php echo JURI::root(true).'/'; ?>', $cache<?php echo $module->id ?>);
                    <?php if($share_url): ?>
                    jak2GetUrlSharing(this);
                    <?php endif; ?>
                } else {
                    var top = jQuery('#<?php echo $formid; ?>').find('.jak2-error:visible').first().offset().top - 100;
                    jQuery("html, body").animate({scrollTop: top});
                    return false;
                }
            });
    
            if (jQuery('#k2Container')) {
                jak2AjaxPagination(jQuery('#k2Container'), '<?php echo JURI::root(true).'/'; ?>', $cache<?php echo $module->id ?>, $cache<?php echo $module->id ?>);
                <?php if($share_url): ?>
                jak2GetUrlSharing('#<?php echo $formid; ?>');
                <?php endif; ?>
            }
    
            <?php else: ?>
            jQuery('#<?php echo $formid; ?>').on('filter.submit', function () { 
                var $check = checkrequired($required_fields<?php echo $module->id; ?>, "<?php echo $formid; ?>");
                if ($check == true) {
                    jQuery('#<?php echo $formid; ?>').submit();
                } else {
                    var top = jQuery('#<?php echo $formid; ?>').find('.jak2-error:visible').first().offset().top - 100;
                    jQuery("html, body").animate({scrollTop: top});
                    return false;
                }
            });
            <?php endif; ?>
        });
        /*]]>*/
    &lt;/script&gt;

    This overrides module in template so it will not be affected when you update new version of this component.

Viewing 15 posts - 1 through 15 (of 17 total)

This topic contains 16 replies, has 3 voices, and was last updated by  forhair 6 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum