6 / 12
Feb 2009

Hello,



Does anyone know how to add multiple items to the shopping cart with a single URL? I found a forum post regarding this:



http://www.e-junkie.com/bb/topic/2428



But haven't been able to get the method outlined to work. Has anyone been able to get this working?



Thanks!



Luke

  • created

    Feb '09
  • last reply

    Jun '09
  • 11

    replies

  • 1.5k

    views

  • 5

    users

  • 10

    links

That method should work; could you provide the URL of a page where you are attempting to implement this, so we can have a look at the code you're working with there?



BTW, you may wish to start testing with a "clean slate" by deleting your browser cookies. Sometimes when a Seller is testing their cart and changing settings in Admin at the same time, their cart-tracking cookie can get confused and starts producing weird cart behavior, so clearing cookies fixes that.

Hi Tyson,



Thanks for the reply! Unfortunately our site is Flash, so you won't be able to view the source on it.



Regarding the method I referenced, doesn't there need to be an EJEJC_multiAdd function defined in the HTML document, or is that not the case because we're sending an array?



This is my current "Add to Cart" Actionscript code that works correctly, adding a single item:



getURL("javascript:EJEJC_lc('https://www.e-junkie.com/ecom/gb.php?c=cart&i=200993&cl=48651&ejc=2')");



This is my new "Add Multiple Items" Actionscript code that does not work. Currently, it does not respond to the click or attempt to open the cart:



getURL("javascript:EJEJC_multiAdd(Array('https://www.e-junkie.com/ecom/gb.php?c=cart&i=200984&cl=48651&ejc=2',https://www.e-junkie.com/ecom/gb.php?c=cart&i=200993&cl=48651&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=200988&cl=48651&ejc=2'))");



In the previous example I'm attempting to add three items simultaneously. Am I doing something wrong? You can ignore the getURL(""); portion, as that is just the standard Flash button action.



Thanks for your help!



Luke

OutshineRegarding the method I referenced, doesn't there need to be an EJEJC_multiAdd function defined in the HTML document, or is that not the case because we're sending an array?





The function is a part of box.js file you include. Can you please confirm that you have included that in your html page?

Ah yes, EJEJC_multiAdd won't work if you don't have any of our View Cart code, if not the button itself, then at least these lines somewhere in your page (could even be up in the HEAD if you wish):



<script language="javascript" type="text/javascript">

<!--

function EJEJC_lc(th) { return false; }

// -->

</script>

<script src='http://www.e-junkie.com/ecom/box.js' type='text/javascript'></script>

Hello Tyson,



Thanks for the reply. I do have the code you mentioned in place, I was thinking maybe there was additional code for the new multi-add function.



I created a page on the staging server that contains an HTML link calling the same function, and I can't get that working either. Would you mind taking a look at that, since you will be able to view source?



http://www.outshinehosting.com/eyeplay/greentips/indexcart.html



It's the "ADD ALL" link at the very top.



Thanks!

Looking at your page, up in the HEAD section you have this extra line in your View Cart code:



function EJEJC_multiAdd(th) { return false; }



You don't need that line there, and it may be interfering. All you need is this:



<script language="javascript" type="text/javascript">

<!--

function EJEJC_lc(th) { return false; }

// -->

</script>

<script type="text/javascript" src="https://www.e-junkie.com/ecom/box.js"></script>

Hello Tyson,



Thanks again for your help. I appreciate you taking so much time to offer assistance.



I removed the unnecessary line of code, but unfortunately it's still not working. I also went ahead and removed everything from the page except two text links, "Add All" and "Add Single Item". The "Add Single Item" link works, but nothing for "Add All".



http://www.outshinehosting.com/eyeplay/greentips/indexcart.html



Is my code correct for the "Add All" link?



Any other ideas?



Thanks!

In your Add All link, your second URL is missing its initial 'single quote' -- i.e., where you have this:



...&cl=48651&ejc=2',https://www.e-junkie...



you should actually have this:



...&cl=48651&ejc=2','https://www.e-junkie...



I tested the fix on a page of my own, and it looks like that should work.

That did it! It's always a missing character that messes me up.



Thank you so much for your help, your service & support is outstanding.

4 months later

Is there a way to have a button add one item for one product, and then add "0" items for related products so a user could then manually add the other ones by entering "1"?



I am trying to find a way to add something along the lines of "you might also be interested in..." on the cart pop-up.



Matt