24 replies [Last post]
wiliam_steven's picture
Offline
Joined: 01/20/2009
Juice: 119

Okay, im newbie in drupal, and very interested with Ubercart, very2 great module for drupal online e-commerce, but i have trying to installing ubercart in drupal 5.15 and its work until i enable module called Payment, and Payment Method Pack. i have adding an attachment.

can you tell me, what should i do now ?

Thanks before.

PreviewAttachmentSize
payment error.jpgpayment error.jpg18.95 KB
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Payment Method Errors, "Javascript must be enabled to view t

Do you have Javascript enabled? Are there any Javascript errors on the page? You can debug this in FireFox using the Firebug plugin.

wiliam_steven's picture
Offline
Joined: 01/20/2009
Juice: 119
Re: Re: Payment Method Errors, "Javascript must be enabled to vi

I have check it double time, and very sure my javascript is running properly. i have reinstalling 3 times, and still not change, so what should i do, sir ?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Payment Method Errors, "Javascript must be enabled t

Hmm... people have had server configuration issues in the past. Any chance you can post a URL to this server? (Is it a dev server?) Then I could at least verify the issue before going down the server setup route.

wiliam_steven's picture
Offline
Joined: 01/20/2009
Juice: 119
Re: Re: Re: Re: Payment Method Errors, "Javascript must be enabl

Thanks alot, im not uploaded it yet, coz... it still in localhost in my computer php emulation, im using WAMP...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Re: Re: Payment Method Errors, "Javascript must be e

Hmm, ok. Can you check in your Apache error and access logs to see if it's turning up anything for the path cart/checkout/line_items?

wiliam_steven's picture
Offline
Joined: 01/20/2009
Juice: 119
Re: Re: Re: Re: Re: Re: Payment Method Errors, "Javascript must

okay then, i will try it, thanks bro,... you really great help for me....

copperIT's picture
Offline
Joined: 11/24/2008
Juice: 25
Ubercart checkout JavaScript Issue

Ryan:

I'm experiencing the same symptoms on a site that I'm developing. I looked in /var/log/httpd/error_log and do not see any errors related to checkout. I DO, however, have JavaScript errors according to the error console in FireFox.

My suspicion is that it is a conflict between jQuery and Moo Tools, a library of JavaScript functions we've installed on the site. We've had other issues due to this conflict (e.g. Collapsible Field Sets won't open or close, etc.).

The solution for us has been to look in various JavaScript files (*.js), mostly in the 'misc' folder and make the following edit:

change all instances of '$(' to 'jQuery('

(helpful command line tool:

    sed -i -e 's/$(/jQuery(/g' *.js

...that will edit each *.js file in the current directory)

This is because both MooTools and jQuery use '$(' as a shorthand reference to themselves. This ends up confusing PHP as it doesn't know which library to look to.

As to Ubercart, the problem shows up for me on the checkout page, in the Payment Method area. With a fresh update of Ubercart (6.x-2.0-beta5), when I go to our checkout page, I see 2 animated bars of stripes in the Payment Method area.

However, when I poke around the many different subdirectories of the Ubercart module, I see a lot of JavaScript files sprinkled about most of which use the '$(' shorthand for jQuery.

I've tried editing Ubercart's *js files in 2 ways: using that sed command (slightly altered) to edit every instance of '$(' in any subdirectory of Ubercart (the 'nuclear option'), and doing it one file at a time, by loading the checkout page and then editing the page referenced by FireFox's JavaScript Error Console.

Doing either of these only gets me so far... I lose the animated striped bars, and get the text message 'Javascript must be enabled to view the order total preview' as shown in william_steven's original post (see his attached .jpg).

When I edit the files one by one, I come to a dead end (and a white page) where the Error Console says '$.post is not a function' (not an exact quote) on line 157 of uc_payment.js. That file is in the ubercart module directory, at: payment/uc_payment/uc_payment.js

I'm not done fiddling with this, but I'm not sure what to try next. I admit that I have more googling and searching to do (on drupal & ubercart's sites), but I thought I might re-start this thread with some new info.

Thanks in advance for any insights!

-dave.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Drupal depends on jQuery. As

Drupal depends on jQuery.

As you have discovered, different JavaScript libraries like MooTools and Prototype also claim the "$" namespace. If you want to use one of these libraries in Drupal along with jQuery you're in for an uphill battle. There are long and detailed discussions on drupal.org about how to cope with this. As a minimum, you have to replace all "$" in all Drupal JavaScript (and the JavaScript of all modules you have installed) with "jQuery" plus put jQuery into noConflict mode via a call to jQuery.noConflict() before you use "$" for non-jQuery purposes. Your substitution pattern is insufficient because it doesn't catch uses like $.get(), likewise it doesn't prevent jquery.js from trying to parse your MooTools scripts - that's what noConflict() does.

Again, this is something that is discussed at length in many threads on drupal.org.

<tr>.
copperIT's picture
Offline
Joined: 11/24/2008
Juice: 25
jQuery Conflicts with MooTools, other libraries

Thanks, tr.

As I said I have more research to do.

I'm off to the google-mines.

I would like to hear in this thread if the trouble getting the checkout to take a payment (I'm only currently using the Test Gateway...) is related to this JavaScript conflict.

Thanks again, everybody.

-dave.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Re: jQuery Conflicts with MooTools, other libraries

This issue comes up from time to time in these forums and the cause is almost always a JavaScript error on the page. If you search the forums for that error message you will find a lot of useful debugging help. Firebug should be able to pinpoint the problem if it's a JavaScript error.

<tr>.
copperIT's picture
Offline
Joined: 11/24/2008
Juice: 25
Solved? Firebug helps locate jQuery/MooTools conflicts

Okay, I've made some progress... The tip from Ryan & tr re: using Firebug was very helpful. I'd never used that extension before, but it helped me drill down to the lines in the particular *.js files that needed editing. It may have been possible to do that with just Firefox's error console as well, I suppose.

What I did:

Using Firebug, I would reload the checkout page and Firebug would indicate an error. Initially these errors all pointed to lines that called some function like this: $(some_function)..., and I would change it to read: jQuery(some_function). I would then reload the page and check out the error indicated by Firebug, repeating the process for the indicated line, in the appropriate js file, somewhere in the Ubercart module. I did that about a half dozen times (should have taken notes, sorry - but when necessary, I would start from scratch by simply unpacking the ubercart tarball again in the modules directory and write over any changes I'd made...)

Eventually Firebug indicated a different sort of message: '$.post is not a function' (or similar). In this case, I'd go to the indicated line (or near it) and find a call like that: $.something, and change that to jQuery.something. I did that maybe twice.

Finally, Firebug stopped indicating any errors for the checkout page, and I can now see both of the payment method areas that were previously hidden by the animated striped bar: The order total preview , and the fields where you would enter your Credit Card info (number, card holder name, expiration date, etc.).

Further development will show further errors, no doubt, but I can move on.

Thanks, everybody!
-dave.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Drupal depends on jQuery. As

TR, in reference to the $ namespace conflicts, I think they've come to a resolution since there's a section in the module upgrade doc page that shows how to get around it. http://drupal.org/node/224333#javascript_compatibility

I believe this fix also should work in D5 and D6, so maybe we should start an issue to preemptively convert Ubercart's use of jQuery.

copperIT's picture
Offline
Joined: 11/24/2008
Juice: 25
Fix for jQuery/MooTools/other Javascript libraries

Lyle:

Thanks for the link. I'm not sure how to apply the fix, though. It says:

Javascript should be made compatible with other libraries than jQuery by adding a small wrapper around your existing code:

(function ($) {
  // Original JavaScript code.
})(jQuery);


The $ global will no longer refer to the jquery object. However, with this construction, the local variable $ will refer to jquery, allowing your code to access jQuery through $ anyway, while the code will not conflict with other libraries that use the $ global.

Does that wrapper go around every *.js file in the various directories sprinkled throughout my Drupal install? Or around every separate function? And I assume that this should be applied to the Drupal-installed *js files only, not whatever supplemental Libraries have been put in place (e.g. MooTools).

Thanks in advance for any clarification!
-dave.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
copperIT wrote:Does that
copperIT wrote:

Does that wrapper go around every *.js file in the various directories sprinkled throughout my Drupal install?

Yes.

copperIT wrote:

And I assume that this should be applied to the Drupal-installed *js files only, not whatever supplemental Libraries have been put in place (e.g. MooTools).

Correct.

<tr>.
wiliam_steven's picture
Offline
Joined: 01/20/2009
Juice: 119
Re: copperIT wrote:Does that

Now I get it, the setting is very simple... how simpleton of me.... huhuhu Sad

the solution is here... in the attachment

AttachmentSize
solution.jpg 7.51 KB
amit's picture
Offline
Joined: 07/27/2009
Juice: 12
Re: Re: copperIT wrote:Does that

Can you share link where to configure "Show the order total ....." ?
I am not able to find the solution.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Lyle wrote:TR, in reference
Lyle wrote:

TR, in reference to the $ namespace conflicts, I think they've come to a resolution since there's a section in the module upgrade doc page that shows how to get around it. http://drupal.org/node/224333#javascript_compatibility

I believe this fix also should work in D5 and D6, so maybe we should start an issue to preemptively convert Ubercart's use of jQuery.

The method shown in your link is the standard practice when writing jQuery plugins - it puts the definition of $ into a local scope, avoiding namespace conflicts. I think that's a great idea to apply to all Drupal (and Ubercart) use of jQuery. So yeah, go for it!

But even with all .js in Ubercart changed to use that syntax, you're faced with the problem that the changes to Drupal core may not happen for a LONG time. (The above patch just got committed to D7 after TWO YEARS of discussion. Might never get backported to D6, let alone D5). And of course there are lots of other contributed modules that won't follow along. So it's still going to be a pain to manually change all the Drupal .js and keep it up-to-date. But that shouldn't stop Ubercart from doing the right thing.

<tr>.
somatics's picture
Offline
Joined: 08/18/2007
Juice: 121
I'm still having this problem -- urgent help needed!

We're running the latest recommended version of Ubercart (installed tonight) and it's still producing this same javascript error ("Javascript must be enabled to view the order total preview.") on every browser, ever platform.

I am prepared to go in and make this change -- adding the jquery replacement code to the beginning and end of each .js file. However, this forum topic says it just has to be done to the Drupal installed .js files, not the ones that come with add-on modules. However, all the errors I've found so far in Firebug are '$" characters in 3rd party module .js files (fbconnect, administration menu, etc.). Am I supposed to change this in all files throughout the installation?

Is this really the solution to this -- it seems a little scary to edit everything in drupal and third party modules to get these few checkout pages to work. Is there some other strategy?

If not, is there someway to eliminate all .js files from being loaded on the cart* pages? Is there some globally referenced file that can be put somewhere in Drupal that will do this replace automatically upon loading of those .js files automatically?

This bug has effectively rendered useless our site, the day before we're supposed to go live with a major product sale. I've worked on this for 2_ days and am in trouble here. Does anyone have any guidance or assistance for me?

somatics's picture
Offline
Joined: 08/18/2007
Juice: 121
Solution for me was getting rid of Wibiya toolbar

I fixed this problem entirely by getting rid of the Wibiya module; Wibiya is an awesome little toolbar for the bottom of your page that links your site to all your social sites and provides other features tool. Unfortunatetly, as it says in the 1st link I post below...

Drupal uses jQuery 1.2.6 and Wibiya is using 1.3.2 and somehow it gets the 1.2.6 overwritten and sets jQuery in compatibility mode as well because it doesn't recognise $ as a function anymore ($ is not a function).

It's discussed here:

http://community.wibiya.com/wibiya/topics/drupal_6_wibiya_compatibility_...

http://community.wibiya.com/wibiya/topics/drupal_problem

I couldn't get their solution to work. I just disabled the toolbar/module completely and the problem with Ubercart checkout went away completely. Also, the edit form for all my nodes had a major problem -- the reveal triangles didn't work, so all sections that were hidden couldn't not be revealed -- you would just see the title of the edit section but no way to show it to edit it. This problem was fixed immediately upon removal of the Wibiya toolbar as well, and the node edit pages function as they should.

kegan's picture
Offline
Joined: 02/03/2010
Juice: 4
Payment Method Errors, "Javascript must be enabled to view the o

hello

I am new in drupal and ubercart and i am getting this problem Payment Method Errors, "Javascript must be enabled to view the order total preview.

How to fix it? can you help

thx

Search.n.Rescue's picture
Offline
Joined: 10/29/2009
Juice: 12
look for .js files

Disclosure: I have only worked with D6.
When I received this message I looked at error log from Apache web server, it listed several .js files that were not found and gave the expected location. I confirmed that the folders were there.
I was able to solve this by a doing a copy & paste from a downloaded Drupal/Übercart/ÜberDrupal full installation that I had expanded for use to upload to a shared host & was still unmodified.

So it may work for you to check in your module folders (or where ever they should be in D5) to confirm existence of appropriate .js files.

Also Google is very helpful on some of these issues.

Also to help get you set up for future challenges! Smiling
How to troubleshoot(read this first)
http://drupal.org/node/72108

How to troubleshoot (read this first) http://drupal.org/node/72108

kegan's picture
Offline
Joined: 02/03/2010
Juice: 4
ubercart mobile version?

Hi Search.n.Rescue
sorry i have to rephrase my question.

I actually have this error message on the client side and not from the server side which says Payment Method Errors, "JavaScript must be enabled to view the order total preview, i am afraid to touch the js code from the server side. what do you think?

thnx

Search.n.Rescue's picture
Offline
Joined: 10/29/2009
Juice: 12
Hello kegan That would be

Hello kegan
It would be on the client side where I saw that exact message also. This message can be received for a number of causes, the solution I outlined solves just 1 of the possible causes. If you or someone you know has the ability & confidence to merely look in the following module folders on the server to confirm the existence of the following .js files it will help confirm that this may be the cause:
modules/ubercart/uc_store/ look for uc_country_select.js & uc_store.js
modules/lightbox2/js look for presence of whole folder as it has a number .js files if using lightbox
modules/ubercart/uc_cart/ look for uc_cart.js & uc_cart_block.js

If that is not the issue you can google "Javascript must be enabled to view the order total preview" in conjunction with searches here & on Drupal site.

Just remember "You can do it!" Smiling

How to troubleshoot (read this first) http://drupal.org/node/72108

jcicolani's picture
Offline
Joined: 08/22/2010
Juice: 3
The answer may be in your theme's scripts.js file

This issue bugged the hell out of me for days before I tracked down a bug which was in the base Fusion theme's scripts.js file. Ultimately the bug was found by enabling the console in Firebug. The fix was to upgrade to the newer version of theme (which was, like, 10 items down on my checklist, anyway). Since I haven't seen anything here which pointed me in that direction, I figured I'd post. Hope that helps someone.