Jump to content

commandes en 5 étapes + numéro de téléphone obligatoire = bug


Recommended Posts

Hello

 

J'utilise la version 1.5.4.1

J'ai malheuresement un bug, qui permet lorsque je configure la boutique avec :

 

"5 étapes", et "numéro de téléphone requis"

Le client peut continuer sur la page suivante sans avoir à renseigner un numéro de téléphone.

 

Par contre, lorsque je choisis :

"creation avec compte seulement", et "numéro de téléphone requis"

Cela marche : le client ne peut pas continuer sur la page suivante sans avoir à renseigner un numéro de téléphone

Edited by kevin78 (see edit history)
Link to comment
Share on other sites

coucou 

 

ok on avance donc ^^

 

il faudrait verifier maintenant dans ta base de donnée dans la table configuration si la valeur de PS_ONE_PHONE_AT_LEAST est a 1

(c'est la conditon dans les tpl et les controller pour verifier  que le config clients=>numero de tel est activer)

 

ci c'est le cas il faut après regarder les fichier

adresse.tpl / authentification.tpl / order-opc-new-account.tpl la ou il y a les input pour les "phone" si il y a la conditons

{if isset($one_phone_at_least) && $one_phone_at_least}

 

et le fichier controllers\front\AddressController.php

dans la fonction processSubmitAddress() si il y a bien


// Check phone
if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile'))
    $this->errors[] = Tools::displayError('You must register at least one phone number.');

@++

 

Loulou66

Edited by loulou66 (see edit history)
Link to comment
Share on other sites

J'ai ceci :

 

dans address.tpl :

        <p class="{if $one_phone_at_least}required {/if}text">
            <label for="phone_mobile">{l s='Mobile phone'}{if $one_phone_at_least} <sup>*</sup>{/if}</label>
            <input type="text" id="phone_mobile" name="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{else}{if isset($address->phone_mobile)}{$address->phone_mobile}{/if}{/if}" />
        </p>

authentication.tpl

        <p class="text">
            <label for="phone">{l s='Home phone'}</label>
            <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
        </p>
        <p class="text">
            <label for="phone_mobile">{l s='Mobile phone'} {if $one_phone_at_least}<sup>*</sup>{/if}</label>
            <input type="text" class="text" name="phone_mobile" id="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{/if}" />
        </p>

Order-opc-new-account

                <p class="text is_customer_param">
                    <label for="phone">{l s='Home phone'}</label>
                    <input type="text" class="text" name="phone" id="phone" value="{if isset($guestInformations) && $guestInformations.phone}{$guestInformations.phone}{/if}" />
                </p>
                <p class="{if $one_phone_at_least}required {/if}text">
                    <label for="phone_mobile">{l s='Mobile phone'}{if $one_phone_at_least} <sup>*</sup>{/if}</label>
                    <input type="text" class="text" name="phone_mobile" id="phone_mobile" value="" />
                </p>

Côté BDD, c'est bien sur "1".

Côté controllers, j'ai bien

        // Check phone
        if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile'))
            $this->errors[] = Tools::displayError('You must register at least one phone number.');

Edit :

 

Finalement, je pense où se trouve le bug.

Fichier AuthController.php :

            elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_ORDER_PROCESS_TYPE'))
                    && (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')))
                    && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')))
                $error_phone = true;

remplacé par

            elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_ORDER_PROCESS_TYPE'))
                    || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')))
                    && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')))
                $error_phone = true;
Edited by kevin78 (see edit history)
Link to comment
Share on other sites

coucou

 

tiens essaye cette version de la 1.6

$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;
}

en php  || = OU && = ET (http://www.php.net/manual/fr/language.operators.logical.php)

 

@++

 

Loulou66

Link to comment
Share on other sites

coucou 

 

ton client a peut être mis des espaces dans le tel

 

on peut aussi faire la verif cote FO par le navigateur maintenant avec le html5 

 

dans les tpl ou il y a le téléphone a remplir

remplacer
<input type="text"......
par
<input type="tel" requiered ........


et si tu veut mettre un format genre  01-02-03-04-05 il faut rajouter un patern

<label for="phone">{l s='Home phone'} 01-02-03-04-05</label>
<input type="tel" requiered patern="[0-9]-[0-9]-[0-9]-[0-9]-[0-9]" ........

la ou moins ton client est obliger de rentrer un numéro et au format que tu veut :P

 

http://www.w3schools.com/tags/att_input_type.asp

http://www.alsacreations.com/tuto/lire/1392-formulaire-html5-placeholder-required-pattern.html

 

@++

 

Loulou66

Edited by loulou66 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...