From d1aba87fd952337adab061dce0607e2fac69bf86 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Wed, 4 Feb 2015 16:41:20 +0100 Subject: [PATCH] add used vouchers to order --- .../d3/d3dev/modules/models/d3_dev_oxorder.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php index 447d40f..1ce011b 100644 --- a/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php +++ b/copy_this/modules/d3/d3dev/modules/models/d3_dev_oxorder.php @@ -34,7 +34,6 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent // add this order articles to basket and recalculate basket $this->_addOrderArticlesToBasket($oBasket, $oOrderArticles); - // recalculating basket $oBasket->calculateBasket(true); $oBasket->d3ClearBasketItemArticles(); @@ -63,6 +62,7 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent public function d3getLastOrder() { $this->load($this->d3getLastOrderId()); + $this->_d3AddVouchers(); } /** @@ -78,4 +78,17 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent return $oBasket; } + + protected function _d3AddVouchers() + { + $sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ".oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->quote($this->getId()).";"; + + $aResult = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getArray($sSelect); + + foreach ($aResult as $aFields) { + $oVoucher = oxNew('oxvoucher'); + $oVoucher->load($aFields['oxid']); + $this->_aVoucherList[$oVoucher->getId()] = $oVoucher; + } + } }