Moodle and e-commerce shopping carts

Moodle and e-commerce shopping carts

Linking Moodle to a web based shopping cart is easy and requires very little coding to allow users to browse courses, add them to a cart, pay for them, and then automatically gain access to the paid courses on Moodle.  And best if all, only use one login for the entire process.

Moodle + Magneto = Amazing Moodle Shopping CartMy personal favourite Open Source carts are OS Commerce and the newer, slicker Magento.  But it really doesn’t matter which cart you use, as long as it is driven by a popular web database such as MySQL or MSQL. It can be home grown or a commercial platform.

This short blog posts explains the process in its simplest terms.

In your online shop you create courses as products. You can put them in categories, offer discounts and name then whatever you like. Just like you would if we’re selling DVDs or shoes.

The important bit is to use a unique field for your product that we can use as a course ID number in Moodle.

Once you have your courses entered into your shop and you’ve configured it to accept payments and create accounts you are ready to instruct Moodle to read the products and the users from the shop database.

For this step we will be using 2 important Moodle features.

  1. Plugins > Authentication
  2. Plugin > Enrolment

Under the authentication plugin in Moodle, choose “External Database” and complete the form to match the credentials of your shopping carts database.  You will need to know the user fields used in your shopping cart and basically match them up to the user fields in Moodle.

Now under the enrolment plugin we need to do the same thing, this time we are matching fields from your product table with fields in the Moodle course table.

Now make sure that your courses have the same IDNUMBER as your products in the shopping site.  Lastly, make sure both plugins are enabled and away you go.

Here’s  a quick recap of the process and what happens:

  1. Your user visits your shopping site
  2. They browse for courses and add them to the cart
  3. They go to the checkout and pay for the courses and enter their personal details
  4. Now they can visit your Moodle site and login with the same details they just entered for the shopping site
  5. Moodle will log in the user and enrol them on the correct courses (i.e the ones they have paid for).

You can take this further and theme the shopping site to match your Moodle install and customise the emails to provide direct links to the course in the emailed receipt.  And if you want to go even further, you could tweak the code to keep the same login session so it’s seamless between the 2 systems.

I hope you found this useful and if anyone is thinking about creating a shopping cart for Moodle.

 

Previous post Block Building for Moodle 2
Next post The importance of Moodle backups