Commit 5af8280e authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V5.4: Fix evaluate_for_categories (order amounts calculated without...

V5.4: Fix evaluate_for_categories (order amounts calculated without quantities), Fix evaluate_for_manufacturers (wrong variable used); Fix protected warning
parent 65c6d89d
......@@ -2,7 +2,7 @@ BASE=rules_shipping
BASE_ADV=rules_shipping_advanced
PLUGINTYPE=vmshipment
ZIPBASE=opentools_vm
VERSION=5.3
VERSION=5.4
PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE).script.php $(BASE).xml index.html
PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>5.3</version>
<version>5.4</version>
<description>VMSHIPMENT_RULES_DESC</description>
<files>
<filename plugin="rules_shipping">rules_shipping.php</filename>
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>5.3</version>
<version>5.4</version>
<description>VMSHIPMENT_RULES_ADV_DESC</description>
<files>
<filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename>
......
......@@ -784,17 +784,17 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
// Calculate the prices from the individual products!
// Possible problems are discounts on the order total
foreach ($products as $product) {
$data['amount'] += $product->allPrices[$product->selectedPrice]['salesPrice'];
$data['amountwithtax'] += $product->allPrices[$product->selectedPrice]['salesPrice'];
$data['amountwithouttax'] += $product->allPrices[$product->selectedPrice]['priceWithoutTax'];
$data['baseprice'] += $product->allPrices[$product->selectedPrice]['basePrice'];
$data['basepricewithtax'] += $product->allPrices[$product->selectedPrice]['basePriceWithTax'];
$data['discountedpricewithouttax'] += $product->allPrices[$product->selectedPrice]['discountedPriceWithoutTax'];
$data['salesprice'] += $product->allPrices[$product->selectedPrice]['salesPrice'];
$data['taxamount'] += $product->allPrices[$product->selectedPrice]['taxAmount'];
$data['salespricewithdiscount'] += $product->allPrices[$product->selectedPrice]['salesPriceWithDiscount'];
$data['discountamount'] += $product->allPrices[$product->selectedPrice]['discountAmount'];
$data['pricewithouttax'] += $product->allPrices[$product->selectedPrice]['priceWithoutTax'];
$data['amount'] += $product->quantity*$product->allPrices[$product->selectedPrice]['salesPrice'];
$data['amountwithtax'] += $product->quantity*$product->allPrices[$product->selectedPrice]['salesPrice'];
$data['amountwithouttax'] += $product->quantity*$product->allPrices[$product->selectedPrice]['priceWithoutTax'];
$data['baseprice'] += $product->quantity*$product->allPrices[$product->selectedPrice]['basePrice'];
$data['basepricewithtax'] += $product->quantity*$product->allPrices[$product->selectedPrice]['basePriceWithTax'];
$data['discountedpricewithouttax'] += $product->quantity*$product->allPrices[$product->selectedPrice]['discountedPriceWithoutTax'];
$data['salesprice'] += $product->quantity*$product->allPrices[$product->selectedPrice]['salesPrice'];
$data['taxamount'] += $product->quantity*$product->allPrices[$product->selectedPrice]['taxAmount'];
$data['salespricewithdiscount'] += $product->quantity*$product->allPrices[$product->selectedPrice]['salesPriceWithDiscount'];
$data['discountamount'] += $product->quantity*$product->allPrices[$product->selectedPrice]['discountAmount'];
$data['pricewithouttax'] += $product->quantity*$product->allPrices[$product->selectedPrice]['priceWithoutTax'];
}
}
return $data;
......@@ -805,7 +805,7 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
protected function addCustomCartValues (VirtueMartCart $cart, $products, $cart_prices, &$values) {
}
protected function getCartValues (VirtueMartCart $cart, $products, $method, $cart_prices) {
public function getCartValues (VirtueMartCart $cart, $products, $method, $cart_prices) {
$address = (($cart->ST == 0 || $cart->STsameAsBT == 1) ? $cart->BT : $cart->ST);
$cartvals = array_merge (
array(
......@@ -964,13 +964,14 @@ if (class_exists ('ShippingRule')) {
function filterProducts($products, $filter_conditions) {
$result = array();
foreach ($products as $p) {
// JFactory::getApplication()->enqueueMessage("<pre>Product: ".print_r($p,1)."</pre>", 'error');
if (!empty($filter_conditions['skus']) && !in_array($p->product_sku, $filter_conditions['skus']))
continue;
if (!empty($filter_conditions['categories']) && count(array_intersect($filter_conditions['categories'], $p->categories))==0)
continue;
if (!empty($filter_conditions['manufacturers']) && count(array_intersect($filter_conditions['manufacturers'], $p->product_manufacturers))==0)
if (!empty($filter_conditions['manufacturers']) && count(array_intersect($filter_conditions['manufacturers'], $p->virtuemart_manufacturer_id))==0)
continue;
if (!empty($filter_conditions['vendors']) && count(array_intersect($filter_conditions['vendors'], $p->product_vendors))==0)
if (!empty($filter_conditions['vendors']) && !in_array($p->virtuemart_vendor_id, $filter_conditions['vendors']))
continue;
$result[] = $p;
}
......
Supports Markdown
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