From 60e48eebd3a8c562cca5b2eb9ac8e34df29eb921 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Mon, 8 Dec 2014 12:46:38 +0100 Subject: [PATCH] Fix warnings, correct plugin template --- ordernumber.script.php | 2 +- plugins/template/Makefile | 7 ++++--- plugins/template/YOUR_PLUGIN_NAME.php | 12 ++++++------ plugins/template/YOUR_PLUGIN_NAME.script.php | 2 +- plugins/template/YOUR_PLUGIN_NAME.xml | 7 ++----- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ordernumber.script.php b/ordernumber.script.php index caa5f20..5a27f13 100644 --- a/ordernumber.script.php +++ b/ordernumber.script.php @@ -60,7 +60,7 @@ class plgVmShopperOrdernumberInstallerScript public function install(JAdapterInstance $adapter) { // enabling plugin - $db =& JFactory::getDBO(); + $db = JFactory::getDBO(); $db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "ordernumber" and folder = "vmshopper"'); $db->query(); diff --git a/plugins/template/Makefile b/plugins/template/Makefile index 07f453f..361f0ba 100644 --- a/plugins/template/Makefile +++ b/plugins/template/Makefile @@ -1,19 +1,20 @@ BASE=YOUR_PLUGIN_NAME -PLUGINTYPE=vmshipmentrules -ZIPBASE=opentools_vmshipmentrules +PLUGINTYPE=vmshopper +ZIPBASE=opentools_vmshopper VERSION=1.0 PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html TRANSLATIONS=$(call wildcard,language/en*/*.plg_$(PLUGINTYPE)_$(BASE).*ini) INDEXFILES=language/index.html $(call wildcard,language/**/index.html) +FIELDS=$(call wildcard,fields/*) ZIPFILE=plg_$(ZIPBASE)_$(BASE)_v$(VERSION).zip all: zip zip: $(PLUGINFILES) $(TRANSLATIONS) $(ADVANCEDFILES) $(INDEXFILES) @echo "Packing all files into distribution file $(ZIPFILE):" - @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(INDEXFILES) + @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(INDEXFILES) $(FIELDS) clean: rm -f $(ZIPFILE) diff --git a/plugins/template/YOUR_PLUGIN_NAME.php b/plugins/template/YOUR_PLUGIN_NAME.php index 8f44793..2286201 100644 --- a/plugins/template/YOUR_PLUGIN_NAME.php +++ b/plugins/template/YOUR_PLUGIN_NAME.php @@ -5,7 +5,6 @@ defined ('_JEXEC') or die('Restricted access'); /** * Plugin providing Custom variables for the VM Ordernumber plugin * - * @subpackage Plugins - VmShipmentRules * @copyright Copyright (C) 2014 Reinhold Kainhofer, office@open-tools.net * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant @@ -17,13 +16,14 @@ defined ('_JEXEC') or die('Restricted access'); * http://open-tools.net/ * */ -if (!class_exists ('VmPlugin')) { - require(JPATH_VM_PLUGINS . DS . 'vmplugin.php'); -} +if (!class_exists('vmShopperPlugin')) + require(JPATH_VM_PLUGINS . DS . 'vmshopperplugin.php'); -/** Extension plugin for the Odernumber plugin for VirtueMart +/** Extension plugin for the Ordernumber plugin for VirtueMart */ -class plgVmShopperYOUR_PLUGIN_NAME extends VmPlugin { +class plgVmShopperYOUR_PLUGIN_NAME extends VmShopperPlugin { + // Unfortunately, this dummy function needs to be implementd, because it's abstract in the parent class! + public function plgVmOnUpdateOrderBEShopper($_orderID) {} /** Trigger to add variables to be used in the number formats * You can add new variables to the $cartvals array or modify existing ones. They will be directly * available in all formats. This trigger will be called whenever the ordernumber plugin creates a diff --git a/plugins/template/YOUR_PLUGIN_NAME.script.php b/plugins/template/YOUR_PLUGIN_NAME.script.php index c8f1612..e861c4d 100644 --- a/plugins/template/YOUR_PLUGIN_NAME.script.php +++ b/plugins/template/YOUR_PLUGIN_NAME.script.php @@ -49,7 +49,7 @@ class plgVmShopperYOUR_PLUGIN_NAMEInstallerScript public function install(JAdapterInstance $adapter) { // enabling plugin upon installation - $db =& JFactory::getDBO(); + $db = JFactory::getDBO(); $db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "YOUR_PLUGIN_NAME" and folder = "vmshopper"'); $db->query(); diff --git a/plugins/template/YOUR_PLUGIN_NAME.xml b/plugins/template/YOUR_PLUGIN_NAME.xml index e857e9c..06828b4 100644 --- a/plugins/template/YOUR_PLUGIN_NAME.xml +++ b/plugins/template/YOUR_PLUGIN_NAME.xml @@ -18,10 +18,7 @@ </languages> <scriptfile>YOUR_PLUGIN_NAME.script.php</scriptfile> - <!-- VM 3.x support (fields rather than params): --> - <vmconfig></vmconfig> - - <!-- VM 2.0 support (params rather than fields): --> - <params></params> + <!-- Joomla 2.x and 3.x support (fields rather than params): --> + <config></config> </extension> -- GitLab