Page 1 of 4
Site name in Title
Posted: Sun Sep 13, 2009 1:02 am
by azmansell
hi there,
im struggling to get my site name to show up in products etc. for example on my
other site DingDongDisco (
http://www.dingdongdisco.com) , if you go to a post the title in the bar at the top says Post Name | DingDongDisco (
http://www.dingdongdisco.com/2009/09/kr ... osyncrasy/)
Yet on my opencart run shop, if you go to a particular product, it literally just shows the bproduct name. for example (
http://www.clubberclobber.co.uk/index.p ... uct_id=158) show only Army Cheerleader outfit.
Is there anyway for it to show Army Cheerleader outfit | UK Clubwear by Clubber Clobber?
my site is indexed on google and it only shows the product name which could be problematic for SEO
cheers in advance
aaran
Clubber Clobber
http://www.clubberclobber.co.uk
Re: Site name in Title
Posted: Sun Sep 13, 2009 1:42 am
by Qphoria
(v1.3.2 and older)
1a. Edit catalog/view/theme/default/template/common/layout.tpl
OR
(v1.3.4 and later)
1b. Edit catalog/view/theme/default/template/common/header.tpl
2. FIND:
Code: Select all
<title><?php echo $title; ?></title>
3. REPLACE WITH:
Code: Select all
<?php if (isset($this->request->get['route']) && $this->request->get['route'] != 'common/home') { ?>
<title><?php echo $title; ?> | <?php echo $this->config->get('config_store'); ?></title>
<?php } else { ?>
<title><?php echo $title; ?></title>
<?php } ?>
Re: Site name in Title
Posted: Sun Sep 13, 2009 2:08 am
by azmansell
FANTASTIC!
you a star, and a fast response.
cheers!
Re: Site name in Title
Posted: Tue Sep 15, 2009 1:24 am
by amplifywebdesign
Great I was just about to ask how to do this
Re: Site name in Title
Posted: Thu Oct 22, 2009 5:27 pm
by kcllc
And if one wanted to add the category?
Example: Product Name | Category Name | Site Name Here
Re: Site name in Title
Posted: Fri Oct 23, 2009 11:44 pm
by d33p
kcllc wrote:And if one wanted to add the category?
Example: Product Name | Category Name | Site Name Here
I'd also like to do that, in terms of SEO that would be very useful.
Re: Site name in Title
Posted: Fri May 14, 2010 7:35 am
by katalin
How can we make titles like: Subcategory | Category ?
Re: Site name in Title
Posted: Fri Jun 04, 2010 11:06 pm
by paola84
How can I make this modification in v1.4.7 ?
And is there any way to put also the category name in the title?
Re: Site name in Title
Posted: Mon Jun 07, 2010 10:10 pm
by matteo84
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
Re: Site name in Title
Posted: Mon Jun 07, 2010 10:16 pm
by paola84
Thank you Matteo, you're my saviour!!!
Re: Site name in Title
Posted: Wed Jun 09, 2010 5:11 am
by katalin
How can we use your mod for categories only? I don't want this mod to apply to products.
Re: Site name in Title
Posted: Thu Jul 08, 2010 11:38 pm
by dada
Qphoria wrote:(v1.3.2 and older)
1a. Edit catalog/view/theme/default/template/common/layout.tpl
OR
(v1.3.4 and later)
1b. Edit catalog/view/theme/default/template/common/header.tpl
2. FIND:
Code: Select all
<title><?php echo $title; ?></title>
3. REPLACE WITH:
Code: Select all
<?php if (isset($this->request->get['route']) && $this->request->get['route'] != 'common/home') { ?>
<title><?php echo $title; ?> | <?php echo $this->config->get('config_store'); ?></title>
<?php } else { ?>
<title><?php echo $title; ?></title>
<?php } ?>
It looks like it doesn't work with 1.4.8. How do i get store name in 1.4.8?
Re: Site name in Title
Posted: Fri Jul 09, 2010 1:40 am
by Qphoria
try config_name instead of config_store
Re: Site name in Title
Posted: Wed Jul 14, 2010 9:04 am
by Chrissy Poo
OK this is thread has really helped me out which is cool
I replaced my title tag with this code from above:
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>
and it produces the following page titles:
Sub Category - Category - Store Name
is there a way to reverse this so it says:
Store Name - Category - Sub Category
Any ideas?
Re: Site name in Title
Posted: Thu Jul 29, 2010 1:25 am
by OSWorX
Generally it is a bad idea NOT to work inside the controller.
Anyway, do NOT use the array_reverse.
Instead after the final }:
Code: Select all
}
echo $this->config->get('config_title') .' - '. implode(' - ', $titleBreadCrumbs);
Re: Site name in Title
Posted: Thu Sep 16, 2010 5:46 pm
by barblask
and it produces the following page titles:
Sub Category - Category - Store Name
is there a way to reverse this so it says:
Store Name - Category - Sub Category
Code: Select all
<?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_values($titleBreadCrumbs);
echo implode(' - ', $titleBreadCrumbs) . ' - ';
}
echo $this->config->get('config_title');
# END - titleBreadCrumbs
?>
</title>
Use this code
Re: Site name in Title
Posted: Mon Oct 11, 2010 11:49 am
by Melanie
Chrissy Poo wrote:OK this is thread has really helped me out which is cool
I replaced my title tag with this code from above:
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>
and it produces the following page titles:
Sub Category - Category - Store Name
is there a way to reverse this so it says:
Store Name - Category - Sub Category
Any ideas?
How can I make it show
Sub Category - Category - Store Name
But for the store name just the company name i.e. MY COMPANY
instead of MY COMPANY - I SPECIALIZE IN XYZ
Thanks,
Melanie
Re: Site name in Title
Posted: Mon Oct 11, 2010 11:53 am
by Melanie
Melanie wrote:Chrissy Poo wrote:OK this is thread has really helped me out which is cool
I replaced my title tag with this code from above:
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>
and it produces the following page titles:
Sub Category - Category - Store Name
is there a way to reverse this so it says:
Store Name - Category - Sub Category
Any ideas?
How can I make it show
Sub Category - Category - Store Name
But for the store name just the company name i.e. MY COMPANY
instead of MY COMPANY - I SPECIALIZE IN XYZ
Thanks,
Melanie
Done.
Changed 'config_title' to 'config_name'
Re: Site name in Title
Posted: Tue Oct 19, 2010 6:06 pm
by barnesnet
Running OC 1.4.9.1
Require some help with simple coding please.
I have currently replaced /catalog/view/theme/my theme/template/common/header.tpl
Code: Select all
<title><?php echo $title; ?></title>
with:
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_name');
# END - titleBreadCrumbs
?>
</title>
This gives me everything I am looking for in the format of:
Product - Sub cat - category - store NAME
This works fine on all category and product pages etc.
However on my ‘Homepage’ it obviously only shows ‘store NAME’ (using config_name)
How can I alter this code so that everything remains as is but on the ‘Home page’ the code shows just the “config_TITLE’
To sum up:
Homepage title to show config_title
Other pages title to show code as above with config_name
It must be something to do with an ‘if’ line but I do not know PHP to work it out myself. I have played with it but now ned someone who knows to help out please.
Any help appreciated.
Simon
Re: Site name in Title
Posted: Fri Oct 22, 2010 2:04 am
by dantheman50_98
I'd also like to have a custom homepage title that doesn't show on all pages of the site. Is this possible?