Page 1 of 3
Add Store logo to invoice
Posted: Wed Aug 26, 2009 11:29 pm
by vimal
Hi All,
I am trying to add the store logo to the invoice shown in the admin so that the shop can straight away print it off from there and have a professional looking invoice. Any ideas how to do it?
I have tried to modify the file admin\view\template\customer\order_invoice.tpl. I have the logo in the admin\view\image folder. But still the image is not loaded. There is a box with the correct alt tag though.
Any suggestions?
Code below.
<body>
<h1><?php echo $text_invoice; ?></h1>
<div class="div1">
<table width="100%">
<tr>
<td>
<img src="admin/view/image/logo.jpg" alt="<?php echo $store; ?>"/><br />
<?php echo $store; ?><br />
<?php echo $address; ?><br />
<?php echo $text_telephone; ?> <?php echo $telephone; ?><br />
<?php if ($fax) { ?>
<?php echo $text_fax; ?> <?php echo $fax; ?><br />
<?php } ?>
<?php echo $email; ?><br />
<?php echo $website; ?></td>
<td align="right" valign="top"><table>
<tr>
<td><b><?php echo $text_invoice_date; ?></b></td>
Re: Add Store logo to invoice
Posted: Thu Aug 27, 2009 1:53 am
by CodeBits
Works for me.
Try <img src="/admin/view/image/logo.jpg" alt="<?php echo $store; ?>"/><br />
Re: Add Store logo to invoice
Posted: Thu Aug 27, 2009 7:01 pm
by vimal
Hi Codebits,
tried that. doesnt work. I get an error on my invoice saying
"Notice: Undefined variable: logo in C:\server\xampp\htdocs\opencart\admin\view\template\customer\order_invoice.tpl on line 16
Re: Add Store logo to invoice
Posted: Thu Aug 27, 2009 10:51 pm
by CodeBits
Are you running this local or on a hosted windows server?
Doesn't make sense that its giving an error of Undefined variable <img src="" /> isn't a variable and the variable of [$store] is already registered.
Have you tried taking out <?php echo $store; ?> from the alt attribute?
Have you tried using an absolute path instead of a relative path?
Re: Add Store logo to invoice
Posted: Fri Aug 28, 2009 5:55 pm
by vimal
Hi Codebits. I am running this on a local server. I have tried to take our the alt tag too.
Can you tell me what is an absolute path and relative path? I thought I was using the absolute path with "/admin/view/image/logo.jpg". Is that what you mean?
Re: Add Store logo to invoice
Posted: Fri Aug 28, 2009 10:58 pm
by CodeBits
vimal wrote:Hi Codebits. I am running this on a local server. I have tried to take our the alt tag too.
Can you tell me what is an absolute path and relative path? I thought I was using the absolute path with "/admin/view/image/logo.jpg". Is that what you mean?
Absolute Path:
http://yourDomainName.com/admin/view/image/logo.jpg
Relative Path: /admin/view/image/logo.jpg
Re: Add Store logo to invoice
Posted: Mon Aug 31, 2009 5:17 pm
by vimal
Tried it. Still doesn't work. I tried putting the absolute link in IE browser and it didn't show the pic too.
In IE, in the store admin/setting/image I can see my store logo nicely displayed. So like you said that logo should not be unknown. Other than putting the link to the pic in the order_invoice.tpl and of course having the pic located in the correct folder is there any other things that I should be doing?
Re: Add Store logo to invoice
Posted: Mon Aug 31, 2009 9:50 pm
by gavin m
try right clicking on your logo and viewing image, then getting the absolute url from the address bar.
If you can view the image that way, the url you get will be the one to use.
There is no reason why a image in that folder is not viewable, unless you have changed the permissions on the folder?
Re: Add Store logo to invoice
Posted: Tue Sep 01, 2009 6:58 am
by vimal
Hi Gavin,
I have given all permssions to all users. When I right click on the image I dont get the view image option.
Any help is greatly appreciated.
Vimal.
Re: Add Store logo to invoice
Posted: Tue Sep 01, 2009 9:10 am
by CodeBits
Give us a link to your store!
Re: Add Store logo to invoice
Posted: Tue Sep 01, 2009 6:44 pm
by vimal
Hi CodeBits,
I am on a local server. Set it up on my computer before I can migrate my existing shop onto opencart. I think it is not a big issue. May be I have messed up the rights and hence it doesn't work. Hopefully in the live server it will work.
Thanks for all your and Galvin's help.
Vimal.
Re: Add Store logo to invoice
Posted: Thu Sep 17, 2009 6:08 pm
by idmesspass
Hy!
I think about now you solved the problem, but for the new people that searches i will put the example of how it works for me.
in: admin\view\template\customer\order_invoice.tpl
before: <?php echo $store; ?><br />
i was putting: <img src="/image/logo1.png" alt="<?php echo $store; ?>" width="214" height="59"/><br />
where the "logo1" for me is another picture at w214Xh59; but for the standard logo of your store use "logo.png" or gif or jpeg etc. depends what termination you use for the picture.
The logo must be in root image folder to work as it is shown. And give some refresh at you browser.
(THANK YOU ALL for the help/support/contributions of that great OPENCART script - is great !)
Re: Add Store logo to invoice
Posted: Sat Apr 03, 2010 7:32 pm
by sizzlingscience
Thanks for this, I've managed to add my logo to the invoice.
I tried to follow the same principle for adding Shipping Method and Payment Method as it appears in the order confirmation email but I'm running into problems and getting an undefined variable error.
Can anyone point me in the right direction?
Thanks, Melanie
Re: Add Store logo to invoice
Posted: Fri May 14, 2010 9:57 am
by ifyouseek
Hey, if i remember correctly you will have to add the <img> line twice into the tpl file.
The first time its for the a single(or the first) invoice generated, then somewere else you have to add it again if you want to print mutliple invoices at once all containing store logo! (this was in 1.4.4 i think)
Re: Add Store logo to invoice
Posted: Wed Jun 16, 2010 1:08 pm
by srunyon1
Is there a change for this in 1.4.7?
this does not work for me.
Re: Add Store logo to invoice
Posted: Wed Jul 07, 2010 11:37 am
by ifyouseek
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 />
<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
Re: Add Store logo to invoice
Posted: Sat Jul 17, 2010 8:19 am
by sbstech
I tried this on my 1.4.8 installation, it did not work. Any ideas?
Re: Add Store logo to invoice
Posted: Wed Sep 29, 2010 9:58 pm
by jtsigns
Following ifyouseeks advice worked a treat, and took me less that 2mins to do. Well done.
Re: Add Store logo to invoice
Posted: Mon Oct 11, 2010 3:15 pm
by srunyon1
awesome works great..!!!!!
Re: Add Store logo to invoice
Posted: Wed Nov 24, 2010 12:22 am
by stevemaskery
I'd just like to add my thanks for this, too. Very helpful and much appreciated.
S