News:

Looking for documentation? Take a look on our wiki

Main Menu

Overriding a function createPrintLinks() in view.html.php?

Started by EvanGR, December 28, 2020, 12:11:02 PM

Previous topic - Next topic

EvanGR

Hello,

I am looking to customize the Orders admin page, specifically the order print links.
The relevant code is function createPrintLinks($order,&$print_link,&$deliverynote_link,&$invoice_links)
in administrator\components\com_virtuemart\views\orders\view.html.php
Is it possible to override this (just the specific function would be better) in my template?

Thanks

AH

Yes you can override these - just add the function you want and display those new links
Regards
A

Joomla 4.4.5
php 8.1

EvanGR

Thank you.

That function belongs to the "Controller" file. The template overrides usually work on the "View" layer (assuming MVC architecture).
If I override that function, or create a new one, in my template, I will be mixing Controller logic in the View layer.
That is my main concern, maybe there was a proper way of doing it, I am now aware of.

Thanks again

AH

I just added my own link function in my template override and called it in the same override - I would not worry about MVC for this simple override


<?php //create my own links for printing etc
MYcreatePrintLinks($order,$print_link,$deliverynote_link,$invoice_links,$pickinglist_link$returnslist_link);
?>



and then at the bottom of the code somewhere out of the way


function MYcreatePrintLinks($order,&$print_link,&$deliverynote_link,&$invoice_links,&$pickinglist_link, &$returnslist_link){
$baseUrl = 'index.php?option=com_virtuemart&view=orders&task=callInvoiceView&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id;

    $deliverynote_link = '';
$pickinglist_link = '';
$returnslist_link = '';


etc etc.
Regards
A

Joomla 4.4.5
php 8.1