Forums / All Other Contributions/Addons / PDF Order Centre-Where's the code generating shipping method text in invoice.php

PDF Order Centre-Where's the code generating shipping method text in invoice.php

Locked
Results 1 to 20 of 34
This thread is locked. New replies are disabled.
25 Aug 2009, 01:58
#1
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

PDF Order Centre-Where's the code generating shipping method text in invoice.php

Hi,

I have installed the PDFOC and Big Royal Mail. The invoice printed shown shipping method in html code, I need to run a function to clean up the html. But I can not find the line where it tells to get the shipping method in invoice.php. can any guru out there can shine me some light.

Thank you in advance for help and suggestion.

Genesis
25 Dec 2009, 17:39
#2
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Dear all,

I have been having problems with the combine use of PDF Order Centre (PDFOC) and Big Royal Mail module.

The problem is when my customer chooses to use royal mail as shipping method. In the invoice PDF file generated, a html code was displayed on the shipping method line just above the total amount line.

I have been looking at the code of invoice.php in the PDFOC mod, I can see they use a function namely PDFOC_html_cleanup, believe to be function more or less the same as striptag(). Every other defined objects have their html tags removed, but for the shipping method. It stays.

Later I have realised that shipping method was declared as a CharVar in the order table of shipping method field. I then have change the variable type to adapt the long html text. Problem still persist.

I then use zen cart admin – order – packing slip. It display perfectly in the browser. So I am sure that the shipping method was taken from elsewhere.

Now question. In the order table of MySQL database, shipping method field. What is the purpose of this field, if system read from this field, when? And where it display?

In the admin – order – packing slip that generated, where is the shipping method code they draw from? Is it possible to rewrite the code to draw the shipping method code from the same place of where the packing slip generate.?

Many thanks in advance for help and suggestion.

Genesis Ruan
21 Feb 2010, 01:14
#3
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Dear All,

This has been bugging me for more than six months now. Trying to sign up the forum in nl but never got approved. Since I can't speak dutch, it's logical that I ask for help here.

PDFOC generate my invoices and packing slip, it's an wonderful addon. But I am never able to get the shipping text show proper on prints. Reason being is becasue the shipping mod I use contain html code and PDFOC may had made no provision to clean it up. So..... it looks something like this on the print out.

[SCR]http://www.gamenano.com/images/PDFOC-ShippingMethodLineFault.jpg[/SCR]

I have been looking at the code, and PDFOC do clean up html code, but I can never find where the shipping method text in the whole of this invoice template file. Below is the code that shows PDFOC do use html clean up in their code.

[PHP] //
if ($pos < PDFOC_BOTTOM_MARGIN) {
$secondpage = true;
return;
}
$pdf->ezSetY($pos);
$cy = $pdf->ezText(zen_date_short($orders_comments->fields['date_added']) ,7); // 7 is font size here
$pdf->ezText("<b>". PDFOC_TEXT_COMMENTS . "</b>",PDFOC_COMMENTS_FONT_SIZE);
$cx = $pdf->getTextWidth(PDFOC_COMMENTS_FONT_SIZE,PDFOC_TEXT_COMMENTS) + PDFOC_LEFT_MARGIN;
$pdf->ezSetY($cy);
$y = $pdf->ezText(pdfoc_html_cleanup($orders_comments->fields['comments']),PDFOC_COMMENTS_FONT_SIZE, array('aleft'=>$cx+10));
$pos = ($y -5);

} // EOIF zen_not_null[/PHP]

So why the shipping method got html code??? :frusty:Please help, you make me one very happy man once I get a clearly printed invoice. Many many thanks for you help.
21 Feb 2010, 02:23
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

I see cleaned comments ... where is that cleaning the shipping? :unsure:
21 Feb 2010, 02:44
#5
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Hi Ajeh,

You have come to my rescue once again! Good question, that is excatly it. I can't find where the shipping_method_text are in the whole of the php file. Can I forward the file to you?

Genesis
21 Feb 2010, 02:59
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Let me try and find one I had to work on and see if I had to address this issue ... might be a few ... :smile:
21 Feb 2010, 03:03
#7
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Ok, Thank you very very much!
21 Feb 2010, 03:03
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

I don't remember the original line but see if you have something similar:
    $pdf->ezText("<b>" . pdfoc_html_cleanup($order->totals[$i]['title']) . "</b>",PDFOC_TABLE_HEADER_FONT_SIZE,array('justification'=> 'right','aright'=>$x));
21 Feb 2010, 03:04
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

NOTE: the download directory is a protected directory to prevent direct downloads ... :smile:
21 Feb 2010, 03:13
#10
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Oh yes forgot about that.

Yes, there is that line on 430. What can I do?

Genesis
21 Feb 2010, 03:18
#11
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

[PHP] $pdf->ezSetY($pos+PDFOC_PRODUCT_TOTALS_LEADING);
$x -= PDFOC_PRICING_COLUMN_SIZES;
$pdf->ezText("<b>" . pdfoc_html_cleanup($order->totals[$i]['title']) . "</b>",PDFOC_TABLE_HEADER_FONT_SIZE,array('justification'=> 'right','aright'=>$x));
$x += PDFOC_PRICING_COLUMN_SIZES;
$pdf->ezSetY($pos+PDFOC_PRODUCT_TOTALS_LEADING);
$pdf->ezText(pdfoc_html_cleanup($order->totals[$i]['text']),PDFOC_TABLE_HEADER_FONT_SIZE,array('justification'=> 'right','aright'=>$x));
// $pdf->addText($x,$pos,PDFOC_PRODUCT_TOTALS_FONT_SIZE,pdfoc_html_cleanup($order->totals[$i]['text']), $order->info['currency_value']);

$pos -=PDFOC_PRODUCT_TOTALS_LEADING;
$nexttotal++;
} // EOFOR $i = $nexttotal[/PHP]
21 Feb 2010, 03:22
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

That is cleaned for the titles but the pdfoc_html_cleanup function does not cleaned for the HTML ... if I am not mistaken ...

See what happens if you add to that the zen_clean_html function around that ...
21 Feb 2010, 03:37
#13
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Oh my god!!! It's been six months. I cannot beleive my eyes. The problem is solved!!!


/admin/includes/modules/pdfoc/templates/invoice.php

Just replace line 430

[PHP]$pdf->ezText("<b>" . pdfoc_html_cleanup($order->totals[$i]['title']) . "</b>",PDFOC_TABLE_HEADER_FONT_SIZE,array('justification'=> 'right','aright'=>$x));[/PHP]

with

[PHP]$pdf->ezText("<b>" . zen_clean_html ($order->totals[$i]['title']) . "</b>",PDFOC_TABLE_HEADER_FONT_SIZE,array('justification'=> 'right','aright'=>$x));[/PHP]

Ajeh you such a knowlegebase. You are diamond! :hug: :clap:
Thank you very much Ajeh!

Now it has a very small problem which I can live with, the text is too long and too big and cause the shipping text cover the total. How do I reduce the size of the shipping method text?
21 Feb 2010, 03:42
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

What is your column size?
define('PDFOC_PRICING_COLUMN_SIZES', '50');

Near the top of the file?
21 Feb 2010, 03:42
#15
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

[SCR]http://www.gamenano.com/images/PDFOC-ShippingMethodLineFault2.jpg[/SCR]
21 Feb 2010, 03:50
#16
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

I tried to change the size of the text but if I do, everything shrinks it and all pushed to the left side with text still overlapping. But hey! I am already a very very happy man!
21 Feb 2010, 03:53
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

if you still have that ® in there you need a clean up for it ...
21 Feb 2010, 03:58
#18
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

http://www.gamenano.com/images/PDFOC-ShippingMethodLineFault3.jpg

I would guess there is something other than the size of the text. Even there are adequate space, the word "kg(s))" seems to find its way to the next line for some reason.

Genesis
21 Feb 2010, 04:03
#19
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Posts:
127
Plugin Contributions:
0

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

if you still have that ® in there you need a clean up for it ...


that ® is that logo - ®

Is this a special case?
21 Feb 2010, 04:08
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: PDF Order Centre-Where's the code generating shipping method text in invoice.php

Well I still see it ... so you can either add it to the zen_clean_html function in the general.php file or clean it in the invoice.php for the PDF ...

The deal is, for HTML emails that ® is fine ... but for TEXT emails and things like the PDF generator things need to be cleaned up a bit more as, you have seen, the PDF doesn't like that HTML mixed in ... :lamo: