119 $this->
init(
'oxdelivery');
130 $this->_blDelVatOnTop = $blOnTop;
140 if (is_null($this->_aArtIds)) {
142 $sQ =
"select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->
getId()) .
" and oxtype = 'oxarticles'";
143 $aArtIds = $oDb->getCol($sQ);
144 $this->_aArtIds = $aArtIds;
157 if (is_null($this->_aCatIds)) {
159 $sQ =
"select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->
getId()) .
" and oxtype = 'oxcategories'";
160 $aCatIds = $oDb->getCol($sQ);
161 $this->_aCatIds = $aCatIds;
197 $oProduct = $oBasketItem->getArticle(
false);
199 if ($oProduct->isOrderArticle()) {
200 $oProduct = $oProduct->getArticle();
203 $blExclNonMaterial = $this->
getConfig()->getConfigParam(
'blExclNonMaterialFromDelivery');
206 if ($oProduct->oxarticles__oxfreeshipping->value || ($oProduct->oxarticles__oxnonmaterial->value && $blExclNonMaterial)) {
207 if ($this->_blFreeShipping !==
false) {
208 $this->_blFreeShipping =
true;
212 $this->_blFreeShipping =
false;
215 case self::CONDITION_TYPE_PRICE:
217 $dAmount += $oProduct->getPrice()->getPrice();
219 $dAmount += $oBasketItem->getPrice()->getPrice();
222 case self::CONDITION_TYPE_WEIGHT:
224 $dAmount += $oProduct->getWeight();
226 $dAmount += $oBasketItem->getWeight();
229 case self::CONDITION_TYPE_SIZE:
230 $dAmount += $oProduct->getSize();
232 $dAmount *= $oBasketItem->getAmount();
235 case self::CONDITION_TYPE_AMOUNT:
236 $dAmount += $oBasketItem->getAmount();
240 if ($oBasketItem->getPrice()) {
241 $this->_dPrice += $oBasketItem->getPrice()->getPrice();
255 $this->_oPrice = $oPrice;
267 if ($this->_oPrice === null) {
270 $oPrice =
oxNew(
'oxPrice');
271 $oPrice->setNettoMode($this->_blDelVatOnTop);
272 $oPrice->setVat($dVat);
275 if (!$this->_blFreeShipping) {
291 public function delete($sOxId = null)
294 $sOxId = $this->
getId();
302 $sQ =
"delete from `oxobject2delivery` where `oxobject2delivery`.`oxdeliveryid` = " . $oDb->quote($sOxId);
322 $blForBasket =
false;
325 if ($blHasCategories || $blHasArticles) {
331 foreach ($oBasket->getContents() as $oContent) {
334 $oArticle = $oContent->getArticle(
false);
335 $sProductId = $oArticle->getProductId();
336 $sParentId = $oArticle->getParentId();
338 if ($blHasArticles && (in_array($sProductId, $aDeliveryArticles) || ($sParentId && in_array($sParentId, $aDeliveryArticles)))) {
347 $iAmount += $iArtAmount;
350 } elseif ($blHasCategories) {
352 if (isset(self::$_aProductList[$sProductId])) {
353 $oProduct = self::$_aProductList[$sProductId];
355 $oProduct =
oxNew(
'oxArticle');
356 $oProduct->setSkipAssign(
true);
358 if (!$oProduct->load($sProductId)) {
362 $oProduct->setId($sProductId);
363 self::$_aProductList[$sProductId] = $oProduct;
366 foreach ($aDeliveryCategories as $sCatId) {
368 if ($oProduct->inCategory($sCatId)) {
377 $iAmount += $iArtAmount;
386 foreach ($oBasket->getContents() as $oContent) {
394 $iAmount += $iArtAmount;
404 if (!$blForBasket && $blUse && ($this->
_checkDeliveryAmount($iAmount) || $this->_blFreeShipping)) {
423 $this->_iItemCnt += $oContent->getAmount();
424 $this->_iProdCnt += 1;
443 $oCur = $this->
getConfig()->getActShopCurrencyObject();
444 $iAmount /= $oCur->rate;
464 $sQ =
"SELECT `oxid` FROM `" .
getViewName(
'oxdelivery') .
"` WHERE `oxtitle` = " . $oDb->quote($sTitle);
465 $sId = $oDb->getOne($sQ);
477 if ($this->_aCountriesISO === null) {
480 $this->_aCountriesISO = array();
484 `oxcountry`.`oxisoalpha2`
486 LEFT JOIN `oxobject2delivery` ON `oxobject2delivery`.`oxobjectid` = `oxcountry`.`oxid`
487 WHERE `oxobject2delivery`.`oxdeliveryid` = " . $oDb->quote($this->
getId()) .
"
488 AND `oxobject2delivery`.`oxtype` = 'oxcountry'";
490 $rs = $oDb->getCol($sSelect);
491 $this->_aCountriesISO = $rs;
505 return $this->oxdelivery__oxdeltype->value;
515 return $this->oxdelivery__oxparam->value;
525 return $this->oxdelivery__oxparamend->value;
535 return $this->oxdelivery__oxfixed->value;
545 return $this->oxdelivery__oxaddsum->value;
555 return $this->oxdelivery__oxaddsumtype->value;
569 } elseif ($this->
getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_DIFFERENT_PRODUCT) {
586 $oCur = $this->
getConfig()->getActShopCurrencyObject();
589 $dPrice = $this->_dPrice / 100 * $this->
getAddSum();