VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Stephen Roberts on November 10, 2011, 22:37:36 PM

Title: Bug when overriding models and controllers
Post by: Stephen Roberts on November 10, 2011, 22:37:36 PM
I built a system plugin to override a couple of models and controllers. In my plugin I had to include the following line:

if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');

When going to the VM admin panel, an error is thrown about not being able to redeclare a class. I tracked the problem down to /administrator/components/com_virtuemart/admin.virtuemart.php. Please change the following line:

require(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'config.php');

to:

if (!class_exists( 'VmConfig' )) require(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'config.php');

I hope to see this in the next update! Thanks!
Title: Re: Bug when overriding models and controllers
Post by: Milbo on November 11, 2011, 22:04:37 PM
good point, added.