235 $this->
init(
'oxorder');
251 if ($sName ==
'oDelSet') {
255 if ($sName ==
'oxorder__oxbillcountry') {
259 if ($sName ==
'oxorder__oxdelcountry') {
279 $this->oxorder__oxorderdate =
new oxField($oUtilsDate->formatDBDate($this->oxorder__oxorderdate->value));
280 $this->oxorder__oxsenddate =
new oxField($oUtilsDate->formatDBDate($this->oxorder__oxsenddate->value));
293 if ($sCountryId && $sCountryId !=
'-1') {
294 $oCountry =
oxNew(
'oxcountry');
296 $sTitle = $oCountry->oxcountry__oxtitle->value;
311 $sSelect =
"SELECT `oxorderarticles`.* FROM `oxorderarticles`
312 WHERE `oxorderarticles`.`oxorderid` = '" . $this->
getId() .
"'" .
313 ($blExcludeCanceled ?
" AND `oxorderarticles`.`oxstorno` != 1 " :
" ") .
"
314 ORDER BY `oxorderarticles`.`oxartid`, `oxorderarticles`.`oxselvariant`, `oxorderarticles`.`oxpersparam` ";
317 $oArticles =
oxNew(
'oxlist');
318 $oArticles->init(
'oxorderarticle');
319 $oArticles->selectString($sSelect);
334 if ($blExcludeCanceled) {
338 } elseif ($this->_oArticles === null) {
352 $this->_oArticles = $oOrderArticleList;
362 if ($this->_oDelPrice != null) {
366 $this->_oDelPrice =
oxNew(
'oxprice');
367 $this->_oDelPrice->setBruttoPriceMode();
368 $this->_oDelPrice->setPrice($this->oxorder__oxdelcost->value, $this->oxorder__oxdelvat->value);
380 if ($this->_oWrappingPrice != null) {
384 $this->_oWrappingPrice =
oxNew(
'oxprice');
385 $this->_oWrappingPrice->setBruttoPriceMode();
386 $this->_oWrappingPrice->setPrice($this->oxorder__oxwrapcost->value, $this->oxorder__oxwrapvat->value);
398 if ($this->_oGidtCardPrice != null) {
399 return $this->_oGidtCardPrice;
402 $this->_oGidtCardPrice =
oxNew(
'oxprice');
403 $this->_oGidtCardPrice->setBruttoPriceMode();
404 $this->_oGidtCardPrice->setPrice($this->oxorder__oxgiftcardcost->value, $this->oxorder__oxgiftcardvat->value);
406 return $this->_oGidtCardPrice;
417 if ($this->_oPaymentPrice != null) {
421 $this->_oPaymentPrice =
oxNew(
'oxprice');
422 $this->_oPaymentPrice->setBruttoPriceMode();
423 $this->_oPaymentPrice->setPrice($this->oxorder__oxpaycost->value, $this->oxorder__oxpayvat->value);
435 if ($this->_oTsProtectionPrice != null) {
439 $this->_oTsProtectionPrice =
oxNew(
'oxprice');
440 $this->_oTsProtectionPrice->setBruttoPriceMode();
441 $this->_oTsProtectionPrice->setPrice($this->oxorder__oxtsprotectcosts->value, $this->getConfig()->getConfigParam(
'dDefaultVAT'));
455 $dTotalNetSum += $this->oxorder__oxtotalnetsum->value;
460 return $dTotalNetSum;
495 if (!$blRecalculatingOrder) {
497 $this->
setId($sGetChallenge);
516 if (!$blRecalculatingOrder) {
528 if (!$blRecalculatingOrder) {
530 if ($blRet !==
true) {
535 if (!$this->oxorder__oxordernr->value) {
544 if ($blRet !==
true) {
554 if (!$blRecalculatingOrder) {
572 if (!$blRecalculatingOrder) {
578 if (!$blRecalculatingOrder) {
594 return (
bool) $this->oxorder__oxisnettomode->value;
606 $sQ =
'update oxorder set oxtransstatus=' . $oDb->quote($sStatus) .
' where oxid=' . $oDb->quote($this->
getId());
622 if (strpos($sVat,
'.') < strpos($sVat,
',')) {
623 $sVat = str_replace(array(
'.',
','), array(
'',
'.'), $sVat);
625 $sVat = str_replace(
',',
'', $sVat);
628 return (
float) $sVat;
636 $this->oxorder__oxartvat1 =
new oxField(null);
637 $this->oxorder__oxartvatprice1 =
new oxField(null);
638 $this->oxorder__oxartvat2 =
new oxField(null);
639 $this->oxorder__oxartvatprice2 =
new oxField(null);
655 if (
$myConfig->getConfigParam(
'blStoreIPs') && $this->oxorder__oxip->value === null) {
677 if (($oPaymentCost = $oBasket->
getCosts(
'oxpayment'))) {
683 if (($oDeliveryCost = $oBasket->
getCosts(
'oxdelivery'))) {
691 if (!isset($this->oxorder__oxremark) || $this->oxorder__oxremark->value === null) {
696 $oCur =
$myConfig->getActShopCurrencyObject();
697 $this->oxorder__oxcurrency =
new oxField($oCur->name);
702 $this->oxorder__oxvoucherdiscount =
new oxField($oVoucherDiscount->getBruttoPrice(),
oxField::T_RAW);
706 if ($this->_blReloadDiscount) {
709 if (count($aDiscounts) > 0) {
710 foreach ($aDiscounts as $oDiscount) {
711 $dDiscount += $oDiscount->dDiscount;
742 if ($this->_iOrderLang === null) {
743 if (isset($this->oxorder__oxlang->value)) {
744 $this->_iOrderLang =
oxRegistry::getLang()->validateLanguage($this->oxorder__oxlang->value);
761 $this->oxorder__oxuserid =
new oxField($oUser->getId());
764 $this->oxorder__oxbillcompany = clone $oUser->oxuser__oxcompany;
765 $this->oxorder__oxbillemail = clone $oUser->oxuser__oxusername;
766 $this->oxorder__oxbillfname = clone $oUser->oxuser__oxfname;
767 $this->oxorder__oxbilllname = clone $oUser->oxuser__oxlname;
768 $this->oxorder__oxbillstreet = clone $oUser->oxuser__oxstreet;
769 $this->oxorder__oxbillstreetnr = clone $oUser->oxuser__oxstreetnr;
770 $this->oxorder__oxbilladdinfo = clone $oUser->oxuser__oxaddinfo;
771 $this->oxorder__oxbillustid = clone $oUser->oxuser__oxustid;
772 $this->oxorder__oxbillcity = clone $oUser->oxuser__oxcity;
773 $this->oxorder__oxbillcountryid = clone $oUser->oxuser__oxcountryid;
774 $this->oxorder__oxbillstateid = clone $oUser->oxuser__oxstateid;
775 $this->oxorder__oxbillzip = clone $oUser->oxuser__oxzip;
776 $this->oxorder__oxbillfon = clone $oUser->oxuser__oxfon;
777 $this->oxorder__oxbillfax = clone $oUser->oxuser__oxfax;
778 $this->oxorder__oxbillsal = clone $oUser->oxuser__oxsal;
784 $this->oxorder__oxdelcompany = clone $oDelAdress->oxaddress__oxcompany;
785 $this->oxorder__oxdelfname = clone $oDelAdress->oxaddress__oxfname;
786 $this->oxorder__oxdellname = clone $oDelAdress->oxaddress__oxlname;
787 $this->oxorder__oxdelstreet = clone $oDelAdress->oxaddress__oxstreet;
788 $this->oxorder__oxdelstreetnr = clone $oDelAdress->oxaddress__oxstreetnr;
789 $this->oxorder__oxdeladdinfo = clone $oDelAdress->oxaddress__oxaddinfo;
790 $this->oxorder__oxdelcity = clone $oDelAdress->oxaddress__oxcity;
791 $this->oxorder__oxdelcountryid = clone $oDelAdress->oxaddress__oxcountryid;
792 $this->oxorder__oxdelstateid = clone $oDelAdress->oxaddress__oxstateid;
793 $this->oxorder__oxdelzip = clone $oDelAdress->oxaddress__oxzip;
794 $this->oxorder__oxdelfon = clone $oDelAdress->oxaddress__oxfon;
795 $this->oxorder__oxdelfax = clone $oDelAdress->oxaddress__oxfax;
796 $this->oxorder__oxdelsal = clone $oDelAdress->oxaddress__oxsal;
810 if (($oWrappingCost = $oBasket->
getCosts(
'oxwrapping'))) {
816 if (($oGiftCardCost = $oBasket->
getCosts(
'oxgiftcard'))) {
837 $this->_oArticles =
oxNew(
'oxlist');
841 foreach ($aArticleList as $oContent) {
845 $oProduct = $oContent->getArticle(
true, null,
true);
848 if ($oProduct->isOrderArticle()) {
849 $oOrderArticle = $oProduct;
853 if ($iCurrLang != $oProduct->getLanguage()) {
854 $oProduct->loadInLang($iCurrLang, $oProduct->getProductId());
859 if (count($aChosenSelList = $oContent->getChosenSelList())) {
860 foreach ($aChosenSelList as $oItem) {
864 $sSelList .=
"{$oItem->name} : {$oItem->value}";
868 $oOrderArticle =
oxNew(
'oxorderarticle');
869 $oOrderArticle->setIsNewOrderItem(
true);
870 $oOrderArticle->copyThis($oProduct);
871 $oOrderArticle->setId();
873 $oOrderArticle->oxorderarticles__oxartnum = clone $oProduct->oxarticles__oxartnum;
874 $oOrderArticle->oxorderarticles__oxselvariant =
new oxField(trim($sSelList .
' ' . $oProduct->oxarticles__oxvarselect->getRawValue()),
oxField::T_RAW);
875 $oOrderArticle->oxorderarticles__oxshortdesc =
new oxField($oProduct->oxarticles__oxshortdesc->getRawValue(),
oxField::T_RAW);
877 $oOrderArticle->oxorderarticles__oxtitle =
new oxField(trim($oProduct->oxarticles__oxtitle->getRawValue()),
oxField::T_RAW);
880 if (!is_array($aPersParams = $oProduct->getPersParams())) {
881 $aPersParams = $oContent->getPersParams();
883 if (is_array($aPersParams) && count($aPersParams)) {
889 $oOrderArticle->oxorderarticles__oxorderid =
new oxField($this->
getId());
890 $oOrderArticle->oxorderarticles__oxartid =
new oxField($oContent->getProductId());
891 $oOrderArticle->oxorderarticles__oxamount =
new oxField($oContent->getAmount());
894 $oPrice = $oContent->getPrice();
897 $oOrderArticle->oxorderarticles__oxbrutprice =
new oxField($oPrice->getBruttoPrice(),
oxField::T_RAW);
900 $oUnitPtice = $oContent->getUnitPrice();
901 $oOrderArticle->oxorderarticles__oxnprice =
new oxField($oUnitPtice->getNettoPrice(),
oxField::T_RAW);
902 $oOrderArticle->oxorderarticles__oxbprice =
new oxField($oUnitPtice->getBruttoPrice(),
oxField::T_RAW);
908 $oOrderArticle->oxorderarticles__oxordershopid =
new oxField($oContent->getShopId(),
oxField::T_RAW);
911 $oOrderArticle->oxorderarticles__oxisbundle =
new oxField($oContent->isBundle());
916 $oOrderArticle->oProduct = $oProduct;
918 $oOrderArticle->setArticle($oProduct);
921 $this->_oArticles->offsetSet($oOrderArticle->getId(), $oOrderArticle);
939 $oPayTransaction->setPaymentParams($oUserpayment);
941 if (!$oPayTransaction->executePayment($oBasket->
getPrice()->getBruttoPrice(), $this)) {
945 if (method_exists($oPayTransaction,
'getLastError')) {
946 if (($sLastError = $oPayTransaction->getLastError())) {
952 if (method_exists($oPayTransaction,
'getLastErrorNo')) {
953 if (($iLastErrorNo = $oPayTransaction->getLastErrorNo())) {
954 return $iLastErrorNo;
972 return oxNew(
'oxPaymentGateway');
989 $oPayment =
oxNew(
'oxpayment');
991 if (!$oPayment->load($sPaymentid)) {
997 if (is_array($aStoredDynvalue = $oUserpayment->getDynValues())) {
998 foreach ($aStoredDynvalue as $oVal) {
999 $aDynvalue[$oVal->name] = $oVal->value;
1004 $oPayment->setDynValues(
oxRegistry::getUtils()->assignValuesFromText($oPayment->oxpayments__oxvaldesc->value));
1009 if (is_array($aPaymentDynValues = $oPayment->getDynValues())) {
1010 foreach ($aPaymentDynValues as $key => $oVal) {
1011 if (isset($aDynvalue[$oVal->name])) {
1012 $oVal->value = $aDynvalue[$oVal->name];
1016 $aPaymentDynValues[$key] = $oVal;
1017 $aDynVal[$oVal->name] = $oVal->value;
1024 $oUserpayment =
oxNew(
'oxuserpayment');
1025 $oUserpayment->oxuserpayments__oxuserid = clone $this->oxorder__oxuserid;
1028 $oUserpayment->oxpayments__oxdesc = clone $oPayment->oxpayments__oxdesc;
1029 $oUserpayment->oxpayments__oxlongdesc = clone $oPayment->oxpayments__oxlongdesc;
1030 $oUserpayment->setDynValues($aPaymentDynValues);
1031 $oUserpayment->save();
1035 $this->oxorder__oxpaymenttype = clone $oUserpayment->oxuserpayments__oxpaymentsid;
1038 return $oUserpayment;
1060 foreach ($aArticleList as $oContent) {
1061 if (($sWishId = $oContent->getWishId())) {
1064 if ($sWishId == $oUser->getId()) {
1065 $oUserBasket = $oUser->getBasket(
'wishlist');
1067 $aWhere = array(
'oxuserbaskets.oxuserid' => $sWishId,
'oxuserbaskets.oxtitle' =>
'wishlist');
1068 $oUserBasket =
oxNew(
'oxuserbasket');
1069 $oUserBasket->assignRecord($oUserBasket->buildSelectString($aWhere));
1074 if (!($sProdId = $oContent->getWishArticleId())) {
1075 $sProdId = $oContent->getProductId();
1077 $oUserBasketItem = $oUserBasket->getItem($sProdId, $oContent->getSelList());
1078 $dNewAmount = $oUserBasketItem->oxuserbasketitems__oxamount->value - $oContent->getAmount();
1079 if ($dNewAmount < 0) {
1082 $oUserBasket->addItemToBasket($sProdId, $dNewAmount, $oContent->getSelList(),
true);
1105 if ($oUser->getBasket(
'noticelist')->oxuserbaskets__oxid->value === null) {
1110 if ($oUserBasket = $oUser->getBasket(
'noticelist')) {
1112 foreach ($aArticleList as $oContent) {
1113 $sProdId = $oContent->getProductId();
1116 $oUserBasketItem = $oUserBasket->getItem($sProdId, $oContent->getSelList(), $oContent->getPersParams());
1117 $dNewAmount = $oUserBasketItem->oxuserbasketitems__oxamount->value - $oContent->getAmount();
1118 if ($dNewAmount < 0) {
1121 $oUserBasket->addItemToBasket($sProdId, $dNewAmount, $oContent->getSelList(),
true, $oContent->getPersParams());
1132 $sDate = date(
'Y-m-d H:i:s',
oxRegistry::get(
"oxUtilsDate")->getTime());
1133 $sQ =
'update oxorder set oxorderdate=' . $oDb->quote($sDate) .
' where oxid=' . $oDb->quote($this->
getId());
1147 $this->_aVoucherList = $oBasket->getVouchers();
1149 if (is_array($this->_aVoucherList)) {
1150 foreach ($this->_aVoucherList as $sVoucherId => $oSimpleVoucher) {
1151 $oVoucher =
oxNew(
'oxvoucher');
1152 $oVoucher->load($sVoucherId);
1153 $oVoucher->markAsUsed($this->oxorder__oxid->value, $oUser->oxuser__oxid->value, $oSimpleVoucher->dVoucherdiscount);
1155 $this->_aVoucherList[$sVoucherId] = $oVoucher;
1167 if (($blSave = parent::save())) {
1171 if ($oOrderArticles && count($oOrderArticles) > 0) {
1172 foreach ($oOrderArticles as $oOrderArticle) {
1173 $oOrderArticle->save();
1193 if ($soxAddressId) {
1194 $oDelAdress =
oxNew(
'oxaddress');
1195 $oDelAdress->load($soxAddressId);
1198 if ($oDelAdress->oxaddress__oxcountryid->value && $oDelAdress->oxaddress__oxcountryid->value != -1) {
1199 $oCountry =
oxNew(
'oxcountry');
1200 $oCountry->load($oDelAdress->oxaddress__oxcountryid->value);
1201 $oDelAdress->oxaddress__oxcountry = clone $oCountry->oxcountry__oxtitle;
1218 foreach ($oBasket->getContents() as $key => $oContent) {
1220 $oProd = $oContent->getArticle(
true, null,
true);
1222 $oBasket->removeItem($key);
1225 $oBasket->removeItem($key);
1230 $dArtStockAmount = $oBasket->getArtStockInBasket($oProd->getId(), $key);
1231 $iOnStock = $oProd->checkForStock($oContent->getAmount(), $dArtStockAmount);
1232 if ($iOnStock !==
true) {
1234 $oEx =
oxNew(
'oxOutOfStockException');
1235 $oEx->
setMessage(
'ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK');
1236 $oEx->
setArticleNr($oProd->oxarticles__oxartnum->value);
1238 $oEx->setBasketIndex($key);
1240 if (!is_numeric($iOnStock)) {
1243 $oEx->setRemainingAmount($iOnStock);
1260 if (!$this->oxorder__oxorderdate->value) {
1261 $this->oxorder__oxorderdate =
new oxField(date(
'Y-m-d H:i:s', $oUtilsDate->getTime()),
oxField::T_RAW);
1263 $this->oxorder__oxorderdate =
new oxField($oUtilsDate->formatDBDate($this->oxorder__oxorderdate->value,
true));
1267 $this->oxorder__oxsenddate =
new oxField($oUtilsDate->formatDBDate($this->oxorder__oxsenddate->value,
true));
1283 return $sCounterIdent;
1297 $sQ =
"update oxorder set oxordernr = ? where oxid = ?";
1298 $blUpdate = ( bool ) $oDb->execute($sQ, array($iCnt, $this->
getId()));
1301 $this->oxorder__oxordernr =
new oxField($iCnt);
1314 $this->_aSkipSaveFields = array(
'oxtimestamp',
'oxorderdate');
1315 $this->oxorder__oxsenddate =
new oxField(
oxRegistry::get(
"oxUtilsDate")->formatDBDate($this->oxorder__oxsenddate->value,
true));
1328 public function delete($sOxId = null)
1331 if (!$this->
load($sOxId)) {
1335 } elseif (!$sOxId) {
1336 $sOxId = $this->
getId();
1347 foreach ($oOrderArticles as $oOrderArticle) {
1348 $oOrderArticle->delete();
1353 $oPaymentType->delete();
1382 $oBasket->calculateBasket(
true);
1398 if (defined(
'OXID_PHP_UNIT')) {
1415 $this->_oOrderBasket =
oxNew(
"oxBasket");
1416 $this->_oOrderBasket->enableSaveToDataBase(
false);
1419 $this->_oOrderBasket->setCalculationModeNetto($this->
isNettoMode());
1422 $this->_oOrderBasket->setStockCheckMode($blStockCheck);
1425 $this->_oOrderBasket->setBasketUser($this->
getOrderUser());
1428 $this->_oOrderBasket->setOrderId($this->
getId());
1431 $aCurrencies = $this->
getConfig()->getCurrencyArray();
1432 foreach ($aCurrencies as $oCur) {
1433 if ($oCur->name == $this->oxorder__oxcurrency->value) {
1434 $oBasketCur = $oCur;
1440 $this->_oOrderBasket->setBasketCurrency($oBasketCur);
1443 $this->_oOrderBasket->setCardId($this->oxorder__oxcardid->value);
1444 $this->_oOrderBasket->setCardMessage($this->oxorder__oxcardtext->value);
1446 if ($this->_blReloadDiscount) {
1449 $this->_oOrderBasket->setSkipVouchersChecking(
true);
1452 $sQ =
'select oxid from oxvouchers where oxorderid = ' . $oDb->quote($this->
getId());
1453 $aVouchers = $oDb->getAll($sQ);
1454 foreach ($aVouchers as $aVoucher) {
1455 $this->_oOrderBasket->addVoucher($aVoucher[
'oxid']);
1458 $this->_oOrderBasket->setDiscountCalcMode(
false);
1459 $this->_oOrderBasket->setVoucherDiscount($this->oxorder__oxvoucherdiscount->value);
1460 $this->_oOrderBasket->setTotalDiscount($this->oxorder__oxdiscount->value);
1464 if (!$this->_blReloadDelivery) {
1468 $this->_oOrderBasket->setShipping($this->oxorder__oxdeltype->value);
1469 $this->_oOrderBasket->setDeliveryPrice(null);
1473 $this->_oOrderBasket->setPayment($this->oxorder__oxpaymenttype->value);
1487 $this->oxorder__oxdeltype =
new oxField($sDeliveryId);
1497 if ($this->_oUser === null) {
1498 $this->_oUser =
oxNew(
"oxuser");
1499 $this->_oUser->load($this->oxorder__oxuserid->value);
1502 if ($this->_isLoaded) {
1504 $this->_oUser->oxuser__oxcompany = clone $this->oxorder__oxbillcompany;
1505 $this->_oUser->oxuser__oxusername = clone $this->oxorder__oxbillemail;
1506 $this->_oUser->oxuser__oxfname = clone $this->oxorder__oxbillfname;
1507 $this->_oUser->oxuser__oxlname = clone $this->oxorder__oxbilllname;
1508 $this->_oUser->oxuser__oxstreet = clone $this->oxorder__oxbillstreet;
1509 $this->_oUser->oxuser__oxstreetnr = clone $this->oxorder__oxbillstreetnr;
1510 $this->_oUser->oxuser__oxaddinfo = clone $this->oxorder__oxbilladdinfo;
1511 $this->_oUser->oxuser__oxustid = clone $this->oxorder__oxbillustid;
1514 $this->_oUser->oxuser__oxcity = clone $this->oxorder__oxbillcity;
1515 $this->_oUser->oxuser__oxcountryid = clone $this->oxorder__oxbillcountryid;
1516 $this->_oUser->oxuser__oxstateid = clone $this->oxorder__oxbillstateid;
1517 $this->_oUser->oxuser__oxzip = clone $this->oxorder__oxbillzip;
1518 $this->_oUser->oxuser__oxfon = clone $this->oxorder__oxbillfon;
1519 $this->_oUser->oxuser__oxfax = clone $this->oxorder__oxbillfax;
1520 $this->_oUser->oxuser__oxsal = clone $this->oxorder__oxbillsal;
1560 public function genPdf($sFilename, $iSelLang = 0)
1571 $sQ =
'select max(oxorder.oxinvoicenr) from oxorder where oxorder.oxshopid = "' . $this->
getConfig()->getShopId() .
'" ';
1573 return ((
int )
oxDb::getDb()->getOne($sQ,
false) + 1);
1583 $sQ =
'select max(cast(oxorder.oxbillnr as unsigned)) from oxorder where oxorder.oxshopid = "' . $this->
getConfig()->getShopId() .
'" ';
1585 return ((
int )
oxDb::getDb()->getOne($sQ,
false) + 1);
1596 if (!($sShipId = $this->oxorder__oxdelcountryid->value)) {
1597 $sShipId = $this->oxorder__oxbillcountryid->value;
1604 foreach ($oOrderArticles as $sItemId => $oItem) {
1605 if ($oItem->isBundle()) {
1606 $oOrderArticles->offsetUnset($sItemId);
1614 $oBasket->calculateBasket(
true);
1617 $oDeliveryList =
oxNew(
"oxDeliveryList",
"core");
1618 $oDeliveryList->setCollectFittingDeliveriesSets(
true);
1620 return $oDeliveryList->getDeliveryList($oBasket, $this->
getOrderUser(), $sShipId);
1631 $aVouchers = array();
1632 $sSelect =
"select oxvouchernr from oxvouchers where oxorderid = " . $oDb->quote($this->oxorder__oxid->value);
1633 $rs = $oDb->select($sSelect);
1634 if ($rs !=
false && $rs->recordCount() > 0) {
1636 $aVouchers[] = $rs->fields[
'oxvouchernr'];
1653 $sSelect =
'select sum(oxtotalordersum / oxcurrate) from oxorder where ';
1654 $sSelect .=
'oxshopid = "' . $this->
getConfig()->getShopId() .
'" and oxorder.oxstorno != "1" ';
1657 $sSelect .=
'and oxorderdate like "' . date(
'Y-m-d') .
'%" ';
1660 return (
double )
oxDb::getDb()->getOne($sSelect,
false,
false);
1672 $sSelect =
'select count(*) from oxorder where ';
1673 $sSelect .=
'oxshopid = "' . $this->
getConfig()->getShopId() .
'" and oxorder.oxstorno != "1" ';
1676 $sSelect .=
'and oxorderdate like "' . date(
'Y-m-d') .
'%" ';
1679 return (
int )
oxDb::getDb()->getOne($sSelect,
false,
false);
1697 if ($oDb->getOne(
'select oxid from oxorder where oxid = ' . $oDb->quote($sOxId),
false,
false)) {
1718 $this->_oUser = $oUser;
1719 $this->_oBasket = $oBasket;
1720 $this->_oPayment = $oPayment;
1722 $oxEmail =
oxNew(
'oxemail');
1725 if ($oxEmail->sendOrderEMailToUser($this)) {
1731 $oxEmail->sendOrderEMailToOwner($this);
1773 if ($this->_oDelSet == null) {
1775 $this->_oDelSet =
oxNew(
'oxdeliveryset');
1776 $this->_oDelSet->load($this->oxorder__oxdeltype->value);
1789 if ($this->oxorder__oxpaymentid->value && $this->_oPaymentType === null) {
1790 $this->_oPaymentType =
false;
1791 $oPaymentType =
oxNew(
'oxuserpayment');
1792 if ($oPaymentType->load($this->oxorder__oxpaymentid->value)) {
1793 $this->_oPaymentType = $oPaymentType;
1807 if ($this->oxorder__oxcardid->value && $this->_oGiftCard == null) {
1808 $this->_oGiftCard =
oxNew(
'oxwrapping');
1809 $this->_oGiftCard->load($this->oxorder__oxcardid->value);
1822 $this->_blSeparateNumbering = $blSeparateNumbering;
1835 $sQ =
'select oxorder.oxpaymenttype from oxorder where oxorder.oxshopid="' . $this->
getConfig()->getShopId() .
'" and oxorder.oxuserid=' . $oDb->quote($sUserId) .
' order by oxorder.oxorderdate desc ';
1836 $sLastPaymentId = $oDb->getOne($sQ,
false,
false);
1838 return $sLastPaymentId;
1850 if (count($aOrderArticles) > 0) {
1853 foreach ($aOrderArticles as $oOrderArticle) {
1854 $oBasket->addOrderArticleToBasket($oOrderArticle);
1868 if (count($aArticles) > 0) {
1871 foreach ($aArticles as $oArticle) {
1872 $aSel = isset($oArticle->oxorderarticles__oxselvariant) ? $oArticle->oxorderarticles__oxselvariant->value : null;
1873 $aPersParam = isset($oArticle->oxorderarticles__oxpersparam) ? $oArticle->getPersParams() : null;
1874 $oBasket->addToBasket(
1875 $oArticle->oxorderarticles__oxartid->value,
1876 $oArticle->oxorderarticles__oxamount->value,
1890 $oCur = $this->
getConfig()->getActShopCurrencyObject();
1892 return number_format((
double) $this->oxorder__oxtotalordersum->value, $oCur->decimal,
'.',
'');
1905 if ($this->oxorder__oxartvat1->value) {
1906 $aVats[$this->oxorder__oxartvat1->value] = $this->oxorder__oxartvatprice1->value;
1908 if ($this->oxorder__oxartvat2->value) {
1909 $aVats[$this->oxorder__oxartvat2->value] = $this->oxorder__oxartvatprice2->value;
1912 if ($blFormatCurrency) {
1914 $oCur = $this->
getConfig()->getActShopCurrencyObject();
1915 foreach ($aVats as $sKey => $dVat) {
1916 $aVats[$sKey] = $oLang->formatCurrency($dVat, $oCur);
1930 if (!$this->oxorder__oxbillcountry->value) {
1934 return $this->oxorder__oxbillcountry;
1944 if (!$this->oxorder__oxdelcountry->value) {
1948 return $this->oxorder__oxdelcountry;
1958 $this->_blReloadDelivery = $blReload;
1968 $this->_blReloadDiscount = $blReload;
1976 $this->oxorder__oxstorno =
new oxField(1);
1977 if ($this->
save()) {
1984 $oOrderArticle->cancelOrderArticle();
1997 if ($this->_oOrderCurrency === null) {
2000 $aCurrencies = $this->
getConfig()->getCurrencyArray();
2001 $this->_oOrderCurrency = current($aCurrencies);
2003 foreach ($aCurrencies as $oCurr) {
2004 if ($oCurr->name == $this->oxorder__oxcurrency->value) {
2005 $this->_oOrderCurrency = $oCurr;
2028 if (!$iValidState) {
2033 if (!$iValidState) {
2038 if (!$iValidState) {
2043 if (!$iValidState) {
2048 return $iValidState;
2060 return $oBasket->isBelowMinOrderPrice() ? self::ORDER_STATE_BELOWMINPRICE : null;
2073 $sDelAddressMD5 = $this->
getConfig()->getRequestParameter(
'sDeliveryAddressMD5');
2075 $sDeliveryAddress = $oUser->getEncodedDeliveryAddress();
2078 $oRequiredAddressFields =
oxNew(
'oxRequiredAddressFields');
2081 $oFieldsValidator =
oxNew(
'oxRequiredFieldsValidator');
2082 $oFieldsValidator->setRequiredFields($oRequiredAddressFields->getBillingFields());
2083 $blFieldsValid = $oFieldsValidator->validateFields($oUser);
2087 if ($blFieldsValid && $oDeliveryAddress) {
2088 $sDeliveryAddress .= $oDeliveryAddress->getEncodedDeliveryAddress();
2090 $oFieldsValidator->setRequiredFields($oRequiredAddressFields->getDeliveryFields());
2091 $blFieldsValid = $oFieldsValidator->validateFields($oDeliveryAddress);
2095 if ($sDelAddressMD5 != $sDeliveryAddress || !$blFieldsValid) {
2115 if ($oBasket->getPaymentId() ==
'oxempty') {
2120 $oDelSet =
oxNew(
"oxdeliveryset");
2121 $sTable = $oDelSet->getViewName();
2123 $sQ =
"select 1 from {$sTable} where {$sTable}.oxid=" .
2124 $oDb->quote($oBasket->getShippingId()) .
" and " . $oDelSet->getSqlActiveSnippet();
2126 if (!$oDb->getOne($sQ,
false,
false)) {
2144 $oPayment =
oxNew(
"oxpayment");
2145 $sTable = $oPayment->getViewName();
2147 $sQ =
"select 1 from {$sTable} where {$sTable}.oxid=" .
2148 $oDb->quote($oBasket->getPaymentId()) .
" and " . $oPayment->getSqlActiveSnippet();
2150 if (!$oDb->getOne($sQ,
false,
false)) {
2163 if (($oTsProtectionCost = $oBasket->
getCosts(
'oxtsprotection'))) {
2164 $this->oxorder__oxtsprotectcosts =
new oxField($oTsProtectionCost->getBruttoPrice(),
oxField::T_RAW);
2180 $aValues[
'tsProductId'] = $this->oxorder__oxtsprotectid->value;
2182 $oCur = $this->
getConfig()->getActShopCurrencyObject();
2183 $aValues[
'currency'] = $oCur->name;
2184 $aValues[
'buyerEmail'] = $this->oxorder__oxbillemail->value;
2185 $aValues[
'shopCustomerID'] = $this->oxorder__oxuserid->value;
2186 $aValues[
'shopOrderID'] = $this->oxorder__oxordernr->value;
2187 $aValues[
'orderDate'] = $this->oxorder__oxorderdate->value;
2191 $oTsProtection =
oxNew(
'oxtsprotection');
2192 $oTsProtection->requestForTsProtection($aValues, $sPaymentId);
2204 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxtotalnetsum->value, $this->getOrderCurrency());
2214 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxtotalbrutsum->value, $this->getOrderCurrency());
2224 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxdelcost->value, $this->getOrderCurrency());
2246 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxpaycost->value, $this->getOrderCurrency());
2256 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxwrapcost->value, $this->getOrderCurrency());
2266 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxgiftcardcost->value, $this->getOrderCurrency());
2276 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxvoucherdiscount->value, $this->getOrderCurrency());
2286 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxdiscount->value, $this->getOrderCurrency());
2296 return oxRegistry::getLang()->formatCurrency($this->oxorder__oxtotalordersum->value, $this->getOrderCurrency());
2306 return $this->oxorder__oxtrackcode->value;
2317 if ($this->_sShipTrackUrl === null) {
2318 $sParcelService = $oConfig->getConfigParam(
'sParcelService');
2320 if ($sParcelService && $sTrackingCode) {
2321 $this->_sShipTrackUrl = str_replace(
"##ID##", $sTrackingCode, $sParcelService);