Jump to content

How do I insert the order ID on the invoice (PDF)


Recommended Posts

I assume you are using PS v1.6.0.9.  Do the following

 

1) edit \pdf\header.tpl: You are adding this inside the table

<tr>
    <td style="font-size: 14pt; color: #9E9F9E">{$orderref|escape:'html':'UTF-8'}</td>
</tr>

So it should look like this...

<table style="width: 100%">
    <tr>
        <td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%">{$shop_name|escape:'html':'UTF-8'}</td>
    </tr>
    <tr>
        <td style="font-size: 14pt; color: #9E9F9E">{$date|escape:'html':'UTF-8'}</td>
    </tr>
    <tr>
        <td style="font-size: 14pt; color: #9E9F9E">{$title|escape:'html':'UTF-8'}</td>
    </tr>
    <tr>
        <td style="font-size: 14pt; color: #9E9F9E">{$orderref|escape:'html':'UTF-8'}</td>
    </tr>
</table>

2) edit \classes\pdf\HTMLTemplateInvoice.php.  You are adding this to the end of the __construct function

$orderref = HTMLTemplateInvoice::l('Order ').' #'.sprintf('%06d', $this->order->id);
$this->smarty->assign(array(
    'orderref' => $orderref,
));

So the entire function should look like this

public function __construct(OrderInvoice $order_invoice, $smarty)
{
    $this->order_invoice = $order_invoice;
    $this->order = new Order((int)$this->order_invoice->id_order);
    $this->smarty = $smarty;

    // header informations
    $this->date = Tools::displayDate($order_invoice->date_add);

    $id_lang = Context::getContext()->language->id;
    $this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
    // footer informations
    $this->shop = new Shop((int)$this->order->id_shop);

    $orderref = HTMLTemplateInvoice::l('Order ').' #'.sprintf('%06d', $this->order->id);
    $this->smarty->assign(array(
        'orderref' => $orderref,
    ));

}



 

  • Like 5

Share this post


Link to post
Share on other sites

I inserted this code but did not work what am I doing wrong?

 

_________________________________

 

 

public function __construct(OrderInvoice $order_invoice, $smarty)
{
$this->order_invoice = $order_invoice;
$this->order = new Order((int)$this->order_invoice->id_order);
$this->smarty = $smarty;
 
// header informations
$this->date = Tools::displayDate($order_invoice->date_add);
 
$id_lang = Context::getContext()->language->id;
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
 
$orderref = HTMLTemplateInvoice::l('Order ').' #'.sprintf('%06d', $this->order->id);
$this->smarty->assign(array(
        'orderref' => $orderref,
    ));
 
 
}
 
________________________________
 
<table style="width: 100%">
<tr>
<td style="width: 50%">
{if $logo_path}
<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
{/if}
xxxxx
</td>
<td style="width: 50%; text-align: right;">
<table style="width: 100%">
<tr>
<td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%">{$shop_name|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$date|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$title|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$orderref|escape:'html':'UTF-8'}</td>
</tr
 
</table>
</td>
</tr>
</table>

Share this post


Link to post
Share on other sites

Do you have your smarty cache set to never recompile? (advanced preferences > performance).

 

If you followed my instructions then it would work.  I can't read your mind, or see what you have done, so how can I tell you what you did wrong?

  • Like 1

Share this post


Link to post
Share on other sites

  • 1 year later...

 

I inserted this code but did not work what am I doing wrong?

 

_________________________________

 

 

public function __construct(OrderInvoice $order_invoice, $smarty)
{
$this->order_invoice = $order_invoice;
$this->order = new Order((int)$this->order_invoice->id_order);
$this->smarty = $smarty;
 
// header informations
$this->date = Tools::displayDate($order_invoice->date_add);
 
$id_lang = Context::getContext()->language->id;
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
 
$orderref = HTMLTemplateInvoice::l('Order ').' #'.sprintf('%06d', $this->order->id);
$this->smarty->assign(array(
        'orderref' => $orderref,
    ));
 
 
}
 
________________________________
 
<table style="width: 100%">
<tr>
<td style="width: 50%">
{if $logo_path}
<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
{/if}
xxxxx
</td>
<td style="width: 50%; text-align: right;">
<table style="width: 100%">
<tr>
<td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%">{$shop_name|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$date|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$title|escape:'html':'UTF-8'}</td>
</tr>
<tr>
<td style="font-size: 14pt; color: #9E9F9E">{$orderref|escape:'html':'UTF-8'}</td>
</tr
 
</table>
</td>
</tr>
</table>

 

HI please can u tell how to get order->refernce (also called as order->name or order->number) for the same

Share this post


Link to post
Share on other sites

  • 2 weeks later...

I am developing a mobile application using prestashop. I use web service to access the data. But I have a problem if a register a new customer through mobile I am unable to access that account in website. Do anyone have idea for this problem?

 

 

 

 

 

 

Thanks,

Bala

Edited by PoojaVaithy (see edit history)

Share this post


Link to post
Share on other sites

I am developing a mobile application using prestashop. I use web service to access the data. But I am unable to access the web service. The problem is when I give the key as login id the authentication is been asked repeatedly. Can anyone give me a suggestion to recover from this problem?

 

 

 

 

 

Thanks,

Bala

Edited by PoojaVaithy (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More