Answer the question
In order to leave comments, you need to log in
How to get and display all existing tags in product_form?
Hello. Just don't throw rocks at me for a stupid question. I learn php while working with opencart and now I faced the task of displaying all existing product tags in the admin panel under the tag input field. I believe that this should be done through foreach, but I don’t know how. In this way, I get tags that are in the product where I am $product_description[$language['language_id']]['tag'] , but I don’t understand how to get everything. Please guide me on the right path...
Answer the question
In order to leave comments, you need to log in
foreach($product_description[$language['language_id']]['tag'] as $tag) {
echo $tag;
}
Something like this method can be used:
public function getTags() {
$tags = array();
$query = $this->db->query("SELECT tag FROM " . DB_PREFIX . "producte_description WHERE tag != ''");
foreach ($query->rows as $row) {
$row_tags = explode(',', $row['tag']);
foreach ($row_tags as $tag) {
$tags[] = trim($tag);
}
}
$tags = array_unique($tags);
return $tags;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question