
Originally Posted by
nowie
Thank you for this wonderful mod. This is virtually what I was looking to do.
Question: I would like for customers to be able to type in either model numbers OR product names in the input fields. In this particular case, all model numbers and product names will be unique. I've tried modifying the header_php.php file at line 123 without success as I have limited php/sql experience. Could someone possibly offer some suggestions in achieving this?
Here is line 123 of header_php.php:
PHP Code:
$next_product_id = mysql_query(sprintf('select p.products_id, p.products_model from %s AS p where (p.products_model = \'' . implode("' OR p.products_model = '", $qo_item_info['model']) . "')", $db->prepare_input(TABLE_PRODUCTS)), $db->link);
Hi, i use: zencart 1.38a, QO 1.2.3, QO settings:
define('QO_INPUT_ROWS', 1);
define('QO_MODELS_MUST_BE_CASE_SENSITIVE', false);
define('QO_SIMILAR_MATCHES_LIMIT', 1);
define('QO_SIMILAR_MATCHES_ORDER_BY', true);
I also wanted to the input to be by another field (barcode)
i managed to do this by the folowing:
/includes/modules/pages/quick_order/header.php line 123
my code added is in red
Code:
// if at least one model was entered
if ($total_models > 0) {
$barcode = "select products_model from products where products_barcode = '".$qo_item_info['model'][0]."'";
$barcode_values = $db->Execute($barcode);
$qo_item_info['model'][0] = $barcode_values->fields['products_model'];
// get the selected products
$next_product_id = mysql_query(sprintf('select p.products_id, p.products_model from %s AS p where (p.products_model = \'' . implode("' OR p.products_model = '", $qo_item_info['model']) . "')", $db->prepare_input(TABLE_PRODUCTS)), $db->link);
while ($row = mysql_fetch_array($next_product_id)) {
$next_product_id_array[$row['products_model']] = $row['products_id'];
$next_product_id_array_i[strtolower($row['products_model'])] = $row['products_id'];
}
what i did:
my input field from the form is the actual barcode off my product(you have to have defined the barcodes previosly to use this), as QO searcehes for the product model, with my code in red i change the barcode to the model off the product.
Best regards Zoli.