Post by navalctm » Thu Oct 31, 2013 1:19 pm

The Logo you are looking at (logo.png) is opencart's official logo which is white.
It will not turn up.

What works for me:
Uploaded fresh logo to somewhere (admin/image)
added the relative path (/admin/imag/mylogo.png)
saved and done !

Newbie

Posts

Joined
Thu Oct 31, 2013 1:16 pm

Post by jsw » Fri Nov 22, 2013 11:59 pm

Deadelus wrote:The proper way to add your logo to the invoice while using the logo configured in the admin is as follows:

1: Edit /admin/controller/sale/order.php and add the following in the invoice() method:

Code: Select all

        if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
            $this->data['logo'] = HTTP_IMAGE . $this->config->get('config_logo');
        } else {
            $this->data['logo'] = '';
        } 
This reads the logo image from the config and adds the correct path to it to the invoice template.

2: Edit /admin/view/template/sale/order_invoice.tpl and add the following code before the <h1> tag:

Code: Select all

  <?php if (!empty($logo)): ?>
  <img src="<?php echo $logo; ?>" alt="Logo" />
  <?php endif; ?>
This checks if there actually is a logo and shows the image.

Please don't add hard coded paths to your templates, it will only annoy you in the future or when you changed your logo and forgot it was hard coded in your invoice template.
Awesome! Did it in v1.5.5.1, thank your for this solution!!

jsw
Newbie

Posts

Joined
Wed Jun 12, 2013 11:42 pm
Location - Canada

Post by jsw » Sat Nov 23, 2013 12:00 am

jsw wrote:
Deadelus wrote:The proper way to add your logo to the invoice while using the logo configured in the admin is as follows:

1: Edit /admin/controller/sale/order.php and add the following in the invoice() method:

Code: Select all

        if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
            $this->data['logo'] = HTTP_IMAGE . $this->config->get('config_logo');
        } else {
            $this->data['logo'] = '';
        }
This reads the logo image from the config and adds the correct path to it to the invoice template.

2: Edit /admin/view/template/sale/order_invoice.tpl and add the following code before the <h1> tag:

Code: Select all

  <?php if (!empty($logo)): ?>
  <img src="<?php echo $logo; ?>" alt="Logo" />
  <?php endif; ?>
This checks if there actually is a logo and shows the image.

Please don't add hard coded paths to your templates, it will only annoy you in the future or when you changed your logo and forgot it was hard coded in your invoice template.
Awesome! Did it in v1.5.5.1, thank you very much for this solution!!

jsw
Newbie

Posts

Joined
Wed Jun 12, 2013 11:42 pm
Location - Canada

Post by vnlvet » Thu Dec 12, 2013 2:33 am

Has anyone modified this to add an image that is different than the store logo? And possibly have it centered in the page?

I tried changinging the file path to point it to a different image and it will not come up.

Edit** Any image works if it is uploaded to the server.. forgot to upload it.

Still looking to figure out how to center it in the page!

New member

Posts

Joined
Tue Jan 22, 2013 2:57 am

Post by stokeyblokey » Thu Dec 12, 2013 7:07 am

To make the image centred you can add a div and centre it like so:

Code: Select all

  <?php if (!empty($logo)): ?>
  <div style="text-align:center"><img src="<?php echo $logo; ?>" alt="Logo" /></div>
  <?php endif; ?>
<h1><?php echo $text_invoice; ?></h1>
I have not tested this exact code but the insertion of the styling div worked on my invoice just now

(I use a vQmod which adds product image and logo to the invoice, available free here which means my order_invoice.tpl code is different to the example used here)

Hope this helps someone!

Cheers,

Stokey

Stokey


User avatar
Active Member

Posts

Joined
Sat Aug 31, 2013 10:19 pm

Post by Pyrocrafter » Mon Jan 06, 2014 8:25 pm

ifyouseek wrote:to add your store logo to your invoice go to admin/view/template/sale/order_invoice.tpl and add <img src="http://yourdomain.com/image/data/title.png"> just before the H1 tag as seen below.

Code: Select all

<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $language; ?>" xml:lang="<?php echo $language; ?>">
<head>
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>" />
<link rel="stylesheet" type="text/css" href="view/stylesheet/invoice.css" />
</head>
<body>

<?php foreach ($orders as $order) { ?>
<div style="page-break-after: always;">
  <img src="http://yourdomain.com/image/data/title.png"><h1><?php echo $text_invoice; ?></h1>
  <div class="div1">
    <table width="100%">
      <tr>
        <td><?php echo $order['store_name']; ?><br />
          <?php echo $order['address']; ?><br />
          <?php echo $text_telephone; ?> <?php echo $order['telephone']; ?><br />
          <?php if ($order['fax']) { ?>
          <?php echo $text_fax; ?> <?php echo $order['fax']; ?><br />
          <?php } ?>
          <?php echo $order['email']; ?><br />
          <?php echo $order['store_url']; ?></td>
        <td align="right" valign="top"><table>
            <tr>
              <td><b><?php echo $text_date_added; ?></b></td>
              <td><?php echo $order['date_added']; ?></td>
            </tr>
            <?php if ($order['invoice_id']) { ?>
            <tr>
              <td><b><?php echo $text_invoice_id; ?></b></td>
              <td><?php echo $order['invoice_id']; ?></td>
            </tr>
            <?php } ?>
            <tr>
              <td><b><?php echo $text_order_id; ?></b></td>
              <td><?php echo $order['order_id']; ?></td>
            </tr>
          </table></td>
      </tr>
    </table>
  </div>
  <table class="address">
    <tr class="heading">
      <td width="50%"><b><?php echo $text_to; ?></b></td>
      <td width="50%"><b><?php echo $text_ship_to; ?></b></td>
    </tr>
    <tr>
      <td><?php echo $order['payment_address']; ?></td>
      <td><?php echo$order['shipping_address']; ?></td>
    </tr>
  </table>
  <table class="product">
    <tr class="heading">
      <td><b><?php echo $column_product; ?></b></td>
      <td><b><?php echo $column_model; ?></b></td>
      <td align="right"><b><?php echo $column_quantity; ?></b></td>
      <td align="right"><b><?php echo $column_price; ?></b></td>
      <td align="right"><b><?php echo $column_total; ?></b></td>
    </tr>
    <?php foreach ($order['product'] as $product) { ?>
    <tr>
      <td><?php echo $product['name']; ?>
        <?php foreach ($product['option'] as $option) { ?>
        <br />
        &nbsp;<small> - <?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
        <?php } ?></td>
      <td><?php echo $product['model']; ?></td>
      <td align="right"><?php echo $product['quantity']; ?></td>
      <td align="right"><?php echo $product['price']; ?></td>
      <td align="right"><?php echo $product['total']; ?></td>
    </tr>
    <?php } ?>
    <?php foreach ($order['total'] as $total) { ?>
    <tr>
      <td align="right" colspan="4"><b><?php echo $total['title']; ?></b></td>
      <td align="right"><?php echo $total['text']; ?></td>
    </tr>
    <?php } ?>
  </table>
</div>
<?php } ?>
</body>
</html>
then go to /admin/view/template/sale/order_invoices.tpl and do the same. Just add the image tag just before the <h1> title tag - simples
Brilliant answer, just did this in less than a minute - Yay!

New member

Posts

Joined
Tue May 14, 2013 4:49 am

Post by fred123 » Fri Jan 24, 2014 8:32 pm

I am getting the following error in the invoice...

Notice: Use of undefined constant HTTP_IMAGE - assumed 'HTTP_IMAGE' in /var/www/vhosts/vvvvvv.co.uk/httpdocs/admin/controller/sale/order.php on line 2343

Any ideas?


Deadelus wrote:The proper way to add your logo to the invoice while using the logo configured in the admin is as follows:

1: Edit /admin/controller/sale/order.php and add the following in the invoice() method:

Code: Select all

        if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
            $this->data['logo'] = HTTP_IMAGE . $this->config->get('config_logo');
        } else {
            $this->data['logo'] = '';
        } 
This reads the logo image from the config and adds the correct path to it to the invoice template.

2: Edit /admin/view/template/sale/order_invoice.tpl and add the following code before the <h1> tag:

Code: Select all

  <?php if (!empty($logo)): ?>
  <img src="<?php echo $logo; ?>" alt="Logo" />
  <?php endif; ?>
This checks if there actually is a logo and shows the image.

Please don't add hard coded paths to your templates, it will only annoy you in the future or when you changed your logo and forgot it was hard coded in your invoice template.

Active Member

Posts

Joined
Fri Aug 26, 2011 3:13 pm

Post by delmi » Thu Dec 04, 2014 10:37 pm

hello,

I would like to ask if anybody knows how to put surname and name on invoice? I added custom text on it and would like to add customer name and surname on this text. For expl. I ”name surname” agree with the term of use of this product, etc.....

thank you.

Newbie

Posts

Joined
Fri Dec 27, 2013 12:26 am

New member

Posts

Joined
Fri Sep 28, 2018 1:37 am
Who is online

Users browsing this forum: No registered users and 112 guests