oxorder.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxOrder extends oxBase
00008 {
00014     protected $_aSkipSaveFields = array( 'oxorderdate' );
00015 
00021     protected $_oArticles = null;
00022 
00028     protected $_oDelSet   = null;
00029 
00035     protected $_oGiftCard = null;
00036 
00042     protected $_oPaymentType = null;
00043 
00049     protected $_oPayment = null;
00050 
00056     protected $_aVoucherList = null;
00057 
00063     protected $_oDelPrice = null;
00064 
00070     protected $_oUser = null;
00071 
00077     protected $_oBasket = null;
00078 
00084     protected $_oWrappingPrice = null;
00085 
00091     protected $_oPaymentPrice = null;
00092 
00098     protected $_sClassName = 'oxorder';
00099 
00105     protected $_blSeparateNumbering = null;
00106 
00112     protected $_iOrderLang = null;
00113 
00119     protected $_blReloadDelivery = true;
00120 
00126     protected $_blReloadDiscount = true;
00127 
00131     public function __construct()
00132     {
00133         parent::__construct();
00134         $this->init( 'oxorder' );
00135 
00136         // set usage of seperate orders numbering for different shops
00137         $this->setSeparateNumbering( $this->getConfig()->getConfigParam( 'blSeparateNumbering') );
00138 
00139     }
00140 
00148     public function __get( $sName )
00149     {
00150         if ( $sName == 'oDelSet' ) {
00151             return $this->getDelSet();
00152         }
00153 
00154         if ( $sName == 'oxorder__oxbillcountry' ) {
00155             return $this->getBillCountry();
00156         }
00157 
00158         if ( $sName == 'oxorder__oxdelcountry' ) {
00159             return $this->getDelCountry();
00160         }
00161     }
00162 
00170     public function assign( $dbRecord )
00171     {
00172 
00173         parent::assign( $dbRecord );
00174 
00175         $oUtilsDate = oxUtilsDate::getInstance();
00176 
00177         // convert date's to international format
00178         $this->oxorder__oxorderdate = new oxField( $oUtilsDate->formatDBDate( $this->oxorder__oxorderdate->value));
00179         $this->oxorder__oxsenddate  = new oxField( $oUtilsDate->formatDBDate( $this->oxorder__oxsenddate->value));
00180 
00181         //settting deprecated template variables
00182         $this->_setDeprecatedValues();
00183     }
00184 
00192     protected function _getCountryTitle( $sCountryId )
00193     {
00194         $sTitle = null;
00195         if ( $sCountryId && $sCountryId != '-1' ) {
00196             $oCountry = oxNew( 'oxcountry' );
00197             $oCountry->load( $sCountryId );
00198             $sTitle = $oCountry->oxcountry__oxtitle->value;
00199         }
00200 
00201         return $sTitle;
00202     }
00203 
00211     public function getOrderArticles( $blExcludeCanceled = false )
00212     {
00213         // checking set value
00214         if ( $this->_oArticles === null  ) {
00215             $blExcludeState = $blExcludeCanceled;
00216             $sTable = getViewName( "oxorderarticles" );
00217             $sSelect = "select {$sTable}.* from {$sTable}
00218                         where {$sTable}.oxorderid = '".$this->getId() . "'" .
00219                         ( $blExcludeCanceled ? " and {$sTable}.oxstorno != 1 ": " " ) ."
00220                         order by {$sTable}.oxartid";
00221 
00222             // order articles
00223             $oArticles = oxNew( 'oxlist' );
00224             $oArticles->init( 'oxorderarticle' );
00225             $oArticles->selectString( $sSelect );
00226 
00227             // is value was not set, just returning it
00228             return $oArticles;
00229         }
00230         return $this->_oArticles;
00231     }
00232 
00240     public function setOrderArticleList( $aOrderArticleList )
00241     {
00242         $this->_oArticles = $aOrderArticleList;
00243     }
00244 
00250     public function getOrderDeliveryPrice()
00251     {
00252         if ( $this->_oDelPrice != null ) {
00253             return $this->_oDelPrice;
00254         }
00255 
00256         $this->_oDelPrice = oxNew( 'oxprice' );
00257         $this->_oDelPrice->setBruttoPriceMode();
00258         $this->_oDelPrice->setPrice( $this->oxorder__oxdelcost->value, $this->oxorder__oxdelvat->value );
00259         return $this->_oDelPrice;
00260     }
00261 
00267     public function getOrderWrappingPrice()
00268     {
00269         if ( $this->_oWrappingPrice != null ) {
00270             return $this->_oWrappingPrice;
00271         }
00272 
00273         $this->_oWrappingPrice = oxNew( 'oxprice' );
00274         $this->_oWrappingPrice->setBruttoPriceMode();
00275         $this->_oWrappingPrice->setPrice( $this->oxorder__oxwrapcost->value, $this->oxorder__oxwrapvat->value );
00276         return $this->_oWrappingPrice;
00277     }
00278 
00284     public function getOrderPaymentPrice()
00285     {
00286         if ( $this->_oPaymentPrice != null ) {
00287             return $this->_oPaymentPrice;
00288         }
00289 
00290         $this->_oPaymentPrice = oxNew( 'oxprice' );
00291         $this->_oPaymentPrice->setBruttoPriceMode();
00292         $this->_oPaymentPrice->setPrice( $this->oxorder__oxpaycost->value, $this->oxorder__oxpayvat->value );
00293         return $this->_oPaymentPrice;
00294     }
00295 
00302     public function getOrderNetSum()
00303     {
00304         $dTotalNetSum = 0;
00305 
00306         $dTotalNetSum += $this->oxorder__oxtotalnetsum->value;
00307         $dTotalNetSum += $this->getOrderDeliveryPrice()->getNettoPrice();
00308         $dTotalNetSum += $this->getOrderWrappingPrice()->getNettoPrice();
00309         $dTotalNetSum += $this->getOrderPaymentPrice()->getNettoPrice();
00310 
00311         return $dTotalNetSum;
00312     }
00313 
00334     public function finalizeOrder( oxBasket $oBasket, $oUser, $blRecalculatingOrder = false )
00335     {
00336         // check if this order is already stored
00337         $sGetChallenge = oxSession::getVar( 'sess_challenge' );
00338         if ( $this->_checkOrderExist( $sGetChallenge ) ) {
00339             oxUtils::getInstance()->logger( 'BLOCKER' );
00340             // we might use this later, this means that somebody klicked like mad on order button
00341             return 3;
00342         }
00343 
00344         // if not recalculating order, use sess_challenge id, else leave old order id
00345         if ( !$blRecalculatingOrder ) {
00346             // use this ID
00347             $this->setId( $sGetChallenge );
00348         }
00349 
00350         // copies user info
00351         $this->_setUser( $oUser );
00352 
00353         // copies basket info
00354         $this->_loadFromBasket( $oBasket );
00355 
00356         // payment information
00357         $oUserPayment = $this->_setPayment( $oBasket->getPaymentId() );
00358 
00359         // set folder information, if order is new
00360         // #M575 in recalcualting order case folder must be the same as it was
00361         if ( !$blRecalculatingOrder ) {
00362             $this->_setFolder();
00363         }
00364 
00365         //saving all order data to DB
00366         $this->save();
00367 
00368         // executing payment (on failure deletes order and returns error code)
00369         // in case when recalcualting order, payment execution is skipped
00370         if ( !$blRecalculatingOrder ) {
00371             $blRet = $this->_executePayment( $oBasket, $oUserPayment );
00372             if ( $blRet !== true ) {
00373                 return $blRet;
00374             }
00375         }
00376 
00377         // deleting remark info only when order is finished
00378         oxSession::deleteVar( 'ordrem' );
00379 
00380         // updating order trans status (success status)
00381         $this->_setOrderStatus( 'OK' );
00382 
00383         // store orderid
00384         $oBasket->setOrderId( $this->getId() );
00385 
00386         // updating bought items stock
00387         $this->_updateStock();
00388 
00389         // updating wish lists
00390         $this->_updateWishlist( $oBasket->getContents(), $oUser );
00391 
00392         // updating users notice list
00393         $this->_updateNoticeList( $oBasket->getContents(), $oUser );
00394 
00395         // marking vouchers as used and sets them to $this->_aVoucherList (will be used in order email)
00396         // skipping this action in case of order recalculation
00397         if ( !$blRecalculatingOrder ) {
00398             $this->_markVouchers( $oBasket, $oUser );
00399         }
00400 
00401         // send order by email to shop owner and current user
00402         // skipping this action in case of order recalculation
00403         if ( !$blRecalculatingOrder ) {
00404             $iRet = $this->_sendOrderByEmail( $oUser, $oBasket, $oUserPayment );
00405         } else {
00406             $iRet = 1;
00407         }
00408 
00409         return $iRet;
00410     }
00411 
00419     protected function _setOrderStatus( $sStatus )
00420     {
00421         $sQ = 'update oxorder set oxtransstatus="'.$sStatus.'" where oxid="'.$this->getId().'" ';
00422         oxDb::getDb()->execute( $sQ );
00423     }
00424 
00435     protected function _loadFromBasket( oxBasket $oBasket )
00436     {
00437         $myConfig = $this->getConfig();
00438 
00439         // store IP Adress - default must be FALSE as it is illegal to store
00440         if ( $myConfig->getConfigParam( 'blStoreIPs' ) &&  $this->oxorder__oxip->value === null ) {
00441             $this->oxorder__oxip = new oxField(oxUtilsServer::getInstance()->getRemoteAddress(), oxField::T_RAW);
00442         }
00443 
00444         // copying main price info
00445         $this->oxorder__oxtotalnetsum   = new oxField(oxUtils::getInstance()->fRound($oBasket->getProductsPrice()->getNettoSum()), oxField::T_RAW);
00446         $this->oxorder__oxtotalbrutsum  = new oxField($oBasket->getProductsPrice()->getBruttoSum(), oxField::T_RAW);
00447         $this->oxorder__oxtotalordersum = new oxField($oBasket->getPrice()->getBruttoPrice(), oxField::T_RAW);
00448 
00449         // payment costs if available
00450         if ( ( $oPaymentCost = $oBasket->getCosts( 'oxpayment' ) ) ) {
00451             $this->oxorder__oxpaycost = new oxField($oPaymentCost->getBruttoPrice(), oxField::T_RAW);
00452             $this->oxorder__oxpayvat  = new oxField($oPaymentCost->getVAT(), oxField::T_RAW);
00453         }
00454 
00455         // delivery info
00456         if ( ( $oDeliveryCost = $oBasket->getCosts( 'oxdelivery' ) ) ) {
00457             $this->oxorder__oxdelcost = new oxField($oDeliveryCost->getBruttoPrice(), oxField::T_RAW);
00458             //V #M382: Save VAT, not VAT value for delivery costs
00459             $this->oxorder__oxdelvat  = new oxField($oDeliveryCost->getVAT(), oxField::T_RAW); //V #M382
00460             $this->oxorder__oxdeltype = new oxField($oBasket->getShippingId(), oxField::T_RAW);
00461         }
00462 
00463         // user remark
00464         if ( $this->oxorder__oxremark->value === null ) {
00465             $this->oxorder__oxremark = new oxField(oxSession::getVar( 'ordrem' ), oxField::T_RAW);
00466         }
00467 
00468         // currency
00469         $oCur = $myConfig->getActShopCurrencyObject();
00470         $this->oxorder__oxcurrency = new oxField($oCur->name);
00471         $this->oxorder__oxcurrate  = new oxField($oCur->rate, oxField::T_RAW);
00472 
00473         // store voucherdiscount
00474         if ( ( $oVoucherDiscount = $oBasket->getVoucherDiscount() ) ) {
00475             $this->oxorder__oxvoucherdiscount = new oxField($oVoucherDiscount->getBruttoPrice(), oxField::T_RAW);
00476         }
00477 
00478         // general discount
00479         $dDiscount = 0;
00480         $aDiscounts = $oBasket->getDiscounts();
00481         if ( count($aDiscounts) > 0 ) {
00482             foreach ($aDiscounts as $oDiscount) {
00483                 $dDiscount += $oDiscount->dDiscount;
00484             }
00485         }
00486         if ( $dDiscount ) {
00487             $this->oxorder__oxdiscount = new oxField($dDiscount, oxField::T_RAW);
00488         }
00489 
00490         //order language
00491         $this->oxorder__oxlang = new oxField( $this->getOrderLanguage() );
00492 
00493 
00494         // initial status - 'ERROR'
00495         $this->oxorder__oxtransstatus = new oxField('ERROR', oxField::T_RAW);
00496 
00497         // copies basket product info ...
00498         $this->_setOrderArticles( $oBasket->getContents() );
00499 
00500         // copies wrapping info
00501         $this->_setWrapping( $oBasket );
00502     }
00503 
00510     public function getOrderLanguage()
00511     {
00512         if ( $this->_iOrderLang === null ) {
00513             if ( isset( $this->oxorder__oxlang->value ) ) {
00514                 $this->_iOrderLang = oxLang::getInstance()->validateLanguage( $this->oxorder__oxlang->value );
00515             } else {
00516                 $this->_iOrderLang = oxLang::getInstance()->getBaseLanguage();
00517             }
00518         }
00519         return $this->_iOrderLang;
00520     }
00521 
00529     protected function _setUser( $oUser )
00530     {
00531 
00532         $this->oxorder__oxuserid        = new oxField($oUser->getId());
00533 
00534         // bill address
00535         $this->oxorder__oxbillcompany     = clone $oUser->oxuser__oxcompany;
00536         $this->oxorder__oxbillemail       = clone $oUser->oxuser__oxusername;
00537         $this->oxorder__oxbillfname       = clone $oUser->oxuser__oxfname;
00538         $this->oxorder__oxbilllname       = clone $oUser->oxuser__oxlname;
00539         $this->oxorder__oxbillstreet      = clone $oUser->oxuser__oxstreet;
00540         $this->oxorder__oxbillstreetnr    = clone $oUser->oxuser__oxstreetnr;
00541         $this->oxorder__oxbilladdinfo     = clone $oUser->oxuser__oxaddinfo;
00542         $this->oxorder__oxbillustid       = clone $oUser->oxuser__oxustid;
00543         $this->oxorder__oxbillcity        = clone $oUser->oxuser__oxcity;
00544         $this->oxorder__oxbillcountryid   = clone $oUser->oxuser__oxcountryid;
00545         $this->oxorder__oxbillzip         = clone $oUser->oxuser__oxzip;
00546         $this->oxorder__oxbillfon         = clone $oUser->oxuser__oxfon;
00547         $this->oxorder__oxbillfax         = clone $oUser->oxuser__oxfax;
00548         $this->oxorder__oxbillsal         = clone $oUser->oxuser__oxsal;
00549 
00550 
00551         // delivery address
00552         if ( ( $oDelAdress = $this->getDelAddressInfo() ) ) {
00553             // set delivery address
00554             $this->oxorder__oxdelcompany   = clone $oDelAdress->oxaddress__oxcompany;
00555             $this->oxorder__oxdelfname     = clone $oDelAdress->oxaddress__oxfname;
00556             $this->oxorder__oxdellname     = clone $oDelAdress->oxaddress__oxlname;
00557             $this->oxorder__oxdelstreet    = clone $oDelAdress->oxaddress__oxstreet;
00558             $this->oxorder__oxdelstreetnr  = clone $oDelAdress->oxaddress__oxstreetnr;
00559             $this->oxorder__oxdeladdinfo   = clone $oDelAdress->oxaddress__oxaddinfo;
00560             $this->oxorder__oxdelcity      = clone $oDelAdress->oxaddress__oxcity;
00561             $this->oxorder__oxdelcountryid = clone $oDelAdress->oxaddress__oxcountryid;
00562             $this->oxorder__oxdelzip       = clone $oDelAdress->oxaddress__oxzip;
00563             $this->oxorder__oxdelfon       = clone $oDelAdress->oxaddress__oxfon;
00564             $this->oxorder__oxdelfax       = clone $oDelAdress->oxaddress__oxfax;
00565             $this->oxorder__oxdelsal       = clone $oDelAdress->oxaddress__oxsal;
00566         }
00567     }
00568 
00576     protected function _setWrapping( oxBasket $oBasket )
00577     {
00578         $myConfig = $this->getConfig();
00579 
00580         // wrapping price
00581         if ( ( $oWrappingCost = $oBasket->getCosts( 'oxwrapping' ) ) ) {
00582             $this->oxorder__oxwrapcost = new oxField($oWrappingCost->getBruttoPrice(), oxField::T_RAW);
00583 
00584             // wrapping VAT
00585             if ( $myConfig->getConfigParam( 'blCalcVatForWrapping' ) ) {
00586                 $this->oxorder__oxwrapvat = new oxField($oWrappingCost->getVAT(), oxField::T_RAW);
00587             }
00588         }
00589 
00590         // greetings card
00591         $this->oxorder__oxcardid = new oxField($oBasket->getCardId(), oxField::T_RAW);
00592 
00593         // card text will be stored in database
00594         $this->oxorder__oxcardtext = new oxField($oBasket->getCardMessage(), oxField::T_RAW);
00595     }
00596 
00605     protected function _setOrderArticles( $aArticleList )
00606     {
00607         // reset articles list
00608         $this->_oArticles = oxNew( 'oxlist' );
00609         $iCurrLang = $this->getOrderLanguage();
00610 
00611         // add all the products we have on basket to the order
00612         foreach ( $aArticleList as $oContent ) {
00613 
00614             //$oContent->oProduct = $oContent->getArticle();
00615             $oProduct = $oContent->getArticle();
00616 
00617             // copy only if object is oxarticle type
00618             if ( $oProduct->isOrderArticle() ) {
00619                 $oOrderArticle = $oProduct;
00620             } else {
00621 
00622                 // if order language doe not match product language - article must be reloaded in order language
00623                 if ( $iCurrLang != $oProduct->getLanguage() ) {
00624                     $oProduct->loadInLang( $iCurrLang, $oProduct->getProductId() );
00625                 }
00626 
00627                 // set chosen selectlist
00628                 $sSelList = '';
00629                 if ( count( $aChosenSelList = $oContent->getChosenSelList() ) ) {
00630                     foreach ( $aChosenSelList as $oItem ) {
00631                         if ( $sSelList ) {
00632                            $sSelList .= ", ";
00633                         }
00634                         $sSelList .= "{$oItem->name} : {$oItem->value}";
00635                     }
00636                 }
00637 
00638                 $oOrderArticle = oxNew( 'oxorderarticle' );
00639                 $oOrderArticle->setIsNewOrderItem( true );
00640                 $oOrderArticle->copyThis( $oProduct );
00641                 $oOrderArticle->setId();
00642 
00643                 $oOrderArticle->oxorderarticles__oxartnum     = clone $oProduct->oxarticles__oxartnum;
00644                 $oOrderArticle->oxorderarticles__oxselvariant = new oxField( trim( $sSelList.' '.$oProduct->oxarticles__oxvarselect->value ), oxField::T_RAW );
00645                 $oOrderArticle->oxorderarticles__oxshortdesc  = new oxField( $oProduct->oxarticles__oxshortdesc->value, oxField::T_RAW );
00646                 $oOrderArticle->oxorderarticles__oxtitle      = new oxField( trim( $oProduct->oxarticles__oxtitle->value.' '.$oOrderArticle->oxorderarticles__oxselvariant->value ), oxField::T_RAW );
00647 
00648                 // copying persistent parameters ...
00649                 if ( !is_array( $aPersParams = $oProduct->getPersParams() ) ) {
00650                     $aPersParams = $oContent->getPersParams();
00651                 }
00652                 if ( is_array( $aPersParams ) && count( $aPersParams )) {
00653                     $oOrderArticle->oxorderarticles__oxpersparam = new oxField( serialize( $aPersParams ), oxField::T_RAW );
00654                 }
00655             }
00656 
00657             // ids, titles, numbers ...
00658             $oOrderArticle->oxorderarticles__oxorderid = new oxField( $this->getId() );
00659             $oOrderArticle->oxorderarticles__oxartid   = new oxField( $oContent->getProductId() );
00660             $oOrderArticle->oxorderarticles__oxamount  = new oxField( $oContent->getAmount() );
00661 
00662             // prices
00663             $oPrice = $oContent->getPrice();
00664             $oOrderArticle->oxorderarticles__oxnetprice  = new oxField( $oPrice->getNettoPrice(), oxField::T_RAW );
00665             $oOrderArticle->oxorderarticles__oxvatprice  = new oxField( $oPrice->getVatValue(), oxField::T_RAW );
00666             $oOrderArticle->oxorderarticles__oxbrutprice = new oxField( $oPrice->getBruttoPrice(), oxField::T_RAW );
00667             $oOrderArticle->oxorderarticles__oxvat       = new oxField( $oPrice->getVat(), oxField::T_RAW );
00668 
00669             $oUnitPtice = $oContent->getUnitPrice();
00670             $oOrderArticle->oxorderarticles__oxnprice = new oxField( $oUnitPtice->getNettoPrice(), oxField::T_RAW );
00671             $oOrderArticle->oxorderarticles__oxbprice = new oxField( $oUnitPtice->getBruttoPrice(), oxField::T_RAW );
00672 
00673             // wrap id
00674             $oOrderArticle->oxorderarticles__oxwrapid = new oxField( $oContent->getWrappingId(), oxField::T_RAW );
00675 
00676             // items shop id
00677             $oOrderArticle->oxorderarticles__oxordershopid = new oxField( $oContent->getShopId(), oxField::T_RAW );
00678 
00679             // add information for eMail
00680             //P
00681             //TODO: check if this assign is needed at all
00682             $oOrderArticle->oProduct = $oProduct;
00683 
00684             // simulatin order article list
00685             $this->_oArticles->offsetSet( $oOrderArticle->getId(), $oOrderArticle );
00686         }
00687     }
00688 
00700     protected function _executePayment( oxBasket $oBasket, $oUserpayment )
00701     {
00702         $oPayTransaction = $this->_getGateway();
00703         $oPayTransaction->setPaymentParams( $oUserpayment );
00704 
00705         if ( !$oPayTransaction->executePayment( $oBasket->getPrice()->getBruttoPrice(), $this ) ) {
00706             $this->delete();
00707 
00708             // checking for error messages
00709             if ( method_exists( $oPayTransaction, 'getLastError' ) ) {
00710                 if ( ( $sLastError = $oPayTransaction->getLastError() ) ) {
00711                     return $sLastError;
00712                 }
00713             }
00714 
00715             // checking for error codes
00716             if ( method_exists( $oPayTransaction, 'getLastErrorNo' ) ) {
00717                 if ( ( $iLastErrorNo = $oPayTransaction->getLastErrorNo() ) ) {
00718                     return $iLastErrorNo;
00719                 }
00720             }
00721 
00722             return 2; // means no authentication
00723         }
00724         return true; // everything fine
00725     }
00726 
00733     protected function _getGateway()
00734     {
00735         return oxNew( 'oxPaymentGateway' );
00736     }
00737 
00745     protected function _setPayment( $sPaymentid )
00746     {
00747         // copying payment info fields
00748         $aDynvalue = oxSession::getVar( 'dynvalue' );
00749         $aDynvalue = $aDynvalue ? $aDynvalue : oxConfig::getParameter( 'dynvalue' );
00750 
00751         // loading payment object
00752         $oPayment = oxNew( 'oxpayment' );
00753 
00754         if (!$oPayment->load( $sPaymentid )) {
00755             return null;
00756         }
00757 
00758         // #756M Preserve already stored payment information
00759         if ( !$aDynvalue && ( $oUserpayment = $this->getPaymentType() ) ) {
00760             $aStoredDynvalue = $oUserpayment->getDynValues();
00761             foreach ( $aStoredDynvalue as $oVal ) {
00762                 $aDynvalue[$oVal->name] = $oVal->value;
00763             }
00764         }
00765 
00766         $oPayment->setDynValues( oxUtils::getInstance()->assignValuesFromText( $oPayment->oxpayments__oxvaldesc->value ) );
00767 
00768         // collecting dynamic values
00769         $aDynVal = array();
00770 
00771         $aPaymentDynValues = $oPayment->getDynValues();
00772         foreach ( $aPaymentDynValues  as $key => $oVal ) {
00773             if ( isset( $aDynvalue[$oVal->name] ) ) {
00774                 $oVal->value = $aDynvalue[$oVal->name];
00775             }
00776 
00777             //$oPayment->setDynValue($key, $oVal);
00778             $aPaymentDynValues[$key] = $oVal;
00779             $aDynVal[$oVal->name] = $oVal->value;
00780         }
00781 
00782         // Store this payment information, we might allow users later to
00783         // reactivate already give payment informations
00784 
00785         $oUserpayment = oxNew( 'oxuserpayment' );
00786         $oUserpayment->oxuserpayments__oxuserid     = clone $this->oxorder__oxuserid;
00787         $oUserpayment->oxuserpayments__oxpaymentsid = new oxField($sPaymentid, oxField::T_RAW);
00788         $oUserpayment->oxuserpayments__oxvalue      = new oxField(oxUtils::getInstance()->assignValuesToText( $aDynVal ), oxField::T_RAW);
00789         $oUserpayment->oxpayments__oxdesc           = clone $oPayment->oxpayments__oxdesc;
00790         $oUserpayment->setDynValues( $aPaymentDynValues );
00791         $oUserpayment->save();
00792 
00793         // storing payment information to order
00794         $this->oxorder__oxpaymentid   = new oxField($oUserpayment->getId(), oxField::T_RAW);
00795         $this->oxorder__oxpaymenttype = clone $oUserpayment->oxuserpayments__oxpaymentsid;
00796 
00797         // returning user payment object which will be used later in code ...
00798         return $oUserpayment;
00799     }
00800 
00806     protected function _setFolder()
00807     {
00808         $myConfig = $this->getConfig();
00809         $this->oxorder__oxfolder    = new oxField(key( $myConfig->getShopConfVar(  'aOrderfolder', $myConfig->getShopId() ) ), oxField::T_RAW);
00810     }
00811 
00821     protected function _updateWishlist( $aArticleList, $oUser )
00822     {
00823 
00824         foreach ( $aArticleList as $oContent) {
00825             if ( ( $sWishId = $oContent->getWishId() ) ) {
00826 
00827                 // checking which wishlist user uses ..
00828                 if ( $sWishId == $oUser->getId() ) {
00829                     $oUserBasket = $oUser->getBasket( 'wishlist' );
00830                 } else {
00831                     $aWhere = array( 'oxuserbaskets.oxuserid' => $sWishId, 'oxuserbaskets.oxtitle' => 'wishlist' );
00832                     $oUserBasket = oxNew( 'oxuserbasket' );
00833                     $oUserBasket->assignRecord( $oUserBasket->buildSelectString( $aWhere ) );
00834                 }
00835 
00836                 // updating users wish list
00837                 if ( $oUserBasket ) {
00838                     if ( !($sProdId = $oContent->getWishArticleId() )) {
00839                         $sProdId = $oContent->getProductId();
00840                     }
00841                     $oUserBasketItem = $oUserBasket->getItem( $sProdId, $oContent->getSelList() );
00842                     $dNewAmount = $oUserBasketItem->oxuserbasketitems__oxamount->value - $oContent->getAmount();
00843                     if ( $dNewAmount < 0) {
00844                         $dNewAmount = 0;
00845                     }
00846                     $oUserBasket->addItemToBasket( $sProdId, $dNewAmount, $oContent->getSelList(), true );
00847                 }
00848             }
00849         }
00850     }
00851 
00861     protected function _updateNoticeList( $aArticleList, $oUser )
00862     {
00863         // loading users notice list ..
00864         if ( $oUserBasket = $oUser->getBasket( 'noticelist' ) ) {
00865             // only if wishlist is enabled
00866             foreach ( $aArticleList as $oContent) {
00867                 $sProdId = $oContent->getProductId();
00868 
00869                 // updating users notice list
00870                 $oUserBasketItem = $oUserBasket->getItem( $sProdId, $oContent->getSelList() );
00871                 $dNewAmount = $oUserBasketItem->oxuserbasketitems__oxamount->value - $oContent->getAmount();
00872                 if ( $dNewAmount < 0) {
00873                     $dNewAmount = 0;
00874                 }
00875                 $oUserBasket->addItemToBasket( $sProdId, $dNewAmount, $oContent->getSelList(), true );
00876             }
00877         }
00878     }
00879 
00885     protected function _updateStock()
00886     {
00887         $myConfig = $this->getConfig();
00888 
00889         // ordered articles
00890         if ( $myConfig->getConfigParam( 'blUseStock' ) ) {
00891             $oOrderArticles = $this->getOrderArticles();
00892             foreach ( $oOrderArticles as $oOrderArticle ) {
00893                 if ( $oOrderArticle->isNewOrderItem() ) {
00894                     $oOrderArticle->updateArticleStock( $oOrderArticle->oxorderarticles__oxamount->value * (-1), $myConfig->getConfigParam( 'blAllowNegativeStock' ) );
00895                 }
00896             }
00897         }
00898     }
00899 
00911     protected function _markVouchers( $oBasket, $oUser )
00912     {
00913         $this->_aVoucherList = $oBasket->getVouchers();
00914 
00915         if ( is_array( $this->_aVoucherList ) ) {
00916             foreach ( array_keys( $this->_aVoucherList ) as $sVoucherId ) {
00917                 $oVoucher = oxNew( 'oxvoucher' );
00918                 $oVoucher->load( $sVoucherId );
00919                 $oVSerie = $oVoucher->getSerie();
00920                 $oVoucher->markAsUsed( $this->oxorder__oxid->value, $oUser->oxuser__oxid->value, $oVSerie->oxvoucherseries__oxdiscount );
00921 
00922                 // -- set deprecated values for email templates
00923                 $oVoucher->oxmodvouchers__oxvouchernr = $oVoucher->oxvouchers__oxvouchernr;
00924                 $oVoucher->oxmodvouchers__oxdiscount     = clone $oVSerie->oxvoucherseries__oxdiscount;
00925                 $oVoucher->oxmodvouchers__oxdiscounttype = clone $oVSerie->oxvoucherseries__oxdiscounttype;
00926                 // -- set deprecated values for email templates
00927 
00928                 $this->_aVoucherList[$sVoucherId] = $oVoucher;
00929             }
00930         }
00931     }
00932 
00938     public function save()
00939     {
00940         if ( ( $blSave = parent::save() ) ) {
00941 
00942             // saving order articles
00943             $oOrderArticles = $this->getOrderArticles();
00944             if ( $oOrderArticles && count( $oOrderArticles ) > 0 ) {
00945                 foreach ( $oOrderArticles as $oOrderArticle ) {
00946                     $oOrderArticle->save();
00947                 }
00948             }
00949         }
00950 
00951         return $blSave;
00952     }
00953 
00960     public function getDelAddressInfo()
00961     {
00962         $oDelAdress = null;
00963         if ( ( $soxAddressId = oxConfig::getParameter( 'deladrid' ) ) ) {
00964             $oDelAdress = oxNew( 'oxbase' );
00965             $oDelAdress->init( 'oxaddress' );
00966             $oDelAdress->load( $soxAddressId );
00967 
00968             //get delivery country name from delivery country id
00969             if ( $oDelAdress->oxaddress__oxcountryid->value && $oDelAdress->oxaddress__oxcountryid->value != -1 ) {
00970                  $oCountry = oxNew( 'oxcountry' );
00971                  $oCountry->load( $oDelAdress->oxaddress__oxcountryid->value );
00972                  $oDelAdress->oxaddress__oxcountry = clone $oCountry->oxcountry__oxtitle;
00973             }
00974         }
00975         return $oDelAdress;
00976     }
00977 
00988     public function validateStock( $oBasket )
00989     {
00990         foreach ( $oBasket->getContents() as $oContent ) {
00991             $oProd = $oContent->getArticle();
00992 
00993             // check if its still available
00994             $iOnStock = $oProd->checkForStock( $oContent->getAmount() );
00995             if ( $iOnStock !== true ) {
00996                 $oEx = oxNew( 'oxOutOfStockException' );
00997                 $oEx->setMessage( 'EXCEPTION_OUTOFSTOCK_OUTOFSTOCK' );
00998                 $oEx->setArticleNr( $oProd->oxarticles__oxartnum->value );
00999                 $oEx->setRemainingAmount( $oProd->oxarticles__oxstock->value );
01000                 throw $oEx;
01001             }
01002         }
01003     }
01004 
01010     protected function _insert()
01011     {
01012         $myConfig = $this->getConfig();
01013         $oUtilsDate = oxUtilsDate::getInstance();
01014 
01015         //V #M525 orderdate must be the same as it was
01016         if ( !$this->oxorder__oxorderdate->value ) {
01017             $this->oxorder__oxorderdate = new oxField(date( 'Y-m-d H:i:s', $oUtilsDate->getTime() ), oxField::T_RAW);
01018         } else {
01019             $this->oxorder__oxorderdate = new oxField( $oUtilsDate->formatDBDate( $this->oxorder__oxorderdate->value, true ));
01020         }
01021         $this->oxorder__oxshopid    = new oxField($myConfig->getShopId(), oxField::T_RAW);
01022 
01023         $this->oxorder__oxsenddate  = new oxField( $oUtilsDate->formatDBDate( $this->oxorder__oxsenddate->value, true ));
01024 
01025         if ( ( $blInsert = parent::_insert() ) ) {
01026             // setting order number
01027             if ( !$this->oxorder__oxordernr->value ) {
01028                 $aWhere = '';
01029                 // separate order numbers for shops ...
01030                 if ( $this->_blSeparateNumbering ) {
01031                     $aWhere = array( 'oxshopid = "'.$myConfig->getShopId().'"' );
01032                 }
01033                 $this->_setRecordNumber( 'oxordernr', $aWhere );
01034             }
01035         }
01036         return $blInsert;
01037     }
01038 
01044     protected function _update()
01045     {
01046         $this->oxorder__oxsenddate = new oxField(oxUtilsDate::getInstance()->formatDBDate( $this->oxorder__oxsenddate->value, true ));
01047         return parent::_update();
01048     }
01049 
01058     public function delete( $sOxId = null )
01059     {
01060         if ( $sOxId ) {
01061             if ( !$this->load( $sOxId ) ) {
01062                 // such order does not exist
01063                 return false;
01064             }
01065         } elseif ( !$sOxId ) {
01066             $sOxId = $this->getId();
01067         }
01068 
01069         // no order id is passed
01070         if ( !$sOxId ) {
01071             return false;
01072         }
01073 
01074 
01075         // update article stock information and delete order articles
01076         $myConfig = $this->getConfig();
01077         $blUseStock = $myConfig->getConfigParam( 'blUseStock' );
01078         $oOrderArticles = $this->getOrderArticles( $blUseStock );
01079         foreach ( $oOrderArticles as $oOrderArticle ) {
01080             if ( $blUseStock ) {
01081                 $oOrderArticle->updateArticleStock( $oOrderArticle->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock') );
01082             }
01083             $oOrderArticle->delete();
01084         }
01085 
01086         // #440 - deleting user payment info
01087         if ( $oPaymentType = $this->getPaymentType() ) {
01088             $oPaymentType->delete();
01089         }
01090 
01091         return parent::delete( $sOxId );
01092     }
01093 
01103     public function recalculateOrder( $aNewArticles = array() )
01104     {
01105         oxDb::startTransaction();
01106 
01107         try {
01108             $oBasket = $this->_getOrderBasket();
01109 
01110             // add this order articles to virtual basket and recalculates basket
01111             $this->_addOrderArticlesToBasket( $oBasket, $this->getOrderArticles( true ) );
01112 
01113             // adding new articles to existing order
01114             $this->_addArticlesToBasket( $oBasket, $aNewArticles );
01115 
01116             // recalculating basket
01117             $oBasket->calculateBasket( true );
01118 
01119             //finalizing order (skipping payment execution, vouchers marking and mail sending)
01120             $iRet = $this->finalizeOrder( $oBasket, $this->getOrderUser(), true );
01121 
01122             //if finalizing order failed, rollback transaction
01123             if ( $iRet !== 1 ) {
01124                 oxDb::rollbackTransaction();
01125             } else {
01126                 oxDb::commitTransaction();
01127             }
01128 
01129         } catch( Exception $oE ) {
01130             // if exception, rollBack everything
01131             oxDb::rollbackTransaction();
01132         }
01133     }
01134 
01135     protected $_oOrderBasket = null;
01143     protected function _getOrderBasket( $blStockCheck = true )
01144     {
01145         $this->_oOrderBasket = oxNew( "oxbasket" );
01146 
01147         // setting stock check mode
01148         $this->_oOrderBasket->setStockCheckMode( $blStockCheck );
01149 
01150         // setting virtual basket user
01151         $this->_oOrderBasket->setBasketUser( $this->getOrderUser() );
01152 
01153         // transferring order id
01154         $this->_oOrderBasket->setOrderId( $this->getId() );
01155 
01156         // setting basket currency order uses
01157         $aCurrencies = $this->getConfig()->getCurrencyArray();
01158         foreach ( $aCurrencies as $oCur ) {
01159             if ($oCur->name == $this->oxorder__oxcurrency->value) {
01160                 $oBasketCur = $oCur;
01161                 break;
01162             }
01163         }
01164 
01165         // setting currency
01166         $this->_oOrderBasket->setBasketCurrency( $oBasketCur );
01167 
01168         // set basket card id and message
01169         $this->_oOrderBasket->setCardId( $this->oxorder__oxcardid->value );
01170         $this->_oOrderBasket->setCardMessage( $this->oxorder__oxcardtext->value );
01171 
01172         if ( $this->_blReloadDiscount ) {
01173             // disabling availability check
01174             $this->_oOrderBasket->setSkipVouchersChecking( true );
01175 
01176             // add previously used vouchers
01177             $sQ = 'select oxid from oxvouchers where oxorderid = "'.$this->getId().'"';
01178             $aVouchers = oxDb::getDb( true )->getAll( $sQ );
01179             foreach ( $aVouchers as $aVoucher ) {
01180                 $this->_oOrderBasket->addVoucher( $aVoucher['oxid'] );
01181             }
01182         } else {
01183             $this->_oOrderBasket->setDiscountCalcMode( false );
01184             $this->_oOrderBasket->setVoucherDiscount( $this->oxorder__oxvoucherdiscount->value );
01185             $this->_oOrderBasket->setTotalDiscount( $this->oxorder__oxdiscount->value );
01186         }
01187 
01188         // must be kept old delivery?
01189         if ( !$this->_blReloadDelivery ) {
01190             $this->_oOrderBasket->setDeliveryPrice( $this->getOrderDeliveryPrice() );
01191         } else {
01192             //  set shipping
01193             $this->_oOrderBasket->setShipping( $this->oxorder__oxdeltype->value );
01194             $this->_oOrderBasket->setDeliveryPrice( null );
01195         }
01196 
01197         //set basket payment
01198         $this->_oOrderBasket->setPayment( $this->oxorder__oxpaymenttype->value );
01199 
01200         return $this->_oOrderBasket;
01201     }
01202 
01211     public function setDelivery( $sDeliveryId )
01212     {
01213         $this->reloadDelivery( true );
01214         $this->oxorder__oxdeltype = new oxField( $sDeliveryId );
01215     }
01216 
01222     public function getOrderUser()
01223     {
01224         if ($this->_oUser) {
01225             return $this->_oUser;
01226         }
01227         $this->_oUser = oxNew( "oxuser" );
01228         $this->_oUser->load( $this->oxorder__oxuserid->value );
01229 
01230         return $this->_oUser;
01231     }
01232 
01240     public function pdfFooter( $oPdf )
01241     {
01242     }
01243 
01251     public function pdfHeaderplus( $oPdf )
01252     {
01253     }
01254 
01262     public function pdfHeader( $oPdf )
01263     {
01264     }
01265 
01274     public function genPdf( $sFilename, $iSelLang = 0 )
01275     {
01276     }
01277 
01283     public function getInvoiceNum()
01284     {
01285         $sQ = 'select max(oxorder.oxinvoicenr) from oxorder where oxorder.oxshopid = "'.$this->getConfig()->getShopId().'" ';
01286         return ( ( int ) oxDb::getDb()->getOne( $sQ ) + 1 );
01287     }
01288 
01294     public function getNextBillNum()
01295     {
01296         $sQ = 'select max(cast(oxorder.oxbillnr as unsigned)) from oxorder where oxorder.oxshopid = "'.$this->getConfig()->getShopId().'" ';
01297         return ( ( int ) oxDb::getDb()->getOne( $sQ ) + 1 );
01298     }
01299 
01305     public function getShippingSetList()
01306     {
01307         // in which country we deliver
01308         if ( !( $sShipId = $this->oxorder__oxdelcountryid->value ) ) {
01309             $sShipId = $this->oxorder__oxbillcountryid->value;
01310         }
01311 
01312         $oBasket = $this->_getOrderBasket( false );
01313 
01314         // add this order articles to basket and recalculate basket
01315         $this->_addOrderArticlesToBasket( $oBasket, $this->getOrderArticles() );
01316 
01317         // recalculating basket
01318         $oBasket->calculateBasket( true );
01319 
01320         // load fitting deliveries list
01321         $oDeliveryList = oxNew( "oxDeliveryList", "core" );
01322         $oDeliveryList->setCollectFittingDeliveriesSets( true );
01323 
01324         return $oDeliveryList->getDeliveryList( $oBasket, $this->getOrderUser(), $sShipId );
01325     }
01326 
01332     public function getVoucherNrList()
01333     {
01334         $oDB = oxDb::getDb( true );
01335         $aVouchers = array();
01336         $sSelect = "select oxvouchernr from oxvouchers where oxorderid = '".$this->oxorder__oxid->value."'";
01337         $rs = $oDB->execute( $sSelect);
01338         if ($rs != false && $rs->recordCount() > 0) {
01339             while (!$rs->EOF) {
01340                 $aVouchers[] = $rs->fields['oxvouchernr'];
01341                 $rs->moveNext();
01342             }
01343         }
01344         return $aVouchers;
01345     }
01346 
01354     public function getOrderSum( $blToday = false )
01355     {
01356         $sSelect  = 'select sum(oxtotalordersum / oxcurrate) from oxorder where ';
01357         $sSelect .= 'oxshopid = "'.$this->getConfig()->getShopId().'" and oxorder.oxstorno != "1" ';
01358 
01359         if ( $blToday ) {
01360             $sSelect .= 'and oxorderdate like "'.date( 'Y-m-d').'%" ';
01361         }
01362 
01363         return ( double ) oxDb::getDb()->getOne( $sSelect );
01364     }
01365 
01373     public function getOrderCnt( $blToday = false )
01374     {
01375         $sSelect  = 'select count(*) from oxorder where ';
01376         $sSelect .= 'oxshopid = "'.$this->getConfig()->getShopId().'"  and oxorder.oxstorno != "1" ';
01377 
01378         if ( $blToday ) {
01379             $sSelect .= 'and oxorderdate like "'.date( 'Y-m-d').'%" ';
01380         }
01381 
01382         return ( int ) oxDb::getDb()->getOne( $sSelect );
01383     }
01384 
01385 
01393     protected function _checkOrderExist( $sOxId = null )
01394     {
01395         if ( !$sOxId) {
01396             return false;
01397         }
01398 
01399         if ( oxDb::getDb()->getOne( 'select oxid from oxorder where oxid = "'.$sOxId.'"' ) ) {
01400             return true;
01401         }
01402 
01403         return false;
01404     }
01405 
01415     protected function _sendOrderByEmail( $oUser = null, $oBasket = null, $oPayment = null )
01416     {
01417         $iRet = 0;
01418 
01419         // add user, basket and payment to order
01420         $this->_oUser    = $oUser;
01421         $this->_oBasket  = $oBasket;
01422         $this->_oPayment = $oPayment;
01423 
01424         $oxEmail = oxNew( 'oxemail' );
01425 
01426         // send order email to user
01427         if ( $oxEmail->sendOrderEMailToUser( $this ) ) {
01428             // mail to user was successfully sent
01429             $iRet = 1;
01430         }
01431 
01432         // send order email to shop owner
01433         $oxEmail->sendOrderEMailToOwner( $this );
01434 
01435         return $iRet;
01436     }
01437 
01443     public function getBasket()
01444     {
01445         return $this->_oBasket;
01446     }
01447 
01453     public function getPayment()
01454     {
01455         return $this->_oPayment;
01456     }
01457 
01463     public function getVoucherList()
01464     {
01465         return $this->_aVoucherList;
01466     }
01467 
01473     public function getDelSet()
01474     {
01475         if ( $this->_oDelSet == null ) {
01476             // load deliveryset info
01477             $this->_oDelSet = oxNew( 'oxdeliveryset' );
01478             $this->_oDelSet->load( $this->oxorder__oxdeltype->value );
01479         }
01480 
01481         return $this->_oDelSet;
01482     }
01483 
01489     public function getPaymentType()
01490     {
01491         if ( $this->oxorder__oxpaymentid->value && $this->_oPaymentType === null ) {
01492             $this->_oPaymentType = false;
01493             $oPaymentType = oxNew( 'oxuserpayment' );
01494             if ( $oPaymentType->load( $this->oxorder__oxpaymentid->value ) ) {
01495                 $this->_oPaymentType = $oPaymentType;
01496             }
01497         }
01498 
01499         return $this->_oPaymentType;
01500     }
01501 
01507     public function getGiftCard()
01508     {
01509         if ( $this->oxorder__oxcardid->value && $this->_oGiftCard == null ) {
01510             $this->_oGiftCard = oxNew( 'oxwrapping' );
01511             $this->_oGiftCard->load( $this->oxorder__oxcardid->value );
01512         }
01513 
01514         return $this->_oGiftCard;
01515     }
01516 
01524     public function setSeparateNumbering( $blSeparateNumbering = null )
01525     {
01526         $this->_blSeparateNumbering = $blSeparateNumbering;
01527     }
01528 
01536     public function getLastUserPaymentType( $sUserId)
01537     {
01538         $sQ = 'select oxorder.oxpaymenttype from oxorder where oxorder.oxshopid="'.$this->getConfig()->getShopId().'" and oxorder.oxuserid="'.$sUserId.'" order by oxorder.oxorderdate desc ';
01539         $sLastPaymentId = oxDb::getDb()->getOne( $sQ );
01540         return $sLastPaymentId;
01541     }
01542 
01555     protected function _makeSelListArray( $sArtId = null, $sOrderArtSelList = null )
01556     {
01557         $oOrder = oxNew( 'oxorderArticle' );
01558         return $oOrder->getOrderArticleSelectList( $sArtId, $sOrderArtSelList );
01559     }
01560 
01569     protected function _addOrderArticlesToBasket( $oBasket, $aOrderArticles )
01570     {
01571         // if no order articles, return empty basket
01572         if ( count( $aOrderArticles ) > 0 ) {
01573 
01574             //adding order articles to basket
01575             foreach ( $aOrderArticles as $oOrderArticle ) {
01576                 $oBasket->addOrderArticleToBasket( $oOrderArticle );
01577             }
01578         }
01579     }
01580 
01587     protected function _addArticlesToBasket( $oBasket, $aArticles )
01588     {
01589         // if no order articles
01590         if ( count($aArticles ) > 0 ) {
01591 
01592             //adding order articles to basket
01593             foreach ( $aArticles as $oArticle ) {
01594                 $aSel = isset( $oArticle->oxorderarticles__oxselvariant ) ? $oArticle->oxorderarticles__oxselvariant->value : null;
01595                 $aPersParam = isset( $oArticle->oxorderarticles__oxpersparam ) ? $oArticle->getPersParams() : null;
01596                 $oBasket->addToBasket( $oArticle->oxorderarticles__oxartid->value,
01597                                        $oArticle->oxorderarticles__oxamount->value,
01598                                        $aSel, $aPersParam );
01599             }
01600         }
01601     }
01602 
01610     protected function _setDeprecatedValues()
01611     {
01612         if ( $this->oxorder__oxstorno->value != 1 ) {
01613             $oCur = $this->getConfig()->getActShopCurrencyObject();
01614             $oLang = oxLang::getInstance();
01615 
01616             $this->totalnetsum   = $this->oxorder__oxtotalnetsum->value;
01617             $this->totalbrutsum  = $this->oxorder__oxtotalbrutsum->value;
01618             $this->totalorder    = $this->oxorder__oxtotalordersum->value;
01619             $this->ftotalnetsum  = $oLang->formatCurrency( $this->oxorder__oxtotalnetsum->value, $oCur );
01620             $this->ftotalbrutsum = $oLang->formatCurrency( $this->oxorder__oxtotalbrutsum->value, $oCur );
01621             $this->fdelcost      = $oLang->formatCurrency( $this->oxorder__oxdelcost->value, $oCur );
01622             $this->fpaycost      = $oLang->formatCurrency( $this->oxorder__oxpaycost->value, $oCur );
01623             $this->fwrapcost     = $oLang->formatCurrency( $this->oxorder__oxwrapcost->value, $oCur );
01624             $this->ftotalorder   = $this->getTotalOrderSum();
01625             $this->totalvouchers = 0;
01626 
01627             if ( $this->oxorder__oxvoucherdiscount->value ) {
01628                 $this->totalvouchers  = $oLang->formatCurrency( $this->oxorder__oxvoucherdiscount->value, $oCur );
01629             }
01630 
01631             if ( $this->oxorder__oxdiscount->value ) {
01632                 $this->discount  = $this->oxorder__oxdiscount->value;
01633                 $this->fdiscount = $oLang->formatCurrency( $this->oxorder__oxdiscount->value, $oCur );
01634             }
01635         }
01636     }
01637 
01643     public function getTotalOrderSum()
01644     {
01645         $oCur = $this->getConfig()->getActShopCurrencyObject();
01646         return number_format( $this->oxorder__oxtotalordersum->value, $oCur->decimal, '.', '');
01647     }
01648 
01654     public function getBillCountry()
01655     {
01656         if ( !$this->oxorder__oxbillcountry->value ) {
01657             $this->oxorder__oxbillcountry = new oxField($this->_getCountryTitle( $this->oxorder__oxbillcountryid->value ));
01658         }
01659         return $this->oxorder__oxbillcountry;
01660     }
01661 
01667     public function getDelCountry()
01668     {
01669         if ( !$this->oxorder__oxdelcountry->value ) {
01670             $this->oxorder__oxdelcountry = new oxField($this->_getCountryTitle( $this->oxorder__oxdelcountryid->value ));
01671         }
01672         return $this->oxorder__oxdelcountry;
01673     }
01674 
01682     public function reloadDelivery( $blReload )
01683     {
01684         $this->_blReloadDelivery = $blReload;
01685     }
01686 
01694     public function reloadDiscount( $blReload )
01695     {
01696         $this->_blReloadDiscount = $blReload;
01697     }
01698 
01699 }

Generated on Tue Aug 18 09:21:06 2009 for OXID eShop CE by  doxygen 1.5.5