News:

Looking for documentation? Take a look on our wiki

Main Menu

new vmshopper plugin plgVmOnUserStore

Started by frankiefredericks, June 28, 2013, 16:02:16 PM

Previous topic - Next topic

frankiefredericks

Hi,

I'm trying to develop a new plugin to change shopper group, using plgVmOnUserStore event and vmShopperPlugin

Here's my code.
I just tried, for example, to add $data["virtuemart_shoppergroup_id"] = array("2","3"), because I saw that the item is in the array when I edit a shopper from the backend.
So I wanted to get the same result by adding the item to the array.
The item gets added to the array, but it's not stored into the db.

What's the reason of an plgVmOnUserStore event if I cannot change the value of the data?
Am I doing something wrong?

Thanks
F.


<?php
defined
('_JEXEC') or die;

if (!
class_exists ('vmShopperPlugin')) require(JPATH_VM_PLUGINS DS 'vmshopperplugin.php');

class 
plgVmShopperGroup  extends vmShopperPlugin
{
public function plgVmOnUserStore($data
{
$data["virtuemart_shoppergroup_id"] = array("2","3");
jimport('joomla.log.log');
JLog::addLogger(array());
JLog::add(var_export($data,true));

return $data;
}

public function plgVmOnUpdateOrderBEShopper($_orderID){

}

public function plgVmAfterUserStore($data){
return $data;
}
}


EDIT:
Really there is nobody who can help me?
Do I have necessarily update virtuemart tables manually?