I need to use jquery in my Magento store. I’ve managed to let both prototype and jquery of my extension work alongside. But the problem is I am using two third party extensions. Both have their own jquery files to include. Now prototype of Magento and two additional jquery files are making a mess of my store. Is there any way to use one jquery file for both extensions. I have tried using the latest jquery version but neither extension works with that version. I am out of options and ideas here. Can anyone tell me how can i make this work?
I tried removing the script blocks. But it generates more errors. I have one extension that displays product images in a lightbox from product list page. This extension uses jquery-1.7.2.min. version. The other is a call for price extension which uses jQuery v1.4.2 version. I removed the one from call for price extension’s xml and added a jQuery v1.8.2 version in page.xml. So both the extensions can use it. It now generates these errors:
TypeError: $(document).ready is not a function
$(document).ready(function() {
This code is written in my list.phtml file.
$(document).ready(function() {
var curUrl = "<?php echo $this->getUrl('contacts/index/reseturl/') ?>";
$("#selCat").change(function(){
$.ajax({
type: "POST",
data: "catUrl=" + $("#selCat").val(),
url: curUrl,
dataType: "text",
success: function(response){
//alert(response);
window.location.replace(response);
}
});
});
});
Hey I’ve found a solution for my problem for now. I combined the two jquery files of my two third party extensions into one so now for both of them I include only one file. There was still the conflict between that file and the default prototype.js. So what i did was added
on the top of my product view file view.phtml which released the use of $ from the jquery code to prototype. And all is working as it should now. Thanks for all who replied to me and I hope my solution works for someone else.