Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

using 'nl2br' when adding a product


Guest

Recommended Posts

Posted

Hi,

 

I was wondering if it would be possible to use PHP's function 'nl2br' to add line breaks to the product description when adding a product?

I find it frustrating to have to manualy type in <br /> tags.

 

If I added something like this to the relevant page the line breaks would automatically be added:

$productdescription= nl2br($productdescription);

 

Can anyone possibly give me any advice on which page to add this to and what variable name the product description is stored in?

Posted

I'm guessing that I need to make the mod at around line 357 of admin/categories.php

 

Can anyone verify this?

Posted

Actually line 296 looks more like it:

 

 while ($description = tep_db_fetch_array($description_query)) {
		  tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
		}

Posted

OScommerce is one of the most popular shopping cart solutuions available, surely Im not the only one who sees this as a problem?

Can anyone with a little more experience with PHP lend a hand, please?

Posted

I have implemented something similar, but at the point when osCommerce displays the description. This means that anyone editing it doesn't have to deal with any HTML code, and the code won't interfere with searches etc.

 

I changed the following line in "product_info.php" (around line 120):

 

FROM:

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

TO:

<p><?php echo nl2br(stripslashes($product_info['products_description'])); ?></p>

 

Hope this helps!

  • 3 years later...
Posted

I have implemented something similar, but at the point when osCommerce displays the description. This means that anyone editing it doesn't have to deal with any HTML code, and the code won't interfere with searches etc.

 

I changed the following line in "product_info.php" (around line 120):

 

FROM:

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

TO:

<p><?php echo nl2br(stripslashes($product_info['products_description'])); ?></p>

 

Hope this helps!

 

exactly what i needed, many thanks!

Archived

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

×
×
  • Create New...