Merge branch 'ticket-12962-LandingPage' into develop

This commit is contained in:
Marion Muszynski 2017-04-28 11:05:31 +02:00
commit fa2db797b8
6 changed files with 151 additions and 2 deletions

View File

@ -23,6 +23,7 @@ class AdminLandingPages extends AdminTab {
DEFAULT,
'.(int) (bool) Tools::getValue('enabled').',
'.(int) (bool) Tools::getValue('connect_button').',
'.(int) (bool) Tools::getValue('on_home').',
"'.pSQL(Tools::str2url($name)).'",
"'.pSQL(Tools::getValue('text1')).'",
"'.pSQL(Tools::getValue('text2')).'",
@ -76,6 +77,7 @@ class AdminLandingPages extends AdminTab {
UPDATE `'._DB_PREFIX_.'landing_page`
SET `enabled` = '.(int) (bool) Tools::getValue('enabled').',
`connect_button` = '.(int) (bool) Tools::getValue('connect_button').',
`on_home` = '.(int) (bool) Tools::getValue('on_home').',
`name` = "'.pSQL(Tools::str2url($name)).'",
`text1` = "'.pSQL(Tools::getValue('text1')).'",
`text2` = "'.pSQL(Tools::getValue('text2')).'",
@ -150,6 +152,7 @@ class AdminLandingPages extends AdminTab {
<th id="cust_sort">'.$this->l('Customers').'</th>
<th style="width: 55px;">'.$this->l('Enabled').'</th>
<th style="width: 55px;">'.$this->l('Connect').'</th>
<th style="width: 55px;">'.$this->l('Home').'</th>
<th style="width: 35px;">'.$this->l('Actions').'</th>
</tr>';
@ -157,10 +160,11 @@ class AdminLandingPages extends AdminTab {
echo '<tr>
<td>'.$page['id_landing_page'].'</td>
<td>'.$page['name'].'</td>
<td>http://'.$_SERVER['SERVER_NAME'].'/authentification?create_account=1&lp='.$page['name'].'</td>
<td>'.($page['on_home']?'https://'.$_SERVER['SERVER_NAME'].'?lpes='.$page['name']:'https://'.$_SERVER['SERVER_NAME'].'/authentification?create_account=1&lp='.$page['name']).'</td>
<td>'.(isset($counts[$page['id_landing_page']])? $counts[$page['id_landing_page']]: '0').'</td>
<td>'.($page['enabled']? $this->l('Yes'): $this->l('No')).'</td>
<td>'.($page['connect_button']? $this->l('Yes'): $this->l('No')).'</td>
<td>'.($page['on_home']? $this->l('Yes'): $this->l('No')).'</td>
<td>
<img style="cursor: pointer;" onclick="itemEdition('.$page['id_landing_page'].')" title="'.$this->l('Edit this landing page').'" alt="" src="../img/admin/edit.gif" />
</td>
@ -299,6 +303,15 @@ class AdminLandingPages extends AdminTab {
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Home:').'</label>
<div class="margin-form">
<div id="enabled" style="float: left;">
<input name="on_home" type="radio" value="0"'.($this->curlp? ($this->curlp['on_home'] == 0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('No').'&nbsp;&nbsp;&nbsp;<input name="on_home" type="radio" value="1"'.($this->curlp && $this->curlp['on_home'] == 1? ' checked="checked"': '').' /> '.$this->l('Yes').'
<sup> *</sup>
</div>
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Text 1:').'</label>
<div class="margin-form">
<div id="enabled" style="float: left;">

View File

@ -0,0 +1,59 @@
{if !$cookie->isLogged() && $lp}
<div id="landingpage-connect">
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="account-creation_form" class="std">
<fieldset>
<h3>{l s='Registered' mod='landingpage'}</h3>
<p class="required text">
<label for="customer_firstname">{l s='First name' mod='landingpage'}</label>
<input onkeyup="$('#firstname').val(this.value);" type="text" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.request.customer_firstname)}{$smarty.request.customer_firstname}{/if}" />
<sup>*</sup>
</p>
<p class="required text">
<label for="customer_lastname">{l s='Last name' mod='landingpage'}</label>
<input onkeyup="$('#lastname').val(this.value);" type="text" class="text" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.request.customer_lastname)}{$smarty.request.customer_lastname}{/if}" />
<sup>*</sup>
</p>
<p class="required text">
<label for="email">{l s='E-mail' mod='landingpage'}</label>
<input type="text" class="text" id="email" name="email" value="{if isset($smarty.request.email)}{$smarty.request.email}{/if}" />
<sup>*</sup>
</p>
<p class="required password">
<label for="passwd">{l s='Password' mod='landingpage'}</label>
<input type="password" class="text" name="passwd" id="passwd" />
<sup>*</sup>
{*<span class="form_info">{l s='(5 characters min.)'}</span>*}
</p>
{$HOOK_CREATE_ACCOUNT_FORM}
<script type="text/javascript">
$(function() {
var mail = $("#referralprogram").val();
var data = mail.split('@');
if(data[1] == 'bebeboutik.com'){
$("#referralprogram").parent().hide();
}
});
</script>
<fieldset>
{if isset($newsletter) && $newsletter}
<p class="checkbox" >
<input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($smarty.post.newsletter) AND $smarty.post.newsletter == 1} checked="checked"{/if} />
<label for="newsletter">{l s='Sign up for our newsletter' mod='landingpage'}</label>
</p>
{/if}
</fieldset>
<p class="cart_navigation required submit">
<input type="hidden" name="email_create" value="1" />
<input type="hidden" name="is_new_customer" value="1" />
<input type="hidden" name="lp" value="{$lp}" />
<input type="submit" name="submitAccount" id="submitAccount" value="{l s='Register' mod='landingpage'}" class="exclusive" onclick="if($('#newsletter:checked').length == 0) { alert('{l s='Please accept our terms of use to continue' js=1}'); return false; }" />
<span><sup>*</sup>{l s='Required field' mod='landingpage'}</span>
</p>
</fieldset>
</form>
</div>
<div id="landingpage_overlay"></div>
{/if}

View File

@ -246,4 +246,34 @@ class LandingPages extends Module {
));
return $this->display(__FILE__, 'authentication_bottom.tpl');
}
public function hookPrivateSales_Block($params) {
global $smarty, $cookie;
$connect_button = 0;
$on_home = 0;
$lp = Tools::getValue('lpes');
if($lp) {
if($landing = Db::getInstance()->getRow('
SELECT `on_home`,`connect_button`
FROM `'._DB_PREFIX_.'landing_page`
WHERE `enabled` = 1
AND `name` = "'.pSQL($lp).'"
')) {
$connect_button = $landing['connect_button'];
$on_home = (int)$landing['on_home'];
}
}
if(!$on_home){
return true;
}
$smarty->assign(array(
'connect_button' => $connect_button,
'lp' => $lp,
'HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'),
'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop')
));
$smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
return $this->display(__FILE__, 'home_footer.tpl');
}
}

View File

@ -84,6 +84,7 @@ class PrivateSales extends Module {
'privatesales_product' => array('Private Sales - Product', 'Called on each private sale category page'),
'privatesales_category' => array('Private Sales - Category', 'Called on each private sale product page'),
'privatesales_end' => array('Private Sales - End', 'Called when a sale ends'),
'privatesales_block' => array('Private Sales - Home block', 'Called on the vp linsting/home page'),
'preprocess' => array('Pre Process', 'Called before the page processing'),
);
foreach($hooks as $k => $v) {
@ -416,6 +417,7 @@ class PrivateSales extends Module {
'path' => __PS_BASE_URI__.'modules/privatesales/',
'sales' => $sales,
'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('sales' => $sales, 'futuresales' => $futuresales)),
'HOOK_PRIVATESALES_BLOCK' => Module::hookExec('privatesales_block'),
'futuresales' => $futuresales,
'showtoguests' => Configuration::get('PRIVATESALES_GUESTLIST'),
'customer_groups' => ($cookie->isLogged()? Customer::getGroupsStatic((int) $cookie->id_customer): array(1)),

View File

@ -7329,3 +7329,46 @@ table#carrierTable tbody td {
#relay_point_selected_box .mr_relay_update_relay span a{
font-size: 16px
}
/* Landingpage connect */
#privatesales_block #landingpage-connect{
background: url("../img/modal_subscribe.png") no-repeat;
border-radius: 0px;
height: 430px;
left: 50%;
margin-left: -175px;
position: fixed;
top: 15%;
width: 300px;
z-index: 900;
padding: 40px 60px 68px;
}
#privatesales_block #landingpage-connect h3{
border-bottom: 4px double #ccc;
padding-bottom: 5px;
}
#privatesales_block #landingpage-connect p.password,
#privatesales_block #landingpage-connect p.text{
padding: 0;
margin: 0;
padding-bottom: 5px;
}
#privatesales_block #landingpage-connect p.cart_navigation{
padding: 5px 0;
}
#privatesales_block #landingpage-connect p.cart_navigation #submitAccount{
background-position: right 9px !important;
padding-left: 15px;
padding-right: 36px;
}
#privatesales_block #landingpage_overlay {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.3);
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 800;
}

View File

@ -52,6 +52,8 @@
</script>
<div id="privatesales_block">
{$HOOK_PRIVATESALES_BLOCK}
{* Log in pop up *}
{if !$cookie->isLogged() AND !$showtoguests}
<div class="modalbox_shadow" style="display: none;"></div>