Display credit

This commit is contained in:
Michael RICOIS 2017-12-07 17:17:52 +01:00
parent c3cf35571d
commit 4841e02436
7 changed files with 31 additions and 13 deletions

View File

@ -74,6 +74,7 @@ class BlockUserInfo extends Module
}
$display_credits = false;
$loyalties = null;
if ($this->disableCredits === false) {
$display_credits = true;
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer;
@ -115,6 +116,7 @@ class BlockUserInfo extends Module
global $smarty, $cookie, $cart;
$display_credits = false;
$loyalties = null;
if ($this->disableCredits === false) {
$display_credits = true;
if ($cookie->logged) {

View File

@ -13,7 +13,7 @@ include(dirname(__FILE__).'/../../header.php');
$invite = new Invite();
$activeTab = 'sponsor';
$activeTab = 'credit';
$error = FALSE;
$revive_sent = FALSE;
$mails_exists = array();
@ -241,6 +241,8 @@ if($oi_enable = Configuration::get('INVITE_OPENINVITER_ENABLE')) {
$oi_services = $inviter->getPlugins();
}
$customer_credit = $invite->_get_credit((int) $cookie->id_customer, false, false, 'frontoffice');
$smarty->assign(array(
'activeTab' => $activeTab,
'orderQuantity' => $orderQuantity,
@ -265,8 +267,8 @@ $smarty->assign(array(
'oi_enable' => $oi_enable,
'pendingFriends' => $invite->getPendingFriends($customer->id),
'subscribeFriends' => $invite->getFriends($customer->id),
'currency' => $currency->sign,
'currency' => $currency->sign,
'customer_credit' => $customer_credit,
));
echo Module::display(dirname(__FILE__).'/invite.php', 'invite-program.tpl');

View File

@ -1427,7 +1427,8 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
return $result.'<br /><br />';
}
private function _get_credit($id_customer=FALSE, $value=FALSE, $with_sign=FALSE, $mode=FALSE) {
public function _get_credit($id_customer=FALSE, $value=FALSE, $with_sign=FALSE, $mode=FALSE)
{
$credit = Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'invite_credit`
@ -1946,7 +1947,8 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
');
}
public function getFriends($id_customer=FALSE, $nb_limit) {
public function getFriends($id_customer = false, $nb_limit = false)
{
if(!(int) $id_customer) {
return array();
}

View File

@ -1,6 +1,9 @@
<div id="invite_credit" class="cf">
{*<p>{l s='Referral program:' mod='invite'}</p>*}
<p class="submit">
<a class="use_credit_link" href="{$base_dir_ssl}modules/invite/use_credit.php">{l s='Click here to use your credit' mod='invite'}</a> <p><span class="price">{$invite_credit[0]|string_format:'%.02f'} {$invite_credit[2]}</span> {l s='will be deducted from your order total.' mod='invite'}</p>
<a class="use_credit_link" href="{$base_dir_ssl}modules/invite/use_credit.php">
{l s='Click here to use your credit' mod='invite'}</a>
<p><span class="price">{$invite_credit[0]|string_format:'%.02f'} {$invite_credit[2]}</span>
{l s='will be deducted from your order total.' mod='invite'}</p>
</p>
</div>

View File

@ -50,18 +50,22 @@
<div class="block_invite_tab">
<ul class="idTabs">
<li><a href="#idTab1" {if $activeTab=='sponsor'}class="selected"{/if}>{l s='Sponsor my friends' mod='invite'}</a></li>
<li><a href="#idTab2" {if $activeTab=='pending'}class="selected"{/if}>{l s='Pending friends' mod='invite'}</a></li>
<li><a href="#idTab3" {if $activeTab=='subscribed'}class="selected"{/if}>{l s='Friends I sponsored' mod='invite'}</a></li>
<li><a href="#idTab1" {if $activeTab=='credit'}class="selected"{/if}>{l s='Credit parrainage disponible' mod='invite'}</a></li>
<li><a href="#idTab2" {if $activeTab=='sponsor'}class="selected"{/if}>{l s='Sponsor my friends' mod='invite'}</a></li>
<li><a href="#idTab3" {if $activeTab=='pending'}class="selected"{/if}>{l s='Pending friends' mod='invite'}</a></li>
<li><a href="#idTab4" {if $activeTab=='subscribed'}class="selected"{/if}>{l s='Friends I sponsored' mod='invite'}</a></li>
</ul>
<div class="sheets">
<div id="idTab1">
{include file="tab1.tpl"}
{include file="tab-credit.tpl"}
</div>
<div id="idTab2">
{include file="tab2.tpl"}
{include file="tab1.tpl"}
</div>
<div id="idTab3">
{include file="tab2.tpl"}
</div>
<div id="idTab4">
{include file="tab3.tpl"}
</div>
</div>

View File

@ -1 +1,4 @@
<li><a href="{$base_dir_ssl}modules/invite/invite-program.php" title="{l s='Referral program' mod='nivite'}">{l s='Referral program' mod='invite'}</a></li>
<li>
<a href="{$base_dir_ssl}modules/invite/invite-program.php"
title="{l s='Referral program' mod='nivite'}">{l s='Referral program' mod='invite'}</a>
</li>

View File

@ -1,3 +1,5 @@
<li>
<a href="{$base_dir_ssl}modules/loyalty/loyalty-program.php" title="{l s='My loyalty points' mod='loyalty'}">{l s='My loyalty points' mod='loyalty'}</a>
<a href="{$base_dir_ssl}modules/loyalty/loyalty-program.php"
title="{l s='My loyalty points' mod='loyalty'}">{l s='My loyalty points' mod='loyalty'}
</a>
</li>