Hi,
I'm trying to clone a product from a custom component I'm developing:
if (!class_exists('VmConfig')) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
$config = VmConfig::loadConfig();
if (!class_exists('VmModel')) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'vmmodel.php');
$model->createClone($id);
I get always the error: Invalid Token
Is there a way to use this method inside my code whenever I need it?
Thanks
UPDATE:
After I passed the token to the controller task executing the following code, the error disappeared, but the method createClone returns the same id I'm trying to clone and the product is not cloned.
if (!class_exists('VmConfig')) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
$config = VmConfig::loadConfig();
if (!class_exists('VmModel')) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'vmmodel.php');
$model = VmModel::getModel('product'); //print_r($model);
echo " id=".$model->createClone($id);
Any ideas? By the way, Did I post in the correct section?