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

V6.2.4: Load the VM framework in all plugins; fix array_merge warning

parent c5b738f1
No related branches found
No related tags found
No related merge requests found
Showing
with 88 additions and 6 deletions
BASE=awocoupon BASE=awocoupon
PLUGINTYPE=vmshipmentrules PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_$(PLUGINTYPE) ZIPBASE=opentools_$(PLUGINTYPE)
VERSION=1.2 VERSION=1.3
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
...@@ -17,6 +17,10 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -17,6 +17,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/ * http://open-tools.net/
* *
*/ */
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) { if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl> <authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2014-2017, Reinhold Kainhofer</copyright> <copyright>Copyright (C) 2014-2017, Reinhold Kainhofer</copyright>
<license>GPL v3+</license> <license>GPL v3+</license>
<version>1.2</version> <version>1.3</version>
<description>VMSHIPMENTRULES_AWOCOUPON_DESC</description> <description>VMSHIPMENTRULES_AWOCOUPON_DESC</description>
<files> <files>
<filename plugin="awocoupon">awocoupon.php</filename> <filename plugin="awocoupon">awocoupon.php</filename>
......
BASE=regexp BASE=regexp
PLUGINTYPE=vmshipmentrules PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_vmshipmentrules ZIPBASE=opentools_vmshipmentrules
VERSION=1.0 VERSION=1.1
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
...@@ -15,6 +15,10 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -15,6 +15,10 @@ defined ('_JEXEC') or die('Restricted access');
* *
* http://open-tools.net/ * http://open-tools.net/
*/ */
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) { if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl> <authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2014, Reinhold Kainhofer</copyright> <copyright>Copyright (C) 2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license> <license>GPL v3+</license>
<version>1.0</version> <version>1.1</version>
<description>VMSHIPMENTRULES_REGEXP_DESC</description> <description>VMSHIPMENTRULES_REGEXP_DESC</description>
<files> <files>
<filename plugin="regexp">regexp.php</filename> <filename plugin="regexp">regexp.php</filename>
......
...@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/ * http://open-tools.net/
* *
*/ */
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) { if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
} }
......
No preview for this file type
BASE=vmcouponprice BASE=vmcouponprice
PLUGINTYPE=vmshipmentrules PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_vmshipmentrules ZIPBASE=opentools_vmshipmentrules
VERSION=1.0 VERSION=1.1
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
...@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/ * http://open-tools.net/
* *
*/ */
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) { if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl> <authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2017, Reinhold Kainhofer</copyright> <copyright>Copyright (C) 2017, Reinhold Kainhofer</copyright>
<license>GPL v3+</license> <license>GPL v3+</license>
<version>1.0</version> <version>1.1</version>
<description>VMSHIPMENTRULES_VMCOUPONPRICE_DESC</description> <description>VMSHIPMENTRULES_VMCOUPONPRICE_DESC</description>
<files> <files>
<filename plugin="vmcouponprice">vmcouponprice.php</filename> <filename plugin="vmcouponprice">vmcouponprice.php</filename>
......
File added
File added
...@@ -19,6 +19,10 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -19,6 +19,10 @@ defined ('_JEXEC') or die('Restricted access');
* @author Reinhold Kainhofer, based on the weight_countries shipping plugin by Valerie Isaksen * @author Reinhold Kainhofer, based on the weight_countries shipping plugin by Valerie Isaksen
* *
*/ */
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('vmPSPlugin')) { if (!class_exists ('vmPSPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
} }
......
...@@ -21,6 +21,7 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -21,6 +21,7 @@ defined ('_JEXEC') or die('Restricted access');
if (!class_exists( 'VmConfig' )) { if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php'); require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
} }
if (!class_exists ('vmPSPlugin')) { if (!class_exists ('vmPSPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
......
...@@ -20,6 +20,7 @@ defined ('_JEXEC') or die('Restricted access'); ...@@ -20,6 +20,7 @@ defined ('_JEXEC') or die('Restricted access');
*/ */
if (!class_exists( 'VmConfig' )) { if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php'); require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
} }
if (!class_exists ('vmPSPlugin')) { if (!class_exists ('vmPSPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'); require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
...@@ -565,6 +566,66 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { ...@@ -565,6 +566,66 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
return $ret; return $ret;
} }
/* Display product shipping costs on product details page (required in some jurisdictions)
*
* Copied from the weight_countries shipment plugin
* @copyright Copyright (C) 2004-2012 VirtueMart Team - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @author Valerie Isaksen
*/
/* function plgVmOnProductDisplayShipment($product, &$productDisplayShipments) {
if ($this->getPluginMethods($product->virtuemart_vendor_id) === 0) {
return FALSE;
}
if (!class_exists('VirtueMartCart'))
require(VMPATH_SITE . DS . 'helpers' . DS . 'cart.php');
$html = '';
if (!class_exists('CurrencyDisplay'))
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php');
$currency = CurrencyDisplay::getInstance();
foreach ($this->methods as $this->_currentMethod) {
if($this->_currentMethod->show_on_pdetails){
if(!isset($cart)) {
$cart = VirtueMartCart::getCart();
$cart->prepareCartData();
}
$prices = array('salesPrice'=>0.0);
if(isset($cart->cartPrices)){
$prices['salesPrice'] = $cart->cartPrices['salesPrice'];
}
if(isset($product->prices)){
$prices['salesPrice'] += $product->prices['salesPrice'];
}
if($this->checkConditions($cart, $this->_currentMethod, $prices, $product)){
$product->prices['shipmentPrice'] = $this->getCosts($cart, $this->_currentMethod, $cart->cartPrices);
// TODO: Implement shipping costs with tax included...
if(isset($product->prices['VatTax']) and count($product->prices['VatTax'])>0){
reset($product->prices['VatTax']);
$rule = current($product->prices['VatTax']);
if(isset($rule[1])) {
$product->prices['shipmentTax'] = $product->prices['shipmentPrice'] * $rule[1]/100.0;
$product->prices['shipmentPrice'] = $product->prices['shipmentPrice'] * (1 + $rule[1]/100.0);
}
}
// TODO: Implement custom display template
$html = $this->renderByLayout( 'default', array("method" => $this->_currentMethod, "cart" => $cart,"product" => $product,"currency" => $currency) );
}
}
}
$productDisplayShipments[] = $html;
}
*/
} }
// No closing tag // No closing tag
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment