Pull phone number in to quotes

Howdy all.

I’m trying to pull a phone number from accounts in to AOS_Quotes when a new quote is created from an account (the same way it pulls through account name and account address)

Any ideas?

Cheers

Yes its done in the modules/AOS_Quotes/controller.php

First I assume you have added a custom phone number field to the quotes module via studio? If not do it.

Then copy modules/AOS_Quotes/controller.php to custom/modules/AOS_Quotes/controller.php

edit the copied file and add this line with your newly added field name:


$this->bean->YOURCUSTOMFIELDNAME = $row['phone_office'];

to this if statement:


if (isset($_REQUEST['account_id'])) {
            		$query = "SELECT * FROM accounts WHERE id = '{$_REQUEST['account_id']}'";
			$result = $this->bean->db->query($query, true);
			$row = $this->bean->db->fetchByAssoc($result);
			$this->bean->billing_account_id = $row['id'];
			$this->bean->billing_account = $row['name'];
			$this->bean->billing_address_street = $row['billing_address_street'];
			$this->bean->billing_address_city = $row['billing_address_city'];
			$this->bean->billing_address_state = $row['billing_address_state'];
			$this->bean->billing_address_postalcode = $row['billing_address_postalcode'];
			$this->bean->billing_address_country = $row['billing_address_country'];
			$this->bean->shipping_address_street = $row['shipping_address_street'];
			$this->bean->shipping_address_city = $row['shipping_address_city'];
			$this->bean->shipping_address_state = $row['shipping_address_state'];
			$this->bean->shipping_address_postalcode = $row['shipping_address_postalcode'];
			$this->bean->shipping_address_country = $row['shipping_address_country'];
		       
                        // Your line goes here
                      $this->bean->YOURCUSTOMFIELDNAME = $row['phone_office'];
	}	

And that should be it.

1 Like

Have spent 2 days trying to figure that out !!!

Thanks Andy :slight_smile: