agentjensen Posted September 21, 2007 Share Posted September 21, 2007 Hi All I have installed v. 2.0.5 - GREAT contrib - works first time by me - both in admin and in catalog. 2 minor isues that I need help to solve. a: I use regional signs ÆØÅ in kategori names - so the generated file ex catalog_fønix.pdf cannot be dovnloaded because of the ø. Can I make the contrip force nor to use ÆØÅ. b: I have a lot of subcategories (lots) with only few products - so it generates many sides with only 1 subcategoti and 1-2 products. Can it be fixed so that it will not start on new page, with every subgategori, but continiue on same page. Only new page on new mail category. Hope one of you experts can solve this and help me. Best regard Michael. p.s only a fool doesnt fear php. :-) :-) Quote Link to comment Share on other sites More sharing options...
Hyperspace Posted November 21, 2007 Share Posted November 21, 2007 (edited) Hi there, The PDF catalog works on the admin side, but on the customer side it ain't possible to create a single/separate category PDF catalog. Nothing shows up in the catalogues folder, resulting in a dead link. Only the 2 pdf's that were created in the admin side are showing up in the catalogues folder. I tried a lot of things but nothing works. i'm testing on a xampp server with php5. Some thaughts? Edited November 21, 2007 by Hyperspace Quote Link to comment Share on other sites More sharing options...
Hyperspace Posted November 21, 2007 Share Posted November 21, 2007 I saw that i have the same problem as: http://www.northlandlending.com/shop/pdf_catalogue_info.php i saw that the word "TEP" was showing up in the download screen. what's wrong with that? Quote Link to comment Share on other sites More sharing options...
Hyperspace Posted November 21, 2007 Share Posted November 21, 2007 I'm a litte bit further... installed it on my live shop with php 4 and it works. but in the download screen appears the error: Notice: Constant FPDF_FONTPATH already defined in /var/www/vhosts/xxxxxxxx/httpdocs/pdf_config.php on line 33 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/xxxxxxxx/httpdocs/pdf_config.php:33) in /var/www/vhosts/xxxxxxxx/httpdocs/includes/functions/sessions.php on line 97 ==> Download <== The download link works! in pdf_catalogue_info2.php in changed line 29: define('FPDF_FONTPATH','font/'); into: //define('FPDF_FONTPATH','font/'); And it works!! :D but can it result in some errors or is there another way to fix this. Btw. i thought that the name of the "download" link appears as the name from the specified catagories you have selected. If you select 4 catagories, you will see 4 times "download" thnxz in advance Quote Link to comment Share on other sites More sharing options...
DejaVu Posted November 21, 2007 Share Posted November 21, 2007 (edited) Installed, not working at all. Error - 1054 - Unknown column 'p.products_id' in 'on clause' 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 products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='1' order by pd.products_name, p.products_date_added DESC [TEP STOP] This looks to me like it's an old database query perhaps for OSCommerce MS2.2? I'm using the most recent RC1 and this error is generated. Has anyone been able to fix this yet? Desperately need this for next week! This occurs when trying to 'SAVE' the PDF's in the Admin section. Edited November 21, 2007 by DejaVu Quote Link to comment Share on other sites More sharing options...
Hyperspace Posted November 22, 2007 Share Posted November 22, 2007 Installed, not working at all. Error - 1054 - Unknown column 'p.products_id' in 'on clause' 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 products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='1' order by pd.products_name, p.products_date_added DESC [TEP STOP] This looks to me like it's an old database query perhaps for OSCommerce MS2.2? I'm using the most recent RC1 and this error is generated. Has anyone been able to fix this yet? Desperately need this for next week! This occurs when trying to 'SAVE' the PDF's in the Admin section. I think this could be a php5 error? Quote Link to comment Share on other sites More sharing options...
DejaVu Posted November 22, 2007 Share Posted November 22, 2007 (edited) I've added the PHP5 fix now and it seems to have fixed the problem. I'm now getting this error - Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 8193 bytes) in /home/fhlinux162/t/ticklesticks.co.uk/user/htdocs/admin/pdf_fpdf.php on line 1508 If I'm right, this is a server setting in PHP.ini set too low? PHP Memory Block I think?! Edited November 22, 2007 by DejaVu Quote Link to comment Share on other sites More sharing options...
babba Posted January 8, 2008 Share Posted January 8, 2008 I've added the PHP5 fix now and it seems to have fixed the problem. I'm now getting this error - Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 8193 bytes) in /home/fhlinux162/t/ticklesticks.co.uk/user/htdocs/admin/pdf_fpdf.php on line 1508 If I'm right, this is a server setting in PHP.ini set too low? PHP Memory Block I think?! Just installed the PDF_Catalog Contribution and having the same problem as 'DejaVu' reported. I am using a WEB-Service @ a local Hoster and I am wondering how much Memory Size is required to get this operating in an acceptable manner. Any hint would be appreciated very much. greetings babba Quote Link to comment Share on other sites More sharing options...
suhy Posted January 29, 2008 Share Posted January 29, 2008 Hey, Here is a link to a perfectly working PDF catalogue. - Make a comeplete catalog in admin - let the visitors create their own - all in one - by separate categoris http://www.delko.si/sql/eshop/catalog/pdf_...php?language=en I had many troubles fixing this to work. It wont work in PHP5 ... only PHP4 ... My files are quite modified due to my different look of the store, but nothing you couldn't fix probably ... If you would fine them useable, please let me know and I'l post them .... P.S. I have still one BIG problem to solve as my language have some special characters like ščćžđ ŠČĆŽĐ and I use html editor in my admin area. Can't fix html entities to work properly or to add them separately in the code ... tryed, but no success ... Please post some help .. I'm also willing to donate to solve this ... You will notice this only in Slovenian language. I also don't know why <br> doesn't work when rendering to make a new line .... So, hope we'll do it together, to make one level of marketing easier and more efficient ... Thanks, Gregor Quote Link to comment Share on other sites More sharing options...
spyrotsk Posted February 6, 2008 Share Posted February 6, 2008 (edited) Hi, i have one problem, if i make pdf catalog with tools in admin section the script return to me this error: Fatal error: Call to a member function on a non-object in /web/htdocs/www.3code.it/home/catalog/admin/pdf_fpdf.php on line 1613 in line 1613 have this: $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor); i don't have experience with php...please help :'( Edited February 6, 2008 by spyrotsk Quote Link to comment Share on other sites More sharing options...
spyrotsk Posted February 8, 2008 Share Posted February 8, 2008 Hi,i have one problem, if i make pdf catalog with tools in admin section the script return to me this error: Fatal error: Call to a member function on a non-object in /web/htdocs/www.3code.it/home/catalog/admin/pdf_fpdf.php on line 1613 in line 1613 have this: $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor); i don't have experience with php...please help :'( please, i need your help! :( Quote Link to comment Share on other sites More sharing options...
mr_absinthe Posted February 11, 2008 Share Posted February 11, 2008 If you are using MySQL 5 you will need to change line 609 in pdf_catalogue.php from: $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"; to: $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"; The only change is the addition of brackets after the FROM clause: (" . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd) I hope that helps. :thumbsup: Quote Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
spyrotsk Posted February 22, 2008 Share Posted February 22, 2008 (edited) If you are using MySQL 5 you will need to change line 609 in pdf_catalogue.php from: $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"; to: $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"; The only change is the addition of brackets after the FROM clause: (" . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd) I hope that helps. :thumbsup: no, i don't have mysql 5, i have 4.0.27-standard-log i have fix this problem...there were gif image that not read, but i have other problem now...this error: Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 4097 bytes) in /web/htdocs/www.3code.it/home/catalog/admin/pdf_fpdf.php on line 1508 This error is to use too much of memory on that memory available, how do I fix it? I can not increase the memory on my hosting ... Edited February 22, 2008 by spyrotsk Quote Link to comment Share on other sites More sharing options...
racoon Posted February 24, 2008 Share Posted February 24, 2008 (edited) Here I go for the first time ;-) After 3 years of draining knowledge and advice from this great community - I would like to share some sollutions as a little payback for all help I had from all posts! Sorry if this was solved else where - I could not find answer even after deep search. --- Please back up your files before experimenting with my ideas :-) --- Some people have asked about exporting data to PDF Catalog in the same line. This one is fairly easy. Here is an example - how to put product name and product model in the same line: 1. Locate file catalog\admin\pdf_catalogue.php 2. Around line 411 locate following code: 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(0,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'); } } 3. replace it with: 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(125,5,$data_array[2]." [ SYMBOL :".$data_array[3]." ]",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'); } }*/ You can add as many information as you can only fit :-) Please note that I am also changing width of the multicell to 125. Adjiust it to your specific requirements. IMPORTANT: you will have to comment whole SHOW_MODEL section (as above) - otherwise model field will appear twice. I have also modified a little part of the code from Thumbnal PDF in order to put all info from extra fields contribution in one line as well: //include product_extra_fields if(SHOW_PRODUCTS_EXTRA_FIELDS) { $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".$data_array[10]." ORDER BY products_extra_fields_order"); $a=0; while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if ($extra_fields['value'] != '') { $line[$a] =$extra_fields['name'].": ".$extra_fields['value']." | "; $a = $a+1; }} $this->Cell($data_array[0]+6,5,"",0,0); $this->MultiCell($this->text_fw,5,$line[1].$line[2].$line[3].$line[4].$line[5].$line[6],PRODUCTS_BORDER,'L'); } Many people have asked question how to put more product per page. If you want to add maximum possible products per page just alter following code: /around line 105/ 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); } replace it with 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); } Still - I have not been able to come out with any solutions for multiple columns layout. Hope this helps, let me know if you have problem with above. Edited February 24, 2008 by racoon Quote Link to comment Share on other sites More sharing options...
spyrotsk Posted February 29, 2008 Share Posted February 29, 2008 (edited) I have fix my previews problem, but i have other problem now... if i make a pdf catalog by admin area it's work, but if i make pdf catalog of single or multiple categories by catalog area (public) it's return this error: 1054 - Unknown column 'p.products_id' in 'on clause' 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 products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id='1' order by pd.products_name, p.products_date_added DESC [TEP STOP] i have rewrite line 705 of pdf_catalogue_info2.php: $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"; with this: $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"; it's work, but it's don't create a pdf files and don't return any errors...why? Edited February 29, 2008 by spyrotsk Quote Link to comment Share on other sites More sharing options...
ricksteruk2005 Posted April 15, 2008 Share Posted April 15, 2008 no, i don't have mysql 5, i have 4.0.27-standard-log i have fix this problem...there were gif image that not read, but i have other problem now...this error: Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 4097 bytes) in /web/htdocs/www.3code.it/home/catalog/admin/pdf_fpdf.php on line 1508 This error is to use too much of memory on that memory available, how do I fix it? I can not increase the memory on my hosting ... try adding this to your root .htaccess file php_value memory_limit 100M Quote I dont help with templates (thats what the seller is for) th search function will often help, when it dont try this in google. site:http://www.oscommerce.com/forums then your search word Link to comment Share on other sites More sharing options...
spyrotsk Posted April 22, 2008 Share Posted April 22, 2008 (edited) try adding this to your root .htaccess file php_value memory_limit 100M no, doesn't work with this option, my hoster offers an shit service. if you wanna have a good life, don't choise Aruba for your hoster. Edited April 22, 2008 by spyrotsk Quote Link to comment Share on other sites More sharing options...
agentjensen Posted April 29, 2008 Share Posted April 29, 2008 Same problem here: I get this message: Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 11246 is not allowed to access /tmp owned by uid 0 in /customers/agerholm.com/agerholm.com/httpd.www/shp/includes/functions/sessions.php on line 148 When I use the fix by spyrotsk on the customer page. I can create catalog under admin. I can see the main catalog under "customer" But I cannot create categori catalog under "customer" spyrotsk - had a fix preventing database php5 problems on customer front - but then I get the error i has decsrobed. HELP:::: Quote Link to comment Share on other sites More sharing options...
agentjensen Posted April 29, 2008 Share Posted April 29, 2008 The problem: Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 11246 is not allowed to access /tmp owned by uid 0 in /customers/agerholm.com/agerholm.com/httpd.www/shp/includes/functions/sessions.php on line 148 Is solved - database correction og /tmp to tmp But still no creating of catalog from customer side :-( Anyone??????? Help??????? /AgentJensen Quote Link to comment Share on other sites More sharing options...
mendoh Posted May 3, 2008 Share Posted May 3, 2008 Hi everybody! I installed this contribution, however, I am experiencing a REALLY hard time in getting it to work. After solving a 1054 Unknown column error by installing PHP5 fix, right now I am getting the following error when I try to generate catalog(s) from admin: Fatal error: Class 'CGIF' not found in C:\Programmi\EasyPHP 2.0b1\www\spectradomecomok\catalog\admin\pdf_fpdf.php on line 1604 I tried to replace the existing pdf_gif.php file with the one specified by unyil here: http://addons.oscommerce.com/info/908 ....NO WAY! Is there anybody who can help me to solve the above issue? Thanks in advance. Mendoh Quote Link to comment Share on other sites More sharing options...
anvip Posted May 5, 2008 Share Posted May 5, 2008 (edited) Same problem here: I get this message: Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 11246 is not allowed to access /tmp owned by uid 0 in /customers/agerholm.com/agerholm.com/httpd.www/shp/includes/functions/sessions.php on line 148 When I use the fix by spyrotsk on the customer page. I can create catalog under admin. I can see the main catalog under "customer" But I cannot create categori catalog under "customer" spyrotsk - had a fix preventing database php5 problems on customer front - but then I get the error i has decsrobed. HELP:::: If you have problems with create catalog under customer, please replace pdf_catalogue_info2.php with this code: <?php /******************************************************************************/ /* PDF Catalogs v.2.0.1 for osCommerce v.2.2 MS2 */ /* */ /* by Infobroker ([email protected]), April 2006 */ /* by Antonios THROUVALAS ([email protected]), April 2004 */ /* by Mitch O`Brian (mitchobrian.de), juli2004 2004 */ /* by Nicolas Hilly ([email protected]), August 2004 */ /* by Christophe Buchi ([email protected]), September 2004 */ /* by Ryan Kononoff ([email protected]), October 2004 */ /* */ /* Based on PDF Catalogs v.1.4 by [email protected] */ /* */ /* Uses FPDF (http://www.fpdf.org), Version 1.52, by Olivier PLATHEY */ /* modified by Infobroker */ /* */ /* Credit goes also to: */ /* - Yamasoft (http://www.yamasoft.com/php-gif.zip) for their GIF class, */ /* - Jerome FENAL ([email protected]) for introducing GIF Support */ /* in the FPDF Class, */ /* - The osC forums members (www.oscommerce.com/forums)! */ /* */ /* Please donate to the osCommerce Core Team! */ /* */ /* Freeware, You may use, modify and redistribute this software as you wish! */ /******************************************************************************/ //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>==> <a href="'.$file_PDF.' all selected.pdf" target="_blank"><font size="2" face="verdana"><b>Prenos kataloga</b></font></a> <==</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>==> <a href="'.$file_PDF.' '.$categories_name['categories_name'].'.pdf" target="_blank"><font size="2" face="verdana"><b>Prenos kataloga</b></font></a> <==</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_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . " all selected.pdf",false); $pdf->Output(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 . " " .$categories_name['categories_name'].".pdf",false); $pdf->Output(DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES . "_" . $languages[$i]['id'] ." ". $categories_name['categories_name'].".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 May 5, 2008 by anvip Quote Link to comment Share on other sites More sharing options...
anvip Posted May 5, 2008 Share Posted May 5, 2008 Quote Link to comment Share on other sites More sharing options...
zakya Posted May 16, 2008 Share Posted May 16, 2008 Hello, Anvip, as you suggested I replaced pdf_catalog_info2 with the code you supplied but still could not generate the pdf file from the store (customer) side. What may be the problem? Any other suggestions? In advance thank you. Quote Link to comment Share on other sites More sharing options...
anvip Posted May 16, 2008 Share Posted May 16, 2008 Hello,Anvip, as you suggested I replaced pdf_catalog_info2 with the code you supplied but still could not generate the pdf file from the store (customer) side. What may be the problem? Any other suggestions? In advance thank you. I need link to your store ... Quote Link to comment Share on other sites More sharing options...
zakya Posted May 19, 2008 Share Posted May 19, 2008 I need link to your store ... Sorry Anvip for my late reply.....I am based in China. Currently facing the after earthquake. For the store you could check it : http://www.solarissa.com In advance thank you for taking the time to have a look. Regards, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.