VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: jankoo on December 19, 2020, 01:21:20 AM

Title: display first name and last name in custom module
Post by: jankoo on December 19, 2020, 01:21:20 AM
hi.
im trying to create custom module to display customer first and last name after login..

i found this topic for vm1 - http://forum.virtuemart.net/index.php?topic=79226.0

but when i use the code from @expertslogic i get the error "Class 'ps_user' not found"

can anyone point me to right direction how can i connect to vm user fields from custom module?

thanks a lot
Title: Re: display first name and last name in custom module
Post by: jenkinhill on December 19, 2020, 10:46:39 AM
Logged in to Joomla? Maybe use https://extensions.joomla.org/extension/tf-greet/  - there are other such modules.
Title: Re: display first name and last name in custom module
Post by: jankoo on December 19, 2020, 11:26:19 AM
yes, loged user.
but i need data from virtuemart fields firstname and lastname..
these standard joomla im able to show..
i just need what class to load so i have access to those vm fields..
Title: Re: display first name and last name in custom module
Post by: GJC Web Design on December 19, 2020, 11:43:26 AM
Class 'ps_user' is from VM1

if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
$userModel = VmModel::getModel('User');

use a function from there

e.g.

$userModel->getCurrentUser();

untested
Title: Re: display first name and last name in custom module
Post by: jankoo on December 19, 2020, 20:24:02 PM
GJC Web Design thanks a lot..