Jump to content

Print Postage Labels Automatically On Invoices


Recommended Posts

Is it possible to put an IF statement on the invoice template to print postage labels depending on what carrier has been selected?


 


So for example....


 


IF carrier 1 is selected then print this image: www.domain.com/label1.jpg


If carrier 2 is selected then print this image: www.domain.com/label2.jpg


 


etc


 


If this is possible what should the code be?


 


I've played about with different options without success so far.


Link to comment
Share on other sites

Thanks for your reply.

 

This still doesn't work. I'm pretty sure that's the code I tried in the first place.

 

I've replaced the carrier name exactly as I have it under Shipping > Carriers and put the correct image link in as follows:

 

{if isset($carrier) && $carrier->name == '2nd Class Post'}
  <img href="http://www.cricket-hockey.com/img/2ndclass.jpg" />
{elseif isset($carrier) && $carrier->name == '1st Class Post'}
  <img href="http://www.cricket-hockey.com/img/1stclass.jpg" />
{/if}

Any ideas what might be wrong?

Link to comment
Share on other sites

in classes/pdf/HTMLTemplateInvoice.php there is the following code:

 $carrier = new Carrier($this->order->id_carrier);

        $tax_breakdowns = $this->getTaxBreakdown();

        $data = array(
            'tax_exempt' => $tax_exempt,
            'use_one_after_another_method' => $this->order_invoice->useOneAfterAnotherTaxComputationMethod(),
            'display_tax_bases_in_breakdowns' => $this->order_invoice->displayTaxBasesInProductTaxesBreakdown(),
            'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown($this->order),
            'shipping_tax_breakdown' => $this->order_invoice->getShippingTaxesBreakdown($this->order),
            'ecotax_tax_breakdown' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
            'wrapping_tax_breakdown' => $this->order_invoice->getWrappingTaxesBreakdown(),
            'tax_breakdowns' => $tax_breakdowns,
            'order' => $debug ? null : $this->order,
            'order_invoice' => $debug ? null : $this->order_invoice,
            'carrier' => $debug ? null : $carrier
        );

Does that mean the $carrier variable is available in invoice.tpl?

Link to comment
Share on other sites

  • 11 months later...

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