Menu

SuietASSURED Banner

Save

Save

Welcome, Guest
Username: Password: Remember me

TOPIC: Inheriting Address from Customer in Quote

Inheriting Address from Customer in Quote 6 days 11 hours ago #56718

  • spongioblast
  • spongioblast's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
Hi

I am trying to inherit the address from the customer in the quote (same as if one selects an account). Could somebody point me into the right direction on what I'm missing? I changed the AOS_Quotes/controller.php code in the the following way:
if (isset($_REQUEST['contact_id'])) {
				$query = "SELECT * FROM contacts WHERE id = '{$_REQUEST['contact_id']}'";
            		
			$result = $this->bean->db->query($query, true);
			$row = $this->bean->db->fetchByAssoc($result);
			$this->bean->billing_contact_id = $row['id'];
			$this->bean->billing_contact = $row['first_name'].' '.$row['last_name'];
			// AML inherit address from contact		
			$this->bean->billing_address_street = $row['primary_address_street'];
			$this->bean->billing_address_city = $row['primary_address_city'];
			$this->bean->billing_address_state = $row['primary_address_state'];
			$this->bean->billing_address_postalcode = $row['primary_address_postalcode'];
			$this->bean->billing_address_country = $row['primary_address_country'];
			$this->bean->shipping_address_street = $row['primary_address_street'];
			$this->bean->shipping_address_city = $row['primary_address_city'];
			$this->bean->shipping_address_state = $row['primary_address_state'];
			$this->bean->shipping_address_postalcode = $row['primary_address_postalcode'];
			$this->bean->shipping_address_country = $row['primary_address_country'];
		}

Thanks
Adrian
Last Edit: 6 days 11 hours ago by spongioblast.
The administrator has disabled public write access.

Inheriting Address from Customer in Quote 5 days 16 hours ago #56739

  • pgr
  • pgr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 3150
  • Thank you received: 509
  • Karma: 119
I don't know how to do this, but maybe I have a suggestion: instead of eediting the controller, how about a logic hook (or even a simple Workflow).

-When the Customer address is changed, grab the address and put it in every quote

or

- when the quote is created, go to the Customer and grab the address
The administrator has disabled public write access.

Inheriting Address from Customer in Quote 5 days 13 hours ago #56743

  • spongioblast
  • spongioblast's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
Maybe I didn't explain it well enough. In the quote module, when you select the contact, I would like the shipping address to be filled with the contact's address and not the accounts as it currently is. I attached a screenshot to this post to visualize this. Is the AOS_Quotes/controller.php not the correct place for this?
Attachments:
The administrator has disabled public write access.

Inheriting Address from Customer in Quote 5 days 12 hours ago #56750

  • pgr
  • pgr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 3150
  • Thank you received: 509
  • Karma: 119
Oh, I understand better now, sorry.

You didn't say what happens with your code, do you get an error, empty fields, what?
The administrator has disabled public write access.

Inheriting Address from Customer in Quote 5 days 11 hours ago #56752

  • spongioblast
  • spongioblast's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
The fields just stay empty. If I select an account, the address is filled, but with a customer they stay empty. I also attached the whole controller.php from AOS_Quotes.

Thanks
Attachments:
The administrator has disabled public write access.

Inheriting Address from Customer in Quote 5 days 11 hours ago #56754

  • pgr
  • pgr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 3150
  • Thank you received: 509
  • Karma: 119
Does the first name and last name populate correctly?

Maybe this code only puts the data into the bean, maybe it needs to be made (some other place) to load the bean in to the screen fields. if you can find a place where it does that for the first name and last name, stored in $this->bean->billing_contact, then you can add the other fields there.

But I'm not sure you'll find it, maybe a more generic mechanism is at work there...
The administrator has disabled public write access.
The following user(s) said Thank You: spongioblast

Inheriting Address from Customer in Quote 4 days 12 hours ago #56805

  • spongioblast
  • spongioblast's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
I searched for hours, sadly no luck. I deleted every billing_contact one by one in the quote module php files, with various effects, however the field always filled (except when it was no longer present at all).

With more research I tried to populate it by adding the following to the viewdefs.php in the quotes module, however its not working either.

Thanks for the guidance!

array (
	'name' => 'billing_contact',
	'studio' => 'visible',
	'label' => 'LBL_billing_contact',
	'displayParams' => array (
		'field_to_name_array' => array(
			'id'=>'billing_contact_id', 
			'name' => 'billing_contact',
			'primary_address_street' => 'billing_address_street',
		),
	),
),
The administrator has disabled public write access.
Time to create page: 0.093 seconds
Powered by Kunena Forum