Post by sferris » Fri Feb 10, 2012 11:42 pm

Hi. I have a customer that needs the company field to be required during checkout. Has anyone done this?

New member

Posts

Joined
Sat Jul 16, 2011 12:46 am

Post by sferris » Tue Feb 14, 2012 10:28 pm

Really? No one knows how to make a field required in checkout?

New member

Posts

Joined
Sat Jul 16, 2011 12:46 am

Post by madimar » Tue Feb 14, 2012 11:18 pm

Well, even if it can be simple, it can't be done without code modifications. You will need to work on both controller (adding field validation rules) and template files (mainly adding the asterisk *) for 3 sections: normal account registration, registration during checkout, checkout as guest.

regards,

M

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by jty » Tue Feb 14, 2012 11:40 pm

@madimar, why is your name blue
I know Q & D are red and the others are green but you're blue. Can I be pink

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by dizarter » Wed Feb 15, 2012 6:11 am

Because he is moderator. Q & D are admins :)

New member

Posts

Joined
Tue Oct 11, 2011 7:33 am

Post by madimar » Wed Feb 15, 2012 6:25 am

jty wrote:@madimar, why is your name blue
I know Q & D are red and the others are green but you're blue. Can I be pink
Ahah, you could ask to Q to make you pink! :joker:

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by sferris » Wed Feb 15, 2012 10:18 pm

I already added the * to the fields in checkout, to at least make people think they are required. Which controller files would I need to look at? I can usually figure stuff out if I see an example, but nothing was jumping out at me when I looked.

New member

Posts

Joined
Sat Jul 16, 2011 12:46 am

Post by madimar » Thu Feb 16, 2012 1:53 am

catalog/controller:
account/register.php
account/edit.php (if you want to avoid that a customer remove the company field content after registration)
checkout/register.php
checkout/guest.php

Ah, you will need also to slightly modify corresponding template files in order to show the error message in case of validation failure.

M

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by mediaindustries » Tue Mar 06, 2012 3:52 pm

Anyone got a detailed tutorial to fix this? I also need to add two extra fields to the address section and they need to be required (company number and tax number). If anyone can create an extension it would be nice, no problem to pay for it.

User avatar
New member

Posts

Joined
Mon Mar 05, 2012 10:36 pm
Location - The Netherlands

Post by nzplayer » Sun May 13, 2012 5:59 am

Hi, I have written a vqmod for a mate of mine that makes the Company required.

http://www.web.nzplayer.com/index.php?r ... duct_id=95

Newbie

Posts

Joined
Fri May 11, 2012 5:33 am

Post by madimar » Sun May 13, 2012 1:55 pm

Have you seen my VAT number contribution?

M

Sent from my DesireHD.

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by Avvici » Sun May 13, 2012 2:12 pm

sferris wrote:I already added the * to the fields in checkout, to at least make people think they are required. Which controller files would I need to look at? I can usually figure stuff out if I see an example, but nothing was jumping out at me when I looked.
It's not that difficult. Let's walk you through it.

Open catalog/view/theme/default/template/account/register.tpl and find this line:

Code: Select all

<tr>
          <td><?php echo $entry_company; ?></td>
          <td><input type="text" name="company" value="<?php echo $company; ?>" /></td>
        </tr>
Make it look like this:

Code: Select all

 <tr>
          <td><span class="required">*</span> <?php echo $entry_company; ?></td>
          <td><input type="text" name="company" value="<?php echo $company; ?>" /><?php if ($error_company) { ?>
            <span class="error"><?php echo $error_company; ?></span>
            <?php } ?></td>
        </tr>
Now open catalog/controller/account/register.php and find this line:

Code: Select all

if (isset($this->error['zone'])) {
			$this->data['error_zone'] = $this->error['zone'];
		} else {
			$this->data['error_zone'] = '';
		}
Right below that add this:

Code: Select all

if (isset($this->error['company'])) {
			$this->data['error_company'] = $this->error['company'];
		} else {
			$this->data['error_company'] = '';
		}
Now find this line:

Code: Select all

if ($this->request->post['country_id'] == '') {
      		$this->error['country'] = $this->language->get('error_country');
    	}
Right below it add this:

Code: Select all

if ($this->request->post['company'] == '') {
      		$this->error['company'] = $this->language->get('error_company');
    	}
Lastly open language/english/account/register.php and add this to the list:

Code: Select all

$_['error_company']         = 'Warning: Company name required';
Done.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by enk » Sat Aug 04, 2012 7:03 am

avvici, you are awesome! Thank you for that step-by-step procedure!

enk
Newbie

Posts

Joined
Fri Aug 03, 2012 5:20 am

Post by RobiG » Tue Oct 30, 2012 8:46 am

That was very helpful avvici. That worked great for making the Company field required during registration. How do I get this same result for the registration during the checkout process?

Newbie

Posts

Joined
Sat Sep 15, 2012 2:34 am

Post by mukur » Mon Nov 19, 2012 4:55 am

Does anybody know the steps to do this in 1.5.4.1?

Newbie

Posts

Joined
Fri Sep 07, 2012 9:55 am

Post by Sparki » Thu Jan 24, 2013 4:58 am

Hi,

Does someone know how to do this within the checkout form?
Just can't get it to work properly. Got it to do the verification ( I think, it will not continue without a company filled in) but no error message is generated.

Can someone help?

Regards,

Martijn

Newbie

Posts

Joined
Thu Jan 24, 2013 4:53 am

Post by reason8 » Fri Aug 30, 2013 12:11 pm

Thanks avvici -arvixe- I have made it onto a vQmod if anyone requires it and it works for OC 1.5.5.1 see attached.

Attachments

require company field


Newbie

Posts

Joined
Mon Mar 18, 2013 1:42 pm

Post by Nawid » Sat Sep 14, 2013 7:18 pm

reason8 wrote:Thanks avvici -arvixe- I have made it onto a vQmod if anyone requires it and it works for OC 1.5.5.1 see attached.
Thank you for the files, It also works for OC 1.5.6
Question, How do you let this work in the checkout page, I mean like the page where people can place their order without login --> Direct Order page.

I believe it's something with checkout/checkout.php ?

Best regards,
Nawid

User avatar
New member

Posts

Joined
Fri Aug 19, 2011 6:47 am

Post by kelemvor » Mon Sep 16, 2013 11:14 pm

This works great from the Manual Create Account page but there are different files if they create an account from the Checkout process. Those files used are:
check/register.tpl
catalog/controller/checkout/register.php
catalog/language/english/checkout/register.php

I'm having trouble with the middle file since the format of that file doesn't match the format of the controller/account/register.php file.

Can anyone help with that file? or is there a way to disable creating an account from in the checkout process to force everyone to have to use the regular account creation page?

Thanks.

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am

Post by kelemvor » Wed Sep 25, 2013 11:08 pm

Has anyone else figured out how to do this for the Checkout pages?

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am
Who is online

Users browsing this forum: No registered users and 15 guests