Page 4 of 4

Re: Site name in Title

Posted: Wed Apr 03, 2013 4:50 am
by Elle-Z
Can someone put here same code to adding in title a breadcrumbs for v1.5.4.1
Please! :)

Re: Site name in Title

Posted: Tue May 21, 2013 11:25 pm
by xlam
Working for OC 1.5.5.1 8)

Re: Site name in Title

Posted: Sun Sep 29, 2013 7:10 am
by feriyanto
working great on my website, check this out www.chantiqbutik.com
thanks

Re: Site name in Title

Posted: Sat Oct 04, 2014 8:38 am
by damic
Open the header.php file (catalog/controller/common) change line 4 to something like this:

Code: Select all

		if($this->document->getTitle()!='')
		{
			$data['title'] = $this->config->get('config_name') . ' :: ' .$this->document->getTitle();
		}else{
			$data['title'] = $this->config->get('config_meta_title') ;
		}
Open your home.php (same directory), change line 4 to this:

Code: Select all

$this->document->setTitle('');

Re: Site name in Title

Posted: Wed Jun 29, 2016 12:33 am
by petkon
matteo84 wrote:
paola84 wrote:How can I make this modification in v1.4.7 ?
Hi Paola!
I'm new to OpenCart... so i don't know if this is the best way to solve the problem.

In /catalog/controller/view/theme/default/template/common/header.tpl approximately at line #5 you'll find

Code: Select all

<title><?php echo $title; ?></title>
Replace this line with this code...

Code: Select all

<title>
<?php
# BEGIN - titleBreadCrumbs
if(!empty($this->document->breadcrumbs)) {
    $titleBreadCrumbs = array();
    
    foreach($this->document->breadcrumbs as $breadcrumb) {
        if($breadcrumb['text'] != $this->language->get('text_home'))
        $titleBreadCrumbs[] = $breadcrumb['text'];
    }
    
    $titleBreadCrumbs = array_reverse($titleBreadCrumbs);
    
    echo implode(' - ', $titleBreadCrumbs) . ' - ';
}
echo $this->config->get('config_title');
# END - titleBreadCrumbs
?>
</title>
This should solve your problem. ;)

Regards.
Matteo
Hi guys! This code is not working on Opencart 2.2.0.0
Do you have any idea how can i fix it?

Re: Site name in Title

Posted: Sun Oct 23, 2016 8:19 pm
by pipepiper
For 2.2, you DO NOT need to do $this->config->get as this is already included in the header controller.
just replace

Code: Select all

$this->config->get('config_name')
with

Code: Select all

$name
Hope this helps someone struggling with getting this to work in 2.2.

Re: Site name in Title

Posted: Fri Jul 06, 2018 2:03 am
by sinners
mogwaycz wrote:
Thu Jan 26, 2012 11:09 am
For OC 1.5.1.3:

in catalog/controller/product/product.php find:

Code: Select all

$this->document->setTitle($product_info['name']);
and replace:

Code: Select all

if (isset($product_info['manufacturer'])) {
          $this->document->setTitle('YOURDOMAIN.XYZ - '. $product_info['name'] . ' od ' . $product_info['manufacturer']);
			}
			else
			{
          $this->document->setTitle('YOURDOMAIN.XYZ - '. $product_info['name']);
      }
in catalog/controller/product/category.php find:

Code: Select all

$this->document->setTitle($category_info['name']);
and replace:

Code: Select all

$this->document->setTitle('YOURDOMAIN.XYZ - ' . $category_info['name']);
That's all...

;)
Nice1, finally got it to work with this, how would i change it so domain comes after category and product info, Thanks.