VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: Studio 42 on November 15, 2015, 10:18:01 AM

Title: VirtueMartCustomFieldRenderer overide in 3.0.12
Post by: Studio 42 on November 15, 2015, 10:18:01 AM
Hi all,

I need to overide VirtueMartCustomFieldRenderer in a system plugin but currently the new code don't check for exising class in
JOOMLAROOT\administrator\components\com_virtuemart\models\customfields.php  line 780 and 805.

    if(self::$customfieldRenderer){
self::$customfieldRenderer = false;

if (!class_exists ('VmView'))
require(VMPATH_SITE . DS . 'helpers' . DS . 'vmview.php');
$lPath = VmView::getVmSubLayoutPath ('customfield');

if($lPath){
require ($lPath);
} else {
vmdebug('displayProductCustomfieldFE layout not found customfield');
}
}


adding a class_exists with this code:

if(self::$customfieldRenderer){
self::$customfieldRenderer = false;
if(!class_exists('VirtueMartCustomFieldRenderer') {
if (!class_exists ('VmView'))
require(VMPATH_SITE . DS . 'helpers' . DS . 'vmview.php');
$lPath = VmView::getVmSubLayoutPath ('customfield');

if($lPath){
require ($lPath);
} else {
vmdebug('displayProductCustomfieldFE layout not found customfield');
}
}
}


Solve the problem with a minimum code change.
Thanks to fix this.

Patrick