Installation Tips for Authorize.net for Virtuemart on Joomla 1.0.13Until the next maintenance release of the 1.0 series of Joomla, VM users are running into roadblocks. There are a couple of primary issues resulting in this: Joomla 1.0.13 changed the password storage.Joomla 1.0.13 changed the way session are initiated.
Most early adopters were frustrated and had to roll their storefronts back to the 1.0.12 version. This is a huge issue if the backup recommendations had not been followed. It wasn't long before the Virtuemart forums were flooded with requests to correct this. This post is to provide a one stop fix for these two Joomla / Virtuemart issues.
| Soeren (lead Virtuemart developer) imeadiately released a "hot fix " to correct the second issue. However, anyone working with Authorize.net has found that the system would not allow them to modify the transaction key. I worked my way through the issue and was able to find that the password storage system was the cause. I programmed a patch to this and have it available below and on the Virtuemart Forums . But then we found that the system would continuously redirect us to the Admin Login screen. After tracking this back to Joomla I found it was also an issue from the second issue and Soeren's fix had not corrected it. I began looking through the Joomla forums and found that RobS had produced a fix. Continue reading for a simple tutorial to correct this. |
PATCH JOOMLA The first thing to do after installing Joomla 1.0.13 is to patch the base installation. - index.php - copy this file over the file found at: [yoursite]/administrator/
- joomla.php - copy this file over the file found at: [yoursite]/includes/
PATCH VIRTUEMARTYou should have Joomla patched at this point. If you do not have Virtuemart installed, go ahead and do so at this point. Once Virtuemart is installed you are ready to patch Virtuemart to work with the new password storage system. I'm going to present this two different ways. The first way is a file that can be downloaded and copied over top of the corresponding Virtuemart file (use this method if you have not hacked or modified ps_main.php). - Download the password hot fix from here:
VM 1.0.12 Password Fix.zip
- Copy the file ps_main.php over the file found at:
[yoursite]/administrator/components/com_virtuemart/classes/
The second way is to manually edit a file (use this method if you have hacked virtuemart and are not sure if you modified ps_main.php at some point). - Open the following file in a text editor (PsPad recommended ):
[yoursite]/administrator/components/com_virtuemart/classes/ps_main.php - Locate the function mShop_checkpass() at around line number 729 (this line number may be different if you have modified your file).
- Replace the function with the following code
/** * Login validation function * * Username and encoded password is compared to db entries in the mos_users * table. A successful validation returns true, otherwise false */ function mShop_checkpass() { global $perm, $my,$vmLogger; $db = new ps_db; // only allow access to admins or storeadmins if( $perm->check("admin,storeadmin")) {
$username = $my->username; $passwd = trim( mosGetParam( $_POST, 'passwd', '' ) ); $bypost = 1; if (!$username || !$passwd || $_REQUEST['option'] != "com_virtuemart") { return false; } else { // Modified to work with the new Joomla password system // Thomas Freeman, www.KustomServices.com $q = "SELECT password FROM #__users WHERE username='$username'"; $db->query($q ); $passes = false; while ($db->next_record()){ //Extract the password and the salt code list($hash, $salt) = explode(':', $db->f("password")); //Encrypt the passed password with the salt code $cryptpass = md5($passwd.$salt); //See if there is any password //in the database that matches if ($hash == $cryptpass){ $passes = true; } } if ($passes == true) { return true; } else { return false; } } } else return false; } That should bring everything up to standard. Now work with Authorize.net as you normally would. |