103         $this->
init( 
'oxdelivery' );
 
  116         $this->_blDelVatOnTop = $blOnTop;
 
  126         if ( $this->_aArtIds !== null ) {
 
  131         $sQ = 
"select oxobjectid from oxobject2delivery where oxdeliveryid=".$oDb->quote($this->
getId()).
" and oxtype = 'oxarticles'";
 
  132         $aArtIds = $oDb->getAll( $sQ );
 
  135         foreach ( $aArtIds as $aItem ) {
 
  136             $this->_aArtIds[] = $aItem[0];
 
  150         if ( $this->_aCatIds !== null ) {
 
  155         $sQ = 
"select oxobjectid from oxobject2delivery where oxdeliveryid=".$oDb->quote($this->
getId()).
" and oxtype = 'oxcategories'";
 
  156         $aCatIds = $oDb->getAll( $sQ );
 
  159         foreach ( $aCatIds AS $aItem ) {
 
  160             $this->_aCatIds[] = $aItem[0];
 
  196         $oProduct = $oBasketItem->getArticle( 
false );
 
  198         $blExclNonMaterial = $this->
getConfig()->getConfigParam( 
'blExclNonMaterialFromDelivery' );
 
  201         if ( $oProduct->oxarticles__oxfreeshipping->value || ($oProduct->oxarticles__oxnonmaterial->value && $blExclNonMaterial) ) {
 
  202             if ($this->_blFreeShipping !== 
false) {
 
  203                 $this->_blFreeShipping = 
true;
 
  207             $this->_blFreeShipping = 
false;
 
  209             switch ( $this->oxdelivery__oxdeltype->value ) {
 
  211                     if ( $this->oxdelivery__oxfixed->value == 2 ) {
 
  212                         $dAmount += $oProduct->getPrice()->getPrice();
 
  214                         $dAmount += $oBasketItem->getPrice()->getPrice(); 
 
  218                     if ( $this->oxdelivery__oxfixed->value == 2 ) {
 
  219                         $dAmount += $oProduct->oxarticles__oxweight->value;
 
  221                         $dAmount += $oBasketItem->getWeight();
 
  225                     $dAmount += $oProduct->oxarticles__oxlength->value *
 
  226                                 $oProduct->oxarticles__oxwidth->value *
 
  227                                 $oProduct->oxarticles__oxheight->value;
 
  228                     if ( $this->oxdelivery__oxfixed->value < 2 ) {
 
  229                         $dAmount *= $oBasketItem->getAmount();
 
  233                     $dAmount += $oBasketItem->getAmount();
 
  237             if ( $oBasketItem->getPrice() ) {
 
  238                 $this->_dPrice   += $oBasketItem->getPrice()->getPrice();
 
  254         $this->_oPrice = $oPrice;
 
  266         if ( $this->_oPrice === null ) {
 
  268             $this->_oPrice = 
oxNew( 
'oxPrice' );
 
  270             if ( !$this->_blDelVatOnTop ) {
 
  271                 $this->_oPrice->setBruttoPriceMode();
 
  273                 $this->_oPrice->setNettoPriceMode();
 
  276             $this->_oPrice->setVat( $dVat );
 
  279             if ( $this->_blFreeShipping ) {
 
  284             switch ( $this->oxdelivery__oxaddsumtype->value ) {
 
  289                     if ( $this->oxdelivery__oxfixed->value == 0 ) {
 
  292                     } elseif ( $this->oxdelivery__oxfixed->value == 1 ) {
 
  295                     } elseif ( $this->oxdelivery__oxfixed->value == 2 ) {
 
  300                     $oCur = $this->
getConfig()->getActShopCurrencyObject();
 
  301                     $this->_oPrice->add( $this->oxdelivery__oxaddsum->value * $oCur->rate );
 
  302                     $this->_oPrice->multiply( $dAmount );
 
  306                     $this->_oPrice->add( $this->_dPrice /100 * $this->oxdelivery__oxaddsum->value );
 
  322     public function delete( $sOXID = null )
 
  325             $sOXID = $this->
getId();
 
  333         $sQ = 
"delete from oxobject2delivery where oxobject2delivery.oxdeliveryid = ".$oDb->quote($sOXID);
 
  334         $oDb->execute( $sQ );
 
  353         $blForBasket = 
false;
 
  356         if ( $blHasCategories || $blHasArticles ) {
 
  362             foreach ( $oBasket->getContents() as $oContent ) {
 
  365                 $oArticle   = $oContent->getArticle(
false);
 
  366                 $sProductId = $oArticle->getProductId();
 
  367                 $sParentId  = $oArticle->getProductParentId();
 
  369                 if ( $blHasArticles && (in_array( $sProductId, $aDeliveryArticles ) || ( $sParentId && in_array( $sParentId, $aDeliveryArticles ) ) ) ) {
 
  372                     if ( $this->oxdelivery__oxfixed->value > 0 ) {
 
  378                         $iAmount += $iArtAmount;
 
  381                 } elseif ( $blHasCategories ) {
 
  383                     if ( isset( self::$_aProductList[$sProductId] ) ) {
 
  384                         $oProduct = self::$_aProductList[$sProductId];
 
  386                         $oProduct = 
oxNew( 
'oxArticle' );
 
  387                         $oProduct->setSkipAssign( 
true );
 
  389                         if ( !$oProduct->load( $sProductId ) ) {
 
  393                         $oProduct->setId($sProductId);
 
  394                         self::$_aProductList[$sProductId] = $oProduct;
 
  397                     foreach ( $aDeliveryCategories as $sCatId ) {
 
  399                         if ( $oProduct->inCategory( $sCatId ) ) {
 
  402                             if ( $this->oxdelivery__oxfixed->value > 0 ) {
 
  408                                 $iAmount += $iArtAmount;
 
  417             foreach ( $oBasket->getContents() as $oContent ) {
 
  419                 if ( $this->oxdelivery__oxfixed->value > 0 ) {
 
  425                     $iAmount += $iArtAmount;
 
  431         if ( !$blForBasket && $blUse && ( $this->
_checkDeliveryAmount($iAmount) || $this->_blFreeShipping ) ) {
 
  448             $this->_iItemCnt += $oContent->getAmount();
 
  449             $this->_iProdCnt += 1;
 
  464         switch ( $this->oxdelivery__oxdeltype->value ) {
 
  466                 $oCur = $this->
getConfig()->getActShopCurrencyObject();
 
  467                 $iAmount /= $oCur->rate;
 
  475         if ( $iAmount >= $this->oxdelivery__oxparam->value && $iAmount <= $this->oxdelivery__oxparamend->value ) {
 
  492         $sQ = 
"SELECT `oxid` FROM `" . 
getViewName( 
'oxdelivery' ) . 
"` WHERE  `oxtitle` = " . $oDb->quote( $sTitle );
 
  493         $sId = $oDb->getOne( $sQ );
 
  505         if ( $this->_aCountriesISO === null ) {
 
  507             $this->_aCountriesISO = array();
 
  508             $sSelect = 
'select oxcountry.oxisoalpha2 from oxcountry left join oxobject2delivery on oxobject2delivery.oxobjectid = oxcountry.oxid where oxobject2delivery.oxdeliveryid='.$oDb->quote( $this->
getId() ).
' and oxobject2delivery.oxtype = "oxcountry" ';
 
  509             $rs = $oDb->select( $sSelect );
 
  510             if ( $rs && $rs->recordCount()) {
 
  511                 while ( !$rs->EOF ) {
 
  512                     $this->_aCountriesISO[] = $rs->fields[0];