From ce2c2541c648682496abb269c5b0c619272a5b2e Mon Sep 17 00:00:00 2001 From: DanielSeifert Date: Fri, 10 Jul 2015 15:08:16 +0000 Subject: [PATCH] fix tax claculation for trusted store tracking code --- .../inc/d3ga_universal_trustedstore.tpl | 2 +- .../models/d3_oxorder_googleanalytics.php | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl index 487d6b0..be8f0ee 100644 --- a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl +++ b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl @@ -50,7 +50,7 @@ [{$sTotal|string_format:"%.2f"}] -[{$oOrder->getFieldData('oxdiscount')|string_format:"%.2f"}] [{$oOrder->getFieldData('oxdelcost')|string_format:"%.2f"}] - [{math equation="fi + se + th + fo" fi=$oOrder->getFieldData('oxartvatprice1') se=$oOrder->getFieldData('oxartvatprice2') th=$oOrder->getFieldData('oxpayvat') fo=$oOrder->getFieldData('oxdelvat') format="%.2f"}] + [{$oOrder->d3GetTaxTotal()}] [{$oView->d3GAgetEstimatedDeliveryDate()|date_format:"%Y-%m-%d"}] [{$oView->d3GAgetEstimatedShippingDate()|date_format:"%Y-%m-%d"}] [{$oView->d3GAhasBackorderPreorder()}] diff --git a/copy_this/modules/d3/d3_googleanalytics/modules/models/d3_oxorder_googleanalytics.php b/copy_this/modules/d3/d3_googleanalytics/modules/models/d3_oxorder_googleanalytics.php index c5db052..4a635ed 100644 --- a/copy_this/modules/d3/d3_googleanalytics/modules/models/d3_oxorder_googleanalytics.php +++ b/copy_this/modules/d3/d3_googleanalytics/modules/models/d3_oxorder_googleanalytics.php @@ -73,4 +73,51 @@ class d3_oxorder_googleanalytics extends d3_oxorder_googleanalytics_parent } } } + + /** + * @return float + */ + public function d3GetOrderPayVat() + { + return $this->getFieldData('oxpaycost') / 100 * $this->getFieldData('oxpayvat'); + } + + /** + * @return float + */ + public function d3GetOrderDelVat() + { + return $this->getFieldData('oxdelcost') / 100 * $this->getFieldData('oxdelvat'); + } + + /** + * @return float + */ + public function d3GetOrderWrapVat() + { + return $this->getFieldData('oxwrapcost') / 100 * $this->getFieldData('oxwrapvat'); + } + + /** + * @return float + */ + public function d3GetOrderCardVat() + { + return $this->getFieldData('oxcardcost') / 100 * $this->getFieldData('oxcardvat'); + } + + /** + * @return float + */ + public function d3GetTaxTotal() + { + $dVat = $this->getFieldData('oxartvatprice1') + + $this->getFieldData('oxartvatprice2') + + $this->d3GetOrderPayVat() + + $this->d3GetOrderDelVat() + + $this->d3GetOrderWrapVat() + + $this->d3GetOrderCardVat(); + + return sprintf('%.2f', $dVat); + } }