Jump to content

Nicolas Patrouillaul

Members
  • Posts

    25
  • Joined

  • Last visited

Profile Information

  • First Name
    Nicolas
  • Last Name
    Patrouillault

Nicolas Patrouillaul's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Bonjour à tous Je recherche comme trouver la variable ou le tag de l'image de ma page produit qui est en première position. Ci dessous, le link pour afficher l'image de couverture. Cependant je ne souhaite pas afficher celle ci mais l'image en première position ( qui n'est pas forcement en couverture ) <a class="jqzoom" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" rel="gal1" href="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')|escape:'html':'UTF-8'}" itemprop="url"> <img class="img-responsive retina" itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default2x')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}"/> </a> Merci ! Nicolas
  2. Hi i need help. I'm looking for the tag or ID to call the image in first "position in my product page ? here is the coverid_image code source, but i would like the image in first position which is not in cover image. <a class="jqzoom" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" rel="gal1" href="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')|escape:'html':'UTF-8'}" itemprop="url"> <img class="img-responsive retina" itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default2x')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}"/> </a> Thanks ! Nic
  3. Hi ! I would like to know how to call in the "meta-description" 's content -> the short description of the product page. I want an automatic meta-description and to put the short description of the product as the meta description for product page. I tried this : but it's not working : {if $page_name =='product' } <meta name="description" content="{$short_description|truncate:150:"...":true} - {$shop_name|strip_tags}" /> {/if} Can someone help me please
  4. Hi everyone, I have an issue with my metadescrition. I tried to add a metadescription on my backoffice for each category and it's not working. The only way to make it works it's to add the metadescription on my header.tpl. Then, I'm trying to organise it by catogory and cms but now i need to add the short-description on the specific page to page name => product. Here it's my code source : {if isset($meta_description) AND $meta_description} {if $page_name =='index' } <meta name="description" content=" {if $lang_iso=="fr" && $page_name =='index' }Text{/if} {if $lang_iso=="ja" && $page_name =='index' }Text{/if} {if $lang_iso=="en" && $page_name =='index' }Text" /> {/if} {if $page_name =='cms' } <meta name="description" content=" {if $lang_iso=="fr" && $cms->id==37 }Text{/if} {if $lang_iso=="en" && $cms->id==37 }Text{/if} {if $lang_iso=="ja" && $cms->id==37 }Text{/if} {if $lang_iso=="fr" && $cms->id==27 }Text{/if} {if $lang_iso=="en" && $cms->id==27 }Text{/if} {if $lang_iso=="ja" && $cms->id==27 }Text{/if}" /> {/if} {if $page_name =='category' } <meta name="description" content=" {if $lang_iso=="fr" && $category->id==28 }Text{/if} {if $lang_iso=="en" && $category->id==28 }Text{/if} {if $lang_iso=="ja" && $category->id==28 }Text{/if} {if $lang_iso=="fr" && $category->id==38 }Text{/if} {if $lang_iso=="en" && $category->id==38 }Text{/if} {if $lang_iso=="ja" && $category->id==38 }Text{/if} {if $lang_iso=="fr" && $category->id==69 }Text{/if} {if $lang_iso=="en" && $category->id==69 }Text{/if} {if $lang_iso=="ja" && $category->id==69 }Text{/if} {if $lang_iso=="fr" && $category->id==41 }Text{/if} {if $lang_iso=="en" && $category->id==41 }Text{/if} {if $lang_iso=="ja" && $category->id==41 }Text{/if} " /> {/if} {if $page_name =='product' } <meta name="description" content="${short_description} - {$shop_name|strip_tags}" /> {/if} {/if} But it's no working . Thanks !
  5. Voilà authentification.tpl J'ai mis en commentaire date of birth {capture name=path} {if !isset($email_create)}{l s='Authentication'}{else} <a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Authentication'}">{l s='Authentication'}</a> <span class="navigation-pipe">{$navigationPipe}</span>{l s='Create your account'} {/if} {/capture} <h1 class="page-heading">{if !isset($email_create)}{l s='Authentication'}{else}{l s='Create an account'}{/if}</h1> {if isset($display_guest_checkout)}{assign var='current_step' value='login'}{include file="$tpl_dir./order-steps.tpl"}{/if} {include file="$tpl_dir./errors.tpl"} {assign var='stateExist' value=false} {assign var="postCodeExist" value=false} {assign var="dniExist" value=false} {if !isset($email_create)} <!--{if isset($authentification_error)} <div class="alert alert-danger"> {if {$authentification_error|@count} == 1} <p>{l s='There\'s at least one error'} :</p> {else} <p>{l s='There are %s errors' sprintf=[$account_error|@count]} :</p> {/if} <ol> {foreach from=$authentification_error item=v} <li>{$v}</li> {/foreach} </ol> </div> {/if}--> <div class="clear"></div> <div class="row"> <div class="col-xs-12 col-sm-6 center"> <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}?popup=1" method="post" id="login_form" class="box"> <h3 class="page-subheading">{l s='Already registered?'}</h3> <div class="form_content clearfix"> <p>{l s='Please enter your email address and password to log in'}</p> <div class="form-group"> <label for="email">{l s='Email address'}</label> <input class="is_required validate account_input form-control" data-validate="isEmail" type="text" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email|stripslashes}{/if}" /> </div> <div class="form-group"> <label for="passwd">{l s='Password'}</label> <span><input class="is_required validate account_input form-control" type="password" data-validate="isPasswd" id="passwd" name="passwd" value="{if isset($smarty.post.passwd)}{$smarty.post.passwd|stripslashes}{/if}" /></span> </div> <p class="lost_password"><a target="_top" href="{$link->getPageLink('password')|escape:'html':'UTF-8'}" title="{l s='Recover your forgotten password'}" rel="nofollow">{l s='Forgot your password?'}</a></p> <p class="submit"> {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'html':'UTF-8'}" />{/if} <button type="submit" id="SubmitLogin" name="SubmitLogin" class="button btn btn-default button-medium button-black"> <span> <i class="icon-lock left"></i> {l s='Sign in'} </span> </button> </p> </div> </form> </div> <div class="col-xs-12 col-sm-6 center"> <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="create-account_form" class="box" target="_top"> <h3 class="page-subheading">{l s='Create an account'}</h3> <div class="form_content clearfix"> <p>{l s='Please enter your email address to create an account.'}</p> <div class="alert alert-danger" id="create_account_error" style="display:none"></div> <input type="hidden" class="is_required validate account_input form-control" data-validate="isEmail" id="email_create" name="email_create" value="[email protected]" /> <div class="submit"> {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'html':'UTF-8'}" />{/if} <button class="btn btn-default button button-medium exclusive button-black" type="submit" id="SubmitCreate" name="SubmitCreate"> <span> <i class="icon-user left"></i> {l s='Create an account'} </span> </button> <input type="hidden" class="hidden" name="SubmitCreate" value="{l s='Create an account'}" /> </div> </div> </form> </div> </div> {if isset($inOrderProcess) && $inOrderProcess && $PS_GUEST_CHECKOUT_ENABLED} <form action="{$link->getPageLink('authentication', true, NULL, "back=$back")|escape:'html':'UTF-8'}" method="post" id="new_account_form" class="std clearfix"> <div class="box"> <div id="opc_account_form" style="display: block; "> <h3 class="page-heading bottom-indent">{l s='Instant checkout'}</h3> <!-- Account --> <div class="required form-group"> <label for="guest_email">{l s='Email address'} <sup>*</sup></label> <input type="text" class="is_required validate form-control" data-validate="isEmail" id="guest_email" name="guest_email" value="{if isset($smarty.post.guest_email)}{$smarty.post.guest_email}{/if}" /> </div> <div class="cleafix gender-line"> <label>{l s='Title'}</label> {foreach from=$genders key=k item=gender} <div class="radio-inline"> <label for="id_gender{$gender->id}" class="top"> <input type="radio" name="id_gender" id="id_gender{$gender->id}" value="{$gender->id}"{if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender->id} checked="checked"{/if} /> {$gender->name} </label> </div> {/foreach} </div> <div class="required form-group"> <label for="firstname">{l s='First name'} <sup>*</sup></label> <input type="text" class="is_required validate form-control" data-validate="isName" id="firstname" name="firstname" onblur="$('#customer_firstname').val($(this).val());" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{/if}" /> <input type="hidden" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{/if}" /> </div> <div class="required form-group"> <label for="lastname">{l s='Last name'} <sup>*</sup></label> <input type="text" class="is_required validate form-control" data-validate="isName" id="lastname" name="lastname" onblur="$('#customer_lastname').val($(this).val());" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{/if}" /> <input type="hidden" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{/if}" /> </div> <!-- <div class="form-group date-select birthdate"> <label>{l s='Date of Birth'}</label> <div class="row"> <div class="col-xs-4"> <select id="days" name="days" class="form-control"> <option value="">-</option> {foreach from=$days item=day} <option value="{$day}" {if ($sl_day == $day)} selected="selected"{/if}>{$day} </option> {/foreach} </select> {* {l s='January'} {l s='February'} {l s='March'} {l s='April'} {l s='May'} {l s='June'} {l s='July'} {l s='August'} {l s='September'} {l s='October'} {l s='November'} {l s='December'} *} </div> <div class="col-xs-4"> <select id="months" name="months" class="form-control"> <option value="">-</option> {foreach from=$months key=k item=month} <option value="{$k}" {if ($sl_month == $k)} selected="selected"{/if}>{l s=$month} </option> {/foreach} </select> </div> <div class="col-xs-4"> <select id="years" name="years" class="form-control"> <option value="">-</option> {foreach from=$years item=year} <option value="{$year}" {if ($sl_year == $year)} selected="selected"{/if}>{$year} </option> {/foreach} </select> </div> </div> </div> --> {if isset($newsletter) && $newsletter} <div class="checkbox"> <label for="newsletter"> <input type="checkbox" name="newsletter" id="newsletter" value="1" checked="checked"/> {l s='Sign up for our newsletter!'}</label> </div> <div class="checkbox partners"> <label for="optin"> <input type="checkbox" name="optin" id="optin" value="1" {if isset($smarty.post.optin) && $smarty.post.optin == '1'}checked="checked"{/if} /> {l s='Receive special offers from our partners!'}</label> </div> {/if} <h3 class="page-heading bottom-indent top-indent">{l s='Delivery address'}</h3> {foreach from=$dlv_all_fields item=field_name} {if $field_name eq "company" && $b2b_enable} <div class="form-group"> <label for="company">{l s='Company'}</label> <input type="text" class="form-control" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" /> </div> {elseif $field_name eq "vat_number"} <div id="vat_number" style="display:none;"> <div class="form-group"> <label for="vat-number">{l s='VAT number'}</label> <input id="vat-number" type="text" class="form-control" name="vat_number" value="{if isset($smarty.post.vat_number)}{$smarty.post.vat_number}{/if}" /> </div> </div> {elseif $field_name eq "dni"} {assign var='dniExist' value=true} <div class="required dni form-group"> <label for="dni">{l s='Identification number'} <sup>*</sup></label> <input type="text" name="dni" id="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{/if}" /> <span class="form_info">{l s='DNI / NIF / NIE'}</span> </div> {elseif $field_name eq "address1"} <div class="required form-group"> <label for="address1">{l s='Address'} <sup>*</sup></label> <input type="text" class="form-control" name="address1" id="address1" value="{if isset($smarty.post.address1)}{$smarty.post.address1}{/if}" /> </div> {elseif $field_name eq "address2"} <div class="form-group is_customer_param"> <label for="address2">{l s='Address (Line 2)'} <sup>*</sup></label> <input type="text" class="form-control" name="address2" id="address2" value="{if isset($smarty.post.address2)}{$smarty.post.address2}{/if}" /> </div> {elseif $field_name eq "postcode"} {assign var='postCodeExist' value=true} <div class="required postcode form-group"> <label for="postcode">{l s='Zip/Postal Code'} <sup>*</sup></label> <input type="text" class="form-control" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onblur="$('#postcode').val($('#postcode').val().toUpperCase());" /> </div> {elseif $field_name eq "city"} <div class="required form-group"> <label for="city">{l s='City'} <sup>*</sup></label> <input type="text" class="form-control" name="city" id="city" value="{if isset($smarty.post.city)}{$smarty.post.city}{/if}" /> </div> <!-- if customer hasn't update his layout address, country has to be verified but it's deprecated --> {elseif $field_name eq "Country:name" || $field_name eq "country"} <div class="required select form-group"> <label for="id_country">{l s='Country'} <sup>*</sup></label> <select name="id_country" id="id_country" class="form-control"> {foreach from=$countries item=v} <option value="{$v.id_country}"{if (isset($smarty.post.id_country) AND $smarty.post.id_country == $v.id_country) OR (!isset($smarty.post.id_country) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name}</option> {/foreach} </select> </div> {elseif $field_name eq "State:name"} {assign var='stateExist' value=true} <div class="required id_state select form-group"> <label for="id_state">{l s='State'} <sup>*</sup></label> <select name="id_state" id="id_state" class="form-control"> <option value="">-</option> </select> </div> {/if} {/foreach} {if $stateExist eq false} <div class="required id_state select unvisible form-group"> <label for="id_state">{l s='State'} <sup>*</sup></label> <select name="id_state" id="id_state" class="form-control"> <option value="">-</option> </select> </div> {/if} {if $postCodeExist eq false} <div class="required postcode unvisible form-group"> <label for="postcode">{l s='Zip/Postal Code'} <sup>*</sup></label> <input type="text" class="form-control" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onblur="$('#postcode').val($('#postcode').val().toUpperCase());" /> </div> {/if} {if $dniExist eq false} <div class="required form-group dni_invoice"> <label for="dni">{l s='Identification number'} <sup>*</sup></label> <input type="text" class="text form-control" name="dni_invoice" id="dni_invoice" value="{if isset($guestInformations) && $guestInformations.dni_invoice}{$guestInformations.dni_invoice}{/if}" /> <span class="form_info">{l s='DNI / NIF / NIE'}</span> </div> {/if} <div class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}form-group"> <label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label> <input type="text" class="form-control" name="phone_mobile" id="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{/if}" /> </div> <input type="hidden" name="alias" id="alias" value="{l s='My address'}" /> <input type="hidden" name="is_new_customer" id="is_new_customer" value="0" /> <div class="checkbox"> <label for="invoice_address"> <input type="checkbox" name="invoice_address" id="invoice_address"{if (isset($smarty.post.invoice_address) && $smarty.post.invoice_address) || (isset($guestInformations) && $guestInformations.invoice_address)} checked="checked"{/if} autocomplete="off"/> {l s='Please use another address for invoice'}</label> </div> <div id="opc_invoice_address" class="unvisible"> {assign var=stateExist value=false} {assign var=postCodeExist value=false} <h3 class="page-subheading top-indent">{l s='Invoice address'}</h3> {foreach from=$inv_all_fields item=field_name} {if $field_name eq "company" && $b2b_enable} <div class="form-group"> <label for="company_invoice">{l s='Company'}</label> <input type="text" class="text form-control" id="company_invoice" name="company_invoice" value="" /> </div> Voilà authcontroller.php Je ne pense pas avoir changé quelque chose deçu class AuthControllerCore extends FrontController { public $ssl = true; public $php_self = 'authentication'; /** * @var bool create_account */ protected $create_account; /** * Initialize auth controller * @see FrontController::init() */ public function init() { parent::init(); if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax) { Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); } if (Tools::getValue('create_account')) $this->create_account = true; } /** * Set default medias for this controller * @see FrontController::setMedia() */ public function setMedia() { parent::setMedia(); if (!$this->useMobileTheme()) $this->addCSS(_THEME_CSS_DIR_.'authentication.css'); $this->addJqueryPlugin('typewatch'); $this->addJS(array( _THEME_JS_DIR_.'tools/vatManagement.js', _THEME_JS_DIR_.'tools/statesManagement.js', _THEME_JS_DIR_.'authentication.js', _PS_JS_DIR_.'validate.js' )); } /** * Run ajax process * @see FrontController::displayAjax() */ public function displayAjax() { $this->display(); } /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $this->context->smarty->assign('genders', Gender::getGenders()); $this->assignDate(); $this->assignCountries(); $this->context->smarty->assign('newsletter', 1); $back = Tools::getValue('back'); $key = Tools::safeOutput(Tools::getValue('key')); if (!empty($key)) $back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key; if ($back == Tools::secureReferrer(Tools::getValue('back'))) $this->context->smarty->assign('back', html_entity_decode($back)); else $this->context->smarty->assign('back', Tools::safeOutput($back)); if (Tools::getValue('display_guest_checkout')) { if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // get all countries as language (xy) or language-country (wz-XY) $array = array(); preg_match("#(?<=-)\w\w|\w\w(?!-)#",$_SERVER['HTTP_ACCEPT_LANGUAGE'],$array); if (!Validate::isLanguageIsoCode($array[0]) || !($sl_country = Country::getByIso($array[0]))) $sl_country = (int)Configuration::get('PS_COUNTRY_DEFAULT'); } else $sl_country = (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')); $this->context->smarty->assign(array( 'inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int)$sl_country, 'countries' => $countries )); } if (Tools::getValue('create_account')) $this->context->smarty->assign('email_create', 1); if (Tools::getValue('multi-shipping') == 1) $this->context->smarty->assign('multi_shipping', true); else $this->context->smarty->assign('multi_shipping', false); $this->assignAddressFormat(); // Call a hook to display more information on form $this->context->smarty->assign(array( 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop') )); // Just set $this->template value here in case it's used by Ajax $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); if ($this->ajax) { // Call a hook to display more information on form $this->context->smarty->assign(array( 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'genders' => Gender::getGenders() )); $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'page' => $this->context->smarty->fetch($this->template), 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } } /** * Assign date var to smarty */ protected function assignDate() { // Generate years, months and days if (isset($_POST['years']) && is_numeric($_POST['years'])) $selectedYears = (int)($_POST['years']); $years = Tools::dateYears(); if (isset($_POST['months']) && is_numeric($_POST['months'])) $selectedMonths = (int)($_POST['months']); $months = Tools::dateMonths(); if (isset($_POST['days']) && is_numeric($_POST['days'])) $selectedDays = (int)($_POST['days']); $days = Tools::dateDays(); $this->context->smarty->assign(array( 'one_phone_at_least' => (int)Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'onr_phone_at_least' => (int)Configuration::get('PS_ONE_PHONE_AT_LEAST'), //retro compat 'years' => $years, 'sl_year' => (isset($selectedYears) ? $selectedYears : 0), 'months' => $months, 'sl_month' => (isset($selectedMonths) ? $selectedMonths : 0), 'days' => $days, 'sl_day' => (isset($selectedDays) ? $selectedDays : 0) )); } /** * Assign countries var to smarty */ protected function assignCountries() { // Select the most appropriate country if (isset($_POST['id_country']) && is_numeric($_POST['id_country'])) $selectedCountry = (int)($_POST['id_country']); if (!isset($selectedCountry)) $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); $this->context->smarty->assign(array( 'countries' => $countries, 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (isset($selectedCountry) ? $selectedCountry : 0), 'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT') )); } /** * Assign address var to smarty */ protected function assignAddressFormat() { $addressItems = array(); $addressFormat = AddressFormat::getOrderedAddressFields(Configuration::get('PS_COUNTRY_DEFAULT'), false, true); $requireFormFieldsList = AddressFormat::$requireFormFieldsList; foreach ($addressFormat as $addressline) foreach (explode(' ', $addressline) as $addressItem) $addressItems[] = trim($addressItem); // Add missing require fields for a new user susbscription form foreach ($requireFormFieldsList as $fieldName) if (!in_array($fieldName, $addressItems)) $addressItems[] = trim($fieldName); foreach (array('inv', 'dlv') as $addressType) $this->context->smarty->assign(array($addressType.'_adr_fields' => $addressFormat, $addressType.'_all_fields' => $addressItems)); } /** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('SubmitCreate')) $this->processSubmitCreate(); if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) $this->processSubmitAccount(); if (Tools::isSubmit('SubmitLogin')) $this->processSubmitLogin(); } /** * Process login */ protected function processSubmitLogin() { Hook::exec('actionBeforeAuthentication'); $passwd = trim(Tools::getValue('passwd')); $email = trim(Tools::getValue('email')); if (empty($email)) $this->errors[] = Tools::displayError('An email address required.'); elseif (!Validate::isEmail($email)) $this->errors[] = Tools::displayError('Invalid email address.'); elseif (empty($passwd)) $this->errors[] = Tools::displayError('Password is required.'); elseif (!Validate::isPasswd($passwd)) $this->errors[] = Tools::displayError('Invalid password.'); else { $customer = new Customer(); $authentication = $customer->getByEmail(trim($email), trim($passwd)); if (!$authentication || !$customer->id) $this->errors[] = Tools::displayError('Authentication failed.'); else { $this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare: CompareProduct::getIdCompareByIdCustomer($customer->id); $this->context->cookie->id_customer = (int)($customer->id); $this->context->cookie->customer_lastname = $customer->lastname; $this->context->cookie->customer_firstname = $customer->firstname; $this->context->cookie->logged = 1; $customer->logged = 1; $this->context->cookie->is_guest = $customer->isGuest(); $this->context->cookie->passwd = $customer->passwd; $this->context->cookie->email = $customer->email; // Add customer to the context $this->context->customer = $customer; if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0) && $id_cart = (int)Cart::lastNoneOrderedCart($this->context->customer->id)) $this->context->cart = new Cart($id_cart); else { $this->context->cart->id_carrier = 0; $this->context->cart->setDeliveryOption(null); $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id)); $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id)); } $this->context->cart->id_customer = (int)$customer->id; $this->context->cart->secure_key = $customer->secure_key; $this->context->cart->save(); $this->context->cookie->id_cart = (int)$this->context->cart->id; $this->context->cookie->write(); $this->context->cart->autosetProductAddress(); Hook::exec('actionAuthentication'); // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart($this->context); CartRule::autoAddToCart($this->context); if (!$this->ajax) { if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); echo '<span class="hidden popupclose"></span>'; //Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); } } } if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } else $this->context->smarty->assign('authentification_error', $this->errors); } /** * Process the newsletter settings and set the customer infos. * * @param Customer $customer Reference on the customer Object. * * @note At this point, the email has been validated. */ protected function processCustomerNewsletter(&$customer) { if (Tools::getValue('newsletter')) { $customer->ip_registration_newsletter = pSQL(Tools::getRemoteAddr()); $customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s')); if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) if ($module_newsletter->active) $module_newsletter->confirmSubscription(Tools::getValue('email')); } } /** * Process submit on an account */ protected function processSubmitAccount() { Hook::exec('actionBeforeSubmitAccount'); $this->create_account = true; if (Tools::isSubmit('submitAccount')) $this->context->smarty->assign('email_create', 1); // New Guest customer if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) $this->errors[] = Tools::displayError('You cannot create a guest account..'); if (!Tools::getValue('is_new_customer', 1)) $_POST['passwd'] = md5(time()._COOKIE_KEY_); if (isset($_POST['guest_email']) && $_POST['guest_email']) $_POST['email'] = $_POST['guest_email']; // Checked the user address in case he changed his email address if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) if (Customer::customerExists($email)) $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false); // Preparing customer $customer = new Customer(); $lastnameAddress = Tools::getValue('lastname'); $firstnameAddress = Tools::getValue('firstname'); $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname'); $addresses_types = array('address'); if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) $addresses_types[] = 'address_invoice'; $error_phone = false; if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $error_phone = true; } elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')) || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) $error_phone = true; } if ($error_phone) $this->errors[] = Tools::displayError('You must register at least one phone number.'); $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); // Check the requires fields which are settings in the BO $this->errors = $this->errors + $customer->validateFieldsRequiredDatabase(); if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { if (!count($this->errors)) { if (Tools::isSubmit('newsletter')) $this->processCustomerNewsletter($customer); $customer->firstname = Tools::ucwords($customer->firstname); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); if (!Validate::isBirthDate($customer->birthday)) $this->errors[] = Tools::displayError('Invalid date of birth.'); // New Guest customer $customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0); $customer->active = 1; if (!count($this->errors)) { if ($customer->add()) { if (!$customer->is_guest) if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('The email cannot be sent.'); $this->updateContext($customer); $this->context->cart->update(); Hook::exec('actionCustomerAccountAdd', array( '_POST' => $_POST, 'newCustomer' => $customer )); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int)$this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); // else : redirection to the account else { echo '<span class="hidden popupclose"></span>'; //Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); } } else $this->errors[] = Tools::displayError('An error occurred while creating your account.'); } } } else // if registration type is in one step, we save the address { $_POST['lastname'] = $lastnameAddress; $_POST['firstname'] = $firstnameAddress; $post_back = $_POST; // Preparing addresses foreach($addresses_types as $addresses_type) { $$addresses_type = new Address(); $$addresses_type->id_customer = 1; if ($addresses_type == 'address_invoice') foreach($_POST as $key => &$post) if (isset($_POST[$key.'_invoice'])) $post = $_POST[$key.'_invoice']; $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); if ($addresses_type == 'address_invoice') $_POST = $post_back; if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country)) $this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country'); $postcode = Tools::getValue('postcode'); /* Check zip code format */ if ($country->zip_code_format && !$country->checkZipCode($postcode)) $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); elseif(empty($postcode) && $country->need_zip_code) $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); elseif ($postcode && !Validate::isPostCode($postcode)) $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni')))) $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); elseif (!$country->need_identification_number) $$addresses_type->dni = null; if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) $this->errors[] = Tools::displayError('Country is invalid'); $contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0; $id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0; if ((Tools::isSubmit('submitAccount')|| Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) $this->errors[] = Tools::displayError('This country requires you to choose a State.'); } } if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) $this->errors[] = Tools::displayError('Invalid date of birth'); if (!count($this->errors)) { if (Customer::customerExists(Tools::getValue('email'))) $this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false); if (Tools::isSubmit('newsletter')) $this->processCustomerNewsletter($customer); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); if (!Validate::isBirthDate($customer->birthday)) $this->errors[] = Tools::displayError('Invalid date of birth'); if (!count($this->errors)) { $customer->active = 1; // New Guest customer if (Tools::isSubmit('is_new_customer')) $customer->is_guest = !Tools::getValue('is_new_customer', 1); else $customer->is_guest = 0; if (!$customer->add()) $this->errors[] = Tools::displayError('An error occurred while creating your account.'); else { foreach($addresses_types as $addresses_type) { $$addresses_type->id_customer = (int)$customer->id; if ($addresses_type == 'address_invoice') foreach($_POST as $key => &$post) if (isset($_POST[$key.'_invoice'])) $post = $_POST[$key.'_invoice']; $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); if ($addresses_type == 'address_invoice') $_POST = $post_back; if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add()) $this->errors[] = Tools::displayError('An error occurred while creating your address.'); } if (!count($this->errors)) { if (!$customer->is_guest) { $this->context->customer = $customer; $customer->cleanGroups(); // we add the guest customer in the default customer group $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('The email cannot be sent.'); } else { $customer->cleanGroups(); // we add the guest customer in the guest customer group $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP'))); } $this->updateContext($customer); $this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id); $this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id); if (isset($address_invoice) && Validate::isLoadedObject($address_invoice)) $this->context->cart->id_address_invoice = (int)$address_invoice->id; // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated $this->context->cart->update(); // Avoid articles without delivery address on the cart $this->context->cart->autosetProductAddress(); Hook::exec('actionCustomerAccountAdd', array( '_POST' => $_POST, 'newCustomer' => $customer )); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int)$this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } // if registration type is in two steps, we redirect to register address if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) Tools::redirect('index.php?controller=address'); if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); // else : redirection to the account else Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); } } } } if (count($this->errors)) { //for retro compatibility to display guest account creation form on authentication page if (Tools::getValue('submitGuestAccount')) $_GET['display_guest_checkout'] = 1; if (!Tools::getValue('is_new_customer')) unset($_POST['passwd']); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => false, 'id_customer' => 0 ); die(Tools::jsonEncode($return)); } $this->context->smarty->assign('account_error', $this->errors); } } /** * Process submit on a creation */ protected function processSubmitCreate() { if (!Validate::isEmail($email = Tools::getValue('email_create')) || empty($email)) $this->errors[] = Tools::displayError('Invalid email address.'); elseif (Customer::customerExists($email)) { $this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false); $_POST['email'] = $_POST['email_create']; unset($_POST['email_create']); } else { $this->create_account = true; $this->context->smarty->assign('email_create', Tools::safeOutput($email)); $_POST['email'] = $email; } } /** * Update context after customer creation * @param Customer $customer Created customer */ protected function updateContext(Customer $customer) { $this->context->customer = $customer; $this->context->smarty->assign('confirmation', 1); $this->context->cookie->id_customer = (int)$customer->id; $this->context->cookie->customer_lastname = $customer->lastname; $this->context->cookie->customer_firstname = $customer->firstname; $this->context->cookie->passwd = $customer->passwd; $this->context->cookie->logged = 1; // if register process is in two steps, we display a message to confirm account creation if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) $this->context->cookie->account_created = 1; $customer->logged = 1; $this->context->cookie->email = $customer->email; $this->context->cookie->is_guest = !Tools::getValue('is_new_customer', 1); // Update cart address $this->context->cart->secure_key = $customer->secure_key; } /** * sendConfirmationMail * @param Customer $customer * @return bool */ protected function sendConfirmationMail(Customer $customer) { if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) return true; return Mail::Send( $this->context->language->id, 'account', Mail::l('Welcome!'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname ); } }
  6. Oui en effet car la date de naissance était demandée alors que je ne le demande pas. J'ai donc passé certaines ligne de code concernant le date de naissance en commentaire sur mon FTP. Sais-tu d'où pourrait venir le soucis donc? Merci à toi en tout cas
  7. Bonjour, Suite à un problème avec la demande de la date de naissance sur mon formulaire d'inscription alors que je ne le demande pas , j'ai rectifié le problème mais maintenant j'ai ce message qui arrive lorsque l'on clique sur valider l'inscription : "Un compte est déjà enregistré avec cet e-mail, veuillez renseigner le mot de passe ou en demander un nouveau." Hors l'email est unique et n'est pas dans la base de données. Le compte se créer quand meme mais j'ai ce message apparait entre le chargement de la page après avoir validé et la page du compte. Savez-vous comment réparer le problème ? Merci ! Voici l'erreur : $_ERRORS['95d45b5aed3c29f520abe72ca8673ef9'] = 'Un compte est déjà enregistré avec cet e-mail, veuillez renseigner le mot de passe ou en demander un nouveau.'; Merci ! Nicolas
  8. Hello Community ! I need your help to add a Newsletter form in my home page. I want to add something like the image attached I want to send an email to myself when they click on JOIN with the client's email. We are using mailchimp but I know we cannot used it cause of their double-opt in (confirmation email). So i had to create a form and add the emails by my self. I tried to do it with php, but it's not working and I do have my html done. How can i do it please? Thanks a lot.
  9. Bonjour J'ai fais un transfert de serveur la semaine dernière et après analyse je me suis aperçu que le module de carte bancaire ne fonctionne plus. J'ai re-modifié les accès FTP sur le nouveau et rien à faire : j'ai 5 erreurs : An error log file exists, please read file `/home/dbfeshop/www/modules/tggatos/log/error.log` and archive it to stop seeing this warning. Error when calling request binary, system exit code: 126, text output: Error when calling response binary, system exit code: 126, text output: Logs location is the default location which should be moved for security reason. Put it outside of HTTP document root and any public access folder if you can. Make sure no one who shouldn't has access to it. Do not forget to update module's config with new location in basic panel. ATOS SIPS parameter files location the default location which should be moved for security reason. Put it outside of HTTP document root and any public access folder if you can. Make sure no one who shouldn't has access to it. Do not forget to update module's config with new location in advanced panel. Je suis un peu perdu, quelqu'un peut-il m'aider? Comment faire pour réparer le problème ? Merci !
  10. Hello ! im using «tggatos SIPS/ATOS» module for payements. After migrating my site to a new server i got some errors because of which the payment module is not working : Error when calling request binary, system exit code: 126, text output: Error when calling response binary, system exit code: 126, text output: I would be very grateful for any advice or suggestion on how to fix this issue. Thanks!
  11. Thanks ! this is working : {if $lang_iso=="fr"} . I would like to apply this banner/popup only if the website is in French AND Only on the home page (One particular page only). Do you know how to do it ? Thanks
  12. Hi, I'm trying to apply this banner only if the website is in French. But it's not working. Do you know how to fixed it? {if $language.iso_code=="FR"} <div class="notification-bar"> <div class="text" style="padding-top: 10px;text-transform: uppercase; letter-spacing: 1px; padding-bottom: 10px;color: #b8b7b7; vertical-align: middle; width: 100%; text-align: center; background: #f9f9f9; font-weight: lighter; float: right;font-family: helvetica; font-size: 9px;">Livraison gratuite à partir de 250€</div> </div>{/if} THANKS !
  13. hi, I need your help ! I created a notification bar to collect emails on my website, but i don't know how to add a close button and make it work. CAN SOMEONE HELP ME?Please This is my code : {if $page_name == index} <div class="bar" style=" position: absolute; top: 0; width: 100%; background: #f5f3f3; text-align: center; padding: 5px;"> <div class="signup" style="font-family: Helvetica; text-transform: uppercase; letter-spacing: 1px; line-height: 200% !important; text-align: center; "><span style="font-weight: bold;">Sign Up! </span><br> <span style="font-size:8px;">FOR OUR NEWSLETTER AND GET 10% OFF YOUR FIRST PURCHASE.</span></div> <form action="//Name.us4.list-manage.com/subscribe/post?u=205933f37fded02354f296fb4&id=5cef940122" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address I Votre email" required="" style="width:25%;background-color:#000;text-align:center;text-transform:uppercase;font-size:11px;height:35px;border-radius:0px;border:0px;color:#ffffff;font-family:'Gotham A','Gotham B',sans-serif;} }"> <input type="submit" class="input btn" value="OK" style=" border: 0; padding: 10px;"> </div> </form> {/if} Sorry i'm not the best in html or Java, i try my best ^^. Thanks, Nicolas
×
×
  • Create New...