Esempio n. 1
0
 /**
  * Checks if discount applies for article
  *
  * @param oxArticle $oArticle article object
  *
  * @return bool
  */
 public function isForArticle($oArticle)
 {
     // item discounts may only be applied for basket
     if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
         return false;
     }
     if ($this->oxdiscount__oxamount->value || $this->oxdiscount__oxprice->value) {
         return false;
     }
     if ($this->oxdiscount__oxpriceto->value && $this->oxdiscount__oxpriceto->value < $oArticle->getBasePrice()) {
         return false;
     }
     if ($this->isGlobalDiscount()) {
         return true;
     }
     $sArticleId = $oArticle->getProductId();
     if (!isset($this->_aHasArticleDiscounts[$sArticleId])) {
         $blResult = $this->_isArticleAssigned($oArticle) || $this->_isCategoriesAssigned($oArticle->getCategoryIds());
         $this->_aHasArticleDiscounts[$sArticleId] = $blResult;
     }
     return $this->_aHasArticleDiscounts[$sArticleId];
 }