Access Fabrik Data Programmatically

Metabern

Member
I have created a Fabrik List/Form of consisting of various Virtuemart tables necessary for me to create customized: Order invoices/PO's, etc.

I want to be able to trigger the generation of PDF's from this data programmatically from Virtuemart Order status changes.
What would be the best way to do this?
Cheers
 
Not quite sure what you mean.
You can trigger a Fabrik list PDF via URL (assuming you've set PDF parameters in list settings), something like
your-domain/index.php?option=com_fabrik&view=list&listid=15&format=pdf
 
And you can grab the output of that programmatically by just called file_get_content on the PDF view URL.

-- hugh
 
Let me clarify a little:

My virtuemart store has some extra functionality, specifically Dropshipping from multiple locations
I am using a Virtuemart Extension called Dropshipping Manager by Webkul.
It does most of what I am looking for: It divides a VM order into multiple "Warehouse" location sub-orders and handles emails sent to warehouses when specific order status is set.

The functionality I am missing is an ability to create and handle custom PDF attachments that need to be generated.

An example of the flow I am describing would be something like this:

- Customer buys 2 products from 2 different locations, pays and creates an order.
- Store admin reviews orders and accounts and changes status from "Pending" to "Ready for Shipping"
- VM Dropshipping sends two emails, (1 to each warehouse) with a notification to dropship the product
At this point we would need to be able to create and save 4 custom pdf's:
  • 2x internal PO's: from Store to Warehouse1 and store to warehouse 2 - each showing the order info and items relevant to that warehouse
  • 2x general Delivery Note's: 1 to accompany each of the 2 shipments from warehouses 1,2 to customer
PO and Delivery Notes are the same content wise.

First Question: In general what is the best way to use Fabrik to create a standalone PO/DN manager that programmatically creates pdf's and saves them to a folder making them available for other extension to attach them to emails.?

So far I am able through list joins to have a form/detail page with all of the information of an order: (VM and VMDropshipping lists that show
 

Attachments

  • purchase-orders-test.png
    purchase-orders-test.png
    181 KB · Views: 90
First Question: In general what is the best way to use Fabrik to create a standalone PO/DN manager that programmatically creates pdf's and saves them to a folder making them available for other extension to attach them to emails.?

Fabrik doesn't do any storing of PDFs. We simply generate them on the fly as a response to a browser loading a specific view format, which gets returned to the browser with the appropriate MIME type, and the browser either saves or displays it. Just like any extension in J!, using the standard view mechanism. Most views are HTML (there's always an implied &format=html when you load an extension page without a format arg), but with &format=pdf we take the HTML output of that view and feed it through either DOMPDF or MPDF (depending on your setting in Fabrik's global options).

So it'd be up to you to create and save the PDF's. If this was happening in Fabrik, after (say) a form submission, you could add a form submission plugin that does a file_get_contents() (or a CURL call) on the PDF details view URL for that form and saves the returned content in some predetermined location/name.

But it seems like what triggers your email is happening in VM, not Fabrik. I don't know enough about VM to know if they have triggerable custom code you can run during that workflow. So perhaps enquire on the VM forums, see if there's a way you can run custom code during the VM workflow, to generate and store a Fabrik PDF view.

-- hugh
 
So we've identified the Virtuemart trigger that will run our pdf creation and we have a details page that shows all of the info we need. We now need to be able to create a template override to style it. We were able to successfully implement an override on the frontend detail page, but not on the backend.

Our purpose for using the backend is that the admin performing the VM order status change (Our trigger) is already logged in.

How do we override the form/detail page in the backend?

cheers
 
Hi there, no it wasn't, I'm still trying to figure out have to apply an override to a backend pdf. Frontend works fine.

Cheers
 
What do you mean with "override"?
You can create a PDF template and select this in the list's PDF settings. It will be used in frontend and backend.

If you are doing some Joomla template overriding you must add it to your Joomla backend template (Isis usually).
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top