Answer the question
In order to leave comments, you need to log in
How to display data in a product card from a new mysql table?
People, help)))
In short, I'm making new fields for the product card, namely two multilingual fields (Question, answer)
I created a new table with the product ID, language ID and 2 columns for the question and answer.
In the admin panel in the model, controller, view everything was registered.
As a result, everything is updated, added, displayed, but it is in the admin panel (Everything is super)
Next, I need to display this in a template. And then I'm in a panic.
I copied the query from the admin model and pasted it into the catalog model
public function getProductFaq($product_id) {
$faq_description_data = array();
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_faq WHERE product_id = '" . (int)$product_id . "'");
foreach ($query->rows as $result) {
$faq_description_data[$result['language_id']] = array(
'text' => $result['text'],
'ask' => $result['ask'],
);
}
return $faq_description_data;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question