16 / 20
Oct 2013

I am setting up my cart and was wondering if there is any way to add multiple products to the cart with a single button. We often sell bundles (like two software titles or a software title and a backup CD). I tried to put multiple i= variables in the add to cart link, but that didn't work. Let me know if there is a way.

  • created

    Nov '07
  • last reply

    Apr '20
  • 19

    replies

  • 2.6k

    views

  • 8

    users

  • 22

    links

1 year later

Yes, that will allow a single Add to Cart button/link to add multiple different items to a buyer's cart at once.

Okay...the earlier respond in this post and another said it was not possible.....

E-junkieExpert is not part of our staff (though we're glad for the help they volunteer here :^) -- so they may not be privy to "insider info" like undocumented hacks such as the EJEJC_multiAdd function -- and you may notice that post was made nearly two years ago, so we've added quite a few new features and refinements since then as well.

27 days later
untitledtvThe code you'll need is:



<a href="javascript:EJEJC_multiAdd(Array(

' https://www.e-junkie.com/ecom/gb.php?c=cart&i=YYYYYY&cl=XXXXXX&ejc=2 ',

' https://www.e-junkie.com/ecom/gb.php?c=cart&i=ZZZZZZ&cl=XXXXXX&ejc=2 '

));">Add ALL</a>



You'll have to replace the URLs with the URLs from your add to cart button code. You can add as many URLs as you want in the array.





Hello - New to E-Junkie, and I'm wondering if we need to add the rest of the script for the button... "target="ej_ejc" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><img src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" border="0" alt="Add to Cart"/></a>



If so, do we add it immediately following the "));">Add ALL</a>" Or does the above script follow the primary item button code?



Thanks

Ok... I've played around with the codes a bit, and I must be doing something really wrong.... First I added the primary button code... (for the product) That one works...



Then for the 3 free bonus books I added....

<a href="javascript:EJEJC_multiAdd(Array(

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=...&cl=...&ejc=2',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=...&cl=...&ejc=2',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=...&cl=...&ejc=2'

));">Add ALL</a>



I then see an "Add to cart" and the "Add All" link. However the only the "Add To Cart" button works, the "Add All" doesn't work at all . I receive an error on page at the bottom of the browser only when the multi add code is added.



I've tried to "merge" the 2 codes into one several different ways and that doesn't work either. I do have the "View Cart" button code on the same page.



I, like the original poster offer 1 ebook for sale and 3 additional ebooks as a bonus.

These I would like to show up in the checkout / order screen and be available for individual download as well. I do not want to place them all in a zip file.



Thanks again for all the help!

Bear in mind that you would need to specify your E-junkie client ID after every &cl= part, and specify the Item Number for each product after each &i= part. For instance, using your account ID and some example item numbers, your multiAdd code might look like this:



<a

href="javascript:EJEJC_multiAdd(Array(

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=111111&cl=84573&ejc=2',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=222222&cl=84573&ejc=2',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=333333&cl=84573&ejc=2'

));">Add ALL</a>



You can of course change "Add ALL" to say anything you want, or replace that with the <img> tag from a regular Add to Cart button or any custom button image you choose.



If this doesn't clear up the matter, we'd need the URL of a page where you're testing this, so we can have a look at the code you've got in that actual page.

Hi, Thanks for responding, below is the exact codes that I placed...



<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&i=320463&cl=84573&ejc=2" target="ejejc" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><img src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" border="0" alt="Add to Cart"/></a>



<a

href="javascript:EJEJC_multiAdd(Array('https://www.e-junkie.com/ecom/gb.php?c=cart&i=320483&cl=84573&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=320487&cl=84573&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=320489&cl=84573&ejc=2'));">Add ALL</a>



I have placed them on an "old page" that is now my "test" page before I place them live on the site for visitors. Currently I have the main product "packaged" with the bonus books, but I'm not sure if that will deliver the way that I want it to... I want the ebooks to obtain the "pdf stamp", and be able to have all download links on the same "Thank You" page, or email.



Here is the link for the test page. The "view cart" button is located at top right, and the "buy now button and the ADD All link" is located at the very bottom.



Thanks again for all the help!

L

The problem is caused by your Web page editing software.



You would need to find some way of pasting your View Cart code and your multiAdd code directly into the raw HTML source code of your page, in such a way that you can be certain the code you paste is retained in the page itself exactly as-is without modification.



The software you're using is putting the View Cart code in a completely separate file that gets displayed inside an iframe in your page (instead of putting the View Cart code directly into the page itself), and the other code you're pasting such as the multiAdd is getting rather radically altered to the point our code cannot work as we designed it.

Ok! I've got it! If your website is setup through "Microsoft Office Live Small Business" you have to use the "custom footer" module to add the "View Cart" code. Otherwise it will not work. As an added measure I created another custom footer for the Array code given above with my main product URL listed first. IMPORTANT - when opening the "custom footer" module you must first delete all codes that are there first then add your code...

So my code for the "Array code" in the custom footer looks like this...



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="text" omit-xml-declaration="yes"/>

<xsl:template match="/Footer">

<![CDATA[

<a href="javascript:EJEJC_multiAdd(Array('https://www.e-junkie.com/ecom/gb.php?c=cart&i=320463&cl=84573&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=320483&cl=84573&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=320487&cl=84573&ejc=2','https://www.e-junkie.com/ecom/gb.php?c=cart&i=320489&cl=84573&ejc=2'));"><img src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" border="0" alt="Add to Cart"/></a>

]]>

</xsl:template>

</xsl:stylesheet>



My code for the "View Cart" in the other custom footer looks like this:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="text" omit-xml-declaration="yes"/>

xsl:template match="/Footer">

<![CDATA[

<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&cl=84573&ejc=2" target="ejejc" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><img src="http://www.e-junkie.com/ej/ejview_cart.gif" border="0" alt="View Cart"/></a>

<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>

]]>

</xsl:template>

</xsl:stylesheet>



Hope that helps someone.



Now my question... LOL is there a way to add a code that if the main item is removed that the other free bonus items cannot be downloaded? Another words if the main item is removed then the other items also get removed.. I don't want to use the packaging option because then the ebooks will not be stamped, from what I understand.



Thanks for all your help!

Hm, we don't really have a way to make products "dependent" on other products (so removing the main product would remove the others as well), but some merchants have devised ways of doing that with custom javascripting of their own.



E.g., see what Muvenum has done with their Backup CD option:

http://muvenum.com/buy-now/



If you add a download product to their cart, you can add an optional backup CD, but removing the download from the cart also removes the CD. We don't know quite how they managed that, so you'd need to examine their code and figure it out or ask them if they'd be willing to provide tips.

4 years later

Old post, but it applies so I'm resurrecting. Besides, that shows I actually did use the search button, right? :wink:



I'm looking to do the following which I've posted about before:



Package deal -



They purchase a PDF (which needs to be stamped) and they also get a mp3 file.



Since the PDF needs to be stamped, that rules out zip files or multiple product packages. The muvenum link above gave me another idea.



It appears that each product in their bundle is being offered at full price, but then a "Codes applied: Current Promotion" discount is given. If they remove a product from the cart, the promotion discount is also removed.



This would appear to be the solution I need. I could list both products as full price in the package, but give them the discount. If they remove one product, then it reverts to full price for that product. PDF is still stamped, and everyone goes home happy.



My question is... where is that "Codes applied: Current Promotion" coming from? I don't see anything like that in my seller's admin.



Any help, please?

"Current promotion" indicates a discount was applied to the order automatically because the discount did not require entering a Discount Code (i.e., that field was left blank in the discount's settings), and the order met that discount's requirements for Product (if selected) and Min. Item Qty./Total. This help page explains our discount settings in more detail:

http://www.e-junkie.com/ej/help.discounts.htm



Note that the setting to "Package files from other products, affect their inventory" only does exactly that: issue links for download file(s) you'd already uploaded to other products or affect other products' Inventory Control quantities in stock -- i.e., a package product is its own product and does not work like actually purchasing those other products individually.



If your mp3 file is a freebie/bonus file that's worthless without the PDF, or you otherwise don't care if people might share the mp3 freely, Approach C here would be your simplest solution:

http://www.e-junkie.com/ej/help.package.htm#bonus



If you need to provide both a Stamped PDF and the mp3 through our expirable links, you'd still need to make sure buyers order both products together as individual items. You may wish to consider creating a multiAdd to Cart button as explained here:

3http://www.e-junkie.com/bb/topic/21213



If you won't allow ordering the PDF and mp3 separately, custom javascript in your page could remove both items whenever the buyer removes either one from their cart, similar to how Muvenum's page removes the Backup CD item if the corresponding download item is removed. If you need help setting this up, we can recommend consulting the Developer Directory link at the very top of our site.

Yep, that did the trick and a hat-tip to John from Muvenum for answering an Email as well.



For anyone else needing to do the same thing I was trying -



1) Create a discount under Seller Admin > Add/Edit E-junkie Cart Discounts/Gift Coupons



2) Make the discount for "All Cart Items" and the "Min. Item Quantity" to the number of items in your 'package' and the Min. Item Total to whatever you want. For my case, I set the item quantity to "2" (PDF and MP3 products) and the item total to $30 (since both items will be priced at $15 each).



3) Set the discount to 50% for "Item Total". Provided there are two items in the cart and they total $30, the discount will drop the price to $15 which is my intended package price. If they remove one of the items, the discount no longer applies and the price remains the same.



4) Create a multiAdd to Cart button as outlined in the link pointed out by E-junkieGuru - http://www.e-junkie.com/bb/topic/2121 Create the button for each of your packages.



This allows the PDF to still be stamped (since it is its own purchase) and the MP3 to be bundled with the purchase for "free" yet protected (as much as it can be) from abuse/fraud.



Thanks!

6 years later

I want to be able to do this for my PDFs as well. Not too tech savvy though and just getting used to the main site. Is there a video on how to do this? I can certainly try following the advice here. The visual of this would be of great benefit.

If you just want to create a multiAdd to Cart button that puts multiple PDF products in a buyer's cart with a single click, this thread has been updated with our latest instructions for that: