diff --git a/images/plg_vmshipping_rules_shipping_translation.png b/images/plg_vmshipping_rules_shipping_translation.png new file mode 100644 index 0000000000000000000000000000000000000000..40b8b02f0f5bfc298ca8d423bf6d9299a2984bf3 Binary files /dev/null and b/images/plg_vmshipping_rules_shipping_translation.png differ diff --git a/images/plg_vmshipping_rules_shipping_translation1.png b/images/plg_vmshipping_rules_shipping_translation1.png new file mode 100644 index 0000000000000000000000000000000000000000..cd3eb39fd61a6f929b564d3805995e8050ff27f4 Binary files /dev/null and b/images/plg_vmshipping_rules_shipping_translation1.png differ diff --git a/rules_shipping_base.php b/rules_shipping_base.php index fdf680b4b754b36f9b28ec8d76fa4f42fea97294..349e4c12b5f88f4010390e7b5629eb19288716f5 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -776,20 +776,21 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { $data['discountamount'] = $cart_prices['discountAmount']; $data['pricewithouttax'] = $cart_prices['priceWithoutTax']; } else { - // TODO: Calculate the prices from the individual products! + // 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']; +JFactory::getApplication()->enqueueMessage("<pre>Product: ".print_r($product,1)."</pre>", 'error'); + $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']; } } return $data; @@ -823,8 +824,7 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { // Finally, call the triger of vmshipmentrules plugins to let them add/modify variables JPluginHelper::importPlugin('vmshipmentrules'); - $dispatcher = JDispatcher::getInstance(); - $dispatcher->trigger('onVmShippingRulesGetCartValues',array(&$cartvals, $cart, $products, $method, $cart_prices)); + JDispatcher::getInstance()->trigger('onVmShippingRulesGetCartValues',array(&$cartvals, $cart, $products, $method, $cart_prices)); return $cartvals; } @@ -1203,7 +1203,6 @@ class ShippingRule { "evaluate_for_manufacturers" => 'manufacturers' ); -// JFactory::getApplication()->enqueueMessage("<pre>Scoping: condition is ".$filterkeys[$scoping].'='.print_r($conditionvals,1).", Old cartvals are: ".print_r($vals,1)."</pre>", 'error'); $conditions = array(); if (isset($filterkeys[$scoping])) $conditions[$filterkeys[$scoping]] = $conditionvals; @@ -1212,7 +1211,6 @@ class ShippingRule { $filteredproducts = filterProducts($products, $conditions); // We have been handed a callback function to calculate the cartvals for the filtered list of products, so use it: $filteredvals = $cartvals_callback($filteredproducts); -// JFactory::getApplication()->enqueueMessage("<pre>Scoping: condition is ".print_r($conditions,1).", products filtered: ".count($filteredproducts).", New cartvals are: ".print_r($filteredvals,1)."</pre>", 'error'); return $this->evaluateTerm ($expr, $filteredvals, $filteredproducts, $cartvals_callback); }