src/ShopBundle/objects/db/TShopDiscount.class.php
public function AllowDiscountForArticle(TdbShopArticle $oArticle)
    {
        $bMayBeUsed = true;
        if ($oArticle->fieldExcludeFromDiscounts) {
            $bMayBeUsed = false;
        }

        // check article restrictions
        if ($bMayBeUsed) {
            $aArticleRestrictions = $this->GetFieldShopArticleWithInverseEmptySelectionLogicIdList();
            if (null === $aArticleRestrictions || (count($aArticleRestrictions) > 0 && !in_array($oArticle->id, $aArticleRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        // check category restrictions
        if ($bMayBeUsed) {
            $aCategoryRestrictions = $this->GetFieldShopCategoryWithInverseEmptySelectionLogicIdList();
            if (null === $aCategoryRestrictions || (count($aCategoryRestrictions) > 0 && !$oArticle->IsInCategory($aCategoryRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        return $bMayBeUsed;
    }
public function AllowDiscountForArticle(TdbShopArticle $oArticle)
    {
        $bMayBeUsed = true;
        if ($oArticle->fieldExcludeFromDiscounts) {
            $bMayBeUsed = false;
        }

        // check article restrictions
        if ($bMayBeUsed) {
            $aArticleRestrictions = $this->GetFieldShopArticleWithInverseEmptySelectionLogicIdList();
            if (null === $aArticleRestrictions || (count($aArticleRestrictions) > 0 && !in_array($oArticle->id, $aArticleRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        // check category restrictions
        if ($bMayBeUsed) {
            $aCategoryRestrictions = $this->GetFieldShopCategoryWithInverseEmptySelectionLogicIdList();
            if (null === $aCategoryRestrictions || (count($aCategoryRestrictions) > 0 && !$oArticle->IsInCategory($aCategoryRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        return $bMayBeUsed;
    }
public function AllowDiscountForArticle ( TdbShopArticle $ oArticle ) { $ bMayBeUsed = true ; if ( $ oArticle -> fieldExcludeFromDiscounts ) { $ bMayBeUsed = false ; } // check article restrictions if ( $ bMayBeUsed ) { $ aArticleRestrictions = $ this -> GetFieldShopArticleWithInverseEmptySelectionLogicIdList ( ) ; if ( null === $ aArticleRestrictions || ( count ( $ aArticleRestrictions ) > 0 && ! in_array ( $ oArticle -> id , $ aArticleRestrictions ) ) ) { $ bMayBeUsed = false ; } } // check category restrictions if ( $ bMayBeUsed ) { $ aCategoryRestrictions = $ this -> GetFieldShopCategoryWithInverseEmptySelectionLogicIdList ( ) ; if ( null === $ aCategoryRestrictions || ( count ( $ aCategoryRestrictions ) > 0 && ! $ oArticle -> IsInCategory ( $ aCategoryRestrictions ) ) ) { $ bMayBeUsed = false ; } } return $ bMayBeUsed ; }
return true if the discount may be used for the article.

@param TdbShopArticle $oArticle

@return bool
return true if the discount may be used for the article .