Author Topic: Bug: ps_product_type.php  (Read 2415 times)

doorknob

  • Jr. Member
  • **
  • Posts: 151
Bug: ps_product_type.php
« on: August 12, 2008, 15:45:32 pm »
When the 'search according to parameters' is run, the hidden fields used to hold the search parameter values also use the same text value as the field id. This causes two problems

1. The ID may contain illegal characters such as spaces (see fix below)
2. More than one parameter may contain the same text value, causing illegal duplicated IDs (no fix proposed here)

To fix the illegal ID value issue, I made the following chamge to line 460:
Code: [Select]
$html .= "<input type=\"hidden\" id=\"$value\" name=\"".$item_name."[]\"  value=\"".$value."\" />\n";
changed to:
Code: [Select]
$id = preg_replace( "/[\-]+/", "_", preg_replace( "/[^a-z0-9]/", "_", strtolower( $value )));
$html .= "<input type=\"hidden\" id=\"$id\" name=\"".$item_name."[]\"  value=\"".$value."\" />\n";

This fixes the syntax problem but I'm not sure what other implication there might be.
Regards
Phil
(J1.5.3 vm 1.1.2 (nightly 8th Aug)