osCommerce Slashes acumelating in product name and description fields.


I recently ran into an issue in osCommerce 2.2RC2. In the admin area when adding, editing a product everything is fine but when you hit back on the the on the preview screen your product name and description have a bunch of extra slashes in it. This happens because osCommerce is escaping the quote you put into the name and description and not removing them on the way back.

Heres a quick fix

Go to “admin/categories.php” and find the following line

<td><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>

and replace it with

<td><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : stripslashes(tep_get_products_name($pInfo->products_id, $languages[$i]['id'])))); ?></td>

Then replace this line :

<td><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

with:

<td><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : stripslashes(tep_get_products_description($pInfo->products_id, $languages[$i]['id'])))); ?></td>

Thats it its as easy as that.

  • Share/Bookmark

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.