/

Description of all Modules

Learn about each individual default Donation Store Module

Introduction


Modules are small pieces of independent functionality that can be placed throughout your webstore. Donation Store comes with some default Modules that can be used by you throughout your store. If you haven't already read the doc explaining how modules work, please do so now here

This doc doesn't explain how modules work, that's in the above doc. This doc explains each available module individually. Note that while this doc gives examples of how the modules could be implemented, the default template has implementations for every one of them. This should also be used as a reference when making custom templates to see how it is implemented by default.

Gift Card Balance Module


The Gift Card Balance module is used to take a gift card number and return it's balance. It has two states. One where the form is shown to request the balance and then also where the form and the balances are shown.

In the gift card balance template, the actual gift card module variable is returned. This doesn't hold as much information as the other modules would, however you can access the header of the module using

{{ module.header }}

You should display a form that has the same input fields (with the same names), as the default. Don't forget to include the {% csrf_token %}. If someone has actually entered a number and the information has been retrieved, you will have access to the "gift_card" variable. That's why you can do a check to see if it is set, and display the balances accordingly. If it's set, you can access all information about the gift card object

{# If the gift card has been requested/been set #}
{% if gift_card %}
	{# You now have access to it in here %}
	{{ gift_card.number }}
	{{ gift_card.start_balance }}
	{{ gift_card.owner_email }}
	{{ gift_card.creation_date }}
	{# etc #}
{% endif %}

Payment Goal Module


This one is fairly straight forward. You can access the amount that has been already received and also the goal. You can check to see if the module should display the amount too. You can also check the animated bar status to decide whether the bar should be animated.

{% payment_goal_module module as payment_goal %}
{% if payment_goal.module.show_amount %}
	{{ payment_goal.amount }} {{ payment_goal.module.goal_target }}
{% endif %}

{{ payment_goal.percentage_of_total }}%

{% if payment_goal.module.animate_bar %}
{# Do animate stuff #}
{% endif %}

Recent Payments Module


The recent payments module returns the list of recent payments that have been filtered based on what you have chosen on the control panel. For each payment it also returns the packages bought within that payment. The default template shows how this should be rendered to comply with what you set in the control panel, however you can customise it however you want.

{% recent_payments_module module as recent_payments %}
{# Can loop through each payment #}
{% for payment in recent_payments.payments %}
	{# Can then loop through each package bought in that payment #}
	{% for package_bought in payment.packages_bought #}
		{# Do whatever you'd like #}
		{{ package_bought.name }}
	{% endfor %}
{% endfor %}

Server Status Module


The server status module is used to ping your server to see if it's online, get it's players current and max players and also to get the MOTD.

{% server_status_module module as server_status %}
{# Check if the server is Online #}
{% if server_status.status %}
	{# Is online :D #}
	{{ server_status.module.hostname }}
	{{ server_status.current_players }} / {{ server_status.max_players }}
	{{ server_status.motd }}
{% else %}
	{# Offline :( #}
{% endif %}

Text Box Module


The text box module is the most straight forward module. It simply renders any text passed into it.

{% text_box_module module as text_box %}
{{ text_box.text|safe }}

The safe filter allows for HTML to be placed here. If you don't want to allow HTML, just remove it, so it looks like

{% text_box_module module as text_box %}
{{ text_box.text }}

Top Customer Module


The top customer module returns the top customer on the webstore in a given period. It does all of the work for you (i.e. the during what period etc.), all you have to do is render it yourself. You can display the top customer using something like the following

{% top_customers_module module as top_customer %}
{% if top_customer.customer %}
{{ top_customer.customer.username }}
{{ top_customer.payment__amount__sum }}
{% endif %}

Have Questions? Open a Support Ticket

View Common Issues on the Knowledgebase

Video Guides on YouTube

Other clients and Donation Store developers hang out on our Discord server, where you can ask for support in #ds-chat, or if you are a Client and you don't uet have your Client role on Discord, let us know and we can add it. Once added you get access to our private Client's support channel.