Jump to content

How to change PDF filename to order-reference code?


irabbit

Recommended Posts

Perhaps the reference code is being formatted at an integer? It worked when I used the following:



/**
* Returns the template filename
*
* @return string filename
*/
public function getFilename()
{
/* $id_lang = Context::getContext()->language->id;
$id_shop = (int)$this->order->id_shop;
$format = '%1$s%2$06d';

if (Configuration::get('PS_INVOICE_USE_YEAR')) {
$format = Configuration::get('PS_INVOICE_YEAR_POS') ? '%1$s%3$s-%2$06d' : '%1$s%2$06d-%3$s';
}

return sprintf(
$format,
Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, $id_shop),
$this->order_invoice->number,
date('Y', strtotime($this->order_invoice->date_add))
).'.pdf';
*/
return $this->order->reference.'.pdf';
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...