Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do i add a extra short description field for products


Recommended Posts

How do i add a extra short description field for each products so i can have a sub descirtion which appears like in http://www.rockbottombikes.com/subproducts...ountain%20Bikes

and then appears like it does on this website?

I want to be able to add the short description when i add the products.

 

:?:

Also is it possible to add attributes for a product at the same time as adding in the product instead of having to go to another table in the admin?

:?:

 

Can someone please help me

Link to comment
Share on other sites

You will need to modify the database and add a field for products_description_short to the products_description table:

ALTER TABLE `products_description` ADD `products_description_short` VARCHAR( 255 ) AFTER `products_name`;

You will need to modify the product listing to use products_description_short. I would recommend looking at the Product Description in Listing or Product Description contributions to see how they do it with products_description.

 

All files that currently use the products_description field will have to be changed to use products_description_short as well, if you want to duplicate the way that it works on the example site. I would suggest looking at the Add new products fields contribution to get an idea of where you will need to make changes. You can also check out this thread and this thread.

 

You could also make the two mutually exclusive. In this situation, you would have a short description that would appear in the product listings but nowhere else. This would mean that any information in the short listing would have to be entered into the long version as well, which is more work for the catalog maintainer. However, it would be a lot less work for the coder, since only the product listing and product add/update pages would have to change. I also find this to look better. To me, the short description part of the product info page from the link you posted looks jarring. It doesn't fit in with the rest of the information.

 

Good luck,

Matt

Link to comment
Share on other sites

How do i add a extra short description field for each products so i can have a sub descirtion which appears like in http://www.rockbottombikes.com/subproducts...ountain%20Bikes

and then appears like it does on this website?

I want to be able to add the short description when i add the products.

 

I don't know how comfortable you feel about messing with the code but I made the following changes to /catalog/includes/modules/product_listing.php, around line 111 add after this line

case 'PRODUCT_LIST_NAME':

copy and paste the following code between the next case line,

 

 $lc_align = '';

           if (isset($HTTP_GET_VARS['manufacturers_id'])) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

           } else {

    $desc_query = "SELECT products_description FROM products_description WHERE products_id ='" . $listing['products_id'] . "'";

    $result = mysql_query($desc_query);

    $product_array = mysql_fetch_array($result);

    $prod_description = $product_array['products_description'];

    

             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br><span class="smallText">' . string_cut($prod_description, 200) .  '</span> ';

           }

           break;

 

and then add the following function at the bottom of the page:

<?php



function string_cut($string,$cut_size) { 

$string_size = strlen($string); 

$string = substr($string, 0, $cut_size);

if ($cut_size <= $string_size){

 $string .= ' ...';

}

return $string; 



} 



?>

 

and that's it! just one file to edit, you may see it working at http://www.malewitch.com/catalog/default.php/cPath/9, please let me know if I was able to help you.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Greetings All,

 

Phelan, this little tip is GREAT!!!!

Exactly what I was looking for.

 

THANK YOU :!:

 

One question though...

For some reason I have two(2) Buy It Now buttons?

If I change the configuration not to show the Buy It Now Button, I now show two(2) price columns.

This can't be good.

Any ideas :?:

 

TIA,

Steve

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...