src/ShopBundle/objects/db/TShopDiscountList.class.php
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`')
    {
        static $aActiveDiscountList = array();
        $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder);
        $sKey = TCacheManager::GetKey($aKey);
        if (!array_key_exists($sKey, $aActiveDiscountList)) {
            $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s'));
            if (!empty($sOrder)) {
                $sOrder = "ORDER BY {$sOrder}";
            }
            if (is_null($sFilter)) {
                $sFilter = '';
            } else {
                $sFilter = " AND ({$sFilter})";
            }
            $query = "SELECT *
                    FROM `shop_discount`
                   WHERE `shop_discount`.`active` = '1'
                     AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00'))
                         {$sFilter}
                         {$sOrder}
                 ";
            $aActiveDiscountList[$sKey] = parent::GetList($query);
            $aActiveDiscountList[$sKey]->bAllowItemCache = true;
        } else {
            $aActiveDiscountList[$sKey]->GoToStart();
        }

        return $aActiveDiscountList[$sKey];
    }
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`')
    {
        static $aActiveDiscountList = array();
        $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder);
        $sKey = TCacheManager::GetKey($aKey);
        if (!array_key_exists($sKey, $aActiveDiscountList)) {
            $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s'));
            if (!empty($sOrder)) {
                $sOrder = "ORDER BY {$sOrder}";
            }
            if (is_null($sFilter)) {
                $sFilter = '';
            } else {
                $sFilter = " AND ({$sFilter})";
            }
            $query = "SELECT *
                    FROM `shop_discount`
                   WHERE `shop_discount`.`active` = '1'
                     AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00'))
                         {$sFilter}
                         {$sOrder}
                 ";
            $aActiveDiscountList[$sKey] = parent::GetList($query);
            $aActiveDiscountList[$sKey]->bAllowItemCache = true;
        } else {
            $aActiveDiscountList[$sKey]->GoToStart();
        }

        return $aActiveDiscountList[$sKey];
    }
public static function GetActiveDiscountList ( $ sFilter = null , $ sOrder = '`shop_discount`.`position`' ) { static $ aActiveDiscountList = array ( ) ; $ aKey = array ( 'sFilter' => $ sFilter , 'sOrder' => $ sOrder ) ; $ sKey = TCacheManager :: GetKey ( $ aKey ) ; if ( ! array_key_exists ( $ sKey , $ aActiveDiscountList ) ) { $ now = MySqlLegacySupport :: getInstance ( ) -> real_escape_string ( date ( 'Y-m-d H:i:s' ) ) ; if ( ! empty ( $ sOrder ) ) { $ sOrder = "ORDER BY {$sOrder}" ; } if ( is_null ( $ sFilter ) ) { $ sFilter = '' ; } else { $ sFilter = " AND ({$sFilter})" ; } $ query = "SELECT *
                    FROM `shop_discount`
                   WHERE `shop_discount`.`active` = '1'
                     AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00'))
                         {$sFilter}
                         {$sOrder}
                 " ; $ aActiveDiscountList [ $ sKey ] = parent :: GetList ( $ query ) ; $ aActiveDiscountList [ $ sKey ] -> bAllowItemCache = true ; } else { $ aActiveDiscountList [ $ sKey ] -> GoToStart ( ) ; } return $ aActiveDiscountList [ $ sKey ] ; }
return all discounts that are currently set to active.

@param string $sFilter
@param string $sOrder

@return TdbShopDiscountList
return all discounts that are currently set to active .