News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Invoice name change issue.

Started by mailblade, November 14, 2017, 10:12:21 AM

Previous topic - Next topic

mailblade

Latest VM ; Joomla 3.6

Hello.

I'm having some trouble with changing the invoice name which the user receives attached to the email which is sent to them.

I found these 2 lines in "mytemplate\components\com_virtuemart\controllers\invoice.php":


//$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
$path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout).'.pdf';


If I enable the top line and comment out the bottom one, the user is not able to download the PDF anymore from the "Order Details" page. They can only print it. They still receive it in the email though.

Now, currently the name of the invoice is: "vminvoice_invoicenumber.pdf" (invoiceumber is the automatically generated random letters)

Example: "vminvoice_171114185H0115"

How do I change the name of "$layout"?

I've been struggling a lot with this.

I've found no way to do this. If I use this:

$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_',.$layout.'_'.$invoiceNumber.'.pdf');

it changes the name to just "invoice_171114185H0115". However the PDF is not able to be downloaded anymore, even though the user receives it in their mail.

I would like the download option to still be available if they want to download it at another time.





AH

What are you trying to change the name to ??


You are trying to change a function that requires the variables $invoiceNumber and $layout

You should continue to use this function:-

$path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout).'.pdf';


The creation of an invoice name is done in shopFunctionsF


Regards
A

Joomla 4.4.5
php 8.1

mailblade

#2
Thanks for the reply AH.

I'm trying to change the name to: "IKEA_ORDER_" and then the random invoice number after it.

I'll have a look in shopfunctions.

Yes I want to use the one you said I should.

AH

The invoice prefix is adjustable

You can just use a name language override.

COM_VIRTUEMART_FILEPREFIX_INVOICE="invoice_"
Regards
A

Joomla 4.4.5
php 8.1