Allow now the combo between invite / sponsor email in landingpage module

Fix on desktop
This commit is contained in:
David 2018-02-19 20:02:23 +01:00
parent 2df6c80619
commit 33753fc289
9 changed files with 51 additions and 32 deletions

View File

@ -1212,8 +1212,10 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
unset($_COOKIE[$cName]);
}
setcookie($cName, base64_encode($referal_email), time() + 3600 * 24, '/', 'bebeboutik.com');
$smarty_value = $smarty->get_template_vars('sponsor_email');
if($smarty_value === null && $referal_email !== '') { //we prevent overwrite
$smarty->assign('sponsor_email', $referal_email);
}
return $this->display(__FILE__, 'authentication.tpl');
}
@ -1234,6 +1236,9 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
}
}
}
}
public function get_credit_value($id_customer=0) {

View File

@ -27,7 +27,8 @@ class AdminLandingPages extends AdminTab {
"'.pSQL(Tools::str2url($name)).'",
"'.pSQL(Tools::getValue('text1')).'",
"'.pSQL(Tools::getValue('text2')).'",
"'.pSQL(Tools::getValue('tag')).'"
"'.pSQL(Tools::getValue('tag')).'",
"'.pSQL(Tools::getValue('parrain_email')).'"
)
');
@ -81,7 +82,8 @@ class AdminLandingPages extends AdminTab {
`name` = "'.pSQL(Tools::str2url($name)).'",
`text1` = "'.pSQL(Tools::getValue('text1')).'",
`text2` = "'.pSQL(Tools::getValue('text2')).'",
`tag` = "'.pSQL(Tools::getValue('tag'), true).'"
`tag` = "'.pSQL(Tools::getValue('tag'), true).'",
`parrain` = "'.pSQL(Tools::getValue('parrain_email'), true).'"
WHERE `id_landing_page` = '.$id_landing_page.'
');
@ -327,6 +329,13 @@ class AdminLandingPages extends AdminTab {
</div>
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Email Parrain :').'</label>
<div class="margin-form">
<div id="enabled" style="float: left;">
<input name="parrain_email" type="text" value="'.($this->curlp? $this->curlp['parrain']: '').'" />
</div>
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Tag :').'</label>
<div class="margin-form">

View File

@ -72,9 +72,11 @@ class LandingPages extends Module {
`name` VARCHAR(255) NOT NULL,
`text1` VARCHAR(255) NOT NULL,
`text2` VARCHAR(255) NOT NULL,
`parrain` VARCHAR(255) NULL,
PRIMARY KEY(`id_landing_page`)
) ENGINE=MyIsam DEFAULT CHARSET=utf8
';
//ALTER TABLE ps_landing_page ADD parrain VARCHAR(255) NULL;
if(!Db::getInstance()->Execute($query)) {
return FALSE;
}
@ -191,6 +193,7 @@ class LandingPages extends Module {
$id_landing_page = 0;
$lp_text1 = '';
$lp_text2 = '';
$email_parrain = '';
if($name = Tools::getValue('lp')) {
if($landing = Db::getInstance()->getRow('
@ -203,10 +206,18 @@ class LandingPages extends Module {
$lp_text1 = $landing['text1'];
$lp_text2 = $landing['text2'];
$tag = $landing['tag'];
$email_parrain = $landing['parrain'];
}
}
if ($id_landing_page > 0) {
if ($email_parrain !== '') {
if($smarty->get_template_vars('sponsor_email') === null){ //we prevent overwrite
$smarty->assign(array(
'sponsor_email' => $email_parrain
));
}
}
if (_PS_MOBILE_) {
if (file_exists(_PS_ROOT_DIR_ . '/modules/landingpages/img/' . $id_landing_page . '_2_' . $cookie->id_lang . '.jpg')) {
$smarty->assign(array(

View File

@ -399,7 +399,14 @@ $(function(){ldelim}
</p>
</fieldset>
{$HOOK_CREATE_ACCOUNT_FORM}
{*MODULE invite / landingpage / referalprogram *}
<fieldset class="account_creation" {if isset($sponsor_email)} style="display:none;" {/if}>
<p>
<label for="referralprogram">{l s='E-mail address of your sponsor' mod='invite'}</label>
<input type="text" size="52" maxlength="128" class="text" id="referralprogram" name="invite" value="{if isset($sponsor_email)}{$sponsor_email|escape:'htmlall':'UTF-8'}{elseif isset($smarty.post.invite)}{$smarty.post.invite|escape:'htmlall':'UTF-8'}{elseif isset($referralprogram)}{$referralprogram|escape:'htmlall':'UTF-8'}{/if}" />
</p>
</fieldset>
{*END MODULE invite / landingpage / referalprogram *}
<script type="text/javascript">
/* ANTADIS */
var input = document.getElementById("referralprogram");

View File

@ -1,7 +1 @@
<fieldset class="account_creation" {if isset($sponsor_email)} style="display:none;" {/if}>
<p>
<label for="referralprogram">{l s='E-mail address of your sponsor' mod='invite'}</label>
<input type="text" size="52" maxlength="128" class="text" id="referralprogram" name="invite" value="{if isset($sponsor_email)}{$sponsor_email|escape:'htmlall':'UTF-8'}{elseif isset($smarty.post.invite)}{$smarty.post.invite|escape:'htmlall':'UTF-8'}{elseif isset($referralprogram)}{$referralprogram|escape:'htmlall':'UTF-8'}{/if}" />
</p>
</fieldset>
{if isset($tag_auth)}{$tag_auth}{/if}

View File

@ -316,6 +316,7 @@ $(function(){ldelim}
{/if}
{else}
<div id="account-creation_container">
<div class="insert_top_account_creation"></div>
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="account-creation_form" class="std">
{$HOOK_CREATE_ACCOUNT_TOP}
<fieldset class="account_creation">
@ -397,6 +398,13 @@ $(function(){ldelim}
</p>
</fieldset>
{$HOOK_CREATE_ACCOUNT_FORM}
{*MODULE invite / landingpage / referalprogram *}
<fieldset class="account_creation" {if isset($sponsor_email)} style="display:none;" {/if}>
<p class="text">
<input placeholder="{l s='E-mail address of your sponsor' mod='invite'}" type="text" size="52" maxlength="128" class="text" id="referralprogram" name="invite" value="{if isset($sponsor_email)}{$sponsor_email|escape:'htmlall':'UTF-8'}{elseif isset($smarty.post.invite)}{$smarty.post.invite|escape:'htmlall':'UTF-8'}{elseif isset($referralprogram)}{$referralprogram|escape:'htmlall':'UTF-8'}{/if}" />
</p>
</fieldset>
{*END MODULE invite / landingpage / referalprogram *}
<fieldset>
{if isset($newsletter) && $newsletter}
<p class="checkbox" >

View File

@ -2176,7 +2176,6 @@ body#product #primary_block #more_info_block {
padding:0px 0px 20px 0px;
font-size:12px;
}
body#authentication #columns .content #center_column #account-creation_form h3,
body#password #columns .content #center_column h3,
body#order-follow #columns .content #center_column h1,
body#module-advsendtoafriend-sendtoafriend-form #columns .content #center_column h1{
@ -2184,13 +2183,12 @@ body#module-advsendtoafriend-sendtoafriend-form #columns .content #center_column
text-align:right;
padding-right:7px;
}
body#authentication #columns .content #center_column #account-creation_form h3 span,
body#password #columns .content #center_column h3 span,
body#order-follow #columns .content #center_column h1 span,
body#module-advsendtoafriend-sendtoafriend-form #columns .content #center_column h1 span{
float:left;
}
body#order-follow #columns .content #center_column > p/*,
/*body#history #columns .content #center_column > p*/{
display:none;

View File

@ -1,7 +1 @@
<fieldset class="account_creation" {if isset($sponsor_email)} style="display:none;" {/if}>
<p class="text">
{*<label for="referralprogram">{l s='E-mail address of your sponsor' mod='invite'}</label>*}
<input placeholder="{l s='E-mail address of your sponsor' mod='invite'}" type="text" size="52" maxlength="128" class="text" id="referralprogram" name="invite" value="{if isset($sponsor_email)}{$sponsor_email|escape:'htmlall':'UTF-8'}{elseif isset($smarty.post.invite)}{$smarty.post.invite|escape:'htmlall':'UTF-8'}{elseif isset($referralprogram)}{$referralprogram|escape:'htmlall':'UTF-8'}{/if}" />
</p>
</fieldset>
{if isset($tag_auth)}{$tag_auth}{/if}

View File

@ -1,17 +1,10 @@
<style type="text/css">
{if $landing}
body#authentication {
background-image: url("{$base_dir_ssl}modules/landingpages/img/{$id_lp}_1_{$cookie->id_lang}.jpg") !important;
body#authentication #account-creation_container .insert_top_account_creation{
background-image: url("{$base_dir_ssl}modules/landingpages/img/{$id_lp}_2_{$cookie->id_lang}.jpg") !important;
background-position: center 99px;
background-repeat: no-repeat;
}
@media screen and (max-width:767px){
body#authentication {
background-image: none !important;
}
}
{*TODO*}
{/if}
</style>
<div class="hidden" style="display: none !important;">