AnsweredAssumed Answered

Running a php file with after save hook

Question asked by ryan urquhart on Mar 23, 2018

I am trying to add a product to a productbundle from a custom module thats attached to the quote of that bundle on an after-save logic hook. In my current logic hook I call a php file that has a lot of rest API calls that add the product using the custom modules record id. When I save the hook is triggered and it sometimes works and sometimes crashes sugar.

The php file works by itself and the hook only has one line in the function which is a call to that php file. It also sometimes adds more than one product if a payment is ever save a second time.

Is there a way to add a product with $bean and not use the rest api? any idea why i sometimes get a 500 error?