diff --git a/Makefile b/Makefile index d3689e3e2f5154eb7dcc41c9724cd04afd0105ec..66e59df4aa892ba9d05c4e93adca06b4bd9f37fb 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BASE=rules_shipping BASE_ADV=rules_shipping_advanced PLUGINTYPE=vmshipment ZIPBASE=opentools_vm -VERSION=6.0 +VERSION=6.1 PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE).script.php $(BASE).xml index.html PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html diff --git a/releases/plg_opentools_vm_rules_shipping_advanced_v6.1.zip b/releases/plg_opentools_vm_rules_shipping_advanced_v6.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..472a886d12b92dee7e7381578386b33e0a15f066 Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_advanced_v6.1.zip differ diff --git a/releases/plg_opentools_vm_rules_shipping_v6.1.zip b/releases/plg_opentools_vm_rules_shipping_v6.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..c68822cc9a8fdf12fabecf083ed6c638c5bc6377 Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_v6.1.zip differ diff --git a/rules_shipping.xml b/rules_shipping.xml index 9db2d2c5bd6348686c53ac8becb422415c9a19b1..031f33150fd8779e0ed58050a639ad5779b88f51 100644 --- a/rules_shipping.xml +++ b/rules_shipping.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <extension version="2.5" type="plugin" group="vmshipment" method="upgrade"> <name>OTSHIPMENT_RULES</name> - <creationDate>2014-09-14</creationDate> + <creationDate>2016-02-15</creationDate> <author>Reinhold Kainhofer</author> <authorUrl>http://www.open-tools.net</authorUrl> <copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>6.0</version> + <version>6.1</version> <description>OTSHIPMENT_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 e39e5d72ce70c9e0f348188782c7f5985851b76e..e62aedc3b0e2dbca1bf2f3e5f9754e6a9da9f1f5 100644 --- a/rules_shipping_advanced.xml +++ b/rules_shipping_advanced.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <extension version="1.5" type="plugin" group="vmshipment" method="upgrade"> <name>OTSHIPMENT_RULES_ADV</name> - <creationDate>2014-09-14</creationDate> + <creationDate>2016-02-15</creationDate> <author>Reinhold Kainhofer</author> <authorUrl>http://www.open-tools.net</authorUrl> <copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>6.0</version> + <version>6.1</version> <description>OTSHIPMENT_RULES_ADV_DESC</description> <files> <filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename> diff --git a/rules_shipping_framework_joomla.php b/rules_shipping_framework_joomla.php index 62cb0eff29b3050e870cad641eb2d161dc900693..e858223ff501db5741455e4c95af1a4cf8b28687 100644 --- a/rules_shipping_framework_joomla.php +++ b/rules_shipping_framework_joomla.php @@ -277,6 +277,7 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework { } protected function getOrderPrices ($cart, $products, /*$cart_prices, */$method) { + $cart_prices = $cart->cartPrices; $data = array( 'amount' => 0, 'amountwithtax' => 0, @@ -289,43 +290,36 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework { 'salespricewithdiscount' => 0, 'discountamount' => 0, 'pricewithouttax' => 0, + + // Bill-related prices: Will not be affected by scoping! Totals before and after cart-wide discounts. + 'billtotal' => $cart_prices['billTotal'], + 'billdiscountamount' => $cart_prices['billDiscountAmount'], + 'billtaxamount' => $cart_prices['billTaxAmount'], + 'billsubtotal' => $cart_prices['billSub'], ); -// if (!empty($cart_prices)) { -// // get prices for the whole cart -> simply user the cart_prices -// $data['amount'] = $cart_prices['salesPrice']; -// $data['amountwithtax'] = $cart_prices['salesPrice']; -// $data['amountwithouttax'] = $cart_prices['priceWithoutTax']; -// $data['baseprice'] = $cart_prices['basePrice']; -// $data['basepricewithtax'] = $cart_prices['basePriceWithTax']; -// $data['discountedpricewithouttax'] = $cart_prices['discountedPriceWithoutTax']; -// $data['salesprice'] = $cart_prices['salesPrice']; -// $data['taxamount'] = $cart_prices['taxAmount']; -// $data['salespricewithdiscount'] = $cart_prices['salesPriceWithDiscount']; -// $data['discountamount'] = $cart_prices['discountAmount']; -// $data['pricewithouttax'] = $cart_prices['priceWithoutTax']; -// } else { - // Calculate the prices from the individual products! - // Possible problems are discounts on the order total - foreach ($products as $product) { -// $prices = isset($product->allPrices)?($product->allPrices[$product->selectedPrice]):($product->prices); - $prices = $product->prices; - $quant = $product->quantity; - $data['amount'] += $quant * $prices['salesPrice']; - $data['amountwithtax'] += $quant * $prices['salesPrice']; - $data['amountwithouttax'] += $quant * $prices['priceWithoutTax']; - $data['baseprice'] += $quant * $prices['basePrice']; - $data['basepricewithtax'] += $quant * $prices['basePriceWithTax']; - $data['discountedpricewithouttax'] += $quant * $prices['discountedPriceWithoutTax']; - $data['salesprice'] += $quant * $prices['salesPrice']; - $data['taxamount'] += $quant * $prices['taxAmount']; - $data['salespricewithdiscount'] += $quant * $prices['salesPriceWithDiscount']; - $data['discountamount'] += $quant * $prices['discountAmount']; - $data['pricewithouttax'] += $quant * $prices['priceWithoutTax']; +// JFactory::getApplication()->enqueueMessage("<pre>getOrderPrices, cart=".print_r($cart,1)."</pre>", 'error'); + + + // Calculate the prices from the individual products! + // Possible problems are discounts on the order total + foreach ($products as $product) { +// $prices = isset($product->allPrices)?($product->allPrices[$product->selectedPrice]):($product->prices); + $prices = $product->prices; + $quant = $product->quantity; + $data['amount'] += $quant * $prices['salesPrice']; + $data['amountwithtax'] += $quant * $prices['salesPrice']; + $data['amountwithouttax'] += $quant * $prices['priceWithoutTax']; + $data['baseprice'] += $quant * $prices['basePrice']; + $data['basepricewithtax'] += $quant * $prices['basePriceWithTax']; + $data['discountedpricewithouttax'] += $quant * $prices['discountedPriceWithoutTax']; + $data['salesprice'] += $quant * $prices['salesPrice']; + $data['taxamount'] += $quant * $prices['taxAmount']; + $data['salespricewithdiscount'] += $quant * $prices['salesPriceWithDiscount']; + $data['discountamount'] += $quant * $prices['discountAmount']; + $data['pricewithouttax'] += $quant * $prices['priceWithoutTax']; // JFactory::getApplication()->enqueueMessage("<pre>prices: ".print_r($prices,1)."</pre>", 'error'); // JFactory::getApplication()->enqueueMessage("<pre>product: ".print_r($product,1)."</pre>", 'error'); - - } -// } + } return $data; }