Jump to content
kymation

[Addon] PDF Datasheet

Recommended Posts

It appears there's a bug in the final release copy. In includes/modules/pdf_datasheet/pd_features.php, find this code:

 

    $describe_query_raw = "describe" . TABLE_PRODUCTS_DESCRIPTION;

 

and change it to this:

 

    $describe_query_raw = "describe " . TABLE_PRODUCTS_DESCRIPTION;

 

Thanks for the bug report. I'll fix this in a new release.

 

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

I changed the row you told me, now I have this:

 

Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: row in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_features.php on line 42 Notice: Undefined variable: specifications_query in /web/htdocs/www.orestesport.it/home/oscommerce/includes/modules/pdf_datasheet/pd_specifications.php on line 40 Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /web/htdocs/www.orestesport.it/home/oscommerce/includes/functions/database.php on line 103 TCPDF ERROR: Some data has already been output, can't send PDF file

Share this post


Link to post
Share on other sites

This is an old version of the file. I don't know how it got in the distribution. There may be more fixes, so be warned. Find this code in pd_features.php:

 

	 if( $row['Field'] == 'products_tab_1' ) {

 

and change it to this:

 

	 if( $describe_array['Field'] == 'products_tab_1' ) {

 

In pd_specifications.php find the following code:

 

    $show_query_raw = tep_db_query( $show_query_raw );

   if( tep_db_num_rows( $specifications_query ) < 1 ) {

 

and change it to:

 

    $show_query = tep_db_query( $show_query_raw );

   if( tep_db_num_rows( $show_query ) < 1 ) {

 

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

I'm very sorry to bother you again but it's still not working

 

now I have this:

 

TCPDF ERROR: Some data has already been output, can't send PDF file

 

Many many thanks

Share this post


Link to post
Share on other sites

There's nothing but that error? It shouldn't do that. Try disabling modules one at a time until you find the one that's causing the error.

 

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

I tried,

I disable all the modules except for Initalize and Font. but I still have that message. Could be related to the language?

Share this post


Link to post
Share on other sites

In that case, it's most likely some whitespace (spaces, line ends, etc.) after the last ?> or before the first <?php in one of the language files. It could also be in an included file, if you have edited any of those. Stock osCommerce files don't have this problem.

 

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

I don't understand, because I don't modified any file related to PDF module. I tried also to reload all the files again but I have the same problem.

It's a pity because it's a very good tool, and it's a pity that I cannot use it.

 

Do you have any other idea? Is there any other test that I can do?

 

Thanks

Share this post


Link to post
Share on other sites

I think you misunderstand. This is not caused by any of the files in the PDF Datasheet distribution. This error is caused by other files in your osCommerce store. Read the suggestions in my previous post.

 

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 Jim!

 

Have you tried the PDF datasheet contribution with the Ultimate SEO by Jack_mcs (http://www.oscommerce.com/community/contributions,2823)?

My PDF-datasheet worked pefectly beofre I installed the Ultimate SEO contribution, now I get an error when trying to generate a PDF.

 

Notice: Undefined index: pName in website.com\includes\classes\seo.class.php on line 2095

 

I know this question may belong in the Ultimate SEO forum, but since Jim is the #1 oscommerce guru I take a chance and ask here aswell.

Edited by mumme1

Share this post


Link to post
Share on other sites

That's a bug in Ultimate SEO. Not a big one, but it needs to be fixed to avoid breaking the TCPDF library functions.

 

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 Jim,

 

Not sure if this question been asked, excused me if I couldn't go through all previous post and ask same question.

 

I had installed PDF sheet and Product Specifications.

 

I just updated about 200 products to our website. And I found some issues:

1. The product describtion tab, because I did not know how to get rid of the \r\n, so I made other Tab as Description, and now all the products (except default Samsung Galaxy Tab product) doesn't show the description on PDF datasheet (It only show up image)

2. Samsung Galaxy Tab, the only one show the product description on PDF datasheet, it doesn't have r n on website description, but it show r n on PDF datasheet

3. And the Images (thumbnails) doesn't show in proper position, so one or two thumbnails go very left hand side which did not show on PDF and the rest of thumbnails just cover the product description.

 

What can I do to resolve these issues?

 

Many thanks in advance.

 

Lyn

Share this post


Link to post
Share on other sites

1. You've moved the ?Description to another tab, so of course it doesn't show up in the PDF. You'll need to make the changes to the PDF Description module to pick up your new tab.

 

2. Whatever is in the database will show up in the PDF.

 

3. I don't know without looking at your site. The extra images may misbehave if there are too many of the m to fit on the 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

I got the new code in the wrong place. Stupid forum software messes up the line numbers. Try putting the code I suggested just after this code:

global $sitemapString, $languages_id;
$information_tree = array();
$informationString = '';
$parent_child_selected = '';

and remove it from where I originally suggested.

Regards

Jim

 

@ kymation

 

Hi Jim,

I modified Unlimited Info Page to Unlimited Staff Page

and I got this error message when I click on PDF icon:

undefined offset: 1

if ($child_staff[$i]['stafparent_staf_id'] == $element['key']) {

could you please kindly explain what does

"undefine offset" "#" means, and when it happens, what code/file should I go to check and modify?

many thanks in advance.

Lyn

<?php
/*
$Id$
Module: Information Pages Unlimited
	 File date: 2007/02/17
	 Based on the FAQ script of adgrafics
	 Adjusted by Joeri Stegeman (joeri210 at yahoo.com), The Netherlands
	 Modified by [email="SLiCK_303@hotmail.com"]SLiCK_303@hotmail.com[/email] for OSC v2.3.1
osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
////
/************************************************
Modified by Robert Fisher aka Thunderace
23 March 2006
Information_children mod
This file now shows highlights and children
in the same manner as osCommerce
************************************************/
function tep_staff_show_category($staff_group_id = 1) {
global $sitemapString, $languages_id;
$staff_tree = array();
$staffString = '';
$stafstafparent_child_selected = '';
$child_staff = array();

// Retrieve information from db
// ID set by module for Information box
$staff_query = tep_db_query("select staff_id, staff_title, stafparent_id from " . TABLE_STAFF . " where visible = '1' and language_id = '" . (int)$languages_id ."' and staff_group_id = '" . (int)$staff_group_id . "' ORDER BY sort_order");
while ($staff = tep_db_fetch_array($staff_query)) {
 $staff_tree[$staff['staff_id']] = array(
 'staf_title' => $staff['staff_title'],
 'stafparent_id' => $staff['stafparent_id'],
 'staf_next_id' => 0
 );
 if ($staff_tree[$staff['staff_id']]['stafparent_id'] != '0') {

 $child_staff[] = array (
	 'stafparent_staf_id' => $staff['stafparent_id'],
	 'child_staf_id' => $staff['staff_id']
 );
 }
}
$count_child = count($child_staff);
// Test if a child has been requested and set $stafstafparent_child_selected
for ($i = 1; $i < ($count_child+1); $i++) {
 if ((isset($_GET['staf_id'])) && ($child_staff[$i]['child_staf_id'] == $_GET['staf_id'])) {
 $stafstafparent_child_selected = $child_staff[$i]['stafparent_staf_id'];
 }
}
// Run through the $staff_tree to find all pages
while ($element = each($staff_tree)) {
 if (!isset($staff_tree[$element['key']]['stafparent_id']) || ($staff_tree[$element['key']]['stafparent_id'] == 0)) {
 //Set the main title to bold if it was selected or one of its children were selected
 if (((isset($_GET['staf_id'])) && ($_GET['staf_id'] == $element['key'])) || ($stafstafparent_child_selected == $element['key'])) {
	 $staffString .= '<a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $element['key']) . '"><strong>' . $staff_tree[$element['key']]['staf_title'] . '</strong></a><br />';
 } else {
	 $staffString .= '<a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $element['key']) . '">' . $staff_tree[$element['key']]['staf_title'] . '</a><br />';
	 //Sitemap only
	 $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $element['key']) . '">' . $staff_tree[$element['key']]['staf_title'] . '</a></li>' . "\n";
 }
 //Just for sitemap
 $ul = false;
 for ($i = 1; $i < ($count_child+1); $i++) {
	 if ($child_staff[$i]['stafparent_staf_id'] == $element['key']) {
	 if ($ul == false) {
		 $sitemapString .= '<ul>' . "\n";
		 $ul = true;
	 }
	 $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $child_staff[$i]['child_staf_id']) . '">' . $staff_tree[$child_staff[$i]['child_staf_id']]['staf_title'] . '</a></li>' . "\n";
	 }
	 if (($i == $count_child) && ($ul == true)) {
	 $sitemapString .= '</ul>' . "\n";
	 }
 }
 //End just for sitemap
 //Show children if they exist
 if (((isset($_GET['staf_id'])) && ($_GET['staf_id'] == $element['key'])) || ($stafstafparent_child_selected == $element['key'])) {
	 for ($i = 0; $i < ($count_child); $i++) {
	 if ($child_staff[$i]['stafparent_staf_id'] == $element['key'])
		 //Show a child as bold if it was selected
		 if ((isset($_GET['staf_id'])) && ($_GET['staf_id'] == $child_staff[$i]['child_staf_id'])) {
		 $staffString .= '  <a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $child_staff[$i]['child_staf_id']) . '"><strong>' . $staff_tree[$child_staff[$i]['child_staf_id']]['staf_title'] . '</strong></a><br />';
		 } else {
		 $staffString .= '  <a href="' . tep_href_link(FILENAME_STAFF, 'staf_id=' . $child_staff[$i]['child_staf_id']) . '">' . $staff_tree[$child_staff[$i]['child_staf_id']]['staf_title'] . '</a><br />';
		 }
	 }
 }
 }
}
return $staffString;
}
////
// Define customer greetings
function tep_staff_customer_greeting_define() {
global $customer_id, $customer_first_name, $languages_id, $category_depth;
if ($category_depth == 'top') {
 // Retrieve information from db
 $staff_group_id = 2; // ID set by module for Entrance messages
 $staff_query = tep_db_query("select staff_title, staff_description from " . TABLE_STAFF . " where language_id = '" . (int)$languages_id . "' and staff_group_id = '" . (int)$staff_group_id . "'");
 while ($staff = tep_db_fetch_array($staff_query)) {
 // if($staff['staff_title'] == 'HEADING_TITLE')
 define($staff['staff_title'], $staff['staff_description']);
 }
}
}
////
// Return a customer greeting
function tep_staff_customer_greeting() {
global $customer_id, $customer_first_name;
if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {
 $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW));
} else {
 $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
}
return $greeting_string;
}
?>

Edited by ce7

Share this post


Link to post
Share on other sites

It means that part of the array is missing. The error message tells you which part. You'll have to find that and fix it.

 

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

It means that part of the array is missing. The error message tells you which part. You'll have to find that and fix it.

 

Regards

Jim

 

Hi Jim,

 

Thank you for your reply.

 

I tried google and found some other answer about the undefined offset as well.

Since that part of code is for Sitemap SEO so I comment them out. Will take time later to learn more about undefined offset.

 

the next error I got after click the PDF icon is:

 

Warning: Cannot modify header information - headers already sent by (output started at /includes/modules/boxes/bm_categories_accordion.php:2) in /ext/tcpdf/tcpdf.php on line 8940

TCPDF ERROR: Some data has already been output to browser, can't send PDF file

 

what should I do to make the PDF show up?

Many thanks in advance.

 

Lyn

Edited by ce7

Share this post


Link to post
Share on other sites

Use this code. Please try to search for answers before asking -- it saves my time that can better be used for creating new Addons and updating existing ones.

 

Regards

JIm

 

Edit: Broken link

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

Hi Jim,

 

Thank you for your reply.

Sorry didn't find the forum to solve my problem first.

I had bookmark that page, so if it happen again, I know how I can refer and try to solve myself first.

 

And hope you can update some addons, such as MVS for osC2.3.x...

thanks for your kindness to share the addons and help to solve problem.

 

Lyn

Share this post


Link to post
Share on other sites

Hi Jim,

 

I've installed this addon and installation went fine. However, when clicking on the PDF link on the product_info page, nothing shows up. I only see a white page.

 

I've read the forum several times and found some possible issues but after trying nothing worked.

 

The produced URL seems fine, see example URL:

 

http://localhost/sriracrafts.com/catalog/pdf_datasheet.php/products_id/26/language/english

 

1) At first the URL looked messed up so I set "User search-engine safe URLs" to "false".

 

that gave me the message :

 

Fatal error: Call to undefined function tep_session_save_path() in E:\xampp\htdocs\sriracrafts.com\catalog\includes\languages\english.php on line 274

 

Then I revised this and set "User search-engine safe URLs" to "true", Now the message has disappeared and the URL looks fine but I still have a white page.

 

Encoding is for database and all languages: utf-8.

 

I hope you can help me out.

 

Thanks,

 

Gerhard

Edited by srirahandcraft

Addons installed on my website:

 

- Addons Installed

- Advanced Special Offer Discounts

- AJAX-Attribute Manager for osc 2.3.1

- Banner box v1.1.1

- Dutch Language Pack

- Extra Pages-info box with admin for OSC2.3

- German Language Pack

- Login Box

- Multi-language Support for Configuration

- Multiple products manager

- Order Editor

- OSC PDF Catalogue 2.1

- PDF-Datasheet

- product Field Groups

- Quickly Update Product Stock

- Unit of weight

- YAG (Yet another Guestbook)

Share this post


Link to post
Share on other sites

A white page usually means some sort of error. It's impossible to tell what if you have error messages blocked. The PDF Datasheet addon has error display turned on, so the problem is with your PHP settings. Ask your host for help.

 

You need to debug this with Use search-engine safe URLs set to false. Don't turn that on again until you have the PDF working perfectly. I will not guarantee that this addon will ever work with that set to true.

 

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 Jim,

 

Thanks for your help, I have the datasheet up and running, looks good, great work.

 

I have only one question.

I have the addon "products_fields_groups) installed, with this addon it's possible to work with tabs. It's still possible to input the information through the original field.

 

Is it possible to have the code in pd_description.php changed so it would always pickup the description whether it's in the old position or under the tab.

 

I'm still learning a lot on coding and have tried the following:

 

 function execute() {
global $PHP_SELF, $pdf, $products_id, $languages_id, $currencies, $current_y;

if( basename( $PHP_SELF ) == 'pdf_datasheet.php' && isset( $products_id ) && $products_id > 0 ) {
// Get the product name
$product_info_query_raw = "
select
pfgv.products_fields_group_values,
pi.image
from
" . TABLE_PRODUCT_FIELDS_GROUPS_VALUES . " pfgv
left join " . TABLE_PRODUCTS_IMAGES . " pi
on (pi.products_id = pfgv.products_id
and pi.sort_order = '1')
where
pfgv.products_options_id = '7'
and pfgv.products_id = '" . $products_id . "'
and pfgv.language_id = '" . ( int )$languages_id . "'";

} elseif ( basename( $PHP_SELF ) == 'pdf_datasheet.php' && isset( $products_id ) && $products_id > 0 ) {
// Get the product name
$product_info_query_raw = "
select
pd.products_description,
pi.image
from
" . TABLE_PRODUCTS_DESCRIPTION . " pd
left join " . TABLE_PRODUCTS_IMAGES . " pi
on (pi.products_id = pd.products_id
and pi.sort_order = '1')
where
pd.products_id = '" . $products_id . "'
and pd.language_id = '" . ( int )$languages_id . "'
";

$product_info_query = tep_db_query( $product_info_query_raw );
$product_info = tep_db_fetch_array( $product_info_query );

 

The datasheet still shows up and doesn't give an error on the database query, however I only see my picture and no description.

 

I would really appreciate your help on this if it's possible with the information given.

 

Thanks a lot.

 

Gerhard


Addons installed on my website:

 

- Addons Installed

- Advanced Special Offer Discounts

- AJAX-Attribute Manager for osc 2.3.1

- Banner box v1.1.1

- Dutch Language Pack

- Extra Pages-info box with admin for OSC2.3

- German Language Pack

- Login Box

- Multi-language Support for Configuration

- Multiple products manager

- Order Editor

- OSC PDF Catalogue 2.1

- PDF-Datasheet

- product Field Groups

- Quickly Update Product Stock

- Unit of weight

- YAG (Yet another Guestbook)

Share this post


Link to post
Share on other sites

Yes, you need to do an if statement after the above code, something like this:

 

if( $product_info['products_fields_group_values'] ) {
 $product_info['products_description'] = $product_info['products_fields_group_values'];
}

 

Not tested of course, so you may nead to tweak that a bit.

 

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 Jim,

 

Thanks a lot for the fast reply, that put me in the right direction.

and sorry for my late reply, I've been very busy with other things lately.

 

It picks up the data from the tab-cell, however, it doesn't change the language. It only shows the information in the default language (English) No matter what language has been selected.

 

For some reason, the language_id isn't working.

 

 function execute() {
global $PHP_SELF, $pdf, $products_id, $languages_id, $currencies, $current_y;
// Get the product name
/* if( basename( $PHP_SELF ) == 'pdf_datasheet.php' && isset( $products_id ) && $products_id > 0 ) {

$product_info_query_raw = "
select
pd.products_description,
pi.image
from
" . TABLE_PRODUCTS_DESCRIPTION . " pd
left join " . TABLE_PRODUCTS_IMAGES . " pi
on (pi.products_id = pd.products_id
and pi.sort_order = '1')
where
pd.products_id = '" . $products_id . "'
and pd.language_id = '" . ( int )$languages_id . "'
";

}*/ if ( basename( $PHP_SELF ) == 'pdf_datasheet.php' && isset( $products_id ) && $products_id > 0 ) {
// Get the product name
$product_info_query_raw = "
select
pfgv.products_fields_group_values,
pi.image
from
" . TABLE_PRODUCT_FIELDS_GROUPS_VALUES . " pfgv
left join " . TABLE_PRODUCTS_IMAGES . " pi
on (pi.products_id = pfgv.products_id
and pi.sort_order = '1')
where
pfgv.products_id = '" . $products_id . "'
and pfgv.products_options_id = '6'
and pfgv.language_id = '" . ( int )$languages_id . "'";

$product_info_query = tep_db_query( $product_info_query_raw );
$product_info = tep_db_fetch_array( $product_info_query );

if( $product_info['products_fields_group_values'] ) {
$product_info['products_description'] = $product_info['products_fields_group_values'];
}

 

I guess it has something to do with the last line added, but I can't figure out what.

 

Thanks again for your help, it's much appreciated.

 

Gerhard.

Edited by srirahandcraft

Addons installed on my website:

 

- Addons Installed

- Advanced Special Offer Discounts

- AJAX-Attribute Manager for osc 2.3.1

- Banner box v1.1.1

- Dutch Language Pack

- Extra Pages-info box with admin for OSC2.3

- German Language Pack

- Login Box

- Multi-language Support for Configuration

- Multiple products manager

- Order Editor

- OSC PDF Catalogue 2.1

- PDF-Datasheet

- product Field Groups

- Quickly Update Product Stock

- Unit of weight

- YAG (Yet another Guestbook)

Share this post


Link to post
Share on other sites

The language ID hasn't changed, so I don't think that the modification has anything to do with this problem. Is the link to the PDF passing the language as a parameter? It should look like this:

 

 

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

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

×