alverman Posted January 29, 2003 Share Posted January 29, 2003 Just posted my contrib in Features section (PDF data_sheet maker v.1) http://www.oscommerce.com/community/contributions,923 It 's a basic version of a PDF data-sheet maker. It allows the costumer to print a pdf file of the single product from the products page. Printed data will include * products category (path) * products image (jpg or png only) * description * model * manufacturer * price / special price * options * date of availability. It's based on "Catalog products PDF reports V1.1 - 1.2" contributions by Gurvan Riou. The pdf file is printed "on the fly" directly to the browser (no pdf's on the server). ivan Quote Link to comment Share on other sites More sharing options...
Guyver Posted January 29, 2003 Share Posted January 29, 2003 How easily can this be 'modded' to allow the final checkout screen to be 'pdf'd...? Thanks John Quote Link to comment Share on other sites More sharing options...
hellbound Posted January 30, 2003 Share Posted January 30, 2003 FPDF error: Image file has no extension and no type was specified: images/ Thats the error. I am using the original pdf catalog contribution and all is working OK. regards. Nice contrib :) Quote Link to comment Share on other sites More sharing options...
CyberMike Posted January 30, 2003 Share Posted January 30, 2003 I have the same Problem Quote Link to comment Share on other sites More sharing options...
Waza04 Posted January 30, 2003 Share Posted January 30, 2003 I also have the same problem, browsed through te files but to no avail!! Please can somebody solve this as it seems to be a really good mod, and I think it is better than the original one!! Cheers, Warren Ashcroft Quote Link to comment Share on other sites More sharing options...
alverman Posted January 30, 2003 Author Share Posted January 30, 2003 Hi all Thanks for giving a chance to my "great contrib" :oops: However I confess it is really frustrating to verify that is working only for me! :x I have tested locally and O.K. (Win '98 box EasyPhP) Then uploaded on remote (Linux beta.propagation.net 2.4.7-10smp Apache/1.3.26 (Unix) PHP/4.2.1 FrontPage/5.0.2.2510) following the same instructions I'm giving to the read-me file. Still O.K. as you can see in the testing site. At first I thought there'was some server side "pdf-related" PHP support needed but on my remote system there's no mention about that. If I could replicate the bug I might think to a possible solution but... If there's any lucky guy how successfully installed it :? please let me know. Guyver: I'm not ignoring your question, it think that also can be done w/some tweaking, but I'd better solve this one before repeting the experience w/ other files. Thank you all ivan Quote Link to comment Share on other sites More sharing options...
alverman Posted January 30, 2003 Author Share Posted January 30, 2003 One thing we can do, is uncomment lines 365 and 357 in pdf_datasheet_functions.php viewArray($print_catalog_array); exit; ( Mattice [TIP / TRICK] viewArray debug function :idea: ) and see where the image value points to. My pale attempt trying to isolate the problem. ivan Quote Link to comment Share on other sites More sharing options...
puddled Posted January 30, 2003 Share Posted January 30, 2003 Just to let you know, I followed the instructions included, and got the same error, and after some playing with the code found that if I changed the following $languages_id reference to 1 in the pdf_datasheet_functions.php file It worked. Change on line 327 :- and pd.language_id = '" . $languages_id . "'"); to the following :- and pd.language_id = '1'"); I also found product options were not bieng listed, as in the latest snapshot, there is a field in the query that does not exist in the table, change from lines 389 - 392 to the following $products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '1'"); and line 417 to the following $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '1'" . " order by pov.products_options_values_name"); It worked for me as it now runs on my site (http://www.puddled.co.uk/hosting.php) PS. be sure to make a backup first... PPS. DO NOT FORGET THE BACKUP Quote Instant idiot......Just add mud !! Link to comment Share on other sites More sharing options...
alverman Posted January 30, 2003 Author Share Posted January 30, 2003 Many thanks Puddled. My problem is passing "$languages_id" to: function ProductsDataSheet($languages_id, $products_id) I think that adding it to the URL in products_id.php could solve the problem: <?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info_values['products_id'] . '&language_id=' . $languages_id) .'" target="blank">' . tep_image('pdf/pdf.gif') .'</a>'; ?> could you please confirm that? I also found product options were not bieng listed, as in the latest snapshot, there is a field in the query that does not exist in the table, You are referring to "products_options_sort_order" field and you are correct because it is not included in the daily snapshot DB. Thanks again ivan Quote Link to comment Share on other sites More sharing options...
alverman Posted January 30, 2003 Author Share Posted January 30, 2003 Nope I think that adding it to the URL in products_id.php could solve the problem: read product_info.php. ivan Quote Link to comment Share on other sites More sharing options...
puddled Posted January 30, 2003 Share Posted January 30, 2003 <?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info_values['products_id'] . '&language_id=' . $languages_id) .'" target="blank">' . tep_image('pdf/pdf.gif') .'</a>'; ?> spotted a mistake in your code, should it not read <?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info_values['products_id'] . '&language_id=' . $languages_id .') .'" target="blank">' . tep_image('pdf/pdf.gif') .'</a>'; ?> Quote Instant idiot......Just add mud !! Link to comment Share on other sites More sharing options...
Waza04 Posted January 31, 2003 Share Posted January 31, 2003 So have we found a solution? Im confused!!! Quote Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 Any help is appreciated! :wink: ivan Quote Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 O.K. we can try this: "product_info.php" link to PDF: <?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info_values['products_id'] . '&languages_id=' . $languages_id ) .'" target="blank">' . tep_image('pdf/pdf.gif') .'</a>'; ?></td> "pdf_datasheet_functions.php" change line 468 to this: $pdf->ProductsDataSheet($languages_id, $products_id); :shock: ivan Quote Link to comment Share on other sites More sharing options...
mikimoto Posted January 31, 2003 Share Posted January 31, 2003 Thanks for your answers and this great work. :) My thumbnails are in gif format and i wanna fix pdf_datasheet_functions.php to use the medium or big image (they are in jpg). I think this easy, but i know what lines of code a must change to do this. ?Can you help me? Thanks again :D Quote Link to comment Share on other sites More sharing options...
mikimoto Posted January 31, 2003 Share Posted January 31, 2003 ?May be only the line 370? $imagepath=DIR_WS_IMAGES.$print_catalog_array['image']; Quote Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 Ol? se?or mikimoto, do you want to use medium or big? However try this: line 322 $print_catalog_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, ....... change "p.products_image" to "p.products_image_big" or "p.products_image_medium" (I do not know what you are using but it must be the db field name for the image you want to show) like: $print_catalog_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image_big, p.products_model, ....... and then line 344 changes to: 'image' => $print_catalog['products_image_big'], comment out lines 319 and 320: // $imagewidth=SMALL_IMAGE_WIDTH*PDF_TO_MM_FACTOR; // $imageheight=SMALL_IMAGE_HEIGHT*PDF_TO_MM_FACTOR; HTH ivan Quote Link to comment Share on other sites More sharing options...
hellbound Posted January 31, 2003 Share Posted January 31, 2003 I have applied the last patch, but now I see a very strange error. Sometimes the contrib is working and sometimes not (??). You can check it in mi shop www.sportlander.com For example if I choose the product 'BCAA 4' or 'Androtest' I see it OK in PDF format; but if I choose 'Isopro' it fails with this error: 1054 - Unknown column 'pa.products_options_sort_order' in 'field list' select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '47' and pa.options_id = '1' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '3' order by pa.products_options_sort_order, 0+pov.products_options_values_name [TEP STOP] And another error that I have is that If I have a description with html tags; they are not good printed (as html) in the PDF sheet. regards Quote Link to comment Share on other sites More sharing options...
puddled Posted January 31, 2003 Share Posted January 31, 2003 1054 - Unknown column 'pa.products_options_sort_order' in 'field list' select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '47' and pa.options_id = '1' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '3' order by pa.products_options_sort_order, 0+pov.products_options_values_name [TEP STOP] try changing the query to the following select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '47' and pa.options_id = '1' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '3' order by pov.products_options_values_name Quote Instant idiot......Just add mud !! Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 For those who have "products_options_sort_order" field in db "table products" : query on line 417 does not change: $products_options = tep_db_query("select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by pa.products_options_sort_order, 0+pov.products_options_values_name"); otherwise: line 417 changes to: $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by 0+pov.products_options_values_name"); SEE BUG FIX : "$languages_id" can be used now (instead of a numeric value) since the var is passed to function ProductsDataSheet() by $pdf->ProductsDataSheet($languages_id, $products_id); (line 470) Did not believe it was so hard to make a contribution! ivan Quote Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 Again "products_options_sort_order" is in "table products_attributes" NOT "table products". ivan Quote Link to comment Share on other sites More sharing options...
mikimoto Posted January 31, 2003 Share Posted January 31, 2003 Mr. alverman :lol: The final solution was: Change two instances of products_image for products_mimage. Change the lines 318 to 320 like this //Convertion pixels -> mm $imagewidth=IMAGE_WIDTH*PDF_TO_MM_FACTOR; $imageheight=IMAGE_HEIGHT*PDF_TO_MM_FACTOR; All right now with the images. I gonna start to do regular expressions to convert html characters into plain text. ?Do you think if this is possible? Pdf rules :) Quote Link to comment Share on other sites More sharing options...
alverman Posted January 31, 2003 Author Share Posted January 31, 2003 Sig. Alverman please! :lol: I gonna start to do regular expressions to convert html characters into plain text. ?Do you think if this is possible? Se?or Mikimoto, anything is possible in this world, but .... :shock: what do you mean ?? (I'm a little slow). Hasta la Vendimia Siempre! Quote Link to comment Share on other sites More sharing options...
hellbound Posted February 1, 2003 Share Posted February 1, 2003 For those who have "products_options_sort_order" field in db "table products" : query on line 417 does not change: $products_options = tep_db_query("select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by pa.products_options_sort_order, 0+pov.products_options_values_name"); otherwise: line 417 changes to: $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by 0+pov.products_options_values_name"); SEE BUG FIX : "$languages_id" can be used now (instead of a numeric value) since the var is passed to function ProductsDataSheet() by $pdf->ProductsDataSheet($languages_id, $products_id); (line 470) Did not believe it was so hard to make a contribution! ivan Now all its OK for me! :) Thanks for all your help Quote Link to comment Share on other sites More sharing options...
Guest Posted February 1, 2003 Share Posted February 1, 2003 its writing the file as type .php instead of .pdf any ideas??? 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.
Note: Your post will require moderator approval before it will be visible.