Ajax load of Category Slider modules not working after update

  • Posts: 5
  • Thank you received: 0
6 years 7 months ago #291058

-- HikaShop version -- : Business: 3.4.0
-- Joomla version -- : 3.8.6
-- PHP version -- : 7.0
-- Browser(s) name and version -- : Chrome 65.0.3325.181
-- Error-message(debug-mod must be tuned on) -- : none

Hello

We use Hikashop for our clients site and we load category modules in an overlay via ajax when user clicks on a main menu item.
This works fine on the desktop version of the site and originally worked well in the iOS (tablet) version of the site until recently updating Hikashop.
The code we use for this is:

//Overlay categories Script (AJAX)		
			

    function loadContent(target, myurl, selector) {

        jQuery(target).fadeOut('fast', function() {

            showLoader();

            jQuery.ajax({
                url: myurl,
                success: function(data,status,jqXHR) {
                    jQuery(target).html(jQuery(data).find(selector).addBack(selector).children())
                    .fadeIn('fast', hideLoader());
                }
            });

        });
    }
    //Get URL and use loadContent to populate overlay
    
       jQuery('a').on('click', function() {
        if (jQuery(this).hasClass("overlay")) {
            if (jQuery(this).hasClass("accordeonck")) {
            
        } else {
		jQuery('#overlay').append('<div id="ovcontent"></div>');
		jQuery('header').fadeOut('normal');
	jQuery('#overlay').fadeIn(900);
    jQuery('#closeova').fadeIn(900);
		  jQuery('#ovcontent').fadeOut('fast',loadContent);
    jQuery('#load').remove();
      var myURL = jQuery(this).attr('href');
    console.log(myURL);
        loadContent( '#ovcontent', myURL, '#contentarea' );
		jQuery('html,body').animate({scrollTop:0},900);
        return false;
        } 
        
    }

 });
    function showLoader() {
        jQuery('#load').remove();
        jQuery('#ovcontent').append('<span style="color:#fff;" id="load">LOADING...</span>').fadeIn('normal');
    }

    function hideLoader() {
        jQuery('#load').fadeOut('normal');
		
    }

	
	jQuery('#closeova').click(function(){
			 
			 jQuery('#overlay').fadeOut(900);
			 jQuery('#ovcontent').remove();
		jQuery('header').fadeIn('normal');
		 });
Currently we are hiding this code from iOS using a PHP if HTTP_USER_AGENT statement as when it runs in iOS it just shows a blank page with no errors in console( the modules do not seem load) however loading any other content this way ( content page or other module) it works fine...e.g. see the privacy policy.

Interestingly If I hardcode a url in place of the myURL variable here it loads the modules ok in iOS: loadContent( '#ovcontent', myURL, '#contentarea' );

But logging myURL to console shows the same result!!?

Just hoping someone could shed some light as to why this stopped working after recent updates to hikashop and if there is a fix for it?
Really hoping I can get someone to take a look as I have tried everything I can think of.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 7 months ago #291072

Hi,

If it still works with other browsers, I don't think that it is linked to the update.
You must have had the issue before but only realised you had it when you tested your website after the update.
It's more likely that the issue comes from some arcane javascript/jQuery which doesn't work properly with that browser.
You could potentially install an older version of HikaShop to see if you still have the issue or not.

Also, if you want others to be able to help with a javascript issue, it would be great to setup a copy of the website where they can replicate the issue. Then, you can post it on stackoverflow. I'm sure someone who knows javascript and jquery a lot better that me would be able to help you there.

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum