Sameh Sameh - 7 months ago 52
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

$this->request->get['product_id']
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;

Answer

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

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

Refer this link: How to become an OpenCart guru?