Post by masterross » Fri Sep 25, 2020 6:12 am

Hi guys,

I'm trying to add meta description in manufacturer list but I get stuck.

I tried in catalog/controller/common/header.php in public function index() {

Code: Select all

                if ((isset($this->request->get['route'])) AND ($this->request->get['route'] = 'product/manufacturer')) {
                        $data['description'] = 'Test manufacturer  meta description';
                                                        } else {
                                                $data['description'] = $this->document->getDescription();
                                                }

But then in all pages meta description become 'Test manufacturer meta description'.
What I did wrong?

Thanks!

Pottery Glaze shop


New member

Posts

Joined
Mon Jan 02, 2017 7:07 pm

Post by IP_CAM » Fri Sep 25, 2020 8:27 am

Manufacturer Description - add description and meta-tag - OC v. 2.2.0.0
https://www.opencart.com/index.php?rout ... n_id=26587

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by masterross » Fri Sep 25, 2020 8:58 am

Thanks mate,
but this extention adds data to page:
index.php?route=product/manufacturer/info&manufacturer_id=xx

I'm looking to add data to:
index.php?route=product/manufacturer

Pottery Glaze shop


New member

Posts

Joined
Mon Jan 02, 2017 7:07 pm

Post by paulfeakins » Fri Sep 25, 2020 4:20 pm

masterross wrote:
Fri Sep 25, 2020 8:58 am
Thanks mate,
but this extention adds data to page:
index.php?route=product/manufacturer/info&manufacturer_id=xx

I'm looking to add data to:
index.php?route=product/manufacturer
If you can't find an extension, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by masterross » Fri Sep 25, 2020 5:37 pm

paulfeakins wrote:
Fri Sep 25, 2020 4:20 pm

If you can't find an extension, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.
Or you could be more friendly and share the right syntaxis which is:

Code: Select all

        if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/manufacturer') {
                        $data['description'] = 'meta description in manufacturer list';
                }else {
                        $data['description'] = $this->document->getDescription();
                }

Pottery Glaze shop


New member

Posts

Joined
Mon Jan 02, 2017 7:07 pm

Post by masterross » Fri Sep 25, 2020 6:16 pm

Here is the OCMOD file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>Meta desc in manufacturer list</name>
	<version>1.0</version>
	<author>masterross</author>
	<code>MDML</code>
	<description>Addind Meta desc in manufacturer list</description>
	<link>https://www.ceramic-glazes.com/</link>


    <file path="catalog/controller/common/header.php">
        <operation>
            <search><![CDATA[$data['description'] = $this->document->getDescription();]]></search>
            <add position="replace"><![CDATA[if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/manufacturer') {
                        $data['description'] = 'My Meta desc in manufacturer list';
                }else {
                        $data['description'] = $this->document->getDescription();
                }
		]]></add>
        </operation>
    </file>

</modification>
Save the content in file named:
Meta-desc-in-manufacturer-list.ocmod.xml

and dont forget to change 'My Meta desc in manufacturer list' with your description.
You can check how it works in our ceramic glazes shop
Enjoy!

Pottery Glaze shop


New member

Posts

Joined
Mon Jan 02, 2017 7:07 pm
Who is online

Users browsing this forum: No registered users and 193 guests