If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / 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

Started by gamenano on 25 Aug 2009, 1:58 AM · Views: 3,912

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

gamenano

Zen Follower

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

Post #1 by gamenano

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, 5:39 PM
#2
gamenano avatar

gamenano

Zen Follower

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

Post #2 by gamenano

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, 1:14 AM
#3
gamenano avatar

gamenano

Zen Follower

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

Post #3 by gamenano

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.

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

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.

		    //
		    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

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, 2:23 AM
#4
ajeh avatar

ajeh

Oba-san

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

Post #4 by ajeh

I see cleaned comments ... where is that cleaning the shipping? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 2:44 AM
#5
gamenano avatar

gamenano

Zen Follower

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

Post #5 by gamenano

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, 2:59 AM
#6
ajeh avatar

ajeh

Oba-san

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

Post #6 by ajeh

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:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 3:03 AM
#8
ajeh avatar

ajeh

Oba-san

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

Post #8 by ajeh

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 3:04 AM
#9
ajeh avatar

ajeh

Oba-san

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

Post #9 by ajeh

NOTE: the download directory is a protected directory to prevent direct downloads ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 3:18 AM
#11
gamenano avatar

gamenano

Zen Follower

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

Post #11 by gamenano

    $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
21 Feb 2010, 3:22 AM
#12
ajeh avatar

ajeh

Oba-san

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

Post #12 by ajeh

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 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 3:37 AM
#13
gamenano avatar

gamenano

Zen Follower

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

Post #13 by gamenano

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

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

with

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

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, 3:42 AM
#14
ajeh avatar

ajeh

Oba-san

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

Post #14 by ajeh

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

Near the top of the file?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 3:53 AM
#17
ajeh avatar

ajeh

Oba-san

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

Post #17 by ajeh

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2010, 4:08 AM
#20
ajeh avatar

ajeh

Oba-san

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

Post #20 by ajeh

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:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!