Jump to content
chris23

[CONTRIBUTION] PDF Customer Invoice

Recommended Posts

Hello Lee @LeeFoster,

I just searched in all pdf invoice files and couldn't find the constant STORE_NAME_ADDRESS. It is neither a standard OsCommerce constant.

Please post the lines where it is used in your file.

Did you add it?

 

Share this post


Link to post
Share on other sites

I believe you have to use the apostrophes for the constant in a function:

$pos_y += ((substr_count('STORE_NAME_ADDRESS', "\n")+1) * 4.4);

and of course, check also if it is defined somewhere

Share this post


Link to post
Share on other sites
10 minutes ago, raiwa said:

I believe you have to use the apostrophes for the constant in a function:


$pos_y += ((substr_count('STORE_NAME_ADDRESS', "\n")+1) * 4.4);

and of course, check also if it is defined somewhere

Apparently it is supposed to use the information from the store configuration but I can't see it defined anywhere to use it.

Share this post


Link to post
Share on other sites
STORE_NAME_ADDRESS

isn't defined in the standard configuration table.

It is

STORE_NAME

and

STORE_ADDRESS

 

Edited by raiwa

Share this post


Link to post
Share on other sites

STORE_NAME_ADDRESS used to be used and was changed.  I still have it in my configuration DB for my old PDF that I still use.


I'm not really a dog.

Share this post


Link to post
Share on other sites

You could just insert it into your DB if you want. 

INSERT INTO `configuration`(
    `configuration_title`,
    `configuration_key`,
    `configuration_value`,
    `configuration_description`,
    `configuration_group_id`,
    `sort_order`,
    `last_modified`,
    `date_added`,
    `use_function`,
    `set_function`
)
VALUES(
    'Store Address and Phone',
    'STORE_NAME_ADDRESS',
    'Put your store name and address here',
    'This is the Store Name, Address and Phone used on printable documents and displayed online',
    1,
    18,
    '2005-06-29 15:52:28',
    '2003-07-17 10:29:22',
    NULL,
    'tep_cfg_textarea('
);

 


I'm not really a dog.

Share this post


Link to post
Share on other sites

I managed to get around that and am now trying to make it work from the admin section via another add on however I am getting the below error now.

Quote

Fatal error: Uncaught Error: Call to a member function format() on string in C:\xampp\htdocs\oscomm\admin\pdfinvoice.php:56 Stack trace: #0 {main} thrown in C:\xampp\htdocs\oscomm\admin\pdfinvoice.php on line 56

Though I suspect this is more to do with me moving it to the admin section than either of the addons

Share this post


Link to post
Share on other sites

Never mind, I was right, it was some of the changes I'd made along with others I'd not taken into consideration and this is now working admin side.

Share this post


Link to post
Share on other sites

@PaulMC

Hi all I am similar problems to others with a blank screen after I moved the shop to it's home.

Installed PDF Customer Invoice v1.6 2016/10/29 on frozen
So it worked / works on test site when it is in the public_html dir but being move to public_html/store gives me a blank page even when full error writing is on in application top does not produce an error on the page still just blank.. debugger gives me the below but I have no idea what file is producing it..
My only guess is it's not happy with an entry in configure but everything else is working.

Error is from https://www.supercheaphobbies.com.au/store/pdfinvoice.php?order_id=6828
Error loading this URI: Could not load the source for blob:https://www.supercheaphobbies.com.au/b3768795-5ed4-4fd6-a22b-afa7a9e4538c.
[Exception... "Failed to open input source 'blob:https://www.supercheaphobbies.com.au/b3768795-5ed4-4fd6-a22b-afa7a9e4538c'"  nsresult: "0x805303f4 (<unknown>)"  location: "JS frame :: resource://devtools/shared/DevToolsUtils.js :: mainThreadFetch/< :: line 631"  data: yes]
Stack: mainThreadFetch/<@resource://devtools/shared/DevToolsUtils.js:631:15
mainThreadFetch@resource://devtools/shared/DevToolsUtils.js:512:10
_getSourceText@resource://devtools/server/actors/source.js:247:27
Line: 631, column: 0

Line 631 if pdfinvoice.php is     $pos_y += $cref_shift_y+6;

Share this post


Link to post
Share on other sites

Ok found the issue. It seems when using file zilla to transfer files it seems to like to screw up files big time

In this case all the files in modules/fpdf folder

Share this post


Link to post
Share on other sites

Some editors and such can add a BOM to the begining of files, which can screw things up.  There's another thread where that happened to a certificate file.


I'm not really a dog.

Share this post


Link to post
Share on other sites

Ok a new question

in frozen

line 251 in admin/order.php how do I change invoice.php to pdfinvoice.php as the pdfinvoice is in the roor dir not the admin dir I have not been able to work out how to make it work

div style="text-align: right; padding-bottom: 15px;"><?php echo tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link('invoice.php', 'oID=' . $_GET['oID']), null, array('newwindow' => true)) . tep_draw_button(IMAGE_ORDERS_PACKINGSLIP, 'document', tep_href_link('packingslip.php', 'oID=' . $_GET['oID']), null, array('newwindow' => true)) . tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link('orders.php', tep_get_all_get_params(array('action')))); ?></div>

As guessed I am trying to replace the invoice in admin with the pdf one

 

Share this post


Link to post
Share on other sites

Unforuntally PDF will not be much use on mobile devices as you would need to download it to view it. As far as I know your still not able to view pdf in mobile device browsers. Hence most people opt for html or plain text.


 

Share this post


Link to post
Share on other sites

Hi @JcMagpie I have no idea why you have mentioned this as it has no bearing on my question

I am seeking assistance in getting pdf invoice to work in the admin area

in frozen

line 251 in admin/order.php how do I change invoice.php to pdfinvoice.php as the pdfinvoice is in the root dir not the admin dir I have not been able to work out how to make it work. Even if I copy pdfinvoice.php to admin it still relies on other files

div style="text-align: right; padding-bottom: 15px;"><?php echo tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link('invoi

Can anyone assist with how to code this correctly

 

Share this post


Link to post
Share on other sites

I don't use this but based on the line you quoted above, try changing....

tep_href_link('invoice.php', 

  to

tep_href_link('pdfinvoice.php', 

You could also try moving your pdfinvoice.php to the admin directory.  I'm assuming there are no instructions with the add-on?

Let us know what happens and maybe we can give a little more guidance.

Dan

Share this post


Link to post
Share on other sites
3 hours ago, supercheaphobb said:

Hi all, am I the only one that wants PDF invoice in the admin customer area?

😂 Sorry only saw that line did not read anything before.


 

Share this post


Link to post
Share on other sites

The answer to your question I think is in the original post for the add-on.

"This contribution is based on PDF Invoice (http://www.oscommerce.com/community/contributions,3027) Apart from recoding PDF Invoice to work client side, "

So the OP has recoded it to work client side! for admin side use the original add-on that this is based on which is codded for admin. You could if your feeling adventurous try combining the two? But either way I'm sure if you look at the original you will see what is needed to make it work admin side.


 

Share this post


Link to post
Share on other sites

The original add-on looks horrid with layout etc so would like to get this this one working

Ok I have had some time to look at this again and copied all the pdf_invoice related files up in to the correct areas in admin and are now getting this error

Fatal error: Uncaught Error: Call to a member function format() on null in /home/xxxx/public_html/store/admin/pdfinvoice.php:53 Stack trace: #0 {main} thrown in /home/xxxxx/public_html/store/admin/pdfinvoice.php on line 53

Line 52 is the first line under the comment line

  // Find Currency Symbol
  $currency_sym = $currencies->format($order->info['currency']);
  $currency_sym = preg_replace( '([0-9Â.]*)', '', $currency_sym);
  $prod_line_sym = '';
  if (DISPLAY_PROD_LINE_CURRENCY == 'true'){$prod_line_sym = $currency_sym . ' ';}

 

Share this post


Link to post
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

×