Jump to content

[vyreseno] Upravy registracniho formulare - neuklada doplnena data


Vvitty

Recommended Posts

Pridavam si do udaju o uzivateli jednu pro muj eshop dulezitou polozku - radio button (id_scale), podobne jako je pro volbu pohlavi uzivatele, jen data jsou jina.
V tabulce mam prislusne pole pridane.

Bohuzel, pri zakladani uctu se mnou nove pridana hodnota neulozi do databaze. Pri editaci uzivatele v menu osobnich udaju to uklada spravne.

Zapomel jsem na neco pri upravach, kdyz jsem upravil jen Customer.php, identity.tpl a authentication.tpl (viz nize)?
Verze shopu - 1.2.5.

Upravil jsem
Customer.php

class        Customer extends ObjectModel
{
   public         $id;

   /** @var string Secure key */
   public        $secure_key;

   /** @var integer Gender ID */
   public        $id_gender = 9;
...

    protected     $fieldsValidate = array('secure_key' => 'isMd5', 'lastname' => 'isName', 'firstname' => 'isName', 'email' => 'isEmail', 'passwd' => 'isPasswd',
        'id_gender' => 'isUnsignedId', 'id_scale' => 'isUnsignedId', 'birthday' => 'isBirthDate', 'newsletter' => 'isBool', 'optin' => 'isBool', 'active' => 'isBool');

.......

   public function getFields()
   {
       parent::validateFields();
       if (isset($this->id))
           $fields['id_customer'] = intval($this->id);
       $fields['secure_key'] = pSQL($this->secure_key);
       $fields['id_gender'] = intval($this->id_gender);
       $fields['id_scale'] = intval($this->id_scale);
       $fields['lastname'] = pSQL(Tools::strtoupper($this->lastname));
....



a authentication.tpl / identity.tpl



{l s='Title'}
               <input type="radio" name="id_gender" id="id_gender1" value="1" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 1}checked="checked"{/if} />
{l s='Mr.'}
               <input type="radio" name="id_gender" id="id_gender2" value="2" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 2}checked="checked"{/if} />
{l s='Ms.'}



{l s='Modelové měřítko'}
               <input type="radio" name="id_scale" id="id_scaleZ" value="1" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 1}checked="checked"{/if} />
{l s='Z'}
               <input type="radio" name="id_scale" id="id_scaleN" value="2" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 2}checked="checked"{/if} />
{l s='N'}
               <input type="radio" name="id_scale" id="id_scaleTT" value="3" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 3}checked="checked"{/if} />
{l s='TT'}
               <input type="radio" name="id_scale" id="id_scaleH0" value="4" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 4}checked="checked"{/if} />
{l s='H0'}
               <input type="radio" name="id_scale" id="id_scale0" value="5" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 5}checked="checked"{/if} />
{l s='0'}
               <input type="radio" name="id_scale" id="id_scale00" value="6" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 6}checked="checked"{/if} />
{l s='00'}
               <input type="radio" name="id_scale" id="id_scaleO" value="99" {if isset($smarty.post.id_scale) && $smarty.post.id_scale == 99}checked="checked"{/if} />
{l s='Jiná'}

...

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...