VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: mhs_pro on February 16, 2019, 14:03:29 PM

Title: Appending fields and codes in virtuemart registration and login form by plugin
Post by: mhs_pro on February 16, 2019, 14:03:29 PM
Hello
I want to Append some fields with specific behavior in registration and login form, that must be saved in my table in DB .for example mobile number field that is unique and been validate by sms and user can login with it .I want to do this job just by plugin and have full control .
this job can done by "onUserPrepareForm" function but when virtuemart installed and handles joomla registration and login this function doesn't work.
also I tried "plgVmOnUserfieldDisplay" function but doesn't work.
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: GJC Web Design on February 28, 2019, 19:40:32 PM
in the user model store() there is

// Preformat and control user datas by plugin
JPluginHelper::importPlugin('vmextended');
JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();

$valid = true ;
$dispatcher->trigger('plgVmOnBeforeUserfieldDataSave',array(&$valid,$this->_id,&$data,$user ));
// $valid must be false if plugin detect an error
if( !$valid ) {
return false;
}

Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: Milbo on February 28, 2019, 20:05:23 PM
vmUserfield, vmshopper plugin, which means actually almost "nothing".

Just use one of both types, be aware that you can use ANY trigger, as long the plugin type gots loaded. Please check also the new version, cause there is another method of loading plugins.

If it does not work, use vmextended. It can implement any trigger function!
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: mhs_pro on March 05, 2019, 18:06:45 PM
Hello
thanks a lot for your reply, but my problem was not solved yet.
I can add a field to the Joomla registration form,But when this form is loaded on the Virtuemart registration page, the fields I added will not be displayed.I want add filed to Virtuemart Shopper Field in Joomla core section.
Joomla registration form show field
http://testapp1.neshangostar.com/user-profile?view=login (http://testapp1.neshangostar.com/user-profile?view=login)
(http://testapp1.neshangostar.com/images/joomla.jpg) (http://testapp1.neshangostar.com/images/joomla.jpg)

Virtuemart registration page
http://testapp1.neshangostar.com/product-list/user (http://testapp1.neshangostar.com/product-list/user)
(http://testapp1.neshangostar.com/images/vir.jpg) (http://testapp1.neshangostar.com/images/vir.jpg)

And It seems vmextended not developed for example this code in my plugin doesn't execute :

class plgvmextendeduser extends vmExtendedPlugin {
public function __construct (&$subject, $config=array()) {
parent::__construct($subject, $config);
}
public function onVmSiteController($controller){
var_dump($controller);
exit;
}
}


I don't want change virtuemart core. I want to append this field only by a plugin.
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: Studio 42 on March 05, 2019, 18:31:59 PM
Joomla user registration form have nothing to do with Vm registration.
So you should check with a Joomla user plugin if you want disply it in the joomla core user form
See https://docs.joomla.org/Plugin/Events/User
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: mhs_pro on March 06, 2019, 14:56:22 PM
Quote from: Studio 42 on March 05, 2019, 18:31:59 PM
Joomla user registration form have nothing to do with Vm registration.
So you should check with a Joomla user plugin if you want disply it in the joomla core user form
See https://docs.joomla.org/Plugin/Events/User

I want to add a field here with plugin
(http://testapp1.neshangostar.com/images/joomla1.jpg) (http://testapp1.neshangostar.com/images/joomla1.jpg)
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: Studio 42 on March 07, 2019, 00:36:30 AM
you have to use or create a Joomla vmuserfield plugin
See for eg.
http://forum.virtuemart.net/index.php?topic=141335.0
here a list of triggers(not updated)
https://forum.virtuemart.net/index.php?topic=101629.0
And some info https://docs.virtuemart.net/tutorials/development/175-code-adjustments-for-virtuemart-3.html
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: GJC Web Design on March 07, 2019, 09:00:22 AM
 ???

http://forum.virtuemart.net/index.php?topic=142056.msg501421#msg501421
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: mhs_pro on March 07, 2019, 15:43:46 PM
Quote from: GJC Web Design on March 07, 2019, 09:00:22 AM
???

http://forum.virtuemart.net/index.php?topic=142056.msg501421#msg501421
thanks for reply but I must first add a field then use "plgVmOnBeforeUserfieldDataSave" function
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: mhs_pro on March 07, 2019, 15:46:56 PM
Thank you for all the answers, my problem has been resolved
;D ;D ;D ;D
Title: Re: Appending fields and codes in virtuemart registration and login form by plugin
Post by: GJC Web Design on March 07, 2019, 16:52:52 PM
to "repay" the help u receive, help other forum users and contribute to the project it would be good to write how u solved it....

can be as long an explanation as u want .. all adds to the general knowledge