I've been playing around with this module for a while now, and I can't get it to work. From the moment I enabled the module I keep getting 2 JS errors. See below
'form.ajaxSubmit is not a function' [Break on this error] success: function(data) {uc_aac.js?F (line 8)
'$(".add-to-cart").uc_aac_attach is not a function' [Break on this error] $('.add-to-cart').uc_aac_attach();
I just updated to the latest version of jQuery today (1.4.4) not sure if that has something to do with it.
My ubercart installation is rather stock, nothing fancy and product node's all have #node-id's etc. I ran the php update fix for php 5.3 and that didn't make a difference.
whatever the issue is, it appears purley JS related. I don't have any other custom JS running on the page so I'm confused.
Does anyone have any ideas?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | uc_aac.970634.5.patch | 1013 bytes | twod |
Comments
Comment #1
cyu commentedPlease try the dev version (or 6.x-2.1 when it becomes available) of the module and report back if that fixes the issue.
Comment #2
di19026 commentedHaving this issue as well- I've installed 6.x-2.1 (earlier version never worked either).
I am getting the errors-
/sites/all/modules/uc_aac/uc_aac.js?H:23 TypeError: Result of expression 'form.ajaxSubmit' [undefined] is not a function.
/sites/all/modules/uc_aac/uc_aac.js?H:37 TypeError: Result of expression '$('.uc-aac-cart').ucAacAttach' [undefined] is not a function.
I have products that are T-Shirts with Color & Size attributes. Some colors are available in one size or more, some are not. Both attributes are pop-up menus that need to be updated to show/allow the correct combinations.
Comment #3
cyu commentedAre you missing misc/jquery.form.js in your Drupal install? I believe that is where ajaxSubmit is defined. Do you have javascript aggregation turned on? If so, can you try turning it off and seeing if that fixes anything?
Comment #4
di19026 commented>Are you missing misc/jquery.form.js in your Drupal install?
No, "misc/jquery.form.js" is there.
>Do you have javascript aggregation turned on?
No, "Optimize JavaScript files" is currently disabled.
Comment #5
twodThis fixes the $(".add-to-cart").uc_aac_attach is not a function error for me.
Using the -dev version.
Note that inside
$.fn.ucAacAttach(),thisrefers to the jQuery object so there's no need to wrap it again, see: http://docs.jquery.com/Plugins/AuthoringComment #6
di19026 commentedNice going "TwoD"-
Yes, your patch now fixes it for me as well. My product's attribute pop-up menus are now updating correctly with the proper combinations. Thanks so much!
Getting this new minor error though-
ReferenceError: Can't find variable: ucAacCalculate
The above is coming from the actual node's page as opposed to a js script. I do not have anything set to recalculate prices for the product (not needed), so this may be the reason?
Comment #7
twodHmm, I put the ucAacCalculate function inside a scope only this script has access to, if other modules need to use it as well, it'll have to be moved above the
(function ($) {line so it's global.Comment #8
di19026 commented>Hmm, I put the ucAacCalculate function inside a scope only this script has access to, if other modules need to use it as well, it'll have to be moved above the (function ($) { line so it's global.
Tried that, it stops working properly if you move that function to the place you specified.
Comment #9
di19026 commentedIt appears that the uc_aac script is not getting called when a page first loads, so all options of a product are shown by default. Only after selecting a menu item does the data get refreshed with the correct default options.
Comment #10
cyu commented@bobmcjob: When you say you upgraded jQuery, do you mean that you used the jQuery update module or that you swapped out the .js files? That module exists because it isn't as simple as swapping out the files.
What is the easiest way for me to replicate this broken behavior on my local install?
Comment #11
bearstar commentedAfter upgrading drupal to 6.22 recently, I noticed that my uc_aac wasn't working any more. I am getting these two errors when I load up my product pages:
form.ajaxSubmit is not a function
ucAacCalculate(element=input#edit-attributes-6-64.form-radio 64)uc_aac.js?J (line 7)
$(".uc-aac-cart").ucAacAttach is not a function
ucAac()uc_aac.js?J (line 36)
Is anyone else experiencing this?
I grabbed the dev version of uc_aac but it didn't really change anything.
Solved: I had another lower jquery call related to a dynamic script, so it was undercutting the more recent version.
Comment #12
Eranga commentedI disabled the JQuery Updates module. It fixed this for me.