Author Topic: ajax behaving badly with mini cart in Firefox 3.04  (Read 5008 times)

james.dupin

  • Beginner
  • *
  • Posts: 12
ajax behaving badly with mini cart in Firefox 3.04
« on: December 12, 2008, 16:51:09 pm »
bundle joomla 1.58 / virtuemart 1.12
on debian server etch up to date

Problem happens with firefox 3.04 in Linux or Windows. No problem with IE7.

The cart uses ajax to update itself when a product is added. The info in the mini cart are refreshed and a change of color is occuring. Sometimes (most of the times) the white color will not disappear so if your text is in white you do not see the contents  of the cart.
haven't noticed it before as I had a different type of color in the mini cart (close to white) and my text was black.

This never happens with IE7 so I suspect a problem with ajax and firefox.

I believe the answer lies in the " function updateMiniCarts() " of components/com_virtuemart/themes/default/theme.js unfortunately my knowledge prevents me from tweaking successfully this function. Tried to lower the duration in the 2 var and in the timeout but it didn't change a thing.

Or simpler, how can I get rid of the highlight when the cart is updated?

Regards,
James

lvraa

  • Beginner
  • *
  • Posts: 4
Re: ajax behaving badly with mini cart in Firefox 3.04
« Reply #1 on: December 30, 2008, 01:08:41 am »
Hi

I have the same problem in Firefox 3.0.5. Please update this thread if you found a solution.

Kind regards
Lars

lvraa

  • Beginner
  • *
  • Posts: 4
Re: ajax behaving badly with mini cart in Firefox 3.04
« Reply #2 on: December 30, 2008, 01:28:14 am »
Hi

I know how it can be fixed now. In function updateMiniCarts there's a fancy functionality that makes it face in.... Well if you dont need this you can just take it out as shown below and you will not have the white area any more.

function updateMiniCarts() {
   
   var callbackCart = function(responseText) {
      carts = $$( '.vmCartModule' );
      if( carts ) {
         try {
            for (var i=0; i<carts.length; i++){
               carts.innerHTML = responseText;
                    /* Removed to make update cart work in firefox 3.0.x
               color = carts.getStyle( 'color' );
               bgcolor = carts.getStyle( 'background-color' );
               if( bgcolor == 'transparent' ) {
                  // If the current element has no background color, it is transparent.
                  // We can't make a highlight without knowing about the real background color,
                  // so let's loop up to the next parent that has a BG Color
                  parent = carts.getParent();
                  while( parent && bgcolor == 'transparent' ) {
                     bgcolor = parent.getStyle( 'background-color' );
                     parent = parent.getParent();
                  }
               }
               var fxc = new Fx.Style(carts, 'color', {duration: 1000});
               var fxbgc = new Fx.Style(carts, 'background-color', {duration: 1000});

               fxc.start( '#222', color );                     
               fxbgc.start( '#fff68f', bgcolor );
                    */

               if( parent ) {
                  setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 );
               }
            }
         } catch(e) {}
      }
   }
   option = { method: 'post', onComplete: callbackCart, data: { only_page:1,page: "shop.basket_short", option: "com_virtuemart" } }
   new Ajax( live_site + '/index2.php', option).request();
}

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: ajax behaving badly with mini cart in Firefox 3.04
« Reply #3 on: December 30, 2008, 21:14:01 pm »
I think it works if you comment out one row(red):
components/com_virtuemart/themes/default/theme.js

function updateMiniCarts() {
   var callbackCart = function(responseText) {
      carts = $$( '.vmCartModule' );
      if( carts ) {
         try {
            for (var i=0; i<carts.length; i++){
               carts.innerHTML = responseText;
      
               try {
                  color = carts.getStyle( 'color' );
               //   bgcolor = carts.getStyle( 'background-color' );
                  if( bgcolor == 'transparent' ) {
........
.....
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11