I'm creating a Core override plugin(for overriding the 3r party extension) using Joomla system plugin.

The issue is Cannot redeclare class VirtueMartCart error showing on t3 framework based template.

The Joomla version is 3.3.6 and VM 3.0.2.

The same plugin works fine on fresh installation but it return the error on this T3 based existing site. I tried to switch template but same issue . I think some other plugin is casing the issue any idea ? :(

System Plugin Override Approach.

class plgSystemComVirtuemartOverride extends JPlugin{

    public function __construct(&$subject, $config = array()) {

         parent::__construct($subject, $config);

     public function  onAfterRoute () {

        $app = JFactory::getApplication();
        if('com_virtuemart' == JRequest::getCMD('option') && !$app->isAdmin()) {
            $template = $app->getTemplate();




1 Answer 1


I figure it out the reason for Cannot redeclare class error with Joomla system override plugin in particular site, is due to another plugin.

Another plugin is manually loaded the class So its not like Joomla System override method. so my real override system plugin dead!. by disabling that plugin everything works fine.

Anybody face such a situation first check your plugin list disable all other 3rd party system plugin and debug it will works!.

  • Would setting override plugin to run before the other plugin work? Commented Jan 25, 2015 at 11:16
  • nope ,bcoz that system plugin is loaded with Onafterintialise event! thats not for override.
    – Jobin
    Commented Jan 26, 2015 at 3:50
  • stackoverflow.com/questions/2658906/…, no idea if the workarounds would work in practice. Commented Jan 26, 2015 at 7:33
  • extending calls will not help bcoz I need to override a method . not want to create new instance (that's not possible bcoz all call are in core files)
    – Jobin
    Commented Jan 27, 2015 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.