News:

Support the VirtueMart project and become a member

Main Menu

Unknown column usertype

Started by sealion, August 12, 2014, 21:16:56 PM

Previous topic - Next topic

sealion

In 2.9.8a there is an error that occurs during checkout when the system tries to send a registration email to superusers if the customer creates an account during checkout, it causes the checkout process to fail. In administrator/components/com_virtuemart/models/user.php lines 1052 to 1055

//get all super administrator
$query = 'SELECT name, email, sendEmail' .
' FROM #__users' .
' WHERE LOWER( usertype ) = "super administrator"';


Problem is that the usertype column no longer exists. You are going to have to rethink this a bit. You could get the ids of superusers from the user_usergroup_map table. Personally I think a better approach, rather than sending the email to all superusers, is to send it to users in the Joomla user table that are set to receive system emails. Who these are is the choice of the site admin which seems a better idea to me, so you could use

//get all set to receive system emails
$query = 'SELECT name, email, sendEmail' .
' FROM #__users' .
' WHERE sendEmail = 1;


But you have commented out most of the rest of the function so it does not actually do anything anyway so maybe you are planning do nothing with this.

Milbo

Hmmm, I did it already that way, but I added your idea.

Actually I like your idea. So we could remove the switch.


//get all super administrator
if(!defined('JVM_VERSION') or JVM_VERSION < 3){
$query = 'SELECT name, email, sendEmail' .
' FROM #__users' .
' WHERE sendEmail = 1';
} else {
$query = 'SELECT `name`, `email`, `sendEmail` ' .
' FROM #__users as us '.
' INNER JOIN #__user_usergroup_map as um ON us.id = um.user_id ' .
' INNER JOIN #__usergroups as ug ON um.group_id = ug.id ' .
' WHERE ug.id = "8" ';
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/