Author Topic: adding new input  (Read 102 times)

Online shahiran12395

  • Newbie
  • *
  • Posts: 33
  • Karma: +1/-0
    • View Profile
adding new input
« on: July 16, 2019, 04:25:02 AM »
hi, im trying to add new input. but the label wont show. i have register definition using admin also add new definition in guest_step_1.xml but still no effect. below is my code. can advice me on how to do it. i need to insert phone code for different country

Code: [Select]
<definition>
<key>entry_extension</key>
<value><![CDATA[Extension:]]></value>
</definition>

Code: [Select]
if (isset($_post['extension'])){
            $extension = $_post['extension'];
        } elseif (isset($_session['guest']['extension'])){
            $extension = $_session['guest']['extension'];
        } else{
            $extension = '';
        }

        $this->data['form']['fields']['general']['extension'] = $form->getFieldHtml(
            array (
                'type'  => 'input',
                'name'  => 'extension',
                'value' => $extension
            ));

if (isset($_post['telephone'])){
$telephone = $_post['telephone'];
} elseif (isset($_session['guest']['telephone'])){
$telephone = $_session['guest']['telephone'];
} else{
$telephone = '';
}

$this->data['form']['fields']['general']['telephone'] = $form->getFieldHtml(
array (
'type'  => 'input',
'name'  => 'telephone',
'value' => $telephone
));

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1780
  • Karma: +247/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: adding new input
« Reply #1 on: July 16, 2019, 11:03:24 AM »
did you tried to load language block?
i mean $this->load->language('checkout/guest_step_1);
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Online shahiran12395

  • Newbie
  • *
  • Posts: 33
  • Karma: +1/-0
    • View Profile
Re: adding new input
« Reply #2 on: July 16, 2019, 10:54:24 PM »
I did try adding the language but still not showing the input label. am i missing something?

i have upload screenshot of the guest checkout form for other to refer below

Code: [Select]
$this->load->language('checkout/guest_step_1');

$form = new AForm();
$form->setForm(array ('form_name' => 'guestFrm'));
$this->data['form']['form_open'] = $form->getFieldHtml(
array (
                    'type'   => 'form',
                    'name'   => 'guestFrm',
                    'action' => $this->html->getSecureURL('checkout/guest_step_1'),
                    'csrf' => true
                )
        );

if (isset($_post['firstname'])){
$firstname = $_post['firstname'];
} elseif (isset($_session['guest']['firstname'])){
$firstname = $_session['guest']['firstname'];
} else{
$firstname = '';
}

$this->data['form']['fields']['general']['firstname'] = $form->getFieldHtml(array (
'type'     => 'input',
'name'     => 'firstname',
'value'    => $firstname,
'required' => true));


if (isset($_post['lastname'])){
$lastname = $_post['lastname'];
} elseif (isset($_session['guest']['lastname'])){
$lastname = $_session['guest']['lastname'];
} else{
$lastname = '';
}
$this->data['form']['fields']['general']['lastname'] = $form->getFieldHtml(
array (
'type'     => 'input',
'name'     => 'lastname',
'value'    => $lastname,
'required' => true));
if (isset($_post['email'])){
$email = $_post['email'];
} elseif (isset($_session['guest']['email'])){
$email = $_session['guest']['email'];
} else{
$email = '';
}

$this->data['form']['fields']['general']['email'] = $form->getFieldHtml(
array (
'type'     => 'input',
'name'     => 'email',
'value'    => $email,
'required' => true));
        if (isset($_post['phone_code'])){
            $phone_code = $_post['phone_code'];
        } elseif (isset($_session['guest']['phone_code'])){
            $phone_code = $_session['guest']['phone_code'];
        } else{
            $phone_code = '';
        }
        $this->data['form']['fields']['general']['phone_code'] = $form->getFieldHtml(
            array (
                'type'  => 'input',
                'name'  => 'phone_code',
                'value' => $phone_code
            ));

if (isset($_post['telephone'])){
$telephone = $_post['telephone'];
} elseif (isset($_session['guest']['telephone'])){
$telephone = $_session['guest']['telephone'];
} else{
$telephone = '';
}
$this->data['form']['fields']['general']['telephone'] = $form->getFieldHtml(
array (
'type'  => 'input',
'name'  => 'telephone',
'value' => $telephone
));

Code: [Select]
<definition>
<key>entry_firstname</key>
<value><![CDATA[First Name:]]></value>
</definition>
<definition>
<key>entry_lastname</key>
<value><![CDATA[Last Name:]]></value>
</definition>
<definition>
<key>entry_email</key>
<value><![CDATA[E-Mail:]]></value>
</definition>
<definition>
<key>entry_phone_code</key>
<value><![CDATA[Phone Code:]]></value>
</definition>
<definition>
<key>entry_telephone</key>
<value><![CDATA[Telephone:]]></value>
</definition>

 

Powered by SMFPacks Social Login Mod