InvoicesHelper::create_quote ?

Pascal
Pascal
Offline
0
Hi

I would like to create a quote by plugin.

As it exists a function InvoicesHelper::create_invoice(), could you describe me how to create a quote in php code ?

Regards

Accepted Answer

Wednesday, February 21 2018, 11:02 AM - #Permalink
0
yes, basically. you have also to calculate the next quote number (instead of invoice number), select the template.
also, the quote has no payments.

the rest is pretty much the same.
The reply is currently minimized Show
Responses (4)
  • Accepted Answer

    Wednesday, February 21 2018, 10:55 AM - #Permalink
    0
    hello,

    there's no function create_quote, there's just create_invoice.
    basically you would need to build a new function for quotes instead of invoices.
    The reply is currently minimized Show
  • Accepted Answer

    Pascal
    Pascal
    Offline
    Wednesday, February 21 2018, 10:57 AM - #Permalink
    0
    Yes (I saw the code)

    In fact you have to create an invoice with type=2.
    The reply is currently minimized Show
  • Accepted Answer

    Pascal
    Pascal
    Offline
    Wednesday, February 21 2018, 11:19 AM - #Permalink
    0
    By the way, do you know the PHP function to convert quotes to invoices ?
    • Germinal Camps
      more than a month ago
      this is not as easy as the helper function "create_invoice". this is done inside the invoice model file, with the duplicate() function

      you cannot call it "externally" just like with InvoicesHelper::create_invoice()
    The reply is currently minimized Show
  • Accepted Answer

    Pascal
    Pascal
    Offline
    Wednesday, February 21 2018, 03:28 PM - #Permalink
    0
    It should be

    $modelInvoice = InvoicesHelper::getInvoiceAdminModel();
    $modelInvoice->duplicate($quote->id, 1);


    But It doesn't work...
    The reply is currently minimized Show
Your Reply