The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. How to add Canonical Tags on Opencart Products

    How to add Canonical Tags on Opencart Products

    Intermediate & Advanced SEO
    6 3 1.2k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • moon-boots
      moon-boots last edited by

      Does anyone know how to add canonical tags to product pages in Opencart?

      Is this possible to do in htaccess? If so, how specifically should it be written in?

      Please do not post any links to other pages which reference generic canonical information as I've read them all and none help. I'm looking for an Opencart specific answer, or a way to do it in htaccess.

      1 Reply Last reply Reply Quote 0
      • Vijay-Gaur
        Vijay-Gaur last edited by

        Hi there,

        In continuation to my response earlier on another question.

        Have u tried these extensions on Opencart? http://www.opencart.com/index.php?route=extension/extension&filter_search=canonical url

        Thanks,

        Vijay

        1 Reply Last reply Reply Quote 0
        • Mustansar
          Mustansar last edited by

          I suggerst you to adopt the following :

          The best way to achieve this is to modify your Document class, set your canonical in your controller, then render it in the header controller.

          Edit system/library/document.php

          add:

          private $canonical; to your class variables up top.

          Then add the following methods:

          <code>publicfunction setCanonical($url){ $this->canonical = $url;}publicfunction getCanonical(){return $this->canonical;}</code>
          

          In your header controller add:

          $this->data['canonical'] = $this->document->getCanonical();

          Then you can set your canonical dynamically in the header controller:

          <code>if(isset($this->request->get['_route_'])): $canonical_route = $this->request->get['_route_'];else: $canonical_route =''; endif; $this->document->setCanonical($this->data['base']. $canonical_route);</code>
          

          Or you can set it manually in your controllers using the setCanonical method.

          moon-boots 2 Replies Last reply Reply Quote 2
          • moon-boots
            moon-boots @Mustansar last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • moon-boots
              moon-boots last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • moon-boots
                moon-boots @Mustansar last edited by

                Apparently this didn't work. According to the Moz tool I have the same amount of duplicate title tags as before.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                • Quickview product modal - should I add rel=canonical to each URL ?
                  0
                  1
                  42

                • In our reports we get alt tag errors for our banner images. We are unable to add alt tags to the banner images as they live inside CSS. We can add a title tag on the div title for the banner. Does that help with SEO and accessibility?
                  Shirley.Fenlason
                  Shirley.Fenlason
                  0
                  3
                  37

                • Putting rel=canonical tags on blogpost pointing to product pages
                  Tylerj
                  Tylerj
                  0
                  3
                  71

                • How to deal with canonicals on dup product pages in Opencart?
                  danwebman
                  danwebman
                  0
                  2
                  54

                • Canonical tag
                  KarlBantleman
                  KarlBantleman
                  0
                  11
                  315

                • Canonical tag: how to deal with product variations in the music industry?
                  fablau
                  fablau
                  0
                  10
                  853

                • Rel Alternate tag and canonical tag implementation question
                  Amiee
                  Amiee
                  0
                  4
                  7.5k

                • Is having a canonical tag for the link that IS the canonical a negative thing?
                  DanDeceuster
                  DanDeceuster
                  0
                  2
                  813

                Get started with Moz Pro!

                Unlock the power of advanced SEO tools and data-driven insights.

                Start my free trial
                Products
                • Moz Pro
                • Moz Local
                • Moz API
                • Moz Data
                • STAT
                • Product Updates
                Moz Solutions
                • SMB Solutions
                • Agency Solutions
                • Enterprise Solutions
                • Digital Marketers
                Free SEO Tools
                • Domain Authority Checker
                • Link Explorer
                • Keyword Explorer
                • Competitive Research
                • Brand Authority Checker
                • Local Citation Checker
                • MozBar Extension
                • MozCast
                Resources
                • Blog
                • SEO Learning Center
                • Help Hub
                • Beginner's Guide to SEO
                • How-to Guides
                • Moz Academy
                • API Docs
                About Moz
                • About
                • Team
                • Careers
                • Contact
                Why Moz
                • Case Studies
                • Testimonials
                Get Involved
                • Become an Affiliate
                • MozCon
                • Webinars
                • Practical Marketer Series
                • MozPod
                Connect with us

                Contact the Help team

                Join our newsletter
                Moz logo
                © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                • Accessibility
                • Terms of Use
                • Privacy