Jump to content
kymation

[Addon] PDF Datasheet

Recommended Posts

When posting code into this forum, use the Code button on the editor (Third from the left in the top row; the one with the green bars.) This prevents the loss of formatting and changing of line numbers. Since the lines are messed up, I had to guess at the right place in the code, so this may not work.

 

Find this code:

if ($information_tree[$information['information_id']]['parent_id'] != '0') {

 

and insert this line just before it:

$child_information = array();

 

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,

 

Thank you to explain how to post the code properly. Never use it before. Good to learn a new thing.

 

 

 

I repost it again. Hopefully I do it right!

 

<?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 SLiCK_303@hotmail.com for OSC v2.3.1
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 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_information_show_category($information_group_id = 1) {
   global $sitemapString, $languages_id;
   $information_tree = array();
   $informationString = '';
   $parent_child_selected = '';
   // Retrieve information from db
   // ID set by module for Information box
   $information_query = tep_db_query("select information_id, information_title, parent_id from " . TABLE_INFORMATION . " where visible = '1' and language_id = '" . (int)$languages_id ."' and information_group_id = '" . (int)$information_group_id . "' ORDER BY sort_order");
   while ($information = tep_db_fetch_array($information_query)) {
  $information_tree[$information['information_id']] = array(
    'info_title'   => $information['information_title'],
    'parent_id'    => $information['parent_id'],
    'info_next_id' => 0
  );
  if ($information_tree[$information['information_id']]['parent_id'] != '0') {
    $child_information[] = array (
	  'parent_info_id' => $information['parent_id'],
	  'child_info_id'  => $information['information_id']
    );
  }
   }
   $count_child = count($child_information);
   // Test if a child has been requested and set $parent_child_selected
   for ($i = 1; $i < ($count_child+1); $i++) {
  if ((isset($_GET['info_id'])) && ($child_information[$i]['child_info_id'] == $_GET['info_id'])) {
    $parent_child_selected = $child_information[$i]['parent_info_id'];
  }
   }
   // Run through the $information_tree to find all pages
   while ($element = each($information_tree)) {
  if (!isset($information_tree[$element['key']]['parent_id']) || ($information_tree[$element['key']]['parent_id'] == 0)) {
    //Set the main title to bold if it was selected or one of its children were selected
    if (((isset($_GET['info_id'])) && ($_GET['info_id'] == $element['key'])) || ($parent_child_selected == $element['key'])) {
	  $informationString .= '<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $element['key']) . '"><strong>' . $information_tree[$element['key']]['info_title'] . '</strong></a><br />';
    } else {
	  $informationString .= '<a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $element['key']) . '">' . $information_tree[$element['key']]['info_title'] . '</a><br />';
	  //Sitemap only
	  $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $element['key']) . '">' . $information_tree[$element['key']]['info_title'] . '</a></li>' . "\n";
    }
    //Just for sitemap
    $ul = false;
    for ($i = 1; $i < ($count_child+1); $i++) {
	  if ($child_information[$i]['parent_info_id'] == $element['key']) {
	    if ($ul == false) {
		  $sitemapString .= '<ul>' . "\n";
		  $ul = true;
	    }
	    $sitemapString .= '<li><a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '">' . $information_tree[$child_information[$i]['child_info_id']]['info_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['info_id'])) && ($_GET['info_id'] == $element['key'])) || ($parent_child_selected == $element['key'])) {
	  for ($i = 0; $i < ($count_child); $i++) {
	    if ($child_information[$i]['parent_info_id'] == $element['key'])
		  //Show a child as bold if it was selected
		  if ((isset($_GET['info_id'])) && ($_GET['info_id'] == $child_information[$i]['child_info_id'])) {
		    $informationString .= '  <a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '"><strong>' . $information_tree[$child_information[$i]['child_info_id']]['info_title'] . '</strong></a><br />';
		  } else {
		    $informationString .= '  <a href="' . tep_href_link(FILENAME_INFORMATION, 'info_id=' . $child_information[$i]['child_info_id']) . '">' . $information_tree[$child_information[$i]['child_info_id']]['info_title'] . '</a><br />';
		  }
	  }
    }
  }
   }
   return $informationString;
 }
////
// Define customer greetings
 function tep_information_customer_greeting_define() {
   global $customer_id, $customer_first_name, $languages_id, $category_depth;
   if ($category_depth == 'top') {
  // Retrieve information from db
  $information_group_id = 2; // ID set by module for Entrance messages
  $information_query = tep_db_query("select information_title, information_description from " . TABLE_INFORMATION . " where language_id = '" . (int)$languages_id . "' and information_group_id = '" . (int)$information_group_id . "'");
  while ($information = tep_db_fetch_array($information_query)) {
    // if($information['information_title'] == 'HEADING_TITLE')
    define($information['information_title'], $information['information_description']);
  }
   }
 }
////
// Return a customer greeting
 function tep_information_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

That's much easier to read. The code that I posted should work. Did you try 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

Hi Jim,

 

I repost the information.php code with your instruction (green button).

 

Could you please help me again with it?

 

I put the code you mentioned

 

$child_information = array();

 

and the error message I got is

 

Notice: Undefined variable: child_information in /catalog/includes/functions/information.php on line 49

TCPDF ERROR: Wrong page number on setPage() function: 0

Edited by ce7

Share this post


Link to post
Share on other sites

line 49 is

 

 $count_child = count($child_information);

 

thank you very much in advance

 

Lyn

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


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,

 

I tried to put the code after your new suggestion, this time I get different error:

 

TCPDF ERROR: Wrong page number on setPage() function: 0

 

thank you again for your help.

 

Lyn

Share this post


Link to post
Share on other sites

That's probably a setup error. Do you have the required modules installed with the default sort order?

 

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,

 

Do you mean set up PDF Datasheet error ? I will have a look my PDF Datasheet and information page unlimited again. And will be back later.

Share this post


Link to post
Share on other sites

Hi Jim,

 

I had check the installation of your PDF Datasheet and Information Page unlimited again. I think I did it right of every step.

 

And then came back to read your reply again, I realize just now that you mean the module setting / configuration in backend / modules.

 

Actually I haven't touch that at all. I will read again your User's Manual / part 3 Configuration and come back again later.

 

Tars!

 

Lyn

Edited by ce7

Share this post


Link to post
Share on other sites

Posted at the same time....

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

ok, I went to modules / pdf datasheet / installed the modules

( I didn't installed earlier....silly me) now my PDF Datahseet has the moduels as below:

(i didn't change any sort order, it is as default)

Description 9050

Extra Images 9060

File Name 9999

Fonts *REQUIRED* 9002

Header 9001

Image and Price 9025

Initialize *REQUIRED* 9000

Product Page Link 9070

Manufacturer's Name 9065

Title 9010

 

and the error message I got this time is as below:

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_STATUS already defined in /catalog/pdf_datasheet.php on line 66

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_SORT_ORDER already defined in /catalog/pdf_datasheet.php on line 66

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_SHOW_IMAGE already defined in /catalog/pdf_datasheet.php on line 66

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_IMAGE_WIDTH already defined in /catalog/pdf_datasheet.php on line 66

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_IMAGE_LOCATION already defined in /catalog/pdf_datasheet.php on line 66

 

Notice: Constant MODULE_PDF_DATASHEET_IMAGE_PRICE_IMAGE_PADDING already defined in /hocatalog/pdf_datasheet.php on line 66

 

Notice: Undefined variable: has_list_price in /catalog/includes/modules/pdf_datasheet/pd_image_price.php on line 133

 

Notice: Use of undefined constant TEXT_YOUR_PRICE - assumed 'TEXT_YOUR_PRICE' in /catalog/includes/modules/pdf_datasheet/pd_image_price.php on line 274

 

Fatal error: Call to undefined function tep_get_products_attributes() in /catalog/includes/modules/pdf_datasheet/pd_image_price.php on line 314

 

thank you very much Jim

 

Lyn

Share this post


Link to post
Share on other sites

The first 6 errors indicate that the Image and Price module was installed twice. Try uninstalling that module. If that doesn't work, you'll have to delete the constants from the configuration database table by hand.

 

The last three are bugs. I'll fix those and put up a new version. For now, just leave that module uninstalled. If you need it, let me know and I'll post a fix. Thanks for letting me know about these bugs.

 

Last of all, there is no reason I can think of for installing all of these modules at once. Please read the User's Manual before doing anything with this Addon.

 

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 the reply.

 

I am a newbie, sometimes I got confused even when I read manual...LOL

 

Thanks again. Will go to try what you just mentioned.

 

Lyn

Share this post


Link to post
Share on other sites

Hi Jim,

 

Can you please post the fix?

 

Thank you very much for your time and help.

 

Lyn

Share this post


Link to post
Share on other sites

I don't have a fix, and I don't have time to code one. You can fix it yourself, or just not use that module.

 

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,

 

Thank you very much for your reply.

 

I don't know the php code at all, so I can not fix myself. Looks like I have to uninstall this addon, though I love to have it.

 

Once again, thank you very much for your help and time.

 

Lyn

Share this post


Link to post
Share on other sites

Hi, I don't know if this is the right place for this. I have been figuring most of this out on my own. I want to add a FAQ's page in my information box. I figured out how to edit the information box to add a faq's option to it, but I do not know how to add a faqs.php page into my define languages section so I can edit and have my faqs page viewable to customers. Can anyone help me with this please?

Share this post


Link to post
Share on other sites

This has nothing to do with a PDF Datasheet. Your question has been answered many times; search the forum for the answers.

 

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,

 

I have your wonderful PDFdatseheet contribution installed on two sites and they works like a dream.

Im doing a new site right now and got tons of errors as ususal (mostly fault with double entries in the configuration table).

 

The only thing that isnt working now is the description moudule.

I get the product image but not the description text.

I have looked at the module several times and cant find any error (and the same module is working on other sites).

Do you have any idea where I can start looking to try to get the description text working?

 

(everyting is in UTF8 ;)

Share this post


Link to post
Share on other sites

The description text uses an HTML converter, so check the HTML in the description for errors, or use a product that has no HTML in the description for testing.

 

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

still not work not have idea where is the problem.......

Warning: require_once(/ext/tcpdf/config/lang/eng.php) [function.require-once]: failed to open stream: No such file or directory in /web/htdocs/www.footballshirtstar.com/home/pdf_datasheet.php on line 212
Fatal error: require_once() [function.require]: Failed opening required '/ext/tcpdf/config/lang/eng.php' (include_path='.:/php5/lib/php/') in /web/htdocs/www.footballshirtstar.com/home/pdf_datasheet.php on line 212

 

 

inside the file pdf_datasheet.php on line 212

 

 // Get the PDF language and config files
 require_once( '/ext/tcpdf/config/lang/eng.php' );
 require_once( '/ext/tcpdf/tcpdf.php' );

 

and this are the server setup:

 

Server OS: Linux 2.6.32-71.29.1.el6.x86_64

Database: MySQL 5.5.24-55-log

HTTP Server: Apache/2.4.2 (Unix) mod_fcgid/2.3.7

PHP Version: 5.2.17 (Zend: 2.2.0)

Edited by luigicosta

Share this post


Link to post
Share on other sites

Your code, as posted above:

 

// Get the PDF language and config files
 require_once( '/ext/tcpdf/config/lang/eng.php' );
 require_once( '/ext/tcpdf/tcpdf.php' );

 

Code from the distribution package:

 

  // Get the PDF language and config files
 require_once( 'ext/tcpdf/config/lang/eng.php' );
 require_once( 'ext/tcpdf/tcpdf.php' );

 

See the difference?

 

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 description text uses an HTML converter, so check the HTML in the description for errors, or use a product that has no HTML in the description for testing.

 

Regards

Jim

 

Its plain text, with no html in the text and the only extra addons in this site is Products Specification, Header Tags SEO and SPPC and none of this addons should conflict with the description fields in PDF datasheet.

I will experiment some more to see if I can find some conflicts anywhere..

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

×