Jump to content
kymation

[Addon] PDF Datasheet

Recommended Posts

If anyone wants to use this with the "master products" addon and show the slave products under the product descriptions text you can do like this:

(this is a quick and dirty soultion that works on my site, if you want to use it you probably need to change styling on the table.

This code also takes raw price from products description and dosent ads tax, currency etc. It fits my needs.. )

 

In catalog / includes / modules / pdf_datasheet / pd_description.php

 

Find:

 

$pdf->writeHTMLCell( $content_width, 0, PDF_MARGIN_LEFT, $current_y, $html, $border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopadding=true);

 

After Add:

 

//START MASTER PRODUCTS - SHOW SLAVES
 $slave_query_raw = "select p.products_id, p.products_model, pd.products_name, p.manufacturers_id, p.products_tax_class_id, s.specials_new_products_price, s.status, p.products_price from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pd.products_id and p.products_master like '% " .$products_id. " %' and p.products_status = '1'";
 $slave_query = tep_db_query ($slave_query_raw);
 $count_slave = tep_db_num_rows ($slave_query);

 if ($count_slave > 0) {

$html .= '<font size="8"><table border="0" width="100%" cellspacing="0" cellpadding="3"><tr>
<td width="30%"><strong>Art nr</strong></td>
<td width="60%"><strong>Benämning</strong></td>
<td width="10%"><strong>Pris</strong></td>
</tr>
';

 while ($slave = tep_db_fetch_array ($slave_query) ) {
  $html .= '<tr>
<td>'.$slave['products_model'].'</td>
<td>'.$slave['products_name'].'</td>
<td>'.$slave['products_price'].'</td>
</tr>
';}
$html .= '</table></font>';

 }

 $pdf->writeHTMLCell( $page_width, 0, PDF_MARGIN_LEFT, $current_y, $html, 0, 1, false, true, '', true );
 //STOPP MASTER PRODUCTS SHOW SLAVES

Share this post


Link to post
Share on other sites

I took the query you posted, changed the category and product_id to valid numbers for my test site, and ran it against the database. It returned the expected data. Check that your values are correct, and that you have specifications entered for that product.

 

Regards

Jim

 

I found out why is not working.

Im from sweden and we are using Å Ä Ö as letters in our specifications.

 

If the result from the query has Å Ä or Ö then the module isnt showing.

When I changed to A A and O it works.

 

Is it possible to show the specification data as html, as the products_description. Then I think it can be compatible with non US characters.

Share this post


Link to post
Share on other sites

The TCPDF library uses Unicode fonts so that should work. The module uses the writeHTMLCell library method, which is what the Description module uses. Now I'm even more puzzled.

 

Regards

JIm


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

About the Letter problem

I have tried some different things.

In all modules, if I enter one of the letter Å Ä Ö, example in the link module I want it to look like this: "Länk: productname". (english: Link: produkcname). If I write Länk, the modules wont show up, but if i write Lank with a normal a it works. It also works if I enter the html code for the letter "

&\auml;" (without the \)

 

My swedish.php uses


define('CHARSET', 'ISO-8859-1');

 

instead of

 

 

 


define('CHARSET', 'utf');

 

Maybye thats the problem?

 

But the strange thing is that the products_description works without any problem.

Edited by mumme

Share this post


Link to post
Share on other sites

The PDF library uses Unicode fonts, so you must store everything as UTF. Make certain that your database is using the utf8_general_ci collation. Using the wrong encoding will send incorrect characters to the PDF translation functions, resulting in unpredictable behavior.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

The PDF library uses Unicode fonts, so you must store everything as UTF. Make certain that your database is using the utf8_general_ci collation. Using the wrong encoding will send incorrect characters to the PDF translation functions, resulting in unpredictable behavior.

 

Regards

Jim

 

changed back to:

define('CHARSET', 'utf-8');

in the languages file and now the SQL is in UTF_8..

 

And now it works perfect! =)

Share this post


Link to post
Share on other sites

I've submitted the code again, this time without the TCPDF library package. You'll have to go get that from Sourceforge. Hopefully this will make the package small enough to be approved. I'll post the link here when that happens. As usual, the package is available from my site until the official release happens.

 

This release fixes a number of minor bugs and adds some new modules. Two of those modules work only with the Products Specifications addon, so you can ignore those if you don't have PS. The remaining modules print things that are on the default Product Info page, plus some things that you might want that are not on the stock page.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Dear Jim,

 

First of all, thank you for your great contributions to the Oscommerce community.

 

Im tryting to add this to a new, modified store and I need some hints on where to look to solves this issues:

Last time i installed this contr it was my store that had some porly written addons,

 

This time I guess it is the same problem, but I dont know where to start look.

 

I get this errors on product_datasheet.php

 

1, Notice: Constant DOCUMENTS_SHOW_PRODUCT_INFO already defined in C:\wamp\www\sknbrgs\pdf_datasheet.php on line 66

 

2, Notice: Undefined variable: languages_id in C:\wamp\www\sknbrgs\includes\modules\boxes\bm_whats_new.php on line 38

 

3, Fatal error: Call to a member function store() on a non-object in C:\wamp\www\sknbrgs\includes\modules\ultimate_seo_urls5\main\usu5.php on line 78

 

Any clue where to start looking on this issues?

 

row 7 in usu5.php is:

 

$this->getVar( 'cache' )->store( $this->getVar( 'registry' )->store() );

Share this post


Link to post
Share on other sites

1. This is from the Document Manager Addon. The constant is defined in the database, so apparently you have that define in there twice. Search your configuration table key field for the string DOCUMENTS_SHOW_PRODUCT_INFO and get rid of all but one entry.

 

2. That's in includes/modules/boxes/bm_whats_new.php, but the error is not in the stock module, so apparently you've made some changes there. It might be enough to add this line near the top of the method:

 

	  global $languages_id;

 

3. That's a problem with Ultimate SEO URLs 5. The PDF Datasheet modules all use tep_href_link() to generate links, so this should just work. I have no idea why it's failing.

 

Regards

Jim

 

Edit: Stupid autocorrect....

Edited by kymation

See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Your URL rewriter is messing up the link. Fix it or turn it off.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi,

I am not ussing any addon for URL rewrite. Is the standard oscommerce (with some addons, of course, but it can not interfier with your).

Share this post


Link to post
Share on other sites

Then you are using the rewriter built into osCommerce. The answer is still the same.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

In your Admin, set 'Use Search-Engine Safe URLs (still in development)' to false.

 

Save it.

 

Sometimes you have to set 'Use Cache' to false (or clear the cache in your admin) to see any change.


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Hi,

Thank you. I've setted Use Search-Engine Safe URLs (still in development)' to false.

Now, I have this error:

 

Warning: require_once(ext/tcpdf/config/lang/eng.php) [function.require-once]: failed to open stream: No such file or directory in /home/onlinese/public_html/pdf_datasheet.php on line 212

 

Fatal error: require_once() [function.require]: Failed opening required 'ext/tcpdf/config/lang/eng.php' (include_path='.:/usr/lib64/php') in /home/onlinese/public_html/pdf_datasheet.php on line 212

 

There is no PDF language in the archive (ext/tcpdf/config/lang/eng.php).

Is the archive corrupted or is missing the file?

Regards,

Vicentiu.

Share this post


Link to post
Share on other sites

I just downloaded a fresh copy of TCPDF and the language files are definitely there. Try downloading again if you don't have the file in your copy.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

You could try reading the instructions. Honestly, I wonder if it's even worth putting this stuff up.


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Jim

 

A big thank you for sorting this mod. Just installed on a modified 2.3.1 test site and works like a charm straight out the box, as i would have hoped for. Many thanks.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Jim,

It works really good.

The best part is that if you dont get it to work - you have other errors in your store.

When you get PDF datasheet to work - then you know you have solved a lot of conflicts in the SQL etc.

Really good work from you. Many, many thanks for your contributions to the community.

Share this post


Link to post
Share on other sites

Any ideas why it is not finding the image?

I have managed to fix all my constant errors but can not see why it is not finding the image it looks like images/ is being put in in place of the actual image name?

 

Notice: getimagesize() [function.getimagesize]: Read error! in /XXXX/XXXXX/public_html/includes/modules/pdf_datasheet/pd_description.php on line 54

TCPDF ERROR: [image] Unable to get image: images/

Fatal error: Call to a member function store() on a non-object in /XXXX/XXXXX/public_html/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78

Edited by ShaGGy

Share this post


Link to post
Share on other sites

thank you for great addon

but i got problem i installed 2 time but i didn't have any luck to make it work

here is the error

 

Notice: Undefined variable: count in /os/includes/modules/boxes/bm_categories.php on line 155
Notice: Undefined variable: button_act1 in /os/includes/modules/boxes/fm_menu.php on line 70
Notice: Undefined variable: button_act5 in /os/includes/modules/boxes/fm_menu.php on line 71
Notice: Undefined variable: button_act8 in /os/includes/modules/boxes/fm_menu.php on line 72
Notice: Undefined variable: button_act3 in /os/includes/modules/boxes/fm_menu.php on line 73
Notice: Undefined variable: button_act2 in /os/includes/modules/boxes/fm_menu.php on line 74
Notice: Undefined variable: button_act4 in /os/includes/modules/boxes/fm_menu.php on line 75
Notice: Undefined variable: button_act9 in /os/includes/modules/boxes/fm_menu.php on line 76
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 21870
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22962
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22667
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22241
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22971
Notice: Undefined offset: 0 in /os/ext/tcpdf/tcpdf.php on line 22973
TCPDF ERROR: Wrong page number on setPage() function: 0

 

 

in bm_categories.php on line 155

  $this->tep_show_category($first_element, $count);

 

and in fm_menu.php

 

function execute() {
  global $oscTemplate, $current_page;
 if ($current_page == ((FILENAME_DEFAULT) || (FILENAME_CATEGORIES_NESTED) || (FILENAME_CATEGORIES_LISTING))) {
 $button_act1 = " act";
 $button_act2 = $button_act3 = $button_act4 = $button_act5 = $button_act6 = $button_act7 = $button_act8 = $button_act9 = "";
 }
 if ($current_page == (FILENAME_OFERTA)) {
 $button_act3 = " act";
 $button_act1 = $button_act2 = $button_act4 = $button_act5 = $button_act6 = $button_act7 = $button_act8 = $button_act9 = "";
 }
 if ($current_page == (FILENAME_PORTFOLIO)) {
 $button_act2 = " act";
 $button_act3 = $button_act1 = $button_act4 = $button_act5 = $button_act6 = $button_act7 = $button_act8 = $button_act9 = "";
 }
 if ($current_page == (FILENAME_ONAS)) {
 $button_act4 = " act";
 $button_act2 = $button_act3 = $button_act1 = $button_act5 = $button_act6 = $button_act7 = $button_act8 = $button_act9 = "";
 }
 if ($current_page == (FILENAME_ADVANCED_SEARCH)) {
 $button_act5 = " act";
 $button_act2 = $button_act3 = $button_act4 = $button_act1 = $button_act6 = $button_act7 = $button_act8 = $button_act9 = "";
 }

 if ($current_page == (FILENAME_SHIPPING)) {
 $button_act8 = " act";
 $button_act2 = $button_act3 = $button_act4 = $button_act5 = $button_act6 = $button_act7 = $button_act1 = $button_act9 = "";
 }
 if ($current_page == (FILENAME_CONTACT_US))  {
 $button_act9 = " act";
 $button_act2 = $button_act3 = $button_act4 = $button_act5 = $button_act6 = $button_act7 = $button_act8 = $button_act1 = "";
 }


  $data = '<div class="Footer_BoxWrapper footer_menu">' .
		  '  <h4 class="Footer_BoxHeading">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_TITLE . '</h4>' .
 '  <ul>' .
		  '	<li class="'.$button_act1.'">'. tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_DEFAULT . '</a>' . tep_draw_fmenu_bottom() . '</li>' .
 '	<li class="'.$button_act5.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_ADVANCED_SEARCH . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
 '	<li class="'.$button_act8.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_SHIPPING . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
		  '	<li class="'.$button_act3.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_OFERTA) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_OFERTA . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
		  '	<li class="'.$button_act2.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_PORTFOLIO) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_PORTFOLIO . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
		  '	<li class="'.$button_act4.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_ONAS) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_ONAS . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
 '	<li class="'.$button_act9.'">' . tep_draw_fmenu_top() . '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_CONTACT_US . '</a>' . tep_draw_fmenu_bottom() . '</li>'.
 '  </ul>' .
		  '</div>';

 

and here is the link

http://www.lipariereklama.pl/os/pdf_datasheet.php?products_id=8&language=polish

http://www.lipariereklama.pl/os/

can you help plz

 

Thank you

Edited by rawaby88

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

×