19 replies [Last post]
amaria's picture
Offline
Joined: 04/04/2008
Juice: 80
Was this information Helpful?

I'm getting this error on the checkout page (and only the checkout page), and have been since I've been using Ubercart and SecurePages. SecurePages is setup to secure these url's...
node/add*
node/*/edit
user/*
admin*
admin/*
cart/checkout
cart/checkout/review
cart/checkout/payment_details/*
cart/checkout/complete

And ignore these:
*/autocomplete/*
files/*
misc/*

I unset all of the css and js files except all ubercart js files, drupal.js and jquery.js yet I still get this error. I don't have any image url's with http: as opposed to https:. I started unsetting ubercart js files (at least the ones that won't break the page entirely) to see if any of those are causing the error and it turns out that unsetting the uc_taxes js file causes the error to go away.

Does anyone know why that would be the cause??

UPDATE
- I changed the theme from custom to Garland, error still persists.
- I unset "Show the order total preview on the payment pane.", error goes away!

Chisholm Technologies, Inc.
Custom software development since 1999!
www.chisholmtech.com

amaria's picture
Offline
Joined: 04/04/2008
Juice: 80
Re: Page contains both secure and nonsecure items error

After further investigation, I commented out the line referring to throbber.gif in uc_payment.js and the error goes away. Very strange. This happens in I.E. 6 and 7. FF is Ok.

Chisholm Technologies, Inc.
Custom software development since 1999!
www.chisholmtech.com

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Page contains both secure and nonsecure items error

Curious... can you solve it by adding the throbber's path to your SecurePages settings? It should be misc/throbber.gif or something like that.

amaria's picture
Offline
Joined: 04/04/2008
Juice: 80
Re: Re: Re: Page contains both secure and nonsecure items error

Yeah, I had done that and still no luck. I wonder if it has something to do with jquery? I used jquery_update module to make sure I have the latest version of jquery for use with some things I'm doing with thickbox.

Chisholm Technologies, Inc.
Custom software development since 1999!
www.chisholmtech.com

Akwaaba's picture
Offline
Joined: 09/05/2008
Juice: 4
Re: Re: Re: Re: Page contains both secure and nonsecure items er

I also found it gave the error when you click "Click to calculate shipping" and the order total pane shows. The throbber appended to basePath (typically http://www.example.com0, not https://www.example.com), and I don't beleive Secure Pages will override that URL. Perhaps a relative URL would work better:

Replace line 74 of ubercart/payment/uc_payment/uc_payment.js
$('#order-total-throbber').attr('style', 'background-image: url(' + Drupal.settings.basePath + '/misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html('    ');

with:
$('#order-total-throbber').attr('style', 'background-image: url(/misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html('    ');

It seems to fix my error.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Re: Page contains both secure and nonsecure item

base_path(), on most Drupal installations, is just '/'. So your second example is equivalent to using Drupal.settings.basePath if Drupal is in your webroot. Your first example is actually in error because there shouldn't be a / before "misc". You'll actually end up with something like url('//misc/throbber.gif').

Furthermore, I just checked on a site that uses Secure Pages, and all of the images (even the throbber.gif) were retrieved over a secure connection. So it works, at least for some websites.

amaria's picture
Offline
Joined: 04/04/2008
Juice: 80
Re: Re: Re: Re: Re: Re: Page contains both secure and nonsecure

It's true that Drupal.settings.basePath is '/' which is why this is such a mystery to me. Furthermore I have misc/* set in SecurePages to ignore, meaning it should retrieve over https or http depending on the protocol of the page.

Chisholm Technologies, Inc.
Custom software development since 1999!
www.chisholmtech.com

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Re: Re: Re: Page contains both secure and nonsec

Secure Pages only works on Drupal menu paths, I think. Other URLs like files and JavaScript should just use whatever the page is loaded as anyway.

Hmm...I wonder if the ignore setting is what's causing your problem. I had thought that setting meant that those paths weren't supposed to be secured at all.

amaria's picture
Offline
Joined: 04/04/2008
Juice: 80
Re: Re: Re: Re: Re: Re: Re: Re: Page contains both secure and no

It's not the ignore setting since it was happening before I added this setting. I thought ignore means SecurePages won't do anything to the url. When I didn't have my files directory listed under ignore, my CCK images wouldn't show up in add/edit mode because those pages are secure. Also, I have "Switch back to http pages when there are no matches" set.

Chisholm Technologies, Inc.
Custom software development since 1999!
www.chisholmtech.com

Lynn@drupal.org's picture
Offline
Bug Finder
Joined: 04/15/2008
Juice: 14
Re: Re: Re: Re: Re: Re: Re: Re: Re: Page contains both secure an

We have the same problem on FWK. Altering the path in that jquery line didn't help me (like Lyle says, the base_path is equivalent to '/' for me.) I also tried various securepages settings, an .htaccess redirect for /misc and using css to override the jquery css, none of which helped. The only fix I found was removing line 74 of uc_payment.js.

Maybe it would work better to apply the background image in a css file and then use the jquery to just hide/show that item?

JaceRider's picture
Offline
Joined: 03/17/2008
Juice: 98
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Page contains both secur

Same problem... and only when using IE. Firefox and Safari don't give any warnings.

RachelNY's picture
Offline
Joined: 01/06/2009
Juice: 62
Re: Re: Re: Page contains both secure and nonsecure items error

This error is still occurring with IE7 and Secure Pages. The problem is indeed caused by the "+ Drupal.settings.basePath" and this resolves the issue:

//  $('#order-total-throbber').attr('style', 'background-image: url(' + Drupal.settings.basePath + 'misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html('    ');

  $('#order-total-throbber').attr('style', 'background-image: url(' + 'misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html('    ');

Can we get this change committed so the error does not reappear for those of us who had to edit?

Thanks,
Rachel

ryangroe's picture
Offline
Joined: 02/12/2009
Juice: 24
suggested fix

Removing Drupal.settings.basePath will break sites not rooted at "/". Ultimately although I would classify this as a bug in IE but it manifests itself into a rather off-putting problem in Ubercart especially for non-tech users and requires a change. My suggestion is to put throbber.gif in CSS and manipulate classes in JS. This seems to fix the IE problem, allows for overriding the throbber functionality, and in my opinion is a cleaner solution.

Changes required (tested against 2.0 beta4 in FF3 and IE7):
1. In uc_payment.js change:
$('#order-total-throbber').attr('style', 'background-image: url(' + Drupal.settings.basePath + 'misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html('    ');
To:
$('#order-total-throbber').addClass('ubercart-throbber').html('    ');

2. In uc_order.css add this:
.ubercart-throbber {
background-image: url(../../../../../misc/throbber.gif);
background-repeat: no-repeat;
background-position: 100% -20px;
}

I think the use of "$('XXX').attr('style', 'XXX')" should be moved away from for the IE bug and styling override reasons listed.

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: suggested fix

+1 for ryangroe's change. It fixes this one particular problem, but IMO more importantly it demonstrates good programming practice which improves the quality of UC code.

Specifically, I don't think *any* styles should be hardwired into any of the JS (UC 1.x as well as 2.x). Instead, there should just be class/id assignments in the JS, with the style details defined entirely in the .css files. The way it is now, theming these elements requires modifying the core JS (bad); with the proposed change, theming is a simple matter of overriding the CSS (good). I can examine all the Ubercart JS and prepare a patch if you're going to use it ...

<tr>.
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: suggested fix

I'm totally in favor of a switch like this. I'm creating an issue on d.o to be tested, because I had to make two changes to the suggested improvements. First, the ../../../ etc. relative path assumes everyone will put Ubercart in the same directory... we just can't know that. I made it simple /misc/throbber.gif and it seems to work alright on the 2.x Livetest, a site in a subdirectory.

Second, I put the CSS in uc_store.css. I'm actually not sure why uc_order.css is being added on every pageload, but the store CSS should contain the generally usable properties. Our CSS is sooo crufty. TR, a patch would be unbelievable. If you can, posting it in the issue tracker and tagging it with theme layer would be the thing to do. Thanks!

I'm posting my current change up as a patch for review to the issue tracker tagged with theme layer right now. Review it here.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: suggested fix

You also might be interested in my latest patch in the cart block thread. Based on Steph's suggestions, I moved the cart block icon and arrow images into CSS. Seems to be working fine on the 2.x Livetest but could of course use more review. Smiling

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: suggested fix

Just a quick update... got around the relative problem by adding throbber.gif to the uc_store/images directory. Now the ubercart-throbber class can just refer to that image and not have to worry about where the Ubercart is placed.

I committed the attached patch after some testing... lemme know if you notice anything wonky. Eye-wink

AttachmentSize
throbber_to_css_from_js.patch 1.22 KB
psynaptic's picture
Offline
Early adopter... addicted to alphas.Not KulvikTheminator
Joined: 08/28/2007
Juice: 731
Re: Re: Re: Re: Re: suggested fix

I'd just like to say I've tried the patch and it works for my site. Thanks to everyone who got involved with this.

rbjarnason's picture
Offline
Joined: 02/06/2009
Juice: 12
how to add the patch

Sorry if this has been answered somewhere else. But I need help adding this patch, could anyone get me started.
thanks

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: how to add the patch

I use http://drupal.org/node/60108 as my guide. This code will be in the next beta release, tho.