Skip to content

Add Donation Widget on the site #71

Closed

Description

@moyvincent

Description

The partner wants to add a widget to the side of the website to show a little bit of info about OSI and has an option for people to contribute.

The partner wants to copy the functionality on: https://members.opensource.org/donate/

Here is a quick Mockup the partner provided:
image

When the user clicks on either of the One-time or Yearly buttons, the rest of the fields are displayed:
image

This is the Mobile/Tablet view:
image

Reference

Zendesk
Dev Repo

Activity

  1. gin0115 commented on Apr 29, 2024

    @gin0115
    Contributor

    Have started on this and got it all cloned down locally to investigate. It looks like the members site uses a version of CiviCRM to handle the donations, ive requested access to the member's site in slack.

    Will see if its possible to use the existing functionality, if not we can possibly do this using the T51 donations plugin, but will try and leverage what they already have if possible.

  2. xpurichan commented on May 1, 2024

    @xpurichan

    👋 Wanted to confirm that you received the access you needed @gin0115 . Let me know!

  3. gin0115 commented on May 1, 2024

    @gin0115
    Contributor

    Hey

    Sadly i was told its not something i can work on as its not held in Team51 Repos, so its been added back to the triage queue, sorry @xpurichan

  4. xpurichan commented on May 1, 2024

    @xpurichan

    No worries, thanks for confirming @gin0115 ! I see this will be re-assigned out next week.

  5. nickpagz commented on May 8, 2024

    @nickpagz
    Collaborator

    I've had a brief look at this and there's two main things to address here. One is the page templates, the other is donation handling.

    1. Page Templates - In order to add a donation widget in a sidebar we'll need to update page templates to include a sidebar. The only page with a sidebar at the moment is the blog archive page. Do we know which post types or pages will have the donation widget? Also, based on the mock-ups, the width of the sidebar is greater than on the blog page, so this would need some different styling applied. I think the best approach here would be to register a new widget area specifically for the pages where we want it to appear. This would make it easier to add/change whatever donation solution is implemented. Never mind, I just read the Zendesk ticket which is very specific on the page and location. I'll start looking into a solution for this.
    2. Donation handling - as mentioned above, the members site uses CiviCRM for the donations, among other things. It would probably make sense to use the same solution here, though we would probably need to install the plugin and connect it up. It seems like overkill, though I'm not familiar enough with the plugin/platform. Another option could be the Team 51 Donations plugin - which would also require WooCommerce, WooCommerce Subscriptions, and a hookup to potential gateways. There's also other standalone donation plugins, all of which also require connections to payment gateways. Is there a preferred route we're looking to go here?
  6. smaffulli commented on May 8, 2024

    @smaffulli
    Contributor

    Glad to read you sorted out 1.

    For donation handling, we should really make an effort to use Civi, ideally through its API. We need to find a way to build a donation form that uses the Civi installation we have on members.opensource.org. @ajolo2ky can you please loop in Bryan to address this?

  7. ajolo2ky commented on May 8, 2024

    @ajolo2ky
    Contributor

    Sure. I've created ticket #7880 for him.

    opensource.org and members.opensource.org are connected through Civi, so I think the easiest way is to create a new Contributions Page and develop a quick plugin to fetch its HTML code through the API, but let's wait and see what Brian has to say.

  8. ajolo2ky commented on May 10, 2024

    @ajolo2ky
    Contributor

    I realized there's a simple option to allow embedding Contribute Forms from Civi elsewhere. Here's a quick example: https://registro.nerdear.la/civijs.php

    This is the javascript provided by Civi:

    <!-- The stylesheet link is optional and can be removed 
    if you want to style the form yourself, or if you 
    already are including a bootstrap css environment. -->
    <link rel="stylesheet" property="stylesheet" href="https://members.opensource.org/wp-content/civicustom/ext/net.ourpowerbase.remoteform/remoteform.css">
    <link rel="stylesheet" property="stylesheet" href="https://members.opensource.org/wp-content/civicustom/ext/net.ourpowerbase.remoteform/spin.css">
    <div id="remoteForm"></div>
    <script src="https://members.opensource.org/wp-content/civicustom/ext/net.ourpowerbase.remoteform/remoteform.js"></script>
    <!-- Extra JavaScript URLs, if any: ... -->
    <script> var remoteFormConfig = { 
     url: "https://members.opensource.org/civicrm/remoteform/",
     id: 7,
     entity: "ContributionPage",
     // Uncomment line below for test mode,
     // paymentTestMode: true,
     // Extra JavaScript Params, if any: ...
    };
    if (typeof remoteForm !== "function") {
      document.getElementById("remoteForm").innerHTML = "Oh no! I was not able to display the form! Please check your security settings (for example Privacy Badger) and allow remote javascript to be displayed from members.opensource.org."
      document.getElementById("remoteForm").style.color = "red";
    }
    else {
      remoteForm(remoteFormConfig);
    }
    </script>
    

    I've added the staging website in our CORS policy. Could you please try it and let me know if it works.
    Then we'll have to do some visual touches for it to look good, but let's first try to see if this is technically viable.

    Thanks,

  9. smaffulli commented on May 10, 2024

    @smaffulli
    Contributor
  10. nickpagz commented on May 11, 2024

    @nickpagz
    Collaborator

    I've made a first go at adding a sidebar widget area called "License Sidebar" (in Appearance > Widgets) and pasted in the script above. I've un-commented the test mode attribute. Sample page here, though any license will show it.
    The good news is it works, and we can probably use this as the way forward. The bad/tricky part is the styling of the form. I'm not sure why, but it seems the script provided by Civi is just a generic one with the correct form ID. I say that because I was expecting the same form element selectors and styling/stylesheet, but it's not the case. Even if I link the relevant stylesheets from members.opensource.org nothing happens because of the missing selectors on the form elements.

    Can we find out if it's possible to also pull the form element selectors the same way it renders on the members site?

  11. ajolo2ky commented on May 13, 2024

    @ajolo2ky
    Contributor

    Thanks for testing it out! I've reached out our Civi developer to see if he can help us with the styling.

  12. ajolo2ky commented on May 13, 2024

    @ajolo2ky
    Contributor

    @nickpagz this is his response:

    from what I understand remote form intentionally breaks from the Civi styling to present a more stripped down markup because the assumption is that the site where you are embedding the form will have it's own styling that you would want to match. in other words, you would adjust the styling on your target website so have the embedded form match.

    re: form element selectors specifically -- all of the form elements have unique IDs, so they should be easily selectable.

  13. nickpagz commented on May 14, 2024

    @nickpagz
    Collaborator

    Ok, let me see what I can do.

  14. nickpagz commented on May 20, 2024

    @nickpagz
    Collaborator

    @ajolo2ky @smaffulli
    I've been poking around a bit more with this and looking at options. I should be able to style the remote form to get close to the members site with one major exception - the recurring donation. As far as I can tell, the remote form extension doesn't support recurring donations. If that's not an issue, then I'll work on styling the remote form.

    If recurring donations are a must, then we can consider alternatives such as a basic link to redirect users to members.opensource.org/donate/, potentially with pre-populated selections, other donation plugin/form options outside of civiCRM, or potentially a custom solution through the civiCRM API (I haven't looked into this option yet, and what is possible here).

    Looking forward to your thoughts.

  15. ajolo2ky commented on May 20, 2024

    @ajolo2ky
    Contributor

    Let's get this started, if in the next three months we get a good flow of donations we will consider expanding the functionality. Please move forward!

    Thanks,

  16. 7 remaining items

  17. lcdservices commented on Jul 18, 2024

    @lcdservices
    Collaborator

    @nickpagz sorry for the delay following up on this. The page you linked to previously doesn't appear to have the form anymore. Can you setup a new test page that includes the remoteform js and we can troubleshoot there before adding it to the "real" page? We should be using form ID 19, and I've made one change at my end to address a possible issue. But I'll need something setup for testing at your end to try to troubleshoot the CORs issue further.

  18. nickpagz commented on Jul 31, 2024

    @nickpagz
    Collaborator

    @lcdservices My turn to apologize on the delay here! It looks like another PR wiped out the changes I had made to the theme, but I've added them back now. You should now be able to see the form here:
    https://open-source-initiative-development.mystagingwebsite.com/license/artistic-1-0

    I'm bypassing my script (osiFormInit) for now as this was causing a 500 response, and is really only being used for styling/layout changes. With it out of the way you should be able to now see the CORS issue in the console.
    If/when we resolve that issue I can jump back in and try to resolve the issues with my script.

  19. ajolo2ky commented on Aug 30, 2024

    @ajolo2ky
    Contributor

    Hi, after all the back and forth we decided to go with a much simpler choice. I integrated a Stripe card and it's now working in stg:
    https://open-source-initiative-development.mystagingwebsite.com/license/w3c

    Could you please promote the license template with the sidebar to production ?

  20. nickpagz commented on Sep 3, 2024

    @nickpagz
    Collaborator

    Thanks @ajolo2ky I'll get the PR cleaned up and pushed out this week.

  21. nickpagz commented on Sep 9, 2024

    @nickpagz
    Collaborator

    @ajolo2ky The license sidebar template is now live on production. You can add the Stripe donation code to it now.

    Please let me know if you run into any issues.

  22. ajolo2ky commented on Sep 12, 2024

    @ajolo2ky
    Contributor

    Hi, I added it and it's working, thanks. Minor fix (test in stg and then we move to prod):

    Could you separate a little more the body of the license and the sidebar ? ideally the donation box would fit visually right below the OSI approved license logo

  23. nickpagz commented on Sep 16, 2024

    @nickpagz
    Collaborator

    Sure thing! Let me see what I can do.

  24. nickpagz commented on Sep 17, 2024

    @nickpagz
    Collaborator

    @ajolo2ky I've made the adjustment on the staging site. Let me know what you think.

  25. wpspecialprojects commented on Oct 16, 2024

    @wpspecialprojects
    Collaborator

    @ajolo2ky checking to make sure you saw this thread

  26. ajolo2ky commented on Oct 25, 2024

    @ajolo2ky
    Contributor

    Thanks for the nudge. Looks good, please promote it to prod.

  27. toncijajic commented on Oct 25, 2024

    @toncijajic

    @nickpagz noting the above.

  28. nickpagz commented on Nov 20, 2024

    @nickpagz
    Collaborator

    @ajolo2ky My apologies for the delay! I've now merged the change to the production site, though it looks like the donation widget code is commented out. If/when the code is reactivated and you notice any issues, please let me know.

  29. toncijajic commented on Nov 26, 2024

    @toncijajic

    @nickpagz noting I've pinged @ajolo2ky in the email too, to move this forward.

  30. ajolo2ky commented on Nov 26, 2024

    @ajolo2ky
    Contributor

    Hi, yes, just responded in the thread over email. Thanks for pushing this. Let's close the issue as we need to implement some internal processes before enabling this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions