diff --git a/modules/blockuserinfo/blockuserinfo.php b/modules/blockuserinfo/blockuserinfo.php index c8cb169a..fa7e204a 100755 --- a/modules/blockuserinfo/blockuserinfo.php +++ b/modules/blockuserinfo/blockuserinfo.php @@ -31,6 +31,7 @@ if (!defined('_PS_VERSION_')) class BlockUserInfo extends Module { private $useTopUpper = true; + private $disableCredits = true; public function __construct() { @@ -72,15 +73,18 @@ class BlockUserInfo extends Module return; } - $display_credits = true; - $sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer; - if(Db::getInstance()->getValue($sql)){ - $display_credits = false; + $display_credits = false; + if ($this->disableCredits === false) { + $display_credits = true; + $sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer; + if(Db::getInstance()->getValue($sql)){ + $display_credits = false; + } + + $sql = 'SELECT SUM(`discount_value`) FROM `'._DB_PREFIX_.'loyalty` WHERE `id_loyalty_state`=2 AND `id_discount`=0 AND `id_customer` = ' .(int) $cookie->id_customer; + $loyalties = Db::getInstance()->getValue($sql); } - - $sql = 'SELECT SUM(`discount_value`) FROM `'._DB_PREFIX_.'loyalty` WHERE `id_loyalty_state`=2 AND `id_discount`=0 AND `id_customer` = ' .(int) $cookie->id_customer; - $loyalties = Db::getInstance()->getValue($sql); - + $smarty->assign(array( 'onlyForm' => !$this->useTopUpper, 'display_credits' => $display_credits, @@ -109,16 +113,20 @@ class BlockUserInfo extends Module return; global $smarty, $cookie, $cart; - - $display_credits = true; - if ($cookie->logged) { - $sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer; - if(Db::getInstance()->getValue($sql)){ - $display_credits = false; - } - - $sql = 'SELECT SUM(`discount_value`) FROM `'._DB_PREFIX_.'loyalty` WHERE `id_loyalty_state`=2 AND `id_discount`=0 AND `id_customer` = ' .(int) $cookie->id_customer; - $loyalties = Db::getInstance()->getValue($sql); + + $display_credits = false; + if ($this->disableCredits === false) { + $display_credits = true; + if ($cookie->logged) { + $display_credits = true; + $sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer; + if(Db::getInstance()->getValue($sql)){ + $display_credits = false; + } + + $sql = 'SELECT SUM(`discount_value`) FROM `'._DB_PREFIX_.'loyalty` WHERE `id_loyalty_state`=2 AND `id_discount`=0 AND `id_customer` = ' .(int) $cookie->id_customer; + $loyalties = Db::getInstance()->getValue($sql); + } } $smarty->assign(array( diff --git a/modules/sensefuel/views/top-sensefuel.tpl b/modules/sensefuel/views/top-sensefuel.tpl index 5b1e2ec1..6fdc895b 100644 --- a/modules/sensefuel/views/top-sensefuel.tpl +++ b/modules/sensefuel/views/top-sensefuel.tpl @@ -3,7 +3,7 @@