Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help deciphering code problem


starpowersports

Recommended Posts

:blink:

I am still trying to resolve a fatal error message that states the problem is on line 31 of my new_products.php file.

:blink:

 

Specifically its message states:

Call to undefined function: tep_get_products_description()

 

The script from that file follows ... I believe the line 31 problem is what I colored in red :

 

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 

new contentBoxHeading($info_box_contents);

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS);

} else {

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($new_products = tep_db_fetch_array($new_products_query)) {

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$new_products['products_description'] = tep_get_products_description($new_products['products_id']);

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="100%" valign="top"',

'text' => '

<table width="100%" border="0" cellspacing="0" cellpadding="3">

<tr>

<td rowspan="3" class="imagelist"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>

<td class="main" valign="top"><strong><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></strong></td>

<td align="right" class="main" valign="top"><strong>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</strong></td>

</tr>

<tr>

<td colspan="2" class="main" valign="top">' . strip_tags(substr($new_products['products_description'], 0, 350)) . '...</td>

</tr>

<tr>

<td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW . ' ' . $new_products['products_name']) . '</a></td>

<td align="right"><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW . $new_products['products_name']) . '</a></td>

</tr>

</table>');

$col ++;

if ($col > 0) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

 

 

BUT!

I'm just not seeing (or maybe, its' that I am not understanding) ...

what needs to be corrected, do you?

 

I'm really stuck, please advise, thanks so much!

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

it means that you do not have this function

if this is a new contribution that you installed you missed a step

easy answer

change

$new_products['products_description'] = tep_get_products_description($new_products['products_id']);

to

//$new_products['products_description'] = tep_get_products_description($new_products['products_id']);

$new_products['products_description'] = '';

but you will not get the description displayed

Link to comment
Share on other sites

Frank, Thanks for responding!

 

Well, I have NOT added any contributions anywhere in any file as yet...

So that could not be what is causing the problem, right?

 

Also, I have not even been in this file making any changes - I did change the character count for the product description in the SQL database - could that be related (????) don't see how, but thought I'd ask!

 

Also ...

it means that you do not have this function

Do you have an idea how to make sure I DO have this function working? ... I can't go without a product description - the ol' man'll blow a gasket! :lol:

 

Greatly appreciate your continued thoughts!

Thanks!

 

it means that you do not have this function

if this is a new contribution that you installed you missed a step

easy answer

change

$new_products['products_description'] = tep_get_products_description($new_products['products_id']);

to

//$new_products['products_description'] = tep_get_products_description($new_products['products_id']);

$new_products['products_description'] = '';

but you will not get the description displayed

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

Seems you overriden some files on the catalog side with ones from the admin. Check the includes\functions\general.php and admin\includes\functions\general.php These are different files. (double check with the osc default files) Somehow the admin functions ended up on the catalog side.

Link to comment
Share on other sites

Thanks Mark!

 

I will look through those folders ... am I to assume (or presume, perhaps -!!- ) than that I should be finding same files with same code in each of those folders and if not, to replace them?

 

Maybe ( ???) you could elaborate what comes next after I locate those folders and review their content ?? I feel this may be a lot of steps for you to instruct me on, if so, I will understand if you need to pass on further assistance!

 

Thanks again for responding ! :thumbsup:

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

you could d/l the default osc. And compare the files in the catalog\includes\functions directories. You could use a compare utility like winmerge

 

http://winmerge.org

 

 

Mark, that was a great suggestion!

What a handy tool! :rolleyes:

 

OK ... so, I downloaded WINMERGE and copied the two files (general.php) into the compare function and there are definitely differences! But! I am presuming that I am to copy from one and correct the other, right ? Do I take the one that seems to have more text [for lack of a better definition] into the one that seems to be lacking ?

 

 

I do not have the "original" default oscommerce loaded on my computer as the whole kit'n kaboodle was already functional as an extra with my web host package - and actually I really don't have the hard drive space available to do that either ~~ which means ~~ I can't really compare to the default file ... IS there some other resource for doing that maybe?

 

 

What does this general.php file do anyways? Sure is a ton of code written in there! :-"

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

the osc zip is 1.4MB almost fits in a floppy disk. If you have mods with your shop try to compare the from your backups the general.php files on both admin catalog sides.

 

Do not compare the admin general.php with the catalog general.php These files are different. The general.php has a bunch of critical functions for your osc shop.

Link to comment
Share on other sites

the osc zip is 1.4MB almost fits in a floppy disk.

Do not compare the admin general.php with the catalog general.php These files are different. The general.php has a bunch of critical functions for your osc shop.

 

 

oh man! you guys who are so much more educated then I, throw around your "lingo"s and I just fall off in sheer panic!! Some of us who are still trainable and can learn (even at this age) need more specifics - from time to time! HA!

 

 

You said:

If you have mods with your shop try to compare the from your backups the general.php files on both admin catalog sides.

 

So, I figured out that you meant if I have already made any modifications to my shop - THEN - I should use the backups to do the comparing, and those backups would be the current files I have uploaded right?

 

... But ... if I don't have any modifications made to the shop then I am to use the default files that I will be able to find in the downloaded application.

 

OK ~~~~~~~~

 

I did the oscommerce file download and found the default files, which are located under the catalog folder, and the sub folders of admin and includes...

 

and ~~~

I used my current files (loaded to my site) for comparing as I have done a few modifications to the shop already;

 

and ~~~

WINMERGE says my /catalog/admin/includes/function/general.php file and the osCommerce/catalog/admin/includes/function/general.php (thedefault general.php file) are identical.

 

It also says the very same about the general.php file I would be finding in both of the "catalog/includes/function/ " folders.

 

so -- now -- what -- ?

 

Does this mean that there is not any overiding issues after all?

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

ok then, the error you're getting is when you access the catalog side correct? Because the function error

Call to undefined function: tep_get_products_description()

 

that function exists on the admin side only with the default osc.

Link to comment
Share on other sites

ok then, the error you're getting is when you access the catalog side correct?

 

That is correct!

 

 

Because the function error

Call to undefined function: tep_get_products_description()

 

that function exists on the admin side only with the default osc.

 

Ohh Kay .............

 

:(

What does that mean, Mark?

 

I get what you are telling me ::::::::::::::> which is this fatal error message is happening cuz' the function it trying to call from - exists only in the Admin interface stuff and I am trying to call it from the Catalog [user interface] stuff, right?<::::::::::::::::::::::

 

So how the hell did that happen !! ?? !!

 

Oh, man, I'm going to bed - will try to work on this again tomorrow , if you are around, that's great - if not I'll send the epitah!

 

Thanks for all your fabulous dedication this evening!

you are Swe-e-e-e-e-e-e-T !

Babs

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"What has been, has been, what will come, will come.

Our job is to learn from the past, keep looking ahead, and find joy in each moment."

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Link to comment
Share on other sites

well if you can search the osc tree of files (using a search tool or your explorer) this function should have references 3 times. 2 in the admin\categories.php and 1 in the admin\includes\functions\general.php Because it looks somehow ended up on another file

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...