Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / How can I add an option to contribute to charity on the checkout page?

How can I add an option to contribute to charity on the checkout page?

Locked
This thread is locked. New replies are disabled.
7 Dec 2009, 8:23 PM
#1
agentx avatar

agentx

New Zenner

Join Date:
Nov 2007
Location:
Virginia
Posts:
57
Plugin Contributions:
0

Post #1 by agentx

I want to add a box that comes up on checkout and asks the customer if they want to donate $1 or so to charity and have it added to their order. Is there a way to do that?

I couldn't find anything on the forum under "checkout" so I'm taking a shot here.

7 Dec 2009, 9:04 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Post #2 by niccol

How easy this is depends on whether you want to have the customer be able to choose how much they donate. If you just want a 'Add One Dollar' donation button (that they could use repeatedly) the way I have done this in the past is to create a product that is the charity and hide it in the shop (you could use the hidden category mod) and then put the code for adding that product to the cart on the shopping cart page. ( It is much much trickier to do it on the checkout pages )

It is possible to do a variable donation where the customer can select how much they donate but that is a lot more coding.

If that solution appeals I am happy to outline it a bit more fully.

The code I used to put the product on the shopping cart page was something like:

<div id="whynot">
<div id="charity_donation"><?php  $charity_image=zen_get_products_image(1000);echo $charity_image;?></div>
<a href="http://www.MYDOMAIN.com/shop/index.php?main_page=index&action=buy_now&products_id=1000">
<span class="cssButton " onmouseover="this.className='cssButtonHover'" onmouseout="this.className='cssButton'" > Yes Please </span></a>
<h2 class="whynotheading">Why not Donate to Charity?</h2>
<p><?php $charity = zen_get_products_description(1000, 1);echo $charity; ?></p>
</div>
<br class="clearBoth" />

Where you want to change the '1000's to the product id of the charity product. And change the MYDOMAIN to something appropriate.

Nick
iszent.com

31 Aug 2010, 6:33 AM
#3
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Post #3 by danielle

Hi there,

I am interested in the variable donation option. I do already have a product setup with a donation box where the customer enters the donation amount and it gets added to the cart. And I already have the product displaying on the shopping cart page as per your instructions. What I would like to do is display the actual text box on the shopping cart page, with a button that says "Donate". When the customer enters the amount and clicks the button, the product is added to the cart and the screen refreshes with the new total including the donation amount. Is that possible?

Thanks!

Danielle