Post by vimal » Wed Aug 26, 2009 11:29 pm

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>

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by CodeBits » Thu Aug 27, 2009 1:53 am

Works for me.
Try <img src="/admin/view/image/logo.jpg" alt="<?php echo $store; ?>"/><br />

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by vimal » Thu Aug 27, 2009 7:01 pm

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

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by CodeBits » Thu Aug 27, 2009 10:51 pm

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?

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by vimal » Fri Aug 28, 2009 5:55 pm

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?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by CodeBits » Fri Aug 28, 2009 10:58 pm

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

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by vimal » Mon Aug 31, 2009 5:17 pm

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?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by gavin m » Mon Aug 31, 2009 9:50 pm

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?

Active Member

Posts

Joined
Thu Jun 04, 2009 3:23 pm

Post by vimal » Tue Sep 01, 2009 6:58 am

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.

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by CodeBits » Tue Sep 01, 2009 9:10 am

Give us a link to your store!

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by vimal » Tue Sep 01, 2009 6:44 pm

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.

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by idmesspass » Thu Sep 17, 2009 6:08 pm

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 !)

Newbie

Posts

Joined
Thu Sep 17, 2009 5:51 pm

Post by sizzlingscience » Sat Apr 03, 2010 7:32 pm

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

New member

Posts

Joined
Tue Jan 12, 2010 6:03 am

Post by ifyouseek » Fri May 14, 2010 9:57 am

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)

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by srunyon1 » Wed Jun 16, 2010 1:08 pm

Is there a change for this in 1.4.7?
this does not work for me.

Active Member

Posts

Joined
Thu Jan 28, 2010 3:03 pm

Post by ifyouseek » Wed Jul 07, 2010 11:37 am

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

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by sbstech » Sat Jul 17, 2010 8:19 am

I tried this on my 1.4.8 installation, it did not work. Any ideas?

Newbie

Posts

Joined
Sat Jul 17, 2010 7:04 am

Post by jtsigns » Wed Sep 29, 2010 9:58 pm

Following ifyouseeks advice worked a treat, and took me less that 2mins to do. Well done.

http://www.jtsigns.co.uk


Newbie

Posts

Joined
Tue Sep 28, 2010 7:31 pm

Post by srunyon1 » Mon Oct 11, 2010 3:15 pm

awesome works great..!!!!!

Active Member

Posts

Joined
Thu Jan 28, 2010 3:03 pm

Post by stevemaskery » Wed Nov 24, 2010 12:22 am

I'd just like to add my thanks for this, too. Very helpful and much appreciated.
S

Newbie

Posts

Joined
Sat Nov 20, 2010 12:19 am
Who is online

Users browsing this forum: No registered users and 173 guests