Commit 6687205d authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

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

parent c5b738f1
BASE=awocoupon
PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_$(PLUGINTYPE)
VERSION=1.2
VERSION=1.3
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
......@@ -17,6 +17,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/
*
*/
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
}
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2014-2017, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>1.2</version>
<version>1.3</version>
<description>VMSHIPMENTRULES_AWOCOUPON_DESC</description>
<files>
<filename plugin="awocoupon">awocoupon.php</filename>
......
BASE=regexp
PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_vmshipmentrules
VERSION=1.0
VERSION=1.1
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
......@@ -15,6 +15,10 @@ defined ('_JEXEC') or die('Restricted access');
*
* http://open-tools.net/
*/
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
}
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>1.0</version>
<version>1.1</version>
<description>VMSHIPMENTRULES_REGEXP_DESC</description>
<files>
<filename plugin="regexp">regexp.php</filename>
......
......@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/
*
*/
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
}
......
BASE=vmcouponprice
PLUGINTYPE=vmshipmentrules
ZIPBASE=opentools_vmshipmentrules
VERSION=1.0
VERSION=1.1
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
......
......@@ -16,6 +16,10 @@ defined ('_JEXEC') or die('Restricted access');
* http://open-tools.net/
*
*/
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('VmPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmplugin.php');
}
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2017, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>1.0</version>
<version>1.1</version>
<description>VMSHIPMENTRULES_VMCOUPONPRICE_DESC</description>
<files>
<filename plugin="vmcouponprice">vmcouponprice.php</filename>
......
......@@ -19,6 +19,10 @@ defined ('_JEXEC') or die('Restricted access');
* @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')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
}
......
......@@ -21,6 +21,7 @@ defined ('_JEXEC') or die('Restricted access');
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('vmPSPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
......
......@@ -20,6 +20,7 @@ defined ('_JEXEC') or die('Restricted access');
*/
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
}
if (!class_exists ('vmPSPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
......@@ -565,6 +566,66 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment