The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Conflict between FoxyCart scripts and MODx's QuickEditor scripts

intandemintandem Member
in Bugs & Feature Requests edited April 2011
I seem to have a conflict in the head code between various scripts and am completely stuck. All help is really appreciated! Basically, on any page which as FoxyCart scripts in the head, I get a black page with a bit of a white dot-type icon sticking out in the top left as soon as I want to call the QuickEditor.

The script bits are as follows (there is an accordion script in there too as well as Google Analytics - and the last javascript library call is created by the QuickEditor and is followed by all the rest of the script call which is too long to add here):
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>;
<script type="text/javascript" src="assets/js/ddaccordion.js"></script>
<!-- BEGIN FOXYCART FILES -->
<link rel="stylesheet" href="http://static.foxycart.com/scripts/colorbox/1.3.16/style5_fc/colorbox.css"; type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
		var colorbox_width = "800px";
</script>
<script src="http://cdn.foxycart.com/sourcesligo/foxycart.complete.2.js"; type="text/javascript" charset="utf-8"></script>
<!-- END FOXYCART FILES -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-10547295-30']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 300, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "slow", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}

})
</script>
<script src="http://www.carolincollins.com/source/assets/js/jquery-1.4.4.min.js"; type="text/javascript"></script>
Comments
  • lancelance Member, Community Support Member
    @intandem -

    I know I mentioned the duplicate jquery load in a previous thread, and it looks like you've already corrected that. From the code you have posted above, it appears that there may be similar issue, as I see jQuery loading multiple times.

    Can you check to make sure you are loading it only once while logged in and see if that fixes anything?

    Lance
  • intandemintandem Member
    edited April 2011
    Same thing is still happening I'm afraid. Yes, the QuickEditor calls it's own JQuery (which I dont think I have any control over) but I am using Foxycart on another site (www.celticpress.ie) and I don't experience this problem there with the QuickEditor. Only difference is that it's an older site using 1.3.2 in both calls whereas this site here is using 1.4.4 both times.
  • My error console is telling me the following

    Screenshot-4.png
  • lancelance Member, Community Support Member
    @intandem -

    In the code you posted above, I see jQuery 1.4.2 and 1.4.4 loading. Since I obviously can't login and see this issue, can you just double/triple check and make certain that you're loading jQuery 1.4.4 only one time.

    When you load your page, FoxyCart automatically inserts a colorbox overlay on the page. By default, this is hidden, but it sounds like, somehow, a conflict is causing the overlay to always display.

    Lance
  • And this is what I am getting on the screen:

    Screenshot-5.png
  • The above code is from before I removed the extra 1.4.2 JQuery call.

    1.4.4 is called twice due to the QuickEditor, however this is happening also on the other site but not causing any problems there?
  • intandemintandem Member
    edited April 2011
    The issue, then, appears to be that MODx is using Colorbox for its QuickEditor, and FoxyCart is using Colorbox for the cart. The result - conflict. When you try to call the QuickEditor, it is displaying the (hidden) FoxyCart overlay, which pretty well blocks out everything else. And, previously, when you loaded the cart, the last-defined values for the cart box were being used. When you were logged in, those would have been the images. So, as it turns out, these two issues are probably directly related.

    I will check in the MODx forums if I can edit any of the QuickEditor settings and will post back. Thanks!

    As an alternative, can I somehow switch back to the older Thickbox for FoxyCart instead of the Colorbox?
  • intandemintandem Member
    edited April 2011
    Just bumping that to see whether I can use Thickbox instead of Colorbox? If this is really what is causing the clash, isn't that of serious consequence to a MODx Evo 1.0.5/FoxyCart 0.7 implementation in general as QuickEditor is a core plug-in?
  • lancelance Member, Community Support Member
    @intandem -

    I can say with almost absolute certainty after exploring this issue that the cause is the multiple colorbox uses. You should be able to get it to work with some tweaks to the code. FoxyCart doesn't require that you use ColorBox - you are free to use any (or no) modal box of your choice. Check out this link for more info:

    http://wiki.foxycart.com/v/0.7.0/customizing/cart/colorbox#not_using_the_default_colorbox

    You are definitely correct that this is a pretty significant thing for an implementation of this kind. That said, ColorBox is a freely available tool and it is just by coincidence, it would seem, that both MODx and FoxyCart have chosen to use it.

    Lance
  • brettbrett FoxyCart Team
    Just bumping that to see whether I can use Thickbox instead of Colorbox? If this is really what is causing the clash, isn't that of serious consequence to a MODx Evo 1.0.5/FoxyCart 0.7 implementation in general as QuickEditor is a core plug-in?

    So... correct me if I'm wrong, but this issue is _only_ related to QuickEditor, which is _only_ loaded if you're logged into the manager in Evo, right?

    My take is this: When you're previewing a site to make sure it works, you should preview it as if you were a normal user. QuickEditor loading definitely is not the experience a normal user would have, so I always preview in a separate browser from the one I'm logged into the manager with.

    That said, I'd imagine it wouldn't be too tricky to edit the QuickEditor code to comment out the extra jQuery or Colorbox call that it loads, but I don't have an install of Evo that I can mess with at the moment.

    Yes? Or am I missing something?
Sign In or Register to comment.