Jump to content

Add field to /api/customers


gjanezic

Recommended Posts

Hi!


 


I am trying to add an extra field to /api/customers?display=full.


 


Not sure if I choose the right approach, but I overwrite classes/Customers.php


 




Customer::$definition['fields']['id_parent'] = array('type' => ObjectModel::TYPE_STRING);

class Customer extends CustomerCore
{
        public function __construct($id = null)
        {
                parent::__construct($id);


//                $sql = '... WHERE something = '.(int)$this->id.' ...';
//                $this->id_parent = sql_result;


// debug; $this->id is empty (0):
//d($this->id);
        }
}


the problem is $this->id is empty (0) and I need this id for DB query..

 

Any solutions?

 

Thank you!

Gregor

Link to comment
Share on other sites

Nothing? :(

 

Lets take a different approach..

Why is $id is __constructor null or then I call parent::__construct($id); why doesnt public variables get filled with data

($this->id, $this->date_add, ..)? When do they get filled?

 

What is the right approach to modify only WebServices output?

Is there another method that gets called just before XML output is generated (only for Customers!)

so I dont need to modify __constructor, I could add this field in another method..

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