Hello I need to know if there is a unique way for all virtuemart function to detect if the process ( f.e. saving correctly a product translation ) have gone right or not.
In the core I see always this:
$errors = $productModel->getErrors();
if(!empty($errors)){
foreach($errors as $error){
echo 'Product with id '.$data['virtuemart_product_id'].' Creation failed in following point: '.$i.' ' . $error;
}
vmdebug('Product add error',$product);
$productModel->resetErrors();
$continue = false;
But also when process goes not well the getErrors is blank!
May I know why ? Or if somewhere there is something useful to do ?
Thanks
There are two opposite patterns.
One pattern is to setErrors in the object and get them from the object. The problem with this is that php is not completly OOP like java. Especially if you have a problem, the whole process dies and you see nothing, so we changed the pattern a year ago, using directly the joomla message system. You can enable directly echoing of vmdebug with VmConfig::$echoDebug=true;