Skip to content
Snippets Groups Projects
Commit 4ac82bc3 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

First steps with upgrading to VM3

parent 44871073
No related branches found
No related tags found
No related merge requests found
BASE=buyer_assign_group BASE=buyer_assign_group
PLUGINTYPE=vmcustom PLUGINTYPE=vmcustom
ZIPBASE=opentools_vm2 ZIPBASE=opentools_vm2
VERSION=1.1 VERSION=1.2
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
...@@ -9,6 +9,7 @@ TRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*ini) langua ...@@ -9,6 +9,7 @@ TRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*ini) langua
# INDEXFILES=$(BASE)/index.html # INDEXFILES=$(BASE)/index.html
INDEXFILES=$(call wildcard,language/**/index.html) $(call wildcard,elements/*.html) INDEXFILES=$(call wildcard,language/**/index.html) $(call wildcard,elements/*.html)
ELEMENTS=$(call wildcard,elements/*) ELEMENTS=$(call wildcard,elements/*)
FIELDS=$(call wildcard,fields/*)
# TMPLFILES=$(call wildcard,$(BASE)/tmpl/*.php) $(BASE)/index.html $(BASE)/tmpl/index.html # TMPLFILES=$(call wildcard,$(BASE)/tmpl/*.php) $(BASE)/index.html $(BASE)/tmpl/index.html
# ASSETS=$(call wildcard,$(BASE)/assets/*.png) $(call wildcard,$(BASE)/assets/*.css) # ASSETS=$(call wildcard,$(BASE)/assets/*.png) $(call wildcard,$(BASE)/assets/*.css)
ZIPFILE=plg_$(ZIPBASE)_$(BASE)_v$(VERSION).zip ZIPFILE=plg_$(ZIPBASE)_$(BASE)_v$(VERSION).zip
...@@ -16,7 +17,7 @@ ZIPFILE=plg_$(ZIPBASE)_$(BASE)_v$(VERSION).zip ...@@ -16,7 +17,7 @@ ZIPFILE=plg_$(ZIPBASE)_$(BASE)_v$(VERSION).zip
zip: $(PLUGINFILES) $(TRANSLATIONS) $(ELEMENTS) $(TMPLFILES) zip: $(PLUGINFILES) $(TRANSLATIONS) $(ELEMENTS) $(TMPLFILES)
@echo "Packing all files into distribution file $(ZIPFILE):" @echo "Packing all files into distribution file $(ZIPFILE):"
@zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(ELEMENTS) $(INDEXFILES) $(TMPLFILES) $(ASSETS) @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(ELEMENTS) $(FIELDS) $(INDEXFILES) $(TMPLFILES) $(ASSETS)
clean: clean:
rm -f $(ZIPFILE) rm -f $(ZIPFILE)
......
...@@ -25,8 +25,12 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin { ...@@ -25,8 +25,12 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin {
'shopper_groups_remove'=>array(array(), 'array'), 'shopper_groups_remove'=>array(array(), 'array'),
'purchased_status' => array(array(), 'array'), 'purchased_status' => array(array(), 'array'),
); );
$this->setConfigParameterable('custom_params',$varsToPush); if(!defined('VM_VERSION') or VM_VERSION < 3){
$this->onStoreInstallPluginTable($this->_psType); $this->setConfigParameterable ('custom_params', $varsToPush);
} else {
$this->setConfigParameterable ('customfield_params', $varsToPush);
}
// $this->onStoreInstallPluginTable($this->_psType);
} }
/** /**
...@@ -36,14 +40,19 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin { ...@@ -36,14 +40,19 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin {
function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) {
if ($field->custom_element != $this->_name) return ''; if ($field->custom_element != $this->_name) return '';
$html = ''; $html = '';
$this->parseCustomParams($field); if(!defined('VM_VERSION') or VM_VERSION < 3){
$this->parseCustomParams ($field); // Not needed in VM3!
$paramName = 'custom_param';
} else {
$paramName = 'customfield_params';
}
$html .= '<table class="admintable">'; $html .= '<table class="admintable">';
$html .= VmHTML::row (array('JHTML', '_'),'VMCUSTOM_BUYER_GROUP_JOOMLA', 'access.usergroup', 'custom_param['.$row.'][joomla_groups][]', $field->joomla_groups, ' multiple data-placeholder=" "', false); $html .= VmHTML::row (array('JHTML', '_'),'VMCUSTOM_BUYER_GROUP_JOOMLA', 'access.usergroup', $paramName.'['.$row.'][joomla_groups][]', $field->joomla_groups, ' multiple data-placeholder=" "', false);
$html .= VmHTML::row (array('JHTML', '_'),'VMCUSTOM_BUYER_GROUP_JOOMLA_REMOVE', 'access.usergroup', 'custom_param['.$row.'][joomla_groups_remove][]', $field->joomla_groups_remove, ' multiple data-placeholder=" "', true); $html .= VmHTML::row (array('JHTML', '_'),'VMCUSTOM_BUYER_GROUP_JOOMLA_REMOVE', 'access.usergroup', $paramName.'['.$row.'][joomla_groups_remove][]', $field->joomla_groups_remove, ' multiple data-placeholder=" "', true);
$html .= VmHTML::row (array('ShopFunctions', 'renderShopperGroupList'), 'VMCUSTOM_BUYER_GROUP_SHOPPER', $field->shopper_groups, TRUE, 'custom_param['.$row.'][shopper_groups][]', ' '); $html .= VmHTML::row (array('ShopFunctions', 'renderShopperGroupList'), 'VMCUSTOM_BUYER_GROUP_SHOPPER', $field->shopper_groups, TRUE, $paramName.'['.$row.'][shopper_groups][]', ' ');
$html .= VmHTML::row (array('ShopFunctions', 'renderShopperGroupList'), 'VMCUSTOM_BUYER_GROUP_SHOPPER_REMOVE', $field->shopper_groups_remove, TRUE, 'custom_param['.$row.'][shopper_groups_remove][]', ' '); $html .= VmHTML::row (array('ShopFunctions', 'renderShopperGroupList'), 'VMCUSTOM_BUYER_GROUP_SHOPPER_REMOVE', $field->shopper_groups_remove, TRUE, $paramName.'['.$row.'][shopper_groups_remove][]', ' ');
$html .= '</table></fieldset>'; $html .= '</table></fieldset>';
$retValue .= $html; $retValue .= $html;
...@@ -59,9 +68,16 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin { ...@@ -59,9 +68,16 @@ class plgVmCustomBuyer_Assign_Group extends vmCustomPlugin {
return $this->onStoreInstallPluginTable($psType, $name); return $this->onStoreInstallPluginTable($psType, $name);
} }
// VM2 Compat:
function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){ function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){
return $this->declarePluginParams('custom', $name, $id, $data); return $this->declarePluginParams('custom', $name, $id, $data);
} }
function plgVmDeclarePluginParamsCustomVM3(&$data){
return $this->declarePluginParams('custom', $data);
}
function plgVmGetTablePluginParams($psType, $name, $id, &$xParams, &$varsToPush){
return $this->getTablePluginParams($psType, $name, $id, $xParams, $varsToPush);
}
function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){ function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){
return $this->setOnTablePluginParams($name, $id, $table); return $this->setOnTablePluginParams($name, $id, $table);
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<install version="1.5" type="plugin" group="vmcustom" method="upgrade"> <extension version="2.5" type="plugin" group="vmcustom" method="upgrade">
<name>VMCUSTOM_BUYER_GROUP</name> <name>VMCUSTOM_BUYER_GROUP</name>
<creationDate>2014-04-07</creationDate> <creationDate>2014-04-07</creationDate>
<author>Reinhold Kainhofer</author> <author>Reinhold Kainhofer</author>
<authorUrl>http://www.open-tools.net/</authorUrl> <authorUrl>http://www.open-tools.net/</authorUrl>
<copyright>Copyright (C) 2013-2014 Reinhold Kainhofer. All rights reserved.</copyright> <copyright>Copyright (C) 2013-2014 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license> <license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license>
<version>1.1</version> <version>1.2</version>
<description>VMCUSTOM_BUYER_GROUP_DESC</description> <description>VMCUSTOM_BUYER_GROUP_DESC</description>
<files> <files>
<filename plugin="buyer_assign_group">buyer_assign_group.php</filename> <filename plugin="buyer_assign_group">buyer_assign_group.php</filename>
...@@ -14,17 +14,25 @@ ...@@ -14,17 +14,25 @@
<filename>index.html</filename> <filename>index.html</filename>
<folder>language</folder> <folder>language</folder>
<folder>elements</folder> <folder>elements</folder>
<folder>fields</folder>
</files> </files>
<languages folder="language"> <languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_vmcustom_buyer_assign_group.ini</language> <language tag="en-GB">en-GB/en-GB.plg_vmcustom_buyer_assign_group.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_vmcustom_buyer_assign_group.sys.ini</language> <language tag="en-GB">en-GB/en-GB.plg_vmcustom_buyer_assign_group.sys.ini</language>
</languages> </languages>
<scriptfile>buyer_assign_group.script.php</scriptfile> <scriptfile>buyer_assign_group.script.php</scriptfile>
<vmconfig>
<fields name="params" addfieldpath="/administrator/components/com_virtuemart/fields/">
<fieldset name="order_status" addfieldpath="/plugins/vmcustom/buyer_assign_group/fields/">
<field name="purchased_status" type="orderstatus" default="C,S" multiple="multiple" label="VMCUSTOM_BUYER_GROUP_STATUS" description="VMCUSTOM_BUYER_GROUP_STATUS_DESC"/>
</fieldset>
</fields>
</vmconfig>
<params addpath="/plugins/vmcustom/buyer_assign_group/elements/" /> <params addpath="/plugins/vmcustom/buyer_assign_group/elements/" />
<params addpath="/administrator/components/com_virtuemart/elements/"> <params addpath="/administrator/components/com_virtuemart/elements/">
<param type="vmjpluginwarning" /> <param type="vmjpluginwarning" />
<param name="purchased_status" type="vmorderstates" default="C,S" multiple="multiple" label="VMCUSTOM_BUYER_GROUP_STATUS" description="VMCUSTOM_BUYER_GROUP_STATUS_DESC"/> <param name="purchased_status" type="vmorderstates" default="C,S" multiple="multiple" label="VMCUSTOM_BUYER_GROUP_STATUS" description="VMCUSTOM_BUYER_GROUP_STATUS_DESC"/>
</params> </params>
</install> </extension>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment