Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cannot get Description to Show


bigbuba0

Recommended Posts

Example is this page: http://www.bombadaonline.com/index.php?cPath=59_67

 

basically I want a few sentences to show under each product name. My product listing settings are at 3 for the product description. Any help would be appreciated

 

It's a little tricky, but totally doable. I don't know what your experience with php is, so please bear with me if I seem to talk either down or sound too advanced for you.

 

First thing that you would need to do is make sure that the product description is coming up in the sql statement(s). There are 4 different statements that are called, depending on the situation that the index.php file is presented with, so it would be best to include p.products_description in the list for each of the select statements. These begin around line 170 in the index.php file.

 

Second, you'll want to find the includes/modules/product_listing.php and find the line of code where the name of the product is being displayed. This is around line 111 in my code. If you only want a certain amount of the description to be displayed, then I would recommend doing a split before echoing out the description, that way you can control how much of the description is displayed without making the page bigger. Here's and example of what I'm talking about.

 

case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		$temp_desc = str_split($listing[''products_description], 50);  //50 represents how many characters to display
		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']) . '" style="color:#FFFFFF">' . $listing['products_name'] . '</a><br>' . $temp_desc[0];
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '" style="color:#FFFFFF">' . $listing['products_name'] . '</a> <br>' . $temp_desc[0];
		}

 

I hope that helps a little bit. I haven't tested it out myself, but I know that it can be done. It will just take some time, effort, and coffee.

 

Good luck!

Link to comment
Share on other sites

I just found a function that osCommerce has that would be better than doing php's str_split. Use tep_break_string instead, and osCommerce will take care of the rest. All that you have to do is this:

 

tep_break_string($listing['products_name'], 60, '-<br>')

 

I hope that makes things a little easier.

Link to comment
Share on other sites

Where do I add that line of code??? I have a basic knowledge of php, and can pretty much only add some contributions

 

 

I just found a function that osCommerce has that would be better than doing php's str_split. Use tep_break_string instead, and osCommerce will take care of the rest. All that you have to do is this:

 

tep_break_string($listing['products_name'], 60, '-<br>')

 

I hope that makes things a little easier.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...