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;
388 foreach ($oBasket->getContents() as $oContent) {
396 $iAmount += $iArtAmount;
406 if (!$blForBasket && $blUse && ($this->
_checkDeliveryAmount($iAmount) || $this->_blFreeShipping)) {
425 $this->_iItemCnt += $oContent->getAmount();
426 $this->_iProdCnt += 1;
445 $oCur = $this->
getConfig()->getActShopCurrencyObject();
446 $iAmount /= $oCur->rate;
466 $sQ =
"SELECT `oxid` FROM `" .
getViewName(
'oxdelivery') .
"` WHERE `oxtitle` = " . $oDb->quote($sTitle);
467 $sId = $oDb->getOne($sQ);
479 if ($this->_aCountriesISO === null) {
482 $this->_aCountriesISO = array();
486 `oxcountry`.`oxisoalpha2`
488 LEFT JOIN `oxobject2delivery` ON `oxobject2delivery`.`oxobjectid` = `oxcountry`.`oxid`
489 WHERE `oxobject2delivery`.`oxdeliveryid` = " . $oDb->quote($this->
getId()) .
"
490 AND `oxobject2delivery`.`oxtype` = 'oxcountry'";
492 $rs = $oDb->getCol($sSelect);
493 $this->_aCountriesISO = $rs;
507 return $this->oxdelivery__oxdeltype->value;
517 return $this->oxdelivery__oxparam->value;
527 return $this->oxdelivery__oxparamend->value;
537 return $this->oxdelivery__oxfixed->value;
547 return $this->oxdelivery__oxaddsum->value;
557 return $this->oxdelivery__oxaddsumtype->value;
571 } elseif ($this->
getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_DIFFERENT_PRODUCT) {
588 $oCur = $this->
getConfig()->getActShopCurrencyObject();
591 $dPrice = $this->_dPrice / 100 * $this->
getAddSum();