Hi there,
is there a simple way to make ZenCart check to ensure that product models are unique when they are entered?
I could add a function as follows:
function checkUnique ($table, $field, $compared) { $tablenew=mysql_real_escape_string($table); $fieldnew=mysql_real_escape_string($field); $comparednew=mysql_real_escape_string($compared); $query="SELECT $fieldnew FROM $tablenew WHERE $fieldnew='$comparednew'"; $result=mysql_query($query); $num=mysql_num_rows($result); if($num==0) { return TRUE; } else { return FALSE } }
and call that PHP validation with the collect_info
checkUnique('products', 'product_model', $_POST['product_model'])==FALSE
But I was really hoping that there would be a way of doing this without affecting the base code too much.
Many thanks
Bookmarks