public function GetValuePreviouslyUsed()
    {
        // we have to make sure that is value is accurate... so we will fetch it from database every time
        // performance should not be a big issue, since it only affects users that include a voucher in their basket
        $dValueUsed = 0;
        $query = "SELECT SUM(`value_used`) AS totalused
                  FROM `shop_voucher_use`
            INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id`
                 WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
                   AND `shop_order`.`canceled` = '0'
                 ";
        if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            if (null !== $aValue['totalused']) {
                $dValueUsed = $aValue['totalused'];
            }
        }

        return $dValueUsed;
    }