You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Set Answer Products in Custom Process

Accepted answer
25
Views
2
Comments
edited Jun 8, 2022 12:02PM in General Technical Discussions 2 comments

Content

Hello  

I have an array of product IDs ($productList), and I would like to set them as Answer Products, overwriting the existing ones. I'm trying in this way:

$answer->Products = new RNCPHP\ServiceProductArray();
for($i = 0; $i < sizeof($productList); $i++)
 {                
                $answer->Products[$i] = new RNCPHP\ServiceProduct();
                $answer->Products[$i]->ServiceProduct = RNCPHP\ServiceProduct ::fetch($productList[$i]);
                $answer->Products[$i]->ServiceProduct->save();
 }            
$answer->save();  
 
      

I haven't errors, but Answer Products array is empty at the end of test harness .

Am I missing something?
Thanks very much

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!