Here's something I did that may be interesting.
We're setting up a single cart for crediting about 1,000 or more charities for the purchases that come through them.
Found a cool way.
The originating web site has a specific forwarding link with some java script in it. The HTML is this:
<html>
<head>
<script type="text/javascript">
function open_win() {
win2 = window.open("http://www.yourstore.com/index.php?action=buy_now&products_id=36","_blank","width=5,height=5");
var u = setTimeout("stuff2()", 3000);
}
function stuff2(){
win2.close();
win3 = window.open("http://www.yourstore.com/index.php?main_page=product_info&products_id=36", "_parent", "toolbar=yes, menubar=yes,resizable=yes,scrollbars=yes,titlebar=yes");
}
</script>
<body onload="open_win() ;">
</body>
</html>
Now notice there are two things going on. First, with one window for this session ID, we add a product to the cart. Then wait 3 seconds.
Then we blow that window away.
Then we go to the product description for that product. This is the landing page for the store that the buyer actually sees.
In this case, product ID # 36 is the description of a specific charitable organization that will be credited for the order, and product ID #36 is free free and free.
So, when checkout happens, the order record in the DB has the $ value of the total, and we can sort by the product ID to determine who gets store credit.
We set up a product category "nonprofits" and each nonprofit in the system is a different product with a description and image unique to that nonprofit.
When someone links from their web site to their store, they get an automatic add of the product ID, and then that window poofs as they land on the product page.
The only time it would fail is if the buyer explicitly removes the free product from the cart before placing the order.
You have to match the nonprofits (store owners?) with their product I.D. and generate a fresh HTML file with that ID for each unique originator.