Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Description Cut Off


Kerrigan

Recommended Posts

Hello everyone. I didn't think that I would have to do this, but here I am. I have been able to solve every other "problem" I have had with oscommerce by looking at the past questions asked by others and applying the answers given. I've tried to do the same with this situation, but to no avail. I have made changes where needed in these files:

 

/includes/modules/product_listing.php

 

/includes/modules/new_products.php

 

/product_info.php

 

/products_new.php

 

/includes/header.php

 

And after making all of the changes or some of the changes, it has not helped at all. I have tried to use the phpMyAdmin as well and tried my best to make the changes that I thought I needed to make, but that hasn't helped either. I've searched around in my admin control panel under configuration to see if that would have something, but there is nothing there that limits the number. I do know that at the end of my /includes/header.php, there is this code:

 

<?php 
define(MAX_DESCR_1,'80');

define(MAX_DESCR_NAME,'35');
define(MAX_DESCR_NAME_SHOPPCART,'35');
define(MAX_DESCR_BESTS,'19');
define(MAX_DESCR_REVIEWS,'50');
define(MAX_DESCR_NAME_BOX,'15');
?>

 

And I have changed the '80' in the top line of code to 1,000 and 2,000 but it hasn't helped a bit (although it seems that my product description is limited to 80). Is there something simple that I am missing here? Please help me as this is the last issue that I need to get straightened out before "launching" my store. Thanks...

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Is anyone at all able to help?

 

 

try reading your own post!!! your precise issue is????

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

try reading your own post!!! your precise issue is????

 

Thanks for responding spooks. My problem, as the title of the thread says, is that my product descriptions keep getting cut off. Like I said in my initial post, I have tried all of the things I could find on this forum to fix this problem, but nothing has worked. To see exactly what I have tried, simply look at the first post. Is there something that I am missing or are you saying that the solutions I have tried are the only ways to fix this problem?

Link to comment
Share on other sites

Thanks for responding spooks. My problem, as the title of the thread says, is that my product descriptions keep getting cut off. Like I said in my initial post, I have tried all of the things I could find on this forum to fix this problem, but nothing has worked. To see exactly what I have tried, simply look at the first post. Is there something that I am missing or are you saying that the solutions I have tried are the only ways to fix this problem?

 

 

Your description gets cut off where? in admin after u enter it etc etc

 

product_listing.php does not list it by default, so ???

 

If you don't provide full info u get no reply!!!!

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Your description gets cut off where? in admin after u enter it etc etc

 

product_listing.php does not list it by default, so ???

 

If you don't provide full info u get no reply!!!!

 

Sorry I didn't supply all of the info needed. When I go into my admin control panel and enter the description for each product, it allows me to enter as much information as I want. I save it and then go to the store on my website and it is cut down to about 80-100 characters or so. Then I go back into my admin control panel to edit the same product again and it shows the shortened description. So, the product descriptions are cut off in both, even though I am able to enter a full description in through the admin control panel and save it at first.

 

I went through making the changes in all of the .php files. I changed the

define(MAX_DESCR_1,'80');

in the includes/header.php file from 80 to 2000 and that didn't work. I also made changes to these files: /includes/modules/product_listing.php /includes/modules/new_products.php In both of those I changed the

$p_desc = ''.substr($product['products_description'], 0, MAX_DESCR_1);

to

$p_desc = ''.substr($product['products_description'], 0, 2000);

and that didn't work. I also tried making changes to the /product_info.php file with this code:

<div class="padd3"><?php echo stripslashes($product_info['products_description']); ?>

but that didn't work. I really wasn't sure how to change that file anyway. I have also made changes to this code:

$p_desc = substr($product['products_description'], 0, MAX_DESCR_1);

in the products_new.php file, but that didn't work either. Lastly, I have tried to make changes in the phpMyAdmin, but didn't really know what I was doing in there. I tried to make changes to the structure of the products_description table by changing the Type from TEXT to LONGTEXT, and by changing the Type to VARCHAR and then changing the Length/Values to 1000 and that didn't work.

 

This is all that I have attempted to do in order to fix this problem. I have attempted to add the longer product description after each step taken and none of it has worked. Let me know if you need more information. Thanks for your help and patience spooks...

Link to comment
Share on other sites

Check in phpMyAdmin in the products_description table and be sure that the products_description column type is set to 'text'

 

Thanks Mark. Yeah, it was that in the beginning, but I just changed it back to that and it didn't help...

Link to comment
Share on other sites

Thanks Mark. Yeah, it was that in the beginning, but I just changed it back to that and it didn't help...

Ok, so from the above I think we identified that the text being cut-off is text that does not get into the database. Perhaps the column was set to a varchar(200) or something, which will only store the first 200 characters. Accounts for your problem. Now, once you change it back to 'TEXT' you will have to add the description back in like you are editing a product in the Admin -> Catalog, and then check with phpMyAdmin to see if the text is stored properly.

 

Now what are the results?

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Ok, so from the above I think we identified that the text being cut-off is text that does not get into the database. Perhaps the column was set to a varchar(200) or something, which will only store the first 200 characters. Accounts for your problem. Now, once you change it back to 'TEXT' you will have to add the description back in like you are editing a product in the Admin -> Catalog, and then check with phpMyAdmin to see if the text is stored properly.

 

Now what are the results?

 

Yeah, I did all of that and the results are still the same. The store, the admin and the phpMyAdmin are all showing a cut off description. Here's the rest of my settings on the product_description under phpMyAdmin:

 

Field: products_description

Type: TEXT

Length/Values: it is empty

Default: NULL

Collation: utf8_general_ci

Attributes: it is empty

Null: a checked box

AUTO_INCREMENT: an unchecked box

Comments: it is empty

Link to comment
Share on other sites

Focus your search for this in the add/edit product routines in the admin/categories.php file. All those places you mention in your first post are just limiters on how the data is displayed, not how it is stored.

 

Follow the life of the variable from inception to storage. You have to get it stored in the database and see it with phpMyAdmin before anything else. Look at the text input box, then look at the sql statement that stores the info. And you have already looked at the column parameters so it is not likely that, but just in case, use phpMyAdmin to edit a product description beyond the point of cut off and see if the data remains intact.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

I see my ealier posts have been neg scored, says some think saying why a post get no reply is bad!! is that good for the forum?? ohmy.gif or do they do it without thinking??

 

 

Check categories for inputs with maxlength= params, some templates use that.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Focus your search for this in the add/edit product routines in the admin/categories.php file. All those places you mention in your first post are just limiters on how the data is displayed, not how it is stored.

 

Follow the life of the variable from inception to storage. You have to get it stored in the database and see it with phpMyAdmin before anything else. Look at the text input box, then look at the sql statement that stores the info. And you have already looked at the column parameters so it is not likely that, but just in case, use phpMyAdmin to edit a product description beyond the point of cut off and see if the data remains intact.

 

Thanks Mark. I will check out the admin/categories.php file and see what I find. By the way, one thing that I forgot to mention is that I am able to add the description to each product in the phpMyAdmin and it stays the right length. Only thing is phpMyAdmin does some weird things when I use certain punctuation, like (') and ("). I just don't want to have to go into phpMyAdmin to enter in the product description every time and I don't know how to fix the problems with punctuation. Does the fact that it is "fixed" when I put in the product description in phpMyAdmin help narrow down my problem at all? Thanks again for your help...

Link to comment
Share on other sites

Ok, I looked through the admin/categories.php file and found a lot of "product_description" coding in there, but nothing that I saw to change the length or what the max length could be or inputs with maxlength= params. Am I not able to post the all of the code from the admin/categories.php file? I have tried twice and I just get kicked out to the main forum page.

Link to comment
Share on other sites

Thanks Mark. I will check out the admin/categories.php file and see what I find. By the way, one thing that I forgot to mention is that I am able to add the description to each product in the phpMyAdmin and it stays the right length. Only thing is phpMyAdmin does some weird things when I use certain punctuation, like (') and ("). I just don't want to have to go into phpMyAdmin to enter in the product description every time and I don't know how to fix the problems with punctuation. Does the fact that it is "fixed" when I put in the product description in phpMyAdmin help narrow down my problem at all? Thanks again for your help...

Yeah, actually it does. Now, when the description in your db is like you want it (regarding the length, not the quotes problem) does it output in the various pages like you want it?

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Great! We may be getting somewhere then. YES, when I put the complete description in via the phpMyAdmin, it DOES look like I want it to (except for the ' and the ''). What should I do next?

Next is to enter a description just the way you want it. Make sure that it exceeds the length that is normally cut off. But this time do not use any characters other than a-z.

 

Let's make sure that the quotes are not the cause. The programs should make any quotes you put in there useable, but if that routine is not working right then the quotes will mess it up.

 

If it takes a lengthy description that contains nothing but letters then we have narrowed it down even more.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

does something like this help for extending the product title?

google search +product +title +length

 

Be careful that you don't increase the title length over the amount of characters your payment modules may take i.e. sage pay only allows 100 characters to be passed over. Maybe better to use shorter titles?

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

------------------------------------------------

PM me? - I'm not for hire

Link to comment
Share on other sites

Next is to enter a description just the way you want it. Make sure that it exceeds the length that is normally cut off. But this time do not use any characters other than a-z.

 

Let's make sure that the quotes are not the cause. The programs should make any quotes you put in there useable, but if that routine is not working right then the quotes will mess it up.

 

If it takes a lengthy description that contains nothing but letters then we have narrowed it down even more.

 

Thanks Mark. I tried doing this and it won't take the lengthy description without the quotes from the admin panel. Is there anything else that I can do?

Link to comment
Share on other sites

does something like this help for extending the product title?

google search +product +title +length

 

Be careful that you don't increase the title length over the amount of characters your payment modules may take i.e. sage pay only allows 100 characters to be passed over. Maybe better to use shorter titles?

 

Thanks tigergirl, but my issue is not the product title, but the product description...

Link to comment
Share on other sites

Thanks tigergirl, but my issue is not the product title, but the product description...

 

I' m sorry for being unhelpful, I should have read the post better. :blush: My brain was conecting it to an issue I had.

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

------------------------------------------------

PM me? - I'm not for hire

Link to comment
Share on other sites

Thanks Mark. I tried doing this and it won't take the lengthy description without the quotes from the admin panel. Is there anything else that I can do?

 

Then look at the process of the textarea once you click on the Preview button. The result screen shows the description. Is it complete there?

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Then look at the process of the textarea once you click on the Preview button. The result screen shows the description. Is it complete there?

 

Yes, when I click on the "Preview" button, all of the text is there. Something happens between there and when I press the "Update" button. Most of it just disappears. I am really baffled by it... :(

Link to comment
Share on other sites

Yes, when I click on the "Preview" button, all of the text is there. Something happens between there and when I press the "Update" button. Most of it just disappears. I am really baffled by it... :(

I would then look for the following lines of code in /catalog/admin/categories.php around line 280 +/- add ons.

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),
                                     'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),
                                     'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]),

 

And just below that section...

    if ($action == 'insert_product') {
        $insert_sql_data = array('products_id' => $products_id,
        'language_id' => $language_id);

    $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

    tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
  } elseif ($action == 'update_product') {
    tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}

 

 

Then, in /catalog/admin/includes/functions/database.php around line 144

 function tep_db_prepare_input($string) {
   if (is_string($string)) {
     return trim(stripslashes($string));
   } elseif (is_array($string)) {
     reset($string);
     while (list($key, $value) = each($string)) {
       $string[$key] = tep_db_prepare_input($value);
     }
     return $string;
   } else {
     return $string;
   }
 }

 

See if you have code that is substantially different. Perhaps changed with an add-on?

 

Have you got a backup of the /admin/categories.php to put there just to see what effect it would have?

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...