Jump to content

[SOLVED] Edit delivery slip


Stroud Vaping

Recommended Posts

Hi,

 

Apologies in advance if this has already been asked, but I have searched and can't find what I'm looking for.

 

What I want to do is add a section to my delivery slips displaying the shipping carrier selected by the customer at checkout, so that when shipping I can easily see what shipping method has been paid for. I'd like to add it below the payment method, to display like below:

 

Order number:

######

Order Date:

######

Payment Method:

######

Shipping Method:

######

 

 

Many thanks in advance for your help!

Luke

Edited by Stroud Vaping (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hi Luke,

what PS version do you use?

It seems that in 1.5.6.0 (probably some earlier 1.5.x. versions as well) this is standard included already:

in file pdf/delivery-slip.tpl:

 

They added this red code:

<b>{l s='Payment Method:' pdf='true'}</b><br />
<table style="width: 100%;">
{foreach from=$order_invoice->getOrderPaymentCollection() item=payment}
<tr>
<td style="width: 50%">{$payment->payment_method}</td>
<td style="width: 50%">{displayPrice price=$payment->amount currency=$order->id_currency}</td>
</tr>
{foreachelse}
<tr>
<td>{l s='No payment'}</td>
</tr>
{/foreach}
</table>
<br />
{if isset($carrier)}
<b>{l s='Carrier:' pdf='true'}</b><br />
{$carrier->name}<br />
<br />
{/if}
 
 
and in file: classes/pdf/HTMLTemplateDeliverySlip.php they modified public function getContent():
public function getContent()
{
$delivery_address = new Address((int)$this->order->id_address_delivery);
$formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
$formatted_invoice_address = '';
 
if ($this->order->id_address_delivery != $this->order->id_address_invoice)
{
  $invoice_address = new Address((int)$this->order->id_address_invoice);
  $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
}
 
$carrier = new Carrier($this->order->id_carrier);
$carrier->name = ($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name);
$this->smarty->assign(array(
'order' => $this->order,
'order_details' => $this->order_invoice->getProducts(),
'delivery_address' => $formatted_delivery_address,
'invoice_address' => $formatted_invoice_address,
'order_invoice' => $this->order_invoice,
'carrier' => $carrier
));
 
return $this->smarty->fetch($this->getTemplate('delivery-slip'));
}
 
N.B. Backup your files before you edit them, just in case...)
 
Hope this helps,
pascal.
  • Like 2
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Hi everyone, is there maybe a way to add the current order status? {$order->current_state} only displays id number of the current state (e.g. 7), but not the name (e.g. Order canceled). Thank you very much for any help with this. 

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...