diff --git a/Makefile b/Makefile index 3b9232cd41f78c531283bfe6c08c7e94612ec490..8dd0a76031745ada94ce5d645e6a974f1144444c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/releases/plg_opentools_vm_rules_shipping_advanced_v5.4.zip b/releases/plg_opentools_vm_rules_shipping_advanced_v5.4.zip new file mode 100644 index 0000000000000000000000000000000000000000..b278ab08221f1ed14cb45211967c9be2e00dc5ee Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_advanced_v5.4.zip differ diff --git a/releases/plg_opentools_vm_rules_shipping_v5.4.zip b/releases/plg_opentools_vm_rules_shipping_v5.4.zip new file mode 100644 index 0000000000000000000000000000000000000000..0fc0ce4d51a4b3bab9c8af1444d2339578c51446 Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_v5.4.zip differ diff --git a/rules_shipping.xml b/rules_shipping.xml index a028b2b809006315083ab662e6be16df916a1356..f13b0b35c58cd6eeb7db8953894b6f08f2908619 100644 --- a/rules_shipping.xml +++ b/rules_shipping.xml @@ -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> diff --git a/rules_shipping_advanced.xml b/rules_shipping_advanced.xml index 5b6675da1051701bfcad987ad33accf7bd02e541..39b7ddd6128a68c37eb9ca2e92a6069eaa09c6bc 100644 --- a/rules_shipping_advanced.xml +++ b/rules_shipping_advanced.xml @@ -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> diff --git a/rules_shipping_base.php b/rules_shipping_base.php index 6020104d14e0ecd8b80af6c671b830906dad70aa..143ae09d73d51c5ef47d7e153548762e33abeec1 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -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; }