Brought to you by
2BlueSolutions Creative Web Design

Wednesday, January 25, 2012

Virtuemart - DIBS module “No paytype(s)! Missing test parameter?”

As a follow up to my previous post about installing the DIBS module in Virtuemart, there is a poorly documented error you will run into when trying to use the payment module on a live site.

Basically, it will complain about a missing "paytype" which is actually not what is missing.  What is missing is the "test parameter" as the error will tell you.  After spending too much time trying to fix the "missing" paytype, I tried a different method and deduced that it really was missing a test parameter.

With the default setup, the DIBS payment processor will only send a "test" variable to DIBS when it is actually in testing mode.  Makes sense, right?

 if(DIBS_TESTMODE == "YES") {
  $oid = 'test-' . $db->f("order_id") . '-' . time();
  $post_variables["test"] = "YES";
  $post_variables["orderid"] = $oid;
 } else {
  $oid = $db->f("order_id") . '-' . time();
  $post_variables["orderid"] = $oid;
 }
 

Unfortunately, when it is not in testing mode, it does not send the "test" parameter to DIBS, as you can see in the above conditional statement.

It is an easy fix.  You just need to add a line which will send a "test" value of "NO" to the DIBS payment site when you are not testing the site as shown below:

 if(DIBS_TESTMODE == "YES") {
  $oid = 'test-' . $db->f("order_id") . '-' . time();
  $post_variables["test"] = "YES";
  $post_variables["orderid"] = $oid;
 } else {
  $oid = $db->f("order_id") . '-' . time();
  $post_variables["orderid"] = $oid;
  $post_variables["test"] = "NO";
 }

Monday, January 16, 2012

Installing DIBS in Virtuemart

I recently was contacted to install the DIBS payment module in Joomla's Virtuemart.

It is actually a very straightforward procedure that the DIBS developers lay out nicely in their help file.

First step is to download the files you need from the DIBS site: http://tech.dibs.dk/toolbox/dibs_standard_shopmodules/ (direct download)

Scroll down to the VirtueMart plugin or choose the above direct download link.

Unzip the files.

Inside, you will find the "docs" folder which contains a readme file which is very well laid out.

Quickly, the steps are:
  1. Upload the contents of the module folder to the root of your Joomla installation.
  2. Log in and navigate to your Virtuemart administrative page.
  3. Select List Payment Modules (under Store) and choose DIBS Credit Card from the list of available payment modules.
    1. Tick the box for "Active" to make it active.
    2. Change the payment method name to whatever you want the customer to see when they checkout.
    3. Code = "DIBS".
    4. Payment classs name = "ps_dibs".
    5. Payment method type:  choose the radio button for HTML-Form based.
    6. Discount = 0.00
    7. List Order = 0 (or whatever number you want it to appear as in your list of payment options)
    8. Next, go to the configuration page:
      1. Open the file, from the archive you unzipped, called payment_extra_info.php and cut and past the contents into the big text area called Payment Extra Info.
      2. Enter your Merchant ID
      3. Log into your DIBS administrative panel and get your MD5 codes you will need to enter into the MD5Key1 and MD5Key2 fields. 
      4. Click save.
That's pretty much it, though you should probably test the module, so choose "Test Mode = Yes" in the above configuration panel and do a quick run through of a purchase on your site.  The test credit card numbers you'll want to use are found here:  http://tech.dibs.dk/10_step_guide/your_own_test/

Tuesday, January 10, 2012

Virtuemart - Remove or Edit Send Registration Button (or Form)

If you want your checkout page to look like this:




First, you can edit the text for you button in:

/administrator/components/com_virtuemart/languages/common/english.php

Search for: BUTTON_SEND_REG

Whatever you put in for that value, will change the value of the button. For example, put in "Next" instead of "Send Registration" (the default value):



Now, to remove the empty "Next" box as seen in the above example, it will just require a simple edit from within your Virtuemart administration page.

Log into your Joomla administration page.

Enter your Virtuemart administration page.

Under Admin, select Manage User Fields.

Find delimiter_sendregistration:



Then click on the green check mark in the Published field to unpublish the field



Finally, for a little bit of housekeeping, edit the following file and add some blank space before the BUTTON_SEND_REG button.

/admin/components/com_virtuemart/checkout_register_form.php