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

V2.1: Fix jQuery on VM3/J2

parent b7a0bedb
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,35 @@ class JFormFieldVmOrdernumberCounters extends JFormField {
return $return;
}
// VM2 on J2 works, VM3 on J3 works out of the box, but
// VM3 on J2 does NOT work by simply calling vmJsApi::jQuery, because
// the JS is never added to the page header, so we have to add this manually
protected function loadjQuery() {
vmJsApi::jQuery();
// If we are on Joomla 2.5 and VM 3, manually add the script declarations
// cached in vmJsApi to the document header:
if (version_compare(JVERSION, '3.0', 'lt') && defined('VM_VERSION') && VM_VERSION>=3) {
$document = JFactory::getDocument();
$scripts = vmJsApi::getJScripts();
foreach ($scripts as $name => $jsToAdd) {
if($jsToAdd['written']) continue;
$file = $jsToAdd['script'] ? $jsToAdd['script'] : $name;
if(strpos($file,'/')!==0){
$file = vmJsApi::setPath($file,false,'');
} else if(strpos($file,'//')!==0){
$file = JURI::root(true).$file;
}
$ver = '';
if(!empty($jsToAdd['ver'])) $ver = '?vmver='.$jsToAdd['ver'];
$document->addScript( $file .$ver,"text/javascript",$jsToAdd['defer'],$jsToAdd['async'] );
vmJsApi::removeJScript($name);
}
}
}
protected function makeJSTranslationsAvailable() {
JText::script('PLG_ORDERNUMBER_JS_NOT_AUTHORIZED');
......@@ -74,8 +103,8 @@ class JFormFieldVmOrdernumberCounters extends JFormField {
$pluginpath = '/plugins/vmshopper/ordernumber/ordernumber/';
$doc = JFactory::getDocument()->addStyleSheet(JURI::root(true) . $pluginpath . 'assets/css/ordernumber.css');
$doc->addScript(JURI::root(true).$pluginpath . 'assets/js/ordernumber.js');
vmJsApi::jQuery();
$this->makeJSTranslationsAvailable();
$this->loadjQuery();
// Look up the current counters
$db = JFactory::getDBO();
......
......@@ -2,7 +2,7 @@
; Copyright (C) 2012-2014 Reinhold Kainhofer. All rights reserved.
; License http://www.gnu.org/licenses/gpl.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
VMSHOPPER_ORDERNUMBER="VM2 - Plugin zur Anpassung von Auftrags-, Rechnungs- und Kundennummern"
VMSHOPPER_ORDERNUMBER="Erweiterte Auftragsnummern für VirtueMart"
VMSHOPPER_ORDERNUMBER_DESC=" <div style='font-weight: normal; text-align:left; background: #EEEEEE;'><h2>Ordernumber plugin für Virtuemart (2.x und 3.x)</h2><p style='font-weight: normal'>Dieses Plugin erlaubt die Anpassung des Formats von Auftrags-, Rechnungs- und Kundennummern in VirtueMart 2.x und 3.0.</p><p>Das Format der Auftrags-, Rechnungs- und Kundennummern ist ein einfacher Text, wobei <tt>#</tt> die laufende Nummer anzeigt und <tt>[variable]</tt> als Variable interpretiert und durch deren Wert ersetzt wird.</p><p>Die vollständige Dokumentation ist zu finden auf: <a href='http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html'>http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html</a></p> </div>"
PLG_ORDERNUMBER_COUNTER_GLOBAL="Global"
......
......@@ -2,7 +2,7 @@
; Copyright (C) 2012-2014 Reinhold Kainhofer. All rights reserved.
; License http://www.gnu.org/licenses/gpl.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
VMSHOPPER_ORDERNUMBER="VM2 - Plugin zur Anpassung von Auftrags-, Rechnungs- und Kundennummern"
VMSHOPPER_ORDERNUMBER="Erweiterte Auftragsnummern für VirtueMart"
VMSHOPPER_ORDERNUMBER_DESC=" <div style='font-weight: normal; text-align:left; background: #EEEEEE;'><h2>Ordernumber plugin für Virtuemart (2.x und 3.x)</h2><p style='font-weight: normal'>Dieses Plugin erlaubt die Anpassung des Formats von Auftrags-, Rechnungs- und Kundennummern in VirtueMart 2.x und 3.0.</p><p>Das Format der Auftrags-, Rechnungs- und Kundennummern ist ein einfacher Text, wobei <tt>#</tt> die laufende Nummer anzeigt und <tt>[variable]</tt> als Variable interpretiert und durch deren Wert ersetzt wird.</p><p>Die vollständige Dokumentation ist zu finden auf: <a href='http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html'>http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html</a></p> </div>"
PLG_ORDERNUMBER_COUNTER_GLOBAL="Global"
......
......@@ -3,7 +3,7 @@
; License http://www.gnu.org/licenses/gpl.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
VMSHOPPER_ORDERNUMBER="VM2 - Custom Order, Invoice and Customer Number plugin"
VMSHOPPER_ORDERNUMBER="Advanced Ordernumbers for VirtueMart"
VMSHOPPER_ORDERNUMBER_DESC=" <div style='font-weight: normal; text-align:left; background: #EEEEEE;'><h2>Ordernumber plugin for Virtuemart (2.x and 3.x)</h2><p style='font-weight: normal'>This plugin is used to create custom order, invoice and customer numbers for Virtuemart 2.x and 3.x. The format of the numbers can be specified freely and several variables (year, month, day, time, addresses, etc.) can be used in the format.</p><p>The format of the numbers is a free-form text string, where <tt>#</tt> indicates the running counter and <tt>[variable]</tt> is understood as a variable and replaced by its current value.</p><p>The full documentation can be found at the homepage: <a href='http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html'>http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html</a></p> </div>"
PLG_ORDERNUMBER_COUNTER_GLOBAL="Global"
......
......@@ -3,7 +3,7 @@
; License http://www.gnu.org/licenses/gpl.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
VMSHOPPER_ORDERNUMBER="VM2 - Custom Order, Invoice and Customer Number plugin"
VMSHOPPER_ORDERNUMBER="Advanced Ordernumbers for VirtueMart"
VMSHOPPER_ORDERNUMBER_DESC=" <div style='font-weight: normal; text-align:left; background: #EEEEEE;'><h2>Ordernumber plugin for Virtuemart (2.x and 3.x)</h2><p style='font-weight: normal'>This plugin is used to create custom order, invoice and customer numbers for Virtuemart 2.x and 3.x. The format of the numbers can be specified freely and several variables (year, month, day, time, addresses, etc.) can be used in the format.</p><p>The format of the numbers is a free-form text string, where <tt>#</tt> indicates the running counter and <tt>[variable]</tt> is understood as a variable and replaced by its current value.</p><p>The full documentation can be found at the homepage: <a href='http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html'>http://open-tools.net/documentation/ordernumber-plugin-for-virtuemart.html</a></p> </div>"
PLG_ORDERNUMBER_COUNTER_GLOBAL="Global"
......
......@@ -37,7 +37,6 @@ class plgVmShopperOrdernumberInstallerScript
*
* @return boolean True on success
*/
// public function postflight($route, JAdapterInstance $adapter);
public function postflight ($type, $parent = null) {
if(!class_exists( 'vmPlugin' ))
require JPATH_VM_ADMINISTRATOR.DS.'plugins'.DS.'vmplugin.php';
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment