Jump to content
detsouvalas

PDF Catalog v.1.5

Recommended Posts

hi

 

maybe can someone help me with fonts encoding.

 

on the site all the text are good (eg: não , ração , etc ) but when i create the pdf file i get não , rção , etc.

 

can someone help me with this ,

 

thz

best regards,

MArio Vital


Mario vital

Share this post


Link to post
Share on other sites
hi

 

maybe can someone help me with fonts encoding.

 

on the site all the text are good (eg: não , ração , etc ) but when i create the pdf file i get não , rção , etc.

 

can someone help me with this ,

 

thz

best regards,

MArio Vital

 

I asked this question in the FPDF.ORG forum and the answer is:

 

"HTML code are not supported in FPDF." If you are using a WYSIWYG editor for your description, any characters with accent are translated in HTML code. On my side, I decided to remove the WYSIWYG editor to solve the problem. But here's a solution somebody post me but I did not tried it!

 

Try get_html_translation_table() before sending the strings. 
Exemple "não" into "não": 

$string = "não"; 
$entities = get_html_translation:tabe(HTML_ENTITIES); 
$translate = array_flip($entities); 
echo strstr( $string, $translate);

Share this post


Link to post
Share on other sites
I asked this question in the FPDF.ORG forum and the answer is:

 

"HTML code are not supported in FPDF." If you are using a WYSIWYG editor for your description, any characters with accent are translated in HTML code. On my side, I decided to remove the WYSIWYG editor to solve the problem. But here's a solution somebody post me but I did not tried it!

 

Try get_html_translation_table() before sending the strings. 
Exemple "não" into "não": 

$string = "não"; 
$entities = get_html_translation:tabe(HTML_ENTITIES); 
$translate = array_flip($entities); 
echo strstr( $string, $translate);

 

or just use html_entity_decode()

Share this post


Link to post
Share on other sites
I am getting the exact same thing. Don't see any answers to your question. Were you able to figure this out? I can click the link to view the catalog but there is nothing there. I did notice that when I am in the admin section the session id is at the end of my url (does not happen on my store- just in admin). And when I click the link to view the pdf catalog the session id is also present. Any suggestions would be helpful.

Please note: I have had many a post looking for answers go unanswered so if I am asking this in the wrong section and a newer sectione exsists out there by all means, PLEASE point me in the right direction.

Thanks a lot!

Pattie

 

All of a sudden getting the same thing, after adding more products to the site.

 

In a differnet browser, the page after generating gives a Memory exhausted error message, instead of the blank screen in IE7.

 

So I tryed to up the memory to no avail.

 

If anyone has the answers, would be appreciated, to save digging through all the files looking?

Share this post


Link to post
Share on other sites

Has anyone figured out how to convert html properly in the pdf's and also export categories separately?

 

It would be even cooler if you could tick products from any category that you want to appear on the pdf for custom exports for individual customers... probably a long way off, that one...

Share this post


Link to post
Share on other sites
Has anyone figured out how to convert html properly in the pdf's

 

If the issue is just with entities, change pdf_catalogue.php

 

1. At the beginning of function DrawCells($data_array), add

$entities = get_html_translation_table(HTML_ENTITIES);

You can add extra items that need translating, but they don't have to be entities:

$entities["abc"]="def";

 

2. At the beginning of each block of text you want entities converted, add

$string = str_replace(array_values($entities),array_keys($entities),$data_array[n]);

and replace the $this->MultiCell reference to use $string instead of $data_array[n]

 

Full example for the product description:

	 if(SHOW_DESCRIPTION)
 {
 	if(strlen($data_array[6]))
	{
		$string = str_replace(array_values($entities),array_keys($entities),$data_array[6]);
 		$this->Cell($data_array[0]+6,5,"",0,0);
 		$this->MultiCell($this->text_fw,5,$string,PRODUCTS_BORDER,'L');
	}
 }

Share this post


Link to post
Share on other sites

hi all,

 

I'm having a problem getting a PDF generated

 

When I click on PDF Introduction under tools in the admin section, I get "TEXT_FILE_DOES_NOT_EXIST" with a back button right below it.

 

When I click "Generate Catalog(s)" under tools and then the save button it runs for a few seconds then I get a page with the heading "PDF Catalog(s) Generation", under that everything is black.

 

I running the latest version of osCommerce and PDF Catalog 2.0.5

 

Thanks for any ideas or tries.

 

Jeremy

Share this post


Link to post
Share on other sites

I have this working in a fashion, but 2 issues

 

Major one is how to compress the number of pages used down much further as even small catagories take up too many pages.

 

I wish their was a way to create a catalogue more tabular, i.e. too have say 2 items per row in 2 columns, that way would cut way down on the number of pages used, i only want the price, manufacturer and product name listed

 

I would also like the option to configure a cut off point for the description text i.e. define ("DESC_TEXT_LENGTH", "200");

where the 200 would be a substr or similar cut off of the description to also limit the number of pages used if a description were enabled.

 

Finally i have a strange issue whereby the generated files images overlap each other sometimes, see http://www.outdoorbits.com/catalogues/cate...%20selected.pdf to see what i mean (I turned on image borders so you can clearly see the overlaps)

 

Any help on any of the above muchly appreciated :)

Share this post


Link to post
Share on other sites
If the issue is just with entities, change pdf_catalogue.php

 

1. At the beginning of function DrawCells($data_array), add

$entities = get_html_translation_table(HTML_ENTITIES);

You can add extra items that need translating, but they don't have to be entities:

$entities["abc"]="def";

 

2. At the beginning of each block of text you want entities converted, add

$string = str_replace(array_values($entities),array_keys($entities),$data_array[n]);

and replace the $this->MultiCell reference to use $string instead of $data_array[n]

 

Full example for the product description:

	 if(SHOW_DESCRIPTION)
 {
 	if(strlen($data_array[6]))
	{
		$string = str_replace(array_values($entities),array_keys($entities),$data_array[6]);
 		$this->Cell($data_array[0]+6,5,"",0,0);
 		$this->MultiCell($this->text_fw,5,$string,PRODUCTS_BORDER,'L');
	}
 }

 

 

Hello, I tried your suggestion above and it worked in getting rid of #&blah blah blah in my pdf catalog. Here is my question to you. Out of necessity and to have my store look professional, I use bullets to list the contents of our products in the descriptions. I Use the WYSIWYG editor for my descriptions. I need to be able to have the bullets show up in the pdf catalog for this to be useful to me. Otherwise there is this big jumbled mess for the description. Can you give me some guidance on how I can accomplish this? Thanks

Share this post


Link to post
Share on other sites

Hello

since 1 week I'm trying to solve my problems with this marvellous contrib..

I used the last 2.0.5 with cathalog.php recend bug fix.

I read all these posts but I didn'd found any of my problems.. is it strange?!??!

 

I've installed the files in all my languages with the appropiate translations..

 

My problems are:

 

1) when I create the cathalog from admin panel.. the file seems to be created without reading the pdf_config file in admin folder.. i.e. the title remail in German 'Katalog PDF' .. and all the config preferences (no image or no border or no links etc.. ) I've applied make no differences..

2) when in the Admin panel I decide to change the intro (777 the intro_file in all languages folder of catalog and admin folder) I see the content ..but when I modify the content and click save I read a parde error : the error point to the intro file in my language at row 13 (but isn't it a txt file??) and point to the general.php error at row:

header('Location: ' . $url);

3) when I click to the Cathalog option in normal oscommerce portal.. I can create at the moment a cathalog of many cathegories: if I click to create the cathalog it works fine but adobe acrobat reader tell that it is not a right PDF document.

4) the same problem if 1) in cathalog portal as admin portal

5) when I click to generate a personal cathalog.. it say to be patient... and then compares the --> DOWNLOAD <-- link: the download link is followed by 4 underscores that point to thes link-error [function.getimagesize]: failed to open stream: No such file or directory in /www/catalog/pdf_fpdf.php on line 1486

Missing or incorrect image file: /www/catalog/images/logo_small.jpgFPDF error: Not a JPEG file: /www/catalog/images/10009C.jpg

Share this post


Link to post
Share on other sites

Hi,

 

After a few days of tweaking I finaly got this incredible great contribution working in all ways !!!

 

- I took v2.05 from 4th May 2007 as a base install

- dont forget to copy FONT folder also in catalog folder !!! Missing in the decription and the path to admin in catalog area didn't work for me ...

 

- The admin area works fine from the start !

 

- For the catalog area the language pick didn't work. I modified pdf_catalog_info2.php as follows after comparing with file from v2.06 :

 

find in line 879 :

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " " .$categories_name['categories_name'].".pdf",false);

 

replace with :

 

$pdf->Output(DIR_FS_CATALOG . "/" . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']."_".$KATEGORIE_SELECTED[$j].".pdf",false);

 

 

- Carefuly follow the setup in both config files, in admin and catalog !

 

- Set the permission for catalugue to 757 ! 755 doesn't work for categories add on !

 

You can see it working at :

- Shop is not online yet, but we are just about to get it running, so please be gentle ... :))

 

http://www.delko.si/sql/eshop/catalog/pdf_...php?language=en

Share this post


Link to post
Share on other sites

Hi,

 

I also have a question ...

 

The HTML entities now works better in English language ! But I still have troubles with Slovenian. ..... We are using eastern european language set and some characters are wrongly decoded ....

 

Is it possible to hard code some entities ?

 

Thanks for any help ! Without this solution the catalog looks very funny in Slovenian language ....

 

Suhy

Share this post


Link to post
Share on other sites
Hi,

 

After a few days of tweaking I finaly got this incredible great contribution working in all ways !!!

 

- I took v2.05 from 4th May 2007 as a base install

- dont forget to copy FONT folder also in catalog folder !!! Missing in the decription and the path to admin in catalog area didn't work for me ...

 

- The admin area works fine from the start !

 

- For the catalog area the language pick didn't work. I modified pdf_catalog_info2.php as follows after comparing with file from v2.06 :

 

find in line 879 :

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " " .$categories_name['categories_name'].".pdf",false);

 

replace with :

 

$pdf->Output(DIR_FS_CATALOG . "/" . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']."_".$KATEGORIE_SELECTED[$j].".pdf",false);

- Carefuly follow the setup in both config files, in admin and catalog !

 

- Set the permission for catalugue to 757 ! 755 doesn't work for categories add on !

 

You can see it working at :

- Shop is not online yet, but we are just about to get it running, so please be gentle ... :))

 

http://www.delko.si/sql/eshop/catalog/pdf_...php?language=en

 

 

Forgot to add categories language also for "all categories in one file pdf output" :

 

in line 860 (pdf_catalog_info2.php) find :

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " all selected.pdf",false);

 

and replace with :

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']. " all selected.pdf",false);

 

That's all, works fine now !

Share this post


Link to post
Share on other sites

wow

thanks for last suggestion..

i've applied the '/' modify to the PDF-> output and the result is that the ->DOWNLOAD<- is clear without underscores under the word 'DOWNLOAD' which link to error in the path

 

thanks

 

then: remain only one big problem.. if you select 'only one file' enad not 'one file per category' you have a DOWNLOAD link that point to a file that doesn't exist anywhere but FPDF create the 5 category PDF files..

 

and Acrobat tries to open a file that doesn't exist.. giving the error that the file is not a correct pdf document.

Share this post


Link to post
Share on other sites
wow

thanks for last suggestion..

i've applied the '/' modify to the PDF-> output and the result is that the ->DOWNLOAD<- is clear without underscores under the word 'DOWNLOAD' which link to error in the path

 

thanks

 

then: remain only one big problem.. if you select 'only one file' enad not 'one file per category' you have a DOWNLOAD link that point to a file that doesn't exist anywhere but FPDF create the 5 category PDF files..

 

and Acrobat tries to open a file that doesn't exist.. giving the error that the file is not a correct pdf document.

 

Hi,

 

Try the following : for selecting multiple categories => PDF output in one file

 

- line 860 defines PDF output and what the link of PDF looks like !

 

- make a single PDF catalog from multiple categories and just hoover the mouse on the link !

- read the link and compare it with the made PDF file in "catalogue" directory

 

- Be carefull to undescores _

- bold "_" in bellow code puts _ in the PDF output file ...

 

- Just tweak the code to match your PDF file output

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']. " all selected.pdf",false);

 

categories_8 all selected.pdf => with "_"

 

categories 8 all selected.pdf => without "_"

 

- If your output file has a different name or you'll have problems, paste the name of PDF output and I'll try to help ...

 

regards,

suhy

Share this post


Link to post
Share on other sites
Hi,

 

Try the following : for selecting multiple categories => PDF output in one file

 

- line 860 defines PDF output and what the link of PDF looks like !

 

- make a single PDF catalog from multiple categories and just hoover the mouse on the link !

- read the link and compare it with the made PDF file in "catalogue" directory

 

- Be carefull to undescores _

- bold "_" in bellow code puts _ in the PDF output file ...

 

- Just tweak the code to match your PDF file output

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']. " all selected.pdf",false);

 

categories_8 all selected.pdf => with "_"

 

categories 8 all selected.pdf => without "_"

 

- If your output file has a different name or you'll have problems, paste the name of PDF output and I'll try to help ...

 

regards,

suhy

 

categories_8 all selected.pdf

 

Don't mind the number in the file code as it's generated with . $languages[$i]['id']. and represents the language code ....

Share this post


Link to post
Share on other sites
If the issue is just with entities, change pdf_catalogue.php

 

1. At the beginning of function DrawCells($data_array), add

$entities = get_html_translation_table(HTML_ENTITIES);

You can add extra items that need translating, but they don't have to be entities:

$entities["abc"]="def";

 

2. At the beginning of each block of text you want entities converted, add

$string = str_replace(array_values($entities),array_keys($entities),$data_array[n]);

and replace the $this->MultiCell reference to use $string instead of $data_array[n]

 

Full example for the product description:

	 if(SHOW_DESCRIPTION)
 {
 	if(strlen($data_array[6]))
	{
		$string = str_replace(array_values($entities),array_keys($entities),$data_array[6]);
 		$this->Cell($data_array[0]+6,5,"",0,0);
 		$this->MultiCell($this->text_fw,5,$string,PRODUCTS_BORDER,'L');
	}
 }

 

 

Hi,

 

Even that I usualy figure simple things out, I have often a problem with some basic stuff since I'm a self learning php begginer ... so please point me a bit ...

 

I wanted to try if your above idea would also work to replace entities that are generated couse of mine HTML editor TyneMCE that we use. The problem is the output of our legeb our legendary characters like č and š. Other is OK !

 

String generated is for example : š = š

 

Probably I'm failing at positioning the code at :

$entities = get_html_translation_table(HTML_ENTITIES);

$entities["abc"]="def";

 

Did I did it OK like : ?

 

function DrawCells($entities = get_html_translation_table(HTML_ENTITIES);$entities["abc"]="def";$data_array)

 

or should I put it somhere else ???

 

For the SHOW DESCRIPTION is obvious ....

 

Do you think that the above could work for my č and š ?

 

I also tried to change used fonts if these characters were missing ... I generated the php and z files and uploaded them. Then I had troubles with adding the font to fpdf and setting the font ... just didn't work for me. I would need more thorough instructions. I tried per fpdf instruction but no result.

Is adding and setting fonts with this mod for Oscomm any different ?

 

Or if somebody already have a solution for š and č, please post !

 

THANKS !

Share this post


Link to post
Share on other sites
Hi,

 

Even that I usualy figure simple things out, I have often a problem with some basic stuff since I'm a self learning php begginer ... so please point me a bit ...

 

I wanted to try if your above idea would also work to replace entities that are generated couse of mine HTML editor TyneMCE that we use. The problem is the output of our legeb our legendary characters like č and š. Other is OK !

 

String generated is for example : š = š

 

Probably I'm failing at positioning the code at :

$entities = get_html_translation_table(HTML_ENTITIES);

$entities["abc"]="def";

 

Did I did it OK like : ?

 

function DrawCells($entities = get_html_translation_table(HTML_ENTITIES);$entities["abc"]="def";$data_array)

 

or should I put it somhere else ???

 

For the SHOW DESCRIPTION is obvious ....

 

Do you think that the above could work for my č and š ?

 

I also tried to change used fonts if these characters were missing ... I generated the php and z files and uploaded them. Then I had troubles with adding the font to fpdf and setting the font ... just didn't work for me. I would need more thorough instructions. I tried per fpdf instruction but no result.

Is adding and setting fonts with this mod for Oscomm any different ?

 

Or if somebody already have a solution for š and č, please post !

 

THANKS !

 

 

 

Anyone for some help on this one ?

Share this post


Link to post
Share on other sites

I have made the changes as suggested to the pdf_catalogue_info2 file . but my categories still fails to work.

you can see it at http://www.northlandlending.com/shop/pdf_catalogue_info.php

 

When i create a pdf catalog in admin it only shows catalog_1.pdf in the catalog folder.

is this what is suppose to happen or is it suppose to make one for each category ?

 

I use only english.

here is my pdf_catalogue_info2 file

 

Any help would be greatly appreciated

 

//Anzeigen des Download Links und verstecken der Fehlermeldungen mit weißer Schrift!!! ;)

//Fehler: foreach und Session //Nicht störend bei den Funktionen!

define('FPDF_FONTPATH','font/');

require('pdf_config.php');

require('pdf_fpdf.php');

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PDF_KATALOG);

 

if ($no_of_files == 'one_file') {

echo "<style type=\"text/css\">"

.".mini {font-size: 1pt;};"

."</style>"

."<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/Original/stylesheet.css\">";

echo '<center>==>&npsp;<a href="'.$file_PDF.' all selected.pdf" target="_blank"><font size="2" face="verdana"><b>Download</b></font></a>&npsp;<==</center>';

echo '<font color="#FFFFFF" class="mini">';

}

else {

$KATEGORIE_SELECTED = explode("|", $KAT_SELECTED_ARRAY);

echo "<style type=\"text/css\">"

.".mini {font-size: 1pt;};"

."</style>"

."<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/Original/stylesheet.css\">";

for ($i=0; $i<$ANZAHL_KATEGORIEN; $i++) {

$categories_name_query = tep_db_query('select categories_name from ' . TABLE_CATEGORIES_DESCRIPTION . ' where categories_id = "' . $KATEGORIE_SELECTED[$i] . '"');

$categories_name = tep_db_fetch_array($categories_name_query);

echo '<center>==>&npsp;<a href="'.$file_PDF.' '.$categories_name['categories_name'].'.pdf" target="_blank"><font size="2" face="verdana"><b>Download</b></font></a>&npsp;<==</center>';

}

echo '<font color="#FFFFFF" class="mini">'; }

//Neuerung ab Version 1.6

if (isset($PDF_ACTION)){

 

//Exportieren der Daten aus dem "Array" zurück in das wirkliche Array!!!

$KATEGORIE_SELECTED = explode("|", $KAT_SELECTED_ARRAY);

 

 

 

// Count how many products exist in a category

// TABLES: products, products_to_categories, categories

function tep_products_in_category_count($categories_id, $include_deactivated = false) {

$products_count = 0;

 

if ($include_deactivated) {

$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$categories_id . "'");

} else {

$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$categories_id . "'");

}

 

$products = tep_db_fetch_array($products_query);

 

$products_count += $products['total'];

 

$childs_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$categories_id . "'");

if (tep_db_num_rows($childs_query)) {

while ($childs = tep_db_fetch_array($childs_query)) {

$products_count += tep_products_in_category_count($childs['categories_id'], $include_deactivated);

}

}

 

return $products_count;

}

 

 

$products_index_array;

 

class PDF extends FPDF

{

//Colonne courante

var $col=0;

//Ordonnée du début des colonnes

var $y0;

var $categories_string_spe = '';

var $categories_string = '';

var $categories_id = '';

var $levels = '';

var $parent_category_name;

var $ifw = 0; //internal width margin for the products (image and text) description

var $text_fw = 0; //text width for the products (text) description

var $ifh = 0; //internal height margin for the products description

var $products_index_array;

var $products_index_list='';

 

function Header()

{

//Background Color

$background_color_table=explode(",",BACKGROUND_COLOR);

$this->SetFillColor($background_color_table[0], $background_color_table[1], $background_color_table[2]);

$this->ifw = $this->fw * 0.95; // A4 portrait = 200

$this->ifh = $this->fh * 0.87; // A4 portrait = 260

$this->Rect(0,0,$this->fw,$this->fh,F); // Draw background

 

//Logo: If LOGO_IMAGE defined, show image with logo, else show text

if (PDF_LOGO) {

$this->Image(DIR_FS_CATALOG.DIR_WS_IMAGES.PDF_LOGO,10,8,0,29);

} else {

$this->SetFont('Arial','B',18);

$this->SetLineWidth(0);

$w=$this->GetStringWidth(PDF_TITLE)+6;

//$this->SetX((210-$w)/2);

$this->SetFillColor(100,100,100);

$this->Cell($w,9,PDF_TITLE,0,0,'C');

}

//Année en cour

$aujourdhui = getdate();

$annee = strftime(PDF_DATE_FORMAT);

 

$this->SetFont('Arial','B',12);

$this->Cell(0,9,$annee." ",0,1,'R');

if (PDF_LOGO) {

$this->Ln(20);

} else {

$this->Ln(2);

}

$x=$this->GetX();

$y=$this->GetY();

$this->Line($x,$y,$this->ifw,$y);

$this->Ln(3);

//Schutz der Ordinate

$this->y0=$this->GetY();

}

 

function Footer()

{

//Pied de page

$this->SetY(-15);

$x=$this->GetX();

$y=$this->GetY();

$this->SetLineWidth(0.2);

$this->Line($x,$y,$this->ifw,$y);

$this->SetFont('Arial','I',8);

$this->Cell(0,10,PDF_TXT_PAGE.$this->PageNo().'/{nb} ',0,0,'R');

}

 

function CheckPageBreak($h)

{

//Wenn die Höhe h débordement, manuellen Seitensprung verursacht //$x=$this->SetX(56);

if($this->GetY()+$h>$this->PageBreakTrigger) $this->AddPage($this->CurOrientation);

}

 

function NbLines($w,$txt)

{

//Rechnen Sie die Anzahl der Linien, daß MultiCell von Breite w besetzt

$cw=&$this->CurrentFont['cw'];

if($w==0)

$w=$this->w-$this->rMargin-$this->x;

$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

$s=str_replace("\r",'',$txt);

$nb=strlen($s);

if($nb>0 and $s[$nb-1]=="\n")

$nb--;

$sep=-1;

$i=0;

$j=0;

$l=0;

$nl=1;

while($i<$nb)

{

$c=$s[$i];

if($c=="\n")

{

$i++;

$sep=-1;

$j=$i;

$l=0;

$nl++;

continue;

}

if($c==' ')

$sep=$i;

$l+=$cw[$c];

if($l>$wmax)

{

if($sep==-1)

{

if($i==$j)

$i++;

}

else

$i=$sep+1;

$sep=-1;

$j=$i;

$l=0;

$nl++;

}

else

$i++;

}

return $nl;

}

 

function LineString($x,$y,$txt,$cellheight)

{

//calculate the width of the string

$stringwidth=$this->GetStringWidth($txt);

//calculate the width of an alpha/numerical char

$numberswidth=$this->GetStringWidth('1');

$xpos=($x+$numberswidth);

$ypos=($y+($cellheight/2));

$this->Line($xpos,$ypos,($xpos+$stringwidth),$ypos);

}

 

function ShowImage(&$width,&$height,$link,$path)

{

$width=min($width,MAX_IMAGE_WIDTH);

$height=min($height,MAX_IMAGE_HEIGHT);

 

if(RESIZE_IMAGES) {

$destination =DIR_FS_CATALOG."catalogues/";

if(substr(strtolower($path), (strlen($path)-4),4)==".jpg" || substr(strtolower($path), (strlen($path)-5),5)==".jpeg") {

$src=imagecreatefromjpeg($path);

} else if (substr(strtolower($path), (strlen($path)-4),4)==".png") {

$src=imagecreatefrompng($path);

} else {

echo "Only PNG and JPEG";

exit();

}

 

$array=explode("/", $path);

$last=sizeof($array);

$size = getimagesize($path);

if($size[0] > $size[1]) {

$im=imagecreate($width/PDF_TO_MM_FACTOR, $height/PDF_TO_MM_FACTOR);

imagecopyresized($im, $src, 0, 0, 0, 0,$width/PDF_TO_MM_FACTOR, $height/PDF_TO_MM_FACTOR, $size[0], $size[1]);

} else {

$im=imagecreate($height/PDF_TO_MM_FACTOR,$width/PDF_TO_MM_FACTOR);

imagecopyresized($im, $src, 0, 0, 0, 0, $height/PDF_TO_MM_FACTOR, $width/PDF_TO_MM_FACTOR, $size[0], $size[1]);

}

if(!imagejpeg($im, $destination.$array[$last-1])) {

exit();

}

 

$path=$destination.$array[$last-1];

$this->SetLineWidth(1);

$this->Cell($width+3,$height,"",1,0);

$this->SetLineWidth(0.2);

$this->Image($path,($this->GetX()-$width), $this->GetY(), $width, $height,'',$link);

$this->SetFont('Arial','',8);

unlink($path);

} else {

$this->SetLineWidth(1);

// NH $this->Cell($width,$height,"",1,0);

$this->Cell($width+3,$height,"",SIZE_BORDER_IMAGE,0);

$this->SetLineWidth(0.2);

//NH $this->Image($path,($this->GetX()-$width), $this->GetY(), $width, $height,'',$link);

$this->Image($path,($this->GetX()-$width), $this->GetY(),$width ,'' ,'',$link);

$this->SetFont('Arial','',8);

}

}

 

 

//Ordnen des Baumes (Niveau ist das Niveau der unter- Kategorie)

function Order($cid, $level, $foo, $cpath)

{

if ($cid != 0) {

if($level>1) {

$nbspaces=7;

$dessinrep="|___ ";

//ich drehe die Zeichnung um

$revstring = strrev($dessinrep);

//ich ihn füge nbspace für jedes Niveau von unter- repertoire hinzu

$revstring .= str_repeat(" ",$nbspaces*($level-2));

//je réinverse la chaine

$this->categories_string_spe .= strrev($revstring);

}

$this->levels .=$level." ";

$this->categories_id .= $cid." ";

$this->categories_string .= $foo[$cid]['name'];

$this->categories_string_spe .= $foo[$cid]['name'];

 

if (SHOW_COUNTS) {

$products_in_category = tep_products_in_category_count($cid,'false');

if ($products_in_category > 0) {

$this->categories_string_spe .= ' (' . $products_in_category . ')';

}

}

$this->categories_string .= "\n";

$this->categories_string_spe .= "\n";

}

//Parcourir l'arbre des categories (lecture de la table de hachage comme en Perl)

if (sizeof($foo) > 0 ) {

foreach ($foo as $key => $value) {

if ($foo[$key]['parent'] == $cid) {

$this->Order($key, $level+1, $foo, $cid);

}

}

}

}

 

function ParentsName($current_category_level,$i,&$categorieslevelsarray, &$categoriesnamearray)

{

 

$k=$i;

while($k>0) {

if($categorieslevelsarray[$k] == ($current_category_level-1)) {

$this->$parent_category_name=$categoriesnamearray[$k];

break;

}

$k--;

}

}

 

function CalculatedSpace($y1,$y2,$imageheight)

{

//Wenn die Kommentare sind - wichtig, daß das Bild beim Anschlagraum

if(($h2=$y2-$y1) < $imageheight) {

$this->Ln(($imageheight-$h2)+3);

} else {

$this->Ln(3);

}

}

 

function PrepareIndex($name,$manufacturer,$category)

{

$this->products_index_array[] = array (

'name' => substr($name,0,55),

'manufacturer' => substr($manufacturer,0,20),

'category' => substr($category,0,18),

'page' => $this->PageNo());

}

 

function DrawIndex()

{

//5 = Höhe der Zellen

$h= 5 * sizeof($this->products_index_array) ."<br>";

if($h< $this->ifh) {

$this->CheckPageBreak($h);

}

$this->AddPage();

$this->Ln(5);

// echo "<br>HHHH sizeof= " . sizeof($this->products_index_array);

 

if (!function_exists(CompareIndex)) {

function CompareIndex($a, $B)

{

// return strcmp($a['name'], $b['name']);

return strncasecmp($a['name'],$b['name'],8); // seulement les 8 premiers caracteres

}

}

usort($this->products_index_array, CompareIndex);

 

$this->SetFont('Courier','B',11);

$this->Cell(1,11,"",0,0);

$this->MultiCell($this->ifw,11,PDF_INDEX_HEADER,0,'C');

$this->SetFont('Courier','',11);

if (strlen(INDEX_SEPARATOR) < 1) {

$index_separator=" ";

} else {

$index_separator=INDEX_SEPARATOR;

}

foreach ($this->products_index_array as $key => $value) {

if (strlen($value['manufacturer']) > 0) {

$ligne_index = str_pad($value['name']." - ". $value['manufacturer'],53,$index_separator,STR_PAD_RIGHT);

} else {

$ligne_index = str_pad($value['name'],53,$index_separator,STR_PAD_RIGHT);

}

$ligne_index .= str_pad($value['category'],18,$index_separator,STR_PAD_LEFT);

$ligne_index .= str_pad($value['page'], 5, $index_separator, STR_PAD_LEFT);

$this->Cell(1,6,"",0,0);

$this->MultiCell(0,6,$ligne_index,0,'C');

// echo "<br>HHHH : " . $ligne_index;

}

// echo "<br>HHHH wpt =" .$this->wPt . " fw =" . $this->fw. " ifw =" . $this->ifw ." text_fw =" . $this->text_fw;

// echo "<br>HHHH hpt =" .$this->hPt . " fh =" . $this->fh. " ifh =" . $this->ifh;

}

 

function DrawCells($data_array)

{

$totallines=0;

for($i=2;$i<(sizeof($data_array)-1);$i++)

{

$totallines+=$this->NbLines(($this->ifw -$data_array[0]),$data_array[$i]);

}

 

//5 = Höhe der Zellen - eigentlich Faktor für Füllung der Seite

$h=5*($totallines+1)."<br>";

 

//wenn die Beschreibung des Produktes nicht die ganze Seite nimmt

if($h< $this->ifh)

{

$this->CheckPageBreak($h);

}

 

 

if(SHOW_PRODUCTS_LINKS)

{ // NH DIR_WS_CATALOG

$link=HTTP_SERVER . DIR_WS_HTTP_CATALOG ."product_info.php?products_id=".$data_array[10]."&language=".$data_array[11];

}

else

{

$link='';

}

 

if(SHOW_IMAGES && strlen($data_array[12]) && file_exists($data_array[12]))

{

//If Small Image Width and Small Image Height are defined

if(strlen($data_array[0])>1 && strlen($data_array[1])>1)

{

$this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

$y1=$this->GetY();

}

//If only Small Image Width is defined

else if(strlen($data_array[0])>1 && strlen($data_array[1]))

{

$heightwidth=getimagesize($data_array[12]);

$data_array[0]=$data_array[0];

$data_array[1]=$heightwidth[1]*PDF_TO_MM_FACTOR;

$this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

$y1=$this->GetY();

}

//If only Small Image Height is defined

else if(strlen($data_array[0]) && strlen($data_array[1])>1)

{

$heightwidth=getimagesize($data_array[12]);

$data_array[0]=$width=$heightwidth[0]*PDF_TO_MM_FACTOR;

$data_array[1]=$data_array[1];

$this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

$y1=$this->GetY();

}

else

{

$heightwidth=getimagesize($data_array[12]);

$data_array[0]=$heightwidth[0]*PDF_TO_MM_FACTOR;

$data_array[1]=$heightwidth[1]*PDF_TO_MM_FACTOR;

$this->ShowImage($data_array[0],$data_array[1],$link,$data_array[12]);

$y1=$this->GetY();

}

 

//Margin=10

$this->SetX(10);

}

else

{

$data_array[0]=$data_array[1]=0;

$y1=$this->GetY();

$this->SetFont('Arial','',8);

}

// Calcul l'espace libre a droite de l'image

$this->text_fw = $this->ifw - 18 - $data_array[0];

 

if(SHOW_NAME)

{

if(strlen($data_array[2]))

{

// Cell(marge gauche, hauteur, text, bordure, )

$this->Cell($data_array[0]+6,5,"",0,0);

$x=$this->GetX();

$y=$this->GetY();

$name_color_table=explode(",",NAME_COLOR);

$this->SetFillColor($name_color_table[0],$name_color_table[1],$name_color_table[2]);

$this->MultiCell($this->text_fw,5,$data_array[2],PRODUCTS_BORDER,'L',1);

}

}

if(SHOW_MODEL)

{

if(strlen($data_array[3]))

{

$this->Cell($data_array[0]+6,5,"",0,0);

$this->MultiCell($this->text_fw,5,PDF_TXT_MODEL.$data_array[3],PRODUCTS_BORDER,'L');

}

}

 

if(SHOW_DATE_ADDED)

{

if(strlen($data_array[4]))

{

$this->Cell($data_array[0]+6,5,"",0,0);

$this->MultiCell($this->text_fw,5,$data_array[4],PRODUCTS_BORDER,'L');

}

}

if(SHOW_MANUFACTURER)

{

if(strlen($data_array[5])) {

$this->Cell($data_array[0]+6,5,"",0,0);

$this->SetFont('Arial','I');

$this->MultiCell($this->text_fw,5,PDF_TXT_MANUFACTURER.$data_array[5],PRODUCTS_BORDER,'L');

$this->SetFont('Arial','');

}

}

// NH si il n'y a pas de bordure, ajout d'un petit separateur

if (!PRODUCTS_BORDER) {

$this->Cell($data_array[0]+6,2,"",0,0);

$x=$this->GetX();

$y=$this->GetY();

$this->MultiCell($this->text_fw,1,"",0,'C');

//$this->LineString($x+3,$y," ",2);

$this->Line($x+4,$y,$x+15,$y);

}

if(SHOW_DESCRIPTION)

{

if(strlen($data_array[6]))

{

$this->Cell($data_array[0]+6,5,"",0,0);

$this->MultiCell($this->text_fw,5,$data_array[6],PRODUCTS_BORDER,'L');

}

}

if(SHOW_TAX_CLASS_ID)

{

if(strlen($data_array[7]))

{

$this->Cell($data_array[0]+6,5,"",0,0);

$this->MultiCell($this->text_fw,5,$data_array[7],PRODUCTS_BORDER,'L');

}

 

}

if(VAT == '1')

{

$vatprice_query=tep_db_query("select p.products_id, p.products_tax_class_id, tr.tax_rate from " . TABLE_PRODUCTS . " p, " . TABLE_TAX_RATES . " tr where p.products_id = '" . $data_array[10] . "' and p.products_tax_class_id = tr.tax_class_id");

while($vatprice1 = tep_db_fetch_array($vatprice_query)) {

$steuer = $vatprice1['tax_rate'];

}

$vatprice=sprintf("%01.".DIGITS_AFTER_DOT."f",(($steuer/100)*$data_array[9])+$data_array[9]);

$vatspecialsprice=sprintf("%01.".DIGITS_AFTER_DOT."f",(($steuer/100)*$data_array[8])+$data_array[8]);

}

else

{

$vatprice=sprintf("%01.".DIGITS_AFTER_DOT."f",$data_array[9]);

$vatspecialsprice=sprintf("%01.".DIGITS_AFTER_DOT."f",$data_array[8]);

}

if(SHOW_PRICES)

{

// NH si il n'y a pas de bordure, ajout d'un petit separateur

if (!PRODUCTS_BORDER) {

$this->Cell($data_array[0]+6,2,"",0,0);

$x=$this->GetX();

$y=$this->GetY();

$this->MultiCell($this->text_fw,1,"",0,'C');

//$this->LineString($x+3,$y," ",2);

$this->Line($x+4,$y,$x+15,$y);

}

 

if(strlen($data_array[8])) //If special price

{

$this->Cell($data_array[0]+6,5,"",0,0);

 

$x=$this->GetX();

$y=$this->GetY();

$specials_price_color_table=explode(",",SPECIALS_PRICE_COLOR);

$this->SetTextColor($specials_price_color_table[0],$specials_price_color_table[1],$specials_price_color_table[2]);

$this->SetFont('Arial','B','');

 

 

if(CURRENCY_RIGHT_OR_LEFT == 'R') {

$this->MultiCell($this->text_fw,5,$vatprice.CURRENCY."\t\t\t".$vatspecialsprice.CURRENCY,PRODUCTS_BORDER,'L'); // le rajout d'un param ,1 remplie la couleur de fond );

} else if (CURRENCY_RIGHT_OR_LEFT == 'L') {

$this->MultiCell($this->text_fw,5,CURRENCY.$vatprice."\t\t\t".CURRENCY.$vatspecialsprice,PRODUCTS_BORDER,'L'); // le rajout d'un param ,1 remplie la couleur de fond );

} else {

echo "<b>Choose L or R for CURRENCY_RIGHT_OR_LEFT</b>";

exit();

}

$this->LineString($x,$y,$vatprice.CURRENCY,5);

}

else if(strlen($data_array[9]))

{

$this->Cell($data_array[0]+6,5,"",0,0);

if(CURRENCY_RIGHT_OR_LEFT == 'R') {

$this->MultiCell($this->text_fw,5,$vatprice.CURRENCY,PRODUCTS_BORDER,'L');

}else if(CURRENCY_RIGHT_OR_LEFT == 'L') {

$this->MultiCell($this->text_fw,5,CURRENCY.$vatprice,PRODUCTS_BORDER,'L');

} else {

echo "<b>Choose L or R for CURRENCY_RIGHT_OR_LEFT</b>";

exit();

}

}

$this->SetTextColor(0,0,0);

}

$y2=$this->GetY();

 

// wenn die Beschreibung des Produktes nicht die ganze Seite nimmt

if($h< $this->ifh)

{

$this->CalculatedSpace($y1,$y2,$data_array[1]);

}

else

{

$this->Ln(5);

}

 

}

 

function CategoriesTree($languages_id,$languages_code,$KATEGORIE_SELECTED,$ANZAHL_KATEGORIEN)

{

global $no_of_files;

if ($no_of_files == 'one_file') {

$addquery = " AND (";

for ($j=0; $j<$ANZAHL_KATEGORIEN; $j++) {

$cats[] = $KATEGORIE_SELECTED[$j]; // current catID as starting value

// put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches

for($i=0;$i<count($cats);$i++) {

$categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'");

while ($categorie = tep_db_fetch_array($categorie_query)) {

$cats[] = $categorie['categories_id'];

}

$cats=array_unique($cats); // sort out doubles

}}

$cats = implode(',', $cats);

$lenght = (strlen($cats)+1)/2;

$cats = explode(',', $cats);

$addquery .= "c.categories_id='".$cats[0]."'";

for ($k=1; $k<$lenght; $k++) {

$addquery .= " OR c.categories_id='".$cats[$k]."'"; }

$addquery .= ")";

}

else {

$cats[] = $KATEGORIE_SELECTED; // current catID as starting value

// put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches

for($i=0;$i<count($cats);$i++) {

$categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'");

while ($categorie = tep_db_fetch_array($categorie_query)) {

$cats[] = $categorie['categories_id'];

}

$cats=array_unique($cats); // sort out doubles

}

$cats = implode(',', $cats);

$lenght = (strlen($cats)+1)/2;

$cats = explode(',', $cats);

$addquery = " AND (c.categories_id='".$cats[0]."'";

for ($i=1; $i<$lenght; $i++) {

$addquery .= " OR c.categories_id='".$cats[$i]."'"; }

$addquery .= ")";

}

//selectionne toute les categories

$query = "SELECT c.categories_id, cd.categories_name, c.parent_id

FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd

WHERE c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' ".$addquery."

ORDER by sort_order, cd.categories_name";

 

$categories_query = tep_db_query($query);

while ($categories = tep_db_fetch_array($categories_query)) {

//Table de hachage

$foo[$categories['categories_id']] = array(

'name' => $categories['categories_name'],

'parent' => $categories['parent_id']);

}

 

$this->Order(0, 0, $foo, '');

$this->AddPage();

$this->TitreChapitre("");

if (SHOW_INTRODUCTION) {

$this->Ln(18);

$file= DIR_FS_CATALOG_LANGUAGES . tep_get_languages_directory($languages_code) . '/pdf_define_intro.php';

 

// echo "<br>HHHH " . $file;

if (file_exists($file)) {

$file_array = @file($file);

$file_contents = @implode('', $file_array);

$this->MultiCell(0,6,strip_tags($file_contents),$this->ifw,1,'J');

}

 

}

$this->SetFont('Arial','',DIRECTORIES_TREE_FONT_SIZE);

if (SHOW_TREE) {

$this->Ln(15);

$this->MultiCell(0,6,$this->categories_string_spe,0,1,'L');

}

 

}

 

function CategoriesListing($languages_id, $languages_code)

{

$this->products_index_array=array();

$this->products_index_list='';

$this->index_lenght=0;

 

//Recuperation de toutes les categories dans l'ordre

$categoriesidarray=explode(" ",$this->categories_id);

$categoriesnamearray=explode("\n",$this->categories_string);

$categorieslevelsarray=explode(" ",$this->levels);

 

//Convertion pixels -> mm

$imagewidth=SMALL_IMAGE_WIDTH*PDF_TO_MM_FACTOR;

$imageheight=SMALL_IMAGE_HEIGHT*PDF_TO_MM_FACTOR;

 

for($i=0; $i<sizeof($categoriesidarray)-1; $i++) {

$category_count_products = tep_products_in_category_count($categoriesidarray[$i],'false');

if (!((!SHOW_EMPTY_CATEGORIES) and ($category_count_products < 1))) {

$taille=0;

$current_category_id=$categoriesidarray[$i];

$current_category_name=$categoriesnamearray[$i];

$current_category_level=$categorieslevelsarray[$i];

$requete_prod="select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='".$current_category_id."' order by pd.products_name, p.products_date_added DESC";

 

$SHOW_catalog_query = tep_db_query($requete_prod);

while ($print_catalog = tep_db_fetch_array($SHOW_catalog_query)) {

$print_catalog_array[$taille++] = array(

'id' => $print_catalog['products_id'],

'name' => $print_catalog['products_name'], 'description' => $print_catalog['products_description'],

'model' => $print_catalog['products_model'],

'image' => $print_catalog['products_image'],

'price' => $print_catalog['products_price'], 'specials_price' => $print_catalog['specials_new_products_price'],

'tax_class_id' => $print_catalog['products_tax_class_id'],

'date_added' => tep_date_long($print_catalog['products_date_added']),

'manufacturer' => $print_catalog['manufacturers_name']);

}

 

//Forschung der Name der Vaterkategorie

$this->$parent_category_name='';

$this->ParentsName($current_category_level,$i,$categorieslevelsarray, $categoriesnamearray);

 

if (($current_category_level == 1) and (CATEGORIES_PAGE_SEPARATOR)) {

$this->AddPage();

$this->Ln(120);

$this->SetFont('Arial','',12);

$titles_color_table=explode(",",CENTER_TITLES_CELL_COLOR);

$this->SetFillColor($titles_color_table[0], $titles_color_table[1], $titles_color_table[2]);

$this->Cell(45,5,"",0,0);

$this->MultiCell(100,10,$current_category_name,1,'C',1);

}

 

if ($taille > 0) { // categorie non vide

$this->AddPage();

if (strlen($this->$parent_category_name) > 0 ) {

$this->TitreChapitre($this->$parent_category_name. CATEGORIES_SEPARATOR .$current_category_name);

} else {

$this->TitreChapitre($current_category_name);

}

$this->Ln(3); // NH

$this->SetFont('Arial','',11);

 

for($j=0; $j<$taille; $j++ ) {

// NH si pas d'image definie, image par default

if (strlen($print_catalog_array[$j]['image']) > 0 && file_exists(DIR_FS_CATALOG.DIR_WS_IMAGES.$print_catalog_array[$j]['image'])) {

$imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.$print_catalog_array[$j]['image'];

} else {

$imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.'/'.DEFAULT_IMAGE;

}

$id=$print_catalog_array[$j]['id'];

$name=rtrim(strip_tags($print_catalog_array[$j]['name']));

$model=rtrim(strip_tags($print_catalog_array[$j]['model']));

$description=rtrim(strip_tags($print_catalog_array[$j]['description']));

$manufacturer=rtrim(strip_tags($print_catalog_array[$j]['manufacturer']));

$price=rtrim(strip_tags($print_catalog_array[$j]['price']));

$specials_price=rtrim(strip_tags($print_catalog_array[$j]['specials_price']));

$tax_class_id=rtrim(strip_tags($print_catalog_array[$j]['tax_class_id']));

$date_added=rtrim(strip_tags($print_catalog_array[$j]['date_added']));

 

$data_array=array($imagewidth,$imageheight,$name,$model,$date_added,$manufacturer,$description,$tax_class_id,$specials_price,$price,$id,$languages_code,$imagepath);

$this->Ln(PRODUCTS_SEPARATOR); // NH blank space before the products description cells

$this->DrawCells($data_array);

if (SHOW_INDEX) {

switch (INDEX_EXTRA_FIELD) {

case 1 : $this->PrepareIndex($name,$manufacturer,$current_category_name);

break;

case 2 : $this->PrepareIndex($name,$model,$current_category_name);

break;

case 3 : $this->PrepareIndex($name,$date_added,$current_category_name);

break;

default : $this->PrepareIndex($name,"",$current_category_name);

}

}

}

}

}

}

}

 

function NewProducts($languages_id, $languages_code)

{

$products_new_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by p.products_date_added DESC, pd.products_name";

 

$products_new_query = tep_db_query($products_new_query_raw);

 

while($products_new = tep_db_fetch_array($products_new_query)) {

$products_new_array[] = array('id' => $products_new['products_id'],

'name' => $products_new['products_name'],

'image' => $products_new['products_image'],

'description' => $products_new['products_description'],

'model' => $products_new['products_model'],

'price' => $products_new['products_price'],

'specials_price' => $products_new['specials_new_products_price'],

'tax_class_id' => $products_new['products_tax_class_id'],

'date_added' => tep_date_long($products_new['products_date_added']),

'manufacturer' => $products_new['manufacturers_name']);

}

 

$this->AddPage();

$this->Ln(120);

$this->SetFont('Arial','',12);

$new_color_table=explode(",",NEW_CELL_COLOR);

$this->SetFillColor($new_color_table[0], $new_color_table[1], $new_color_table[2]);

$this->Cell(45,5,"",0,0);

$this->MultiCell(100,10,NEW_TITLE,1,'C',1);

$this->Ln(100);

 

//Convertion pixels -> mm

$imagewidth=SMALL_IMAGE_WIDTH*PDF_TO_MM_FACTOR;

$imageheight=SMALL_IMAGE_HEIGHT*PDF_TO_MM_FACTOR;

 

for($nb=0; $nb<MAX_DISPLAY_PRODUCTS_NEW; $nb++) {

$id=$products_new_array[$nb]['id'];

$name=rtrim(strip_tags($products_new_array[$nb]['name']));

$model=rtrim(strip_tags($products_new_array[$nb]['model']));

$description=rtrim(strip_tags($products_new_array[$nb]['description']));

$manufacturer=rtrim(strip_tags($products_new_array[$nb]['manufacturer']));

$price=rtrim(strip_tags($products_new_array[$nb]['price']));

$specials_price=rtrim(strip_tags($products_new_array[$nb]['specials_price']));

$tax_class_id=rtrim(strip_tags($products_new_array[$nb]['tax_class_id']));

$date_added=rtrim(strip_tags($products_new_array[$nb]['date_added']));

if (strlen($products_new_array[$nb]['image']) > 0 && file_exists(DIR_FS_CATALOG.DIR_WS_IMAGES.$products_new_array[$nb]['image'])) {

$imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.$products_new_array[$nb]['image'];

} else {

$imagepath=DIR_FS_CATALOG.DIR_WS_IMAGES.'/'.DEFAULT_IMAGE;

}

$data_array=array($imagewidth,$imageheight,$model,$name,$date_added,$manufacturer,$description,$tax_class_id,$specials_price,$price,$id,$languages_code,$imagepath);

$this->DrawCells($data_array);

}

}

 

function TitreChapitre($lib) {

//Titel Kategorien

$this->SetFont('Arial','',12);

$titles_color_table=explode(",",HEIGHT_TITLES_CELL_COLOR);

$this->SetFillColor($titles_color_table[0], $titles_color_table[1], $titles_color_table[2]);

$this->Cell(0,6,$lib,$this->ifw,1,'L',1);

$this->Ln(2);

//Schutz der Ordinate

$this->y0=$this->GetY();

}

}

 

$languages = tep_get_languages();

$languages_string = '';

if ($no_of_files == 'one_file') {

for ($i=0; $i<sizeof($languages); $i++)

{

$pdf=new PDF();

$pdf->Open();

$pdf->SetDisplayMode("real");

$pdf->AliasNbPages();

if(SHOW_NEW_PRODUCTS) $pdf->NewProducts($languages[$i]['id'],$languages[$i]['code']);

$pdf->CategoriesTree($languages[$i]['id'],$languages[$i]['code'],$KATEGORIE_SELECTED,$ANZAHL_KATEGORIEN);

$pdf->CategoriesListing($languages[$i]['id'],$languages[$i]['code']);

if (SHOW_INDEX) {

$pdf->DrawIndex();

}

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']. " all selected.pdf",false);

}

}

else {

for ($j=0; $j<$ANZAHL_KATEGORIEN; $j++) {

$categories_name_query = tep_db_query('select categories_name from ' . TABLE_CATEGORIES_DESCRIPTION . ' where categories_id = "' . $KATEGORIE_SELECTED[$j] . '"');

$categories_name = tep_db_fetch_array($categories_name_query);

for ($i=0; $i<sizeof($languages); $i++)

{

$pdf=new PDF();

$pdf->Open();

$pdf->SetDisplayMode("real");

$pdf->AliasNbPages();

if(SHOW_NEW_PRODUCTS) $pdf->NewProducts($languages[$i]['id'],$languages[$i]['code']);

$pdf->CategoriesTree($languages[$i]['id'],$languages[$i]['code'],$KATEGORIE_SELECTED[$j],$ANZAHL_KATEGORIEN);

$pdf->CategoriesListing($languages[$i]['id'],$languages[$i]['code']);

if (SHOW_INDEX) {

$pdf->DrawIndex();

}

$pdf->Output(DIR_FS_CATALOG . "/" . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']."_".$KATEGORIE_SELECTED[$j].".pdf",false);

}

}

}

//Neuerung ab Version 1.6

//Dieser Link muss von Hand geändert werden wenn sich das Verzeichnis in dem pdf_catalog_info.php liegt ändert!

}

else{

echo "</font><br><br><center><font size=1 face=verdana>Sie haben keine Kategorie gewählt, bitte gehen Sie auf <a href=pdf_catalogue_info2.php class=\"menuBoxContentLink\">Zum Katalog Menü</a> und machen Sie Ihre Wahl für den PDF Katalog!<br><br></cenetr>";

}

 

//echo "</font><center><a href=\"$file_PDF\" target=\"_blank\"><font size=2><b>Download</b></font><br><br>";

 

?>

Edited by s0cr8s

Share this post


Link to post
Share on other sites
hi all,

 

I'm having a problem getting a PDF generated

 

When I click on PDF Introduction under tools in the admin section, I get "TEXT_FILE_DOES_NOT_EXIST" with a back button right below it.

 

When I click "Generate Catalog(s)" under tools and then the save button it runs for a few seconds then I get a page with the heading "PDF Catalog(s) Generation", under that everything is black.

 

I running the latest version of osCommerce and PDF Catalog 2.0.5

 

Thanks for any ideas or tries.

 

Jeremy

 

Hello,

I have the exact same problem.

When I click the Save button it seems to work for a few seconds but then I get a page with "PDF Catalog(s) Generation" and the rest is blank. Does anyone know the fix for this?

Thanks,

Alex

Share this post


Link to post
Share on other sites

Hi,

 

PDF catalog works fine.

 

Please check the following, so we could find a solution ...

 

- Are the PDF catalogs generated in the defined folder ?

- If Yes, check the path of the generated files in that folder and compare it with the DOWNLOAD shortcut path

- the output link is generated in two line

 

- for combined categorries:

 

$pdf->Output(DIR_FS_CATALOG . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']. " all selected.pdf",false);

 

- for each categorroes in separate file :

 

$pdf->Output(DIR_FS_CATALOG . "/" . DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id']."_".$KATEGORIE_SELECTED[$j].".pdf",false);

 

Please see bolded selection ... it can't work in both options if the slash is inserted in only one ....

 

Please chech and advise further ...

 

regards,

Gregor

 

p.s.

 

I still havent "hack" the Š and š and Č and č .....Anyone for some help with html entities ?

Share this post


Link to post
Share on other sites

Hi,

 

My webservice provider just moved to PHP5 with MYSQL5 and I also now have some troubles getting it worked again... Ufff

 

I fixed the MYSQL5 fix and I'm not getting any error message now.

 

The catalogs are generated as ususaly, but the time after DOWNLOAD link is shown is too short and catalogs are not generated. Same in catalog and admin area ...

 

Is there maybe also some fix neccessary for PHP5 ?

 

I'll go after it in next days, but if someone has already a solution it would help.

 

I have two online identical sites :

 

- PHP4 + MYSQL4 (test site now) - still works great !

- PHP5 + MYSQL5 (sql5 fix OK!) - just doesn't work ...

 

Thanks for ny help ! :thumbsup:

Share this post


Link to post
Share on other sites
I have this working in a fashion, but 2 issues

 

Major one is how to compress the number of pages used down much further as even small catagories take up too many pages.

 

I wish their was a way to create a catalogue more tabular, i.e. too have say 2 items per row in 2 columns, that way would cut way down on the number of pages used, i only want the price, manufacturer and product name listed

 

I would also like the option to configure a cut off point for the description text i.e. define ("DESC_TEXT_LENGTH", "200");

where the 200 would be a substr or similar cut off of the description to also limit the number of pages used if a description were enabled.

 

Finally i have a strange issue whereby the generated files images overlap each other sometimes, see http://www.outdoorbits.com/catalogues/cate...%20selected.pdf to see what i mean (I turned on image borders so you can clearly see the overlaps)

 

Any help on any of the above muchly appreciated :)

 

 

Does anyone have any tips on this? The catalog for one of my sites is 13 pages and it only has 43 items. Displaying the items in two columns (with descriptions on the side) or 3 columns with descriptions on bottom would make this thing so much better.

Share this post


Link to post
Share on other sites

Hi,

 

Does also somebody has problems when migrating to PHP5 + MYSQL5 ?

 

- I made the changes neccessary for MYSQL5 and I now in admin get a blank page after pressing Make PDF Catalogs .. ??!

 

- It appers that "left join" need different syntax with brackets ... If left alone I get error 1054 as usual, but after applaying changes I just get blank page !

 

Before mysql5 fix (admin area)

 

$requete_prod="select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='".$current_category_id."' order by pd.products_name, p.products_date_added DESC";

 

After change:

 

$requete_prod="select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from [color="#FF0000"](([/color]" . TABLE_PRODUCTS . " p[color="#FF0000"])[/color] left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd[color="#FF0000"])[/color] left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='".$current_category_id."' order by pd.products_name, p.products_date_added DESC";

 

I red is some post that if you have more than one left join, you have to make more brackets in the start and then close them just before left join ...

Can anybody confirm this is OK ?

 

And why am I getting blank page ?

 

in CATALOGE area :

The catalogs are generated as usualy, but no output ?!?! The last action when download link is shown is abviously too fast, the link shows, but no catalogs are generated ...

 

 

I'm still modifying and applaying some changes for PHP5 compatibility .. Can please somebody point out what could also be wrong ?!

 

I have enabled the following in my httacces file :

 

php_flag register_globals on

 

php_value register_long_arrays on

 

For the long arrays, I don't know if it's OK ... Should I just replace all instances in all pages like :

$HTTP_GET_VARS change to $_GET

$HTTP_POST_VARS change to $_POST

 

 

Please HELP !

 

I still have test shop on PHP4+MYSQL4 for testing and all works fine !!!! I'm forced to move to 5 as they will discontinue 4 in short time ... (my webspace providers)

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

×