public function getTriggered(array $data, array $options)
    {
        $options['trigger_id'] = $this->trigger->getTriggered($data, $options);

        if (empty($options['trigger_id'])) {
            return array();
        }

        $coupons = 0;
        $results = array();

        foreach ((array) $this->getList($options) as $id => $rule) {

            if ($rule['code'] !== '') {
                $coupons++;
            }

            if ($coupons <= 1) {
                $results[$id] = $rule;
            }
        }

        // Coupons always go last
        uasort($results, function ($a) {
            return $a['code'] === '' ? -1 : 1;
        });

        return $results;
    }
public function getTriggered(array $data, array $options)
    {
        $options['trigger_id'] = $this->trigger->getTriggered($data, $options);

        if (empty($options['trigger_id'])) {
            return array();
        }

        $coupons = 0;
        $results = array();

        foreach ((array) $this->getList($options) as $id => $rule) {

            if ($rule['code'] !== '') {
                $coupons++;
            }

            if ($coupons <= 1) {
                $results[$id] = $rule;
            }
        }

        // Coupons always go last
        uasort($results, function ($a) {
            return $a['code'] === '' ? -1 : 1;
        });

        return $results;
    }
public function getTriggered ( array $ data , array $ options ) { $ options [ 'trigger_id' ] = $ this -> trigger -> getTriggered ( $ data , $ options ) ; if ( empty ( $ options [ 'trigger_id' ] ) ) { return array ( ) ; } $ coupons = 0 ; $ results = array ( ) ; foreach ( ( array ) $ this -> getList ( $ options ) as $ id => $ rule ) { if ( $ rule [ 'code' ] !== '' ) { $ coupons ++ ; } if ( $ coupons <= 1 ) { $ results [ $ id ] = $ rule ; } } // Coupons always go last uasort ( $ results , function ( $ a ) { return $ a [ 'code' ] === '' ? - 1 : 1 ; } ) ; return $ results ; }
Returns an array of triggered price rules
@param array $data
@param array $options
@return array
Returns an array of triggered price rules