Fixed and Custom Donation Form

staeinstaein Member
in Help edited February 2015
Greetings,

I am looking to see if it is possible to set up a form that allows for one-time donations (of any amount) and monthly donations (of fixed amounts).

I know I can somewhat achieve this by using a select for donation level, a price text input and a select for donation frequency. The problem we run into though is that people don't choose the right frequency option for their donation (if I set the default frequency to monthly, the one-timer donaters don't realize it... if I set it to one-time, the ones choosing monthly levels don't select the monthly frequency).

Is it possible to append this type of an option to include a subscription?
<option value="Partner{p:20}">Partner Program - $20 monthly</option>

Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    edited February 2015
    @staein,

    It is definitely possible to set up a donation form that allows for custom and predetermined amounts, as well as allowing for one-off and subscription based donations. We have an example of setting up the custom and predetermined tiers on our wiki here: https://wiki.foxycart.com/snippets/add_to_cart_form/form_with_radio_options_for_price_with_an_option_to_enter_any_amount

    For making that also allow for one off and recurring donations - you could add a select or radio input for the "sub_frequency" like this:
    <label for="recurring"><input id="recurring" name="sub_frequency" value="1m" /> I want to donate monthly.</label>
    <label for="oneoff"><input id="oneoff" name="sub_frequency" value=""/> I want to donate just this once.</label>
    That combines it all into one form. If you need to only allow the tiers for monthly donations and the open text field for one-off donations - you could also set it up as two different forms, and use javascript to hide/show the required forms. So when the user hits the donation page, all they would see are two options - donate monthly or donate one time. They would then need to click one of those options to see the relevant add to cart form.
  • @fc_adam

    I do like that idea of using JS to hide/show the forms, so might go with that.

    Is there a way where you could have 1 series of radio buttons (or a select) that lets you do:

    *$20 monthly
    *$30 monthly
    *$50 one-time

    Something like the product modifiers for price and weight?
  • fc_adamfc_adam FoxyCart Team
    @staein,

    We don't have a way to do that using a straight FoxyCart add to cart form - but you could rig up some javascript that configures the sub_frequency attribute dynamically based on what option has been selected. So the radio input/select dropdown would be the price input - and then on change you'd update the sub_frequency hidden input to either be "1m" or "" depending on the selection.
  • @fc_adam

    Alright, I can do that to make it work. Wanted to make sure I wasn't missing something in the wiki before doing a JS route.

    Thanks for the help!

  • I took the javascript route for this in our 1.1 shopping cart but it doesn't work right in the 2.0 version. Instead of opening the sidecart, when the javascript calls form.submit() it goes to domain.foxycart.com.... What do I need to add to make it open the sidecart? Is it just the fcsid or are there other parameters as well?
  • I took the javascript route for this in our 1.1 shopping cart but it doesn't work right in the 2.0 version. Instead of opening the sidecart, when the javascript calls form.submit() it goes to domain.foxycart.com.... What do I need to add to make it open the sidecart? Is it just the fcsid or are there other parameters as well?
  • LucyILucyI Member
    Would also like to know the answer to @Aleric 's question.

    Has the snippet form_with_radio_options_for_price_with_an_option_to_enter_any_amount been updated to work with a 2.0 cart? We'll be in need of this shortly.
  • brettbrett FoxyCart Team
    @LucyI, I don't see anything on that wiki page that'd cause problems in 2.0. Is it not working for you? My hunch is that there's a js error somewhere that's just borking all the js on the page. If you can share a link, we can take a look.
  • LucyILucyI Member
    Oh, I haven't even tried it yet, just assumed it isn't compatible since it's not included in the 2.0 snippets, and the OP had issues with it when they updated to 2.0. I'll report back once I try it. :)
Sign In or Register to comment.