diff --git a/controllers/eurecap.php b/controllers/eurecap.php index dc28f320c8e447268ab617d781144ae5b506f200..eab08711e1347aa3a88fcab4cf96c3ecab360e9f 100644 --- a/controllers/eurecap.php +++ b/controllers/eurecap.php @@ -34,7 +34,7 @@ class VirtuemartControllerEuRecap extends VmController { function __construct(){ parent::__construct(); // Add the proper view pathes... - $this->addViewPath(JPATH_PLUGINS.DS . 'vmextended' . DS . 'eurecap' . DS . 'views'); + $this->addViewPath(JPATH_PLUGINS.DS . 'vmextended' . DS . 'eurecap' . DS . 'views' . DS . 'eurecap'); } public function cancel(){ diff --git a/eurecap.php b/eurecap.php index 6a0e84b7a8d8908980d72d8813e7daa0305f442e..03e2254fbc663d563f131debdee4c62735c5d6b9 100644 --- a/eurecap.php +++ b/eurecap.php @@ -24,7 +24,7 @@ class plgVmExtendedEuRecap extends vmExtendedPlugin { public function __construct (&$subject, $config=array()) { parent::__construct($subject, $config); $this->_path = JPATH_PLUGINS.DS.'vmextended'.DS.$this->getName(); - JPlugin::loadLanguage('plg_vmextended_'.$this->getName()); + $this->loadLanguage('plg_vmextended_'.$this->getName()); } // public function getVmPluginCreateTableSQL () { @@ -45,13 +45,21 @@ class plgVmExtendedEuRecap extends vmExtendedPlugin { */ public function onVmAdminController ($controller) { if ($controller == 'eurecap') { - VmModel::addIncludePath($this->_path . DS . 'models'); - - // TODO: Make sure the model exists. We probably should find a better way to load this automatically! - // Currently, some path config seems missing, so the model is not found by default. - require_once($this->_path.DS.'models'.DS.'eurecap.php'); - require_once($this->_path.DS.'models'.DS.'eurecap_config.php'); + VmModel::addIncludePath($this->_path . DS . 'models', 'VirtueMartModel'); +// require_once($this->_path.DS.'models'.DS.'eurecap.php'); +// require_once($this->_path.DS.'models'.DS.'eurecap_config.php'); require_once($this->_path.DS.'controllers'.DS.'eurecap.php'); + + // In later VM versions, we can execute the controller here: + $_class = 'VirtueMartController'.ucfirst($controller); + if(!class_exists($_class)){ + vmError('Serious Error could not find controller '.$_class,'Serious error, unable to find class'); + $app = vFactory::getApplication(); + $app->redirect('index.php?option=com_virtuemart'); + } + $controller = new $_class(); + $controller->execute(vRequest::getCmd('task', $controller)); + $controller->redirect(); return true; } } diff --git a/eurecap.xml b/eurecap.xml index d0ed32e617b429e7f18308618c1dabf04610f611..f14cedeea7780dfd70b4d23a59459756805557a5 100644 --- a/eurecap.xml +++ b/eurecap.xml @@ -7,7 +7,7 @@ <authorUrl>http://www.open-tools.net/</authorUrl> <copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license> - <version>0.4</version> + <version>0.5</version> <releaseDate>2016-01-01</releaseDate> <releaseType>Update</releaseType> <downloadUrl>http://www.open-tools.net</downloadUrl> diff --git a/models/eurecap.php b/models/eurecap.php index 3a294d67426812e387e8860924ff9a79234c4be8..b7dc22af654ea40dddd5120a1cf6402864a058ff 100644 --- a/models/eurecap.php +++ b/models/eurecap.php @@ -252,7 +252,7 @@ vmDebug("SQL: SELECT ".$selectString.$joinedTables.$whereString.$groupBy.$orderB } sort($templates, SORT_STRING); $templates = array_unique($templates); - + $options = array(); foreach ($templates as $tmpl) { $value = substr($tmpl, 7, -4); // Cut off export_ and .php $options[] = JHtml::_('select.option', vmText::_('VMEXT_EU_RECAP_EXPORT_' . strtoupper($value)), $value); diff --git a/views/eurecap/view.html.php b/views/eurecap/view.html.php index 75af80cc1edab31d9c6cd7f47f16fe7a43b44fe0..1e99669eb3cac939bae08624c3b755188579aa66 100644 --- a/views/eurecap/view.html.php +++ b/views/eurecap/view.html.php @@ -34,9 +34,8 @@ if(!defined('VM_VERSION') or VM_VERSION < 3){ class VirtuemartViewEuRecap extends VmViewAdmin { function __construct(){ parent::__construct(); - // Add the proper view pathes... - $this->_addPath('template', JPATH_PLUGINS.DS . 'vmextended' . DS . 'eurecap' . DS . 'views' . DS . $this->getName() . DS . 'tmpl'); -// $this->_addPath('models', JPATH_PLUGINS.DS . 'vmextended' . DS . 'eurecap' . DS . 'models' ); + $this->_name = "eurecap"; + $this->addLayoutPath($this->getName(), JPATH_PLUGINS.DS . 'vmextended' . DS . $this->getName() . DS . 'views' . DS . $this->getName() . DS . 'tmpl'); } /** @@ -47,7 +46,7 @@ class VirtuemartViewEuRecap extends VmViewAdmin { if (!class_exists('VmHTML')) require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'); - $model = VmModel::getModel(); + $model = VmModel::getModel('eurecap'); $this->addStandardDefaultViewLists($model); vRequest::setvar('task','');