Z
Z
zahar_922017-06-03 12:38:33
PHP
zahar_92, 2017-06-03 12:38:33

How to display meta data in opencart?

Hello!
Please help!! The problem is this .. The manufacturer does not display meta-data. They are in the admin panel, but on the site the code is empty. An interesting fact, the controller says

$this->document->setTitle($manufacturer_info['name']);

and in the title the name of the product is displayed. If you write
$this->document->setTitle($manufacturer_info['meta_title']);

then an empty title tag is displayed.
$this->document->setDescription($manufacturer_info['meta_description']);
$this->document->setKeywords($manufacturer_info['meta_keyword']);

The code above does not display anything at all. I have checked the feeling that the data is not received from the database, although it is there.
So the question is .. Where (in which file) and how is the meta-data obtained from the database? I'm not strong in php, I do everything with the help of poke and google
Opencart 2

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
K. A., 2017-06-06
@f_u_s_s

Getting data from the database in the opencart is done in models. Look in the controller for which model it is loading and look for it in the models folder.
All data displayed in templates must be written in the controller to the $data array. For meta data, for example, there should be something like a in the template in the right place in the code:
<?php echo $meta_descriptrion; ?>

S
Serge Tkach, 2021-03-02
@SergeTkach

The question is clearly outdated. But I got into it from the top Yandex search results. So, it's worth unsubscribing here :)
In such cases, it's done like this: So you will know exactly what is in the variable in a specific part of the script program.
var_dump($manufacturer_info['meta_title']);

A
anire812, 2021-10-15
@anire812

I have a similar problem. 2 weeks I can not decide, I asked on the forums, but there is no answer.
Version ocStore 3.0.2.0 does not display meta_h1 in products, instead it displays the name of the product.
I write everything in the fields. I have already verified the files many times, looked at the controller, etc.
I'm not a developer, but just a SEO specialist and I need to find and fix it.
It turns out that H1 is present, but is not displayed, and instead of it, the name of the product is substituted by condition.
The feeling that something is blocking the output. Maybe something in the database or somewhere else.
Other meta tags work and the category title is displayed. It is the plug with the goods.
Tell me where to dig, where to look, etc.
Thanks for the help ... I hope this problem should be resolved

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question