Jump to content

Use identity company name for address


Jurist

Recommended Posts

Hello,

We have a store where customer enters company and vat details during checkout and account opening (b2b option enabled).

However immediately after that company field is empty, which means he needs to insert it again. 

Is there any way to automatically add company name to the new address?

 

Link to comment
Share on other sites

  • 3 years later...

Finally I overrode the CustomerAddressForm::getTemplateVariables() method

public function getTemplateVariables()
    {
        $context = Context::getContext();
		
		$tv = parent::getTemplateVariables();
		$formFields = $tv['formFields'];
		if (empty($formFields['company']['value'])) {
            $formFields['company']['value'] = $context->customer->company;
        }

        return array(
            'id_address' => (isset($this->address->id)) ? $this->address->id : 0,
            'action' => $this->action,
            'errors' => $this->getErrors(),
            'formFields' => $formFields,
        );
    }

 

Link to comment
Share on other sites

1 hour ago, prestacoco said:

Is this question related with the feature of copying company name from one field to another?

It is related to my enquiry about if you do not have troubles with fraudsters.

Its a forum, a message board dedicated to people interchanging opinions, solving problems, problems which could could up also counts. .

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

1 minute ago, Nickz said:

It is related to my enquiry about if you do not have troubles with fraudsters.

Its a forum, a message board dedicated to people interchanging opinions, solving problems, problems which could could up also counts. .

OK but it would be smarter to create your own topic.

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