Coupon

Blocks ::: block_coupon
Maintained by Sebsoft BV, Rogier van Dongen
The Sebsoft Coupon Plugin offers you the possibility to create coupons for various levels of course access. Using a coupon code, users will be enrolled into courses that are attached to the coupon.
Latest release:
647 sites
429 downloads
105 fans
Current versions available: 5

SEBSOFT COUPON PLUGIN


The Sebsoft Coupon Plugin offers you the possibility to create coupons for various levels

of course access. Using a coupon code, users will be enrolled into courses that are attached to the coupon. That way, you can use the coupon system as voucher or vouchering system for your course(s).


There are a few different ways of generating coupons:

- Course level: this means one or more course(s) need to be selected for which the coupon is valid.

  Once the coupon code is entered by a user, he or she will be enroled in every course the coupon

  is attached to.

  A nice extra feature is, when groups are configured for a certain course, you can configure which

  course group the coupon is for. When a user claims the coupon, he or she will be added to that specific

  group in the course. This makes it possible to separate coupon users from regular users.

  You could also make specific course groups every time you generate a batch of new coupons, so there's

  some way of matching a batch of coupons to a group of users. The possibilities are numerous.


- Cohort level: this means one or more cohort(s) need to be selected for which the coupon is valid.

  Once the coupon code is entered by a user, he or she will be added as a cohort member for every

  cohort the coupon is attached to.

  NOTE: When generating cohort level coupons, there is a possibility to "connect" extra courses to

  a given cohort. One MUST know that upon doing this, the courses will at that point be added to

  the cohort enrolment sync. Without knowing this little fact, it could be "unexpected" behavior,

  even though it's a logical step.


Furthermore, coupons can be generated on two "access" levels:

- Personalized. The base of this, is either a CSV is uploaded, or a CSV is given directly in a textbox.

  The needed user information for every coupon to be generated will be the user's name, email address

  and gender.

  These coupons will then be generated and sent off to the appropriate users using a background task.


- Bulk: The base of this is simple: you generate a certain amount of access coupons, which will then

  be emailed to the pre-configured recipient or (if allowed) to an emailaddress that can be freely entered.


- WARNING:

  Wherever possible, please use PNG images.

  Also, whenever possible, do NOT use images that have an alpha channel.

  This will MASSIVELY slow down processing time, due to internal conversion of images by TCPDF.

  On our tests, for a 300 DPI image on A4 format (2480 x 3508 pixels) with an alpha channel,

  rendering a single PDF took around 25 seconds. Taking the alpha channel out of the image,

  rendering a single PDF was reduced to around 3 seconds.

  This means the PNG images should _always_ be stored as 24-bit true colour images.

  _Do not use 32-bit_ (true colour + transparency)!

  Furthermore, whenever possible, have the coupon generator create a single PDF with all

  coupons (this is only applicable when generating coupons in "bulk" mode). The process of

  generating coupons has been optimized to only "use" the image 1 time when creating any amount

  of coupons in a single PDF. If you choose the option to create a seperate PDF for every coupon,

  the image will have to be rendered for each and every PDF.

  This has 2 major downfalls:

  1. Every PDF will roughly have a slightly bigger size than the image size (in our tests, 350 - 400 kB per PDF)

  2. Every PDF takes the full amount of time to render.

  Effectively, this means the following (using fictitious sizes):

  10 coupons, single PDF -> result is around 400 kB, rendering takes around 3-4 seconds.

  10 coupons, seperate PDFs -> result is around 4 MB, rendering takes around 35-40 seconds.


INSTALLATION INSTRUCTIONS


- Copy the coupon folder to your blocks directory.

- Go to the moodle admin pages (you will probably be confronted with it anyway) and install the plugin

- Configure the main settings for the plugin.

- We're set up for usage!


PLACEMENT OF THE PLUGIN


There are only two pages you can add the coupon block on. This is the site's frontpage

or the user dashboard (my) page. The main reason for this is because the block is the

"frontend" for users to enter their coupon or voucher code.

Administrators and users with the correct capabilities will also see the links to

the coupon administration pages and the coupon generator page.


GENERAL CONSIDERATIONS


There's two main configurations to consider when generating coupons.

For course type coupons, this plugin attempts to enrol a user through use of Moodle's

internal function "enrol_try_internal_enrol".

The Moodle documentation shows it will attempt to enrol you using manual enrolment.

For this reason manual enrolment MUST be enabled for these courses.


For cohort type coupons, a user is made a member of a cohort. That's all there is to it.

Surprise though, if you want to actually make a user have access to a course, you

probably want to configure cohort enrolment for the course.


For those paying attention, creating cohort type coupons thus enables a simple

way of enrolling users into multiple courses at once just by configuring the right

cohort enrolments in multiple courses.

That's still not to say course coupons can't be used in a similar way (using meta courses).


Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7
Screenshot #8

Contributors

Sebsoft BV (Lead maintainer)
Rogier van Dongen
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Aakash Jain
    Tue, 21 June 2022, 5:54 PM
    Hi,

    Is it possible to set a custom discount percentage between (1-100%) or set custom discount amount for a coupon. Currently it is getting applied at 100% ?
  • Rogier van Dongen
    Tue, 21 June 2022, 6:42 PM
    Hi Aakash,
    You're using the wrong plugin! This coupon plugin is not intended to provide any kind of "discount" as you're clearly indicating. The plugin provides voucher based course/cohort/enrolment access and there's no link to any payment whatsoever.
    If you'd like to provide a discount in combination with paid course access, you may want to take a look at the "enrol_gwpayments" plugin that's also been developed by us. This provides paid course access combined with payment gateways (Moodle 3.10 and up) as well as fully blown discount code configuration.
    Cheers.
  • Hugh Mann
    Wed, 20 July 2022, 6:13 PM
    Hi team,
    I love your plugin and have been using it for years (so big delayed thanks for that).
    I installed it on a Moodle 4.0 and seems to work as intended except for one rather minor thing. In the cleanup section, the date filters (Created before / Created after) don't seem to go beyond 2020. I know the plugin does not officially support 4.0 but I would be surprised if it didn't affect all versions.
    Best regards,
  • Rogier van Dongen
    Wed, 20 July 2022, 6:20 PM
    Hi Hugh,
    Big thanks (non-delayed ;)) from my end too, both for the cheer and your comment smile
    We'll look into it asap (I do have a sprint week planned in the not so distant future but will see if I might be able to examine/update the plugin sooner).
    Funny how, in the last few weeks, I've received multiple notifications about the date/time pickers; all related to certain dates.
    I haven't checked yet if this is due to changed behaviour in Moodle; but the fix should be easy enough.
    Please keep an eye on both this page and optionally, the github repository. We do sometimes push to the repository before releasing (we're working on full release automation to keep versions here_and_ the repo in line at every point in time).
    Cheers!
  • Itumeleng Khala
    Thu, 21 July 2022, 3:59 PM
    Hi Team Rogier
    Is there a way to automatically add the block for all students?
    As some users may not know how to customize Moodle - So i would like to automatically add this block for them. I have set the permission to for View Block to Allow for students it will not load automatically. I have also set it to Inherit - same results. Kindly assist.

    Moodle version: Moodle 3.11.5+ (Build: 20220303)

    Thanks

  • Rogier van Dongen
    Thu, 21 July 2022, 4:08 PM
    Hi Itumeleng Khala,
    My first question would be: in what way are you attempting to add the block and on which page?
    The block can basically only be added to the frontpage and student's dashboard page (/my).
    To enable it for all student's, the correct way would be to add it to their default dashboard pages (site administration -> appearance -> Default dashboard page). This should force the block the dashoard page for every student.
    If this is how it was configured already let me know.
    Cheers
  • Itumeleng Khala
    Thu, 21 July 2022, 4:47 PM
    Hi Rogier,

    I appreciate the speedy feedback very much. Awesome support.

    My first question would be: in what way are you attempting to add the block and on which page? I was checking the Block config settings.
    default dashboard pages (site administration -> appearance -> Default dashboard page) Takes me straight to the Dashboard and after updating config again still no luck

    I want students to automatically have this block when they login without manually updating it.
  • Rogier van Dongen
    Thu, 21 July 2022, 4:57 PM
    Hi Itumeleng,
    Thank you for that smile
    I'll have to quickly check/verify this. Can you confirm students are also allowed to modify their own dashboard? There may be a few configuration options that could collide.
    Also, you could try to use the "Reset Dashboard for all users" button (from the aforementioned "Default dashboard page" pages).
    Every now and then I've received similar comments and most of the time, this option fixed everything.
    You _may_ wish to try this on a test/acceptance environment if your Moodle installation is in production and heavily in use (because it may cause dashboards to "suddenly" change for your other users).
    I'll be back at the office tomorrow so I can't realistically get back to you before tomorrow if that's ok.
    You can also email me directly (just look for my e-mailaddress in the source code or on github; you can pretty much find it in every file), although the first thing that came to mind was using the "reset" option.
    Cheers!
  • J. F.
    Wed, 17 Aug 2022, 6:29 PM
    There is currently a problem with the plug-in on our instance:
    If a user has never been on the site and scans the QR code, the self-registration page appears, but the user is not enrolled in a course after completing the self-registration.

    This is probably because the voucher code is not transmitted to the site. On the first visit, the field with the filled-in voucher code does not appear. If the registration is cancelled and the code is scanned again and the page is called up again, the field appears and the user is enrolled after completing the self-registration.

    We are running moodle 3.11. on Ubuntu 18.04.6 LTS with NGINX and postgresql.

    Can anyone help?
  • Robin de Rooy
    Fri, 9 Sept 2022, 9:44 PM
    I need to shift some of the text downwards to create some space for an image. Also the QR-code should move to a different location. Does anyone know where the coupons are generated or where these position information is stored?
    Thanks in advance!
  • Rogier van Dongen
    Fri, 9 Sept 2022, 9:50 PM
    @Robin
    At the moment, the "blocks" where text is writtenm, as well as the block where the QR code is included, is hardcoded.
    The only way this could be changed is when you'd hack into the pdf.php file and physically change the coordinates.
    We absolutely have a roadmap to have this configurable but this will not really be facilitated any time very soon due to the huge pressure of other (paid) projects.
    Should you need help with this; find my email in the sources and contact me directly. I can provide some guidelines if needed.

    @JF I havent yet been able to reproduce your issue but honestly have to admit I'm very short on time. However, we did take notice of your issue and try to have it resolved (or explained) asap.

    Cheers
  • Robin de Rooy
    Sun, 18 Sept 2022, 5:19 PM
    @Rogier,
    Thanks for the reply. I have found it and changed the text and its position. Thank you!
  • Robin de Rooy
    Tue, 20 Sept 2022, 3:41 PM
    @Rogier,
    I changed some text in the block_coupon.php file (in \coupon\lang\nl) but the text is not used in the pdf when creating the coupon(s). I looked at the server and the file is indeed changed (date, time but also its content). So, how is this possible? What do I miss?
  • Rogier van Dongen
    Tue, 20 Sept 2022, 3:44 PM
    @Robin,
    Not 100% sure what method you used to change the language; but language strings are cached in Moodle.
    The best way to go about this is to use the correct interface in Moodle itself (seee e.g. https://docs.moodle.org/311/en/Language_customisation). You *could* try clearing the caches first; then this way if clearing caches doesn't help. The standard way to modify defined language strings however is through the provided interface.
    Cheers
  • Robin de Rooy
    Tue, 20 Sept 2022, 6:48 PM
    @Rogier,
    Yes, good idea - and it worked (I already cleaned the cache before). So, now I am going to look where changes are made. At least I can see them in the coupon! Nice.
Please login to post comments