VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: MikUrrey on January 15, 2013, 15:58:13 PM

Title: [Resolved] How to fire onVmSiteController event in an extend VM plugin?
Post by: MikUrrey on January 15, 2013, 15:58:13 PM
Hi all!
I'am developing an extend VM plugin to filter products on page by special way.
<?php
defined
('_JEXEC') or  die( 'Direct Access to ' basename__FILE__ ) . ' is not allowed.' ) ;

if (!
class_exists('vmExtendedPlugin')) require(JPATH_VM_PLUGINS DS 'vmextendedplugin.php');

class 
plgVmExtendedPcplugin extends vmExtendedPlugin {
public function onVmSiteController($controller){
var_dump($controller);
}
}

From Virtuemart wiki:
QuoteThis event is fired, when the called view was not found in the frontend maincontroller. It allows to add new views to virtuemart 2
But when I go to http://mysite/index.php?option=com_virtuemart&view=some_nonexistent_view, VM redirects me on http://mysite/index.php?option=com_virtuemart.

How is right way to use this feature?
Title: Re: How to fire onVmSiteController event in an extend VM plugin?
Post by: MikUrrey on January 17, 2013, 13:02:59 PM
Found some mistakes.
Inside XML:
<install version="1.5" type="plugin" group="vmextend" >
Right is:
<install version="1.5" type="plugin" group="vmextended" >
Inside PHP: onVmSiteController must declare a class with name VirtueMartControllerViewname what must extends JController, then virtuemart.php redirects on VM index page.