best way to programmatically add item to quote in edit view (js/jquery)

I’ve customized the quotes edit view and added a section that lists the sales history for the currently selected account (so the user does not have to leave the page to view past sales). The goal is to be able to add an item from this sales history to a new line item in the quote. I do not want to duplicate the functionality already provided by the autocomplete or product popup to fill in product information. I’m trying to figure out how to “trigger” the autocomplete functionality programmatically through js or jquery but I’ve been unsuccessful so far. Any help would be greatly appreciated.

To be honest this would be a fairly complicated thing to do especially if you are not an experienced programmer. The line items themselves come from a separate module called AOS_Products_Quotes. You would need to look at the modules/AOS_Products_Quotes/line_items.js and line_items.php files and modify them to do what you need.

I am experienced enough and have already played with those files. They do not include the js I’m looking for that makes the ajax call to get the product information. I ended up just making my own call to get the info but I am still curious on how to use the existing functionality already included in the autocomplete functionality. Thanks.

On line 219 in line_items.js there is a function : openProductPopup(ln) this opens the popup, once the popup window is open if you inspect the name link on one of the products you will see a function send_back(‘AOS_Products’,‘a6fc232a-b2ee-3967-11de-5620fc7785ac’); This contains the id of the product and thats how it gets the product information.

Don’t know why I didn’t think of that! In order to access that function, I needed to include the file /include/javascript/popup_helper.js (unless there is another I should be including instead) but now it is complaning about:

Uncaught ReferenceError: associated_javascript_data is not defined

After searching for that string in all the files, I am unsure what to do next.

I am unsure also, your defiantly missing something though.

Seems to be more trouble than its worth. Thanks for the help.