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();




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? – Ville Niemi Jan 25 '15 at 11:16
  • nope ,bcoz that system plugin is loaded with Onafterintialise event! thats not for override. – Jobin Jan 26 '15 at 3:50
  • stackoverflow.com/questions/2658906/…, no idea if the workarounds would work in practice. – Ville Niemi Jan 26 '15 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 Jan 27 '15 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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