K2 nivoSlider stops working when Hikashop is on

  • Posts: 4
  • Thank you received: 0
11 years 11 months ago #45416

I have just installed a new template on a fresh Joomla 2.5 install. The template uses K2 extension heavily.

The template I installed works fine and this template has a K2 Slider (nivoSlider sub-template) on the top of the Home page just under the Main Menu. The slider (banner slide show under menu) was working fine until I installed the HikaShop Joomla extension and created a new Menu item in the Main Menu called Shop. This menu item simply points to the HikaShop product Listing menu item.

Now the slider will not load any images and doesn't work. If I looked at the javaScript errors there is only one related to the slider, this error says:

" Unable to get value of the property 'nivoSlider': object is null or undefined"

and this error happens on this line of code:

var $slider_ul_id = $('#slider'); //Please define slider items list ID
$slider_ul_id.nivoSlider({ //// …..error happens here as $slider_ul_id is Null

If I disable the menu item 'Shop' from the main menu then the slider will work again. Somehow the HikaShop and K2 JavaScript are interfering with each other. If I look at the page source code the only difference between having the Hikashop menu enabled and disabled is that it loads a Hikashop.js file in the enabled mode. So this Hikashop.js is somehow interfering with the nivoSlider.js. If I rename the nivoSlider.js to nivoSlider1.js on my host so it doesn't load with the page due to spelling mistake then the slider works. So this proves to me that the nivoSlider.js is causing the issue.

I have a feeling it maybe related to the order in which the js files are being loaded and executed but I am no expert and this is only a hunch. I have been scratching my head now for 2 days and can't seem to make any progress, I am hoping someone here can help. I also contacted the template supplier for help and I am still waiting for their reply.

The site is lyricaldesign.com.au/ld/ and I left the Shop menu item enable so you can see the slider not loading under the Main Menu. Any suggestions on how to get around this issue?

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

  • Posts: 4
  • Thank you received: 0
11 years 11 months ago #45423

I have been trying to fix this on my own and I am getting somewhere. I found that in the Hikashop.js file if I remove the below function everything works:

if (typeof(jQuery) != "undefined") {
if (typeof(jQuery.noConflict) == "function") {
jQuery.noConflict();
}
}

Does anyone know what is this function for and is it safe to remove it?

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
11 years 11 months ago #45427

Did you try to use jquery easy es explained here:
www.hikashop.com/en/support/documentatio...ty-issues.html#modal

That code is there to avoid other js libraries to break mootools code so that the javascript of HikaShop can work.
If you remove it, some features of HikaShop might not work properly like the edition of the address on the front end.

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

  • Posts: 4
  • Thank you received: 0
11 years 11 months ago #45441

Thanks for the suggestion Nicolas, I installed the jQuery Easy and enabled it but nothing changed. Still having the problem.

The issue is on this line var $slider_ul_id = $('#slider');

If I can somehow can find where this bit of javaScript is coming from in my template I could replace it with:

var $slider_ul_id = jQuery('#slider'); This might fix my problem. But I looked for hours and couldn't find the file where it is coming from.

When I was stepping thru the code, the noConflict() call from the Hikashop took place first and before the Slider script executed. I am thinking if there is a way to get the Hikashop script to run after (at the end) this might be another solution. Again I am no coding expert and I could be talking nonsense.

I have been struggling with this for the last 3 days, 5 hours a day, and I am running out of idea.Can you suggest anything else?

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
11 years 11 months ago #45472

From what I can see here www.templatemonster.com/help/joomla-2-5-...ork-with-slider.html it's the file html\mod_k2_content\nivo_slider\default.php which displays that javascript. Changing it there should indeed avoid the problem.

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

  • Posts: 4
  • Thank you received: 0
11 years 11 months ago #45516

Thanks Nicolas for taking the time to locate the script, the HTML file with the javaScript is where you said.

By the way I did some testing with the noConflict() removed from the HikaShop.js file and did not see any performance issues with HikaShop.

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
11 years 11 months ago #45553

That doesn't create any performance issue.
However, when removed it can break the javascript of HikaShop when other extensions don't write proper javascript. That's why we have it.

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

Time to create page: 0.048 seconds
Powered by Kunena Forum