diff --git a/Makefile b/Makefile index 509e0d92f9616424235ed5c8e137cc29fc8ce1ec..824740ab0a353827ecdd48dd00f4009caf7d4121 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BASE=acymailing_subscribe_buyer PLUGINTYPE=vmcustom -VERSION=1.2 +VERSION=1.3 PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html diff --git a/acymailing_subscribe_buyer.php b/acymailing_subscribe_buyer.php index 5409e27de76b1e35e8cf77fe117fbd45954e62fd..5711a0d5126e9cb46ebb4f67d747920a7586d0e4 100644 --- a/acymailing_subscribe_buyer.php +++ b/acymailing_subscribe_buyer.php @@ -16,6 +16,9 @@ defined('_JEXEC') or die( 'Direct Access to ' . basename( __FILE__ ) . ' is not */ if (!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php'); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php')){ + // For some reason, J3.3 does not load the language file otherwice + $language = JFactory::getLanguage(); + $language->load('plg_vmcustom_acymailing_subscribe_buyer'); JFactory::getApplication()->enqueueMessage(JText::_('VMCUSTOM_ACYBUYER_ACYMAILING_NEEDED'), 'error'); return; } @@ -31,7 +34,7 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { 'allow_subscribe_default'=>array(0, 'int'), 'lists'=>array(array(), 'array'), ); - $this->setConfigParameterable('custom_params',$varsToPush); + $this->setConfigParameterable((VM_VERSION<3)?'custom_params':'customfield_params',$varsToPush); } function plgVmOnSelfCallFE($type,$name,&$render) { if ($name != $this->_name || $type != 'vmcustom') return false; @@ -101,6 +104,8 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { if ($field->custom_element != $this->_name) return ''; $this->parseCustomParams($field); + +// JFactory::getApplication()->enqueueMessage("plgVmCustomAcyMailing_subscribe_Buyer::plgVmOnProductEdit: field=<pre>".print_r($field, 1)."</pre>", 'error'); $html = ''; $html .='<fieldset> <legend>'. JText::_('VMCUSTOM_ACYBUYER') .'</legend> @@ -118,14 +123,14 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { $lists = $this->getAcyMailinglists(); if ($lists) { - $html .= VmHTML::row ('select','VMCUSTOM_ACYBUYER_LIST', 'custom_param['.$row.'][lists][]', $lists, $field->lists, ' multiple', 'listid', 'name', ''); + $html .= VmHTML::row ('select','VMCUSTOM_ACYBUYER_LIST', ((VM_VERSION<3)?'custom_param':'customfield_params').'['.$row.'][lists][]', $lists, $field->lists, ' multiple', 'listid', 'name', ''); - $html .= VmHTML::row('select', 'VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE', 'custom_param['.$row.'][subscribe_buyers]', + $html .= VmHTML::row('select', 'VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE', ((VM_VERSION<3)?'custom_param':'customfield_params').'['.$row.'][subscribe_buyers]', array_merge( array(array('id'=>'-1', 'name'=>JText::sprintf('VMCUSTOM_ACYBUYER_AUTO_DEFAULT', JText::_($autosubscribe_modes[$field->subscribe_buyers_default]['name'])))), $autosubscribe_modes), - $field->allow_subscribe,'','id', 'name', false); - $html .= VmHTML::row('select', 'VMCUSTOM_ACYBUYER_ALLOW_SUBSCRIBE', 'custom_param['.$row.'][allow_subscribe]', + $field->subscribe_buyers,'','id', 'name', false); + $html .= VmHTML::row('select', 'VMCUSTOM_ACYBUYER_ALLOW_SUBSCRIBE', ((VM_VERSION<3)?'custom_param':'customfield_params').'['.$row.'][allow_subscribe]', array_merge( array(array('id'=>'-1', 'name'=>JText::sprintf('VMCUSTOM_ACYBUYER_ALLOW_DEFAULT', JText::_($subscribe_modes[$field->allow_subscribe_default]['name'])))), $subscribe_modes), @@ -184,6 +189,15 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { return $html; } + /** + * plgVmOnDisplayProductFEVM3 ... Called for all custom fields to display on the product details page + */ + function plgVmOnDisplayProductFEVM3(&$product,&$group) { + if ($group->custom_element != $this->_name) return ''; + $group->display .= $this->displayProduct($group); + return true; + } + /** * plgVmOnDisplayProductVariantFE ... Called for product variant custom fields to display on the product details page */ @@ -204,10 +218,20 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { return true; } + function plgVmDeclarePluginParamsCustomVM3(&$data){ + return $this->declarePluginParams('custom', $data); + } + // TODO: really required??? + function plgVmGetTablePluginParams($psType, $name, $id, &$xParams, &$varsToPush){ + return $this->getTablePluginParams($psType, $name, $id, $xParams, $varsToPush); + } + + /** * We must reimplement this triggers for joomla 1.7 * vmplugin triggers note by Max Milbers */ + // TODO: Really required or deprecated? public function plgVmOnStoreInstallPluginTable($psType, $name) { return $this->onStoreInstallPluginTable($psType, $name); } @@ -250,7 +274,13 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { } $customModel = VmModel::getModel('customfields'); foreach ($order['items'] as $item) { - $customs = $customModel->getproductCustomslist ($item->virtuemart_product_id); +// JFactory::getApplication()->enqueueMessage("plgVmConfirmedOrder, checking item: <pre>".print_r($item,1)."</pre>", 'error'); + if (VM_VERSION<3) { + $customs = $customModel->getproductCustomslist ($item->virtuemart_product_id); + } else { + $customs = $customModel->getCustomEmbeddedProductCustomFields (array($item->virtuemart_product_id)); + } +// JFactory::getApplication()->enqueueMessage("plgVmConfirmedOrder, CUSTOMS: <pre>".print_r($customs,1)."</pre>", 'error'); foreach ($customs as $field) { if ($field->custom_element != $this->_name) continue; $subscribe = ($field->subscribe_buyers>=0)?($field->subscribe_buyers):($field->subscribe_buyers_default); @@ -263,10 +293,10 @@ class plgVmCustomAcyMailing_subscribe_Buyer extends vmCustomPlugin { $notsubscribed = array_diff ($field->lists, $allsubscriptions); $this->subscribeUser($acyuid, $notsubscribed); // TODO: Shall we display an infor message about the subscription? - // foreach ($notsubscribed as $l) { - // $listname=$this->getAcyListname($l); - // JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_ACYBUYER_ADDED_USER', $name, $email, $listname), 'info'); - // } +// foreach ($notsubscribed as $l) { +// $listname=$this->getAcyListname($l); +// JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_ACYBUYER_ADDED_USER', $name, $email, $listname), 'info'); +// } } } } diff --git a/acymailing_subscribe_buyer.script.php b/acymailing_subscribe_buyer.script.php index fd72bcd86af5ee4c5ba183a027daf49c2cf69458..7b2c7fb68f36b21d72d9f23131a385f768fff15f 100644 --- a/acymailing_subscribe_buyer.script.php +++ b/acymailing_subscribe_buyer.script.php @@ -47,7 +47,7 @@ class plgVmCustomAcyMailing_subscribe_BuyerInstallerScript { // enabling plugin $db =& JFactory::getDBO(); - $db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "acy_subscribe_buyer" and folder = "vmcustom"'); + $db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "acymailing_subscribe_buyer" and folder = "vmcustom"'); $db->query(); return True; diff --git a/acymailing_subscribe_buyer.xml b/acymailing_subscribe_buyer.xml index 06c1f854e1c567370cb26b56dad228b1be128e57..5312e3b0c7bc96eb1390b9d44ece7bf4e7c01c85 100644 --- a/acymailing_subscribe_buyer.xml +++ b/acymailing_subscribe_buyer.xml @@ -1,27 +1,41 @@ <?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_ACYBUYER</name> <creationDate>2014-04-27</creationDate> <author>Reinhold Kainhofer</author> <authorUrl>http://www.open-tools.net/</authorUrl> - <copyright>Copyright (C) 2013 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> - <version>1.2.0</version> + <version>1.3.0</version> <description>VMCUSTOM_ACYBUYER_DESC</description> <files> <filename plugin="acymailing_subscribe_buyer">acymailing_subscribe_buyer.php</filename> <filename>acymailing_subscribe_buyer.script.php</filename> <folder>acymailing_subscribe_buyer</folder> <filename>index.html</filename> - <folder>language</folder> + <folder>language</folder> </files> <languages folder="language"> - <language tag="en-GB">en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini</language> - <language tag="de-DE">de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini</language> - <language tag="en-GB">en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.sys.ini</language> - <language tag="de-DE">de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.sys.ini</language> + <language tag="en-GB">en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini</language> + <language tag="de-DE">de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini</language> + <language tag="en-GB">en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.sys.ini</language> + <language tag="de-DE">de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.sys.ini</language> </languages> <scriptfile>acymailing_subscribe_buyer.script.php</scriptfile> + <vmconfig> + <fields name="params"> + <field name="subscribe_buyers_default" type="radio" scope="com_virtuemart" default="1" label="VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE" description="VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE_DESC" > + <option value="0">COM_VIRTUEMART_NO</option> + <option value="1">COM_VIRTUEMART_YES</option> + </field> + <field name="allow_subscribe_default" type="list" scope="com_virtuemart" default="0" label="VMCUSTOM_ACYBUYER_ALLOW_SUBSCRIBE" description="VMCUSTOM_ACYBUYER_ALLOW_SUBSCRIBE_DESC" > + <option value="0">VMCUSTOM_ACYBUYER_ALLOW_NONE</option> + <option value="1">VMCUSTOM_ACYBUYER_ALLOW_REGISTERED</option> + <option value="2">VMCUSTOM_ACYBUYER_ALLOW_ANONYMOUS</option> + </field> + </fields> + </vmconfig> + <params addpath="/administrator/components/com_virtuemart/elements"> <param type="vmjpluginwarning" /> <param name="subscribe_buyers_default" type="radio" default="1" label="VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE" description="VMCUSTOM_ACYBUYER_AUTO_SUBSCRIBE_DESC" > @@ -34,4 +48,4 @@ <option value="2">VMCUSTOM_ACYBUYER_ALLOW_ANONYMOUS</option> </param> </params> -</install> +</extension> diff --git a/language/de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini b/language/de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini index f090849a1cb76e05beff7370f3271762270a5685..b4733c13c9ae29345a4b9ff7ee056e2a2b0eb1a2 100644 --- a/language/de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini +++ b/language/de-DE/de-DE.plg_vmcustom_acymailing_subscribe_buyer.ini @@ -24,6 +24,6 @@ VMCUSTOM_ACYBUYER_NO_LISTS="Es sind keine AcyMailing Listen verfügbar" VMCUSTOM_ACYBUYER_LIST="AcyMailing Listen:" VMCUSTOM_ACYBUYER_ADDED_USER="Benutzer '%s' (%s) zur Liste '%s' hinzugefügt." -VMCUSTOM_ACYBUYER_SQL_ERROR="SQL Fehler! Bitte <a href='mailto:reinhold@kainhofer.com'>kontaktieren Sie den Autor</a> und geben Sie folgende Fehlermeldung an:<br/>%s" +VMCUSTOM_ACYBUYER_SQL_ERROR="SQL Fehler! Bitte <a href='mailto:office@open-tools.net'>kontaktieren Sie den Autor</a> und geben Sie folgende Fehlermeldung an:<br/>%s" VMCUSTOM_ACYBUYER_ACYMAILING_NEEDED="Das Plugin 'VM Käufer zu AcyMailing Listen hinzufügen' benötigt, dass die AcyMailing Komponente installiert ist." diff --git a/language/en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini b/language/en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini index a38406dbe3172feef03a2d7a387a530d34264645..c51db474406da3ee199fe455d82eb74dbdda3701 100644 --- a/language/en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini +++ b/language/en-GB/en-GB.plg_vmcustom_acymailing_subscribe_buyer.ini @@ -24,6 +24,6 @@ VMCUSTOM_ACYBUYER_NO_LISTS="No AcyMailing lists are available" VMCUSTOM_ACYBUYER_LIST="AcyMailing lists:" VMCUSTOM_ACYBUYER_ADDED_USER="User '%s' (%s) added to mailing list %s." -VMCUSTOM_ACYBUYER_SQL_ERROR="SQL error, please <a href='mailto:reinhold@kainhofer.com'>contact the author</a> with the following information:<br/>%s" +VMCUSTOM_ACYBUYER_SQL_ERROR="SQL error, please <a href='mailto:office@open-tools.net'>contact the author</a> with the following information:<br/>%s" VMCUSTOM_ACYBUYER_ACYMAILING_NEEDED="The 'VM Subscribe Buyers to AcyMailing' plugin requires the AcyMailing Component to be installed" diff --git a/releases/plg_vmcustom_acymailing_subscribe_buyer_v1.3.zip b/releases/plg_vmcustom_acymailing_subscribe_buyer_v1.3.zip new file mode 100644 index 0000000000000000000000000000000000000000..62e1ecd79aa7775dabfa0e34f9f60490ae340fd8 Binary files /dev/null and b/releases/plg_vmcustom_acymailing_subscribe_buyer_v1.3.zip differ