Author Topic: Add to cart functionality is not working properly in VM 1.1.3  (Read 22656 times)

naveed_khan

  • Beginner
  • *
  • Posts: 5
Add to cart functionality is not working properly in VM 1.1.3
« on: January 28, 2009, 12:51:53 pm »
I just installed VM 1.1.3 on joomla 1.0.15, 1.0.8 and joomla 1.5.7. On the front side the Add to cart functionality does not work properly.

The problem occurs after adding a product into cart and clicking the continue button in Ajax prompt window, when you again add the same product that Ajax window does not prompt again. Although the product still adds in the cart but the window does not display again until you refresh the page.

The firebug displays the following error:
timeoutID is not defined.

Any solution of suggestion for solving this problem.
Thanks in advance.

mmarfy

  • Beginner
  • *
  • Posts: 36
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #1 on: January 29, 2009, 23:57:57 pm »
take the following file from virtuemart 1.1.2:
/components/com_virtuemart/themes/default/theme.js
and replace on your virtuemart 1.1.3, this will solve the problem, until someone that knows javascript puts hands on the problem

naveed_khan

  • Beginner
  • *
  • Posts: 5
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #2 on: January 30, 2009, 08:44:37 am »
Thanks a lot mmarfy. This solution works for me. i have tested it on both joomla 1.5.7 and 1.0.15 the cart popup is working now.

mmarfy

  • Beginner
  • *
  • Posts: 36
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #3 on: January 30, 2009, 10:21:56 am »
yes it works, but from what I have understood examining the file there was added a good function to close automatically the ajax popup whith a timeout, even in multiple opening, there's a bug just on this, I don't know javascript, but it looks like a missing variable declaration, the timeoutID. it is beautiful if VM team fix this

naveed_khan

  • Beginner
  • *
  • Posts: 5
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #4 on: January 30, 2009, 13:04:12 pm »
The problem is causing because the code is trying to close the prompt box if it is open and clear the timeout value.

HERE is that code:

line 33 to 36
// close an existing mooPrompt box first, before attempting to create a new one (thanks wellsie!)

if (document.boxB) {
document.boxB.close();
clearTimeout(timeoutID);
}

The code should also work after removing or commenting the above lines.

mmarfy

  • Beginner
  • *
  • Posts: 36
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #5 on: January 30, 2009, 15:42:44 pm »
remove only timeoutID and leave the code so:
clearTimeout();
this should fix the bug

monteiz

  • Beginner
  • *
  • Posts: 1
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #6 on: April 08, 2009, 22:32:57 pm »
It does not fix the bug, it just prevents the error to show.

Do that instead:



var vm_timeoutID = 0;

function handleAddToCart( formId, parameters ) {
   formCartAdd = document.getElementById( formId );
   
   var callback = function(responseText) {
      updateMiniCarts();
      // close an existing mooPrompt box first, before attempting to create a new one (thanks wellsie!)
      if (document.boxB) {
         document.boxB.close();
         clearTimeout(vm_timeoutID);
      }

      document.boxB = new MooPrompt(notice_lbl, responseText, {
            buttons: 2,
            width:400,
            height:150,
            overlay: false,
            button1: ok_lbl,
            button2: cart_title,
            onButton2:    handleGoToCart
         });
         
      vm_timeoutID = setTimeout( 'document.boxB.close()', 3000 );
   }



monteiz


macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #7 on: April 09, 2009, 02:03:10 am »
This is fixed in VM 1.1.4 also the problem of the lightbox not initialising after AJAX page load.

VM1.1.4 should be out soon, but don't press me for a date as I don't know.
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

EquiProVM

  • Jr. Member
  • **
  • Posts: 53
    • Perfect World Luggage
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #8 on: April 22, 2009, 17:22:11 pm »
OK - I made monteiz's changes, and, yes, the Ajax popup now stays longer BUT if you stay at the same product and try to add another item to the cart (another child, let's say), the popup doesn't work AND the additional purchase is NOT reflected in the mini cart until the page is either reloaded OR you go to the cart.

Is there a fix for this available now?  If not, I think that I'll just disable the Ajax cart.  I don't like customers having to keep going back and forth between the cart page and the products, but that Ajax popup and mini cart just don't function that well.

Also, there is the ongoing problem of the Ajax popup being too transpearant.  I looked at the FAQ posted on how to change the popup color, BUT that only changes the yellow text background, not the whole box.  For me, the box issue is that it is completely transparent, and therefor gets muddled up with the product page.

Is there a way to change the color and transparency of the popup box?


It does not fix the bug, it just prevents the error to show.

Do that instead:



var vm_timeoutID = 0;

function handleAddToCart( formId, parameters ) {
   formCartAdd = document.getElementById( formId );
   
   var callback = function(responseText) {
      updateMiniCarts();
      // close an existing mooPrompt box first, before attempting to create a new one (thanks wellsie!)
      if (document.boxB) {
         document.boxB.close();
         clearTimeout(vm_timeoutID);
      }

      document.boxB = new MooPrompt(notice_lbl, responseText, {
            buttons: 2,
            width:400,
            height:150,
            overlay: false,
            button1: ok_lbl,
            button2: cart_title,
            onButton2:    handleGoToCart
         });
         
      vm_timeoutID = setTimeout( 'document.boxB.close()', 3000 );
   }



monteiz



macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #9 on: April 22, 2009, 19:24:39 pm »
The code you posted fixes the problem with the ajax popup box only working once!

I know, cause it works on my test site. http://photography.noctilucent.me.uk/index.php?page=shop.product_details&flypage=flypage-ask.tpl&product_id=6&category_id=1&option=com_virtuemart&Itemid=53

the popup box is not transparent, unless you have changed the styling already

Style is set in mooprompt.css

which is in components/com_virtuemart/js/mootools
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

EquiProVM

  • Jr. Member
  • **
  • Posts: 53
    • Perfect World Luggage
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #10 on: April 22, 2009, 19:44:25 pm »
I haven't made any changes to the styling at all, except what I have posted here.  The popup has been transparent AND popped up behind the child boxes since the get-go.  Attached is a pic.  I would love to get this feature to work, but can't make it work so far. 

The code you posted fixes the problem with the ajax popup box only working once!

I know, cause it works on my test site. http://photography.noctilucent.me.uk/index.php?page=shop.product_details&flypage=flypage-ask.tpl&product_id=6&category_id=1&option=com_virtuemart&Itemid=53

the popup box is not transparent, unless you have changed the styling already

Style is set in mooprompt.css

which is in components/com_virtuemart/js/mootools

[attachment cleanup by admin]

macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #11 on: April 22, 2009, 20:03:52 pm »
Your template has set the z-index of the main page to 1, should always be set to 0

Hence all the items in VM are appearing in front of the ajax cart popup.

the code that you posted does fix the ajax popup problem.

and changing mooprompt.css

.cbOverlay {
   background-color: #000;
z-index: 5;
}

.cbContainer {
   padding:5px;
   background-color:white;
   border: 2px solid gray;
z-index:5;
}

Should cure the popup being behind the elements.

As to the pop always being behind the elements, I guess if you were using the standard joomla template then the problem would not be there.

Hence, you have changed the styling, even if you did not realise it.

Unfortunately we cannot second guess template designers and unfortunately due to the nature of VM, sometimes you will have to make changes!
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

EquiProVM

  • Jr. Member
  • **
  • Posts: 53
    • Perfect World Luggage
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #12 on: April 22, 2009, 20:17:21 pm »
OOOH!  GOT IT!  Thanks SO very much for your help on this.  I'll see if I can make the changes and hopefully it will work!

So much to learn with all of this....

EquiProVM

  • Jr. Member
  • **
  • Posts: 53
    • Perfect World Luggage
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #13 on: April 22, 2009, 21:39:41 pm »
Wow!  That WORKED!  Now the only problem left for me is that any "add to cart" on the same page is NOT reflected in the cart until the page is refreshed.  I might be able to put that issue to bed as soon as I can get that fixed!

Thanks!

macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: Add to cart functionality is not working properly in VM 1.1.3
« Reply #14 on: April 22, 2009, 22:05:58 pm »
you may have to change the z-index of

.vmCartModule

in /components/com_virtuemart/themes/default/theme.css

It's probably at the wrong position because of all the z-index's present
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.