Sameh Sameh - 1 year ago 71
PHP Question

Query get specific value in opencart

Im biggner in opencart my issue is I add field in product table called (model_choice) , in the product.tpl page in path (catalog/view/theme/default/template/product/product.tpl) I want to get the value of the row (model_choice) for the selected product I already get the product id with

I try to get the value of (model_choice) with

$sql = $this->db->query('SELECT model_choice
FROM '.DB_PREFIX.'product
WHERE product_id = ' . $this->request->get['product_id']);
$id = $sql ->model_choice;


$id = $sql->row['model_choice']; - Try this.

print_r($sql->rows); \\Shows all results.

Refer this link: How to become an OpenCart guru?