You are here:  » Metas for brands


Metas for brands

Submitted by Bakalinge on Wed, 2013-05-29 14:22 in

Hi David,

I just discovered that I have not meta description in brand pages. I don't know if it comes from me, but your demo site doesn't have either...

As I'm trying to get better seo results with this pages, and I'm already using txt files to insert brand description (not bad but complicated when you have more than 600 brands), I was wondering if it was possible to use a form to insert :
- <title>
- meta description
- the brand description

Thanks David !

Bak

Submitted by support on Thu, 2013-05-30 08:57

Hello Bak,

Sure - the /brand/Brand-Name/ pages are generated by search.php, and you can identify the page as a brand index page using $parts[0]=="brand" in which case the brand name is in $parts[1]. In that file, look for the following code around line 350:

  require("html/header.php");

...and REPLACE with:

  if ($parts[0]=="brand")
  {
    $header["title"] = htmlentities($parts[1],ENT_QUOTES,$config_charset). " Additional Title Text Here";
    $header["meta"]["description"] = htmlentities($parts[1],ENT_QUOTES,$config_charset). " Additional meta description text here";
    if ($page > 1)
    {
      $header["title"] .= " Page ".$page;
      $header["meta"]["description"] .= " Page ".$page;
    }
  }
  require("html/header.php");

If you want to use the same brand description file as the text being displayed on the page let me know what code you currently have in place to include that and I'll show you how to use the same text as the meta description if required.

(i've included code to append "Page n" text to the title / meta description in the above if not on page 1 to avoid duplicate titles / descriptions)

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Thu, 2013-05-30 09:56

Hi David,

Thanks for your answer. I apologise if I was misinterpreted but this is not exactly what I expected. To make it simple, I would like to manage brands with a dedicated page in admin area where I can put Title, meta description and descripion for each brand.

It could look like this : {link saved}

Just tell me if not clear...

Thanks !

Bak

Submitted by support on Thu, 2013-05-30 11:26

Hello Bak,

Ah, i'm with you. A very quick way to implement this would be to implement custom fields mod for Product Mapping as described in this thread, which you may already have in place.

Then, to use the Product Mapping interface to provide custom meta description, keywords and title tags for the brand pages, create a new "Product Mapping" using the following format:

brand:Brand Name

You can then enter the meta description, keywords and title, and save the mapping.

To use these fields, as above locate the following code around line 350 in search.php:

  require("html/header.php");

...and REPLACE with:

  if ($parts[0]=="brand")
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefx."productsmap`
              WHERE name = 'brand:".database_safe($parts[1])."'";
    if (database_querySelect($sql,$rows))
    {
      if ($rows[0]["meta_title"])
        $header["title"] = htmlentities($rows[0]["meta_title"],ENT_QUOTES,$config_charset);
      if ($rows[0]["meta_description"])
        $header["meta"]["description"] = htmlentities($rows[0]["meta_description"],ENT_QUOTES,$config_charset);
      if ($rows[0]["meta_keywords"])
        $header["meta"]["keywords"] = htmlentities($rows[0]["meta_keywords"],ENT_QUOTES,$config_charset);
    }
  }
  require("html/header.php");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Sun, 2013-06-23 23:36

Hello David,

I'm sill continuing my work on brand pages to avoid duplicate content and I would like to know how to add a presentation under the brand name. As I noticed there is no database for brands, I was thinking to insert text files, as done on product pages. Problem is I can't find wich variable to use to get brand name in searchresults.php:

<?php
if (($page==1) && ($parts[0]=="brand"))
{
if (file_exists("marques/".$[brandname]))
{
include ("marques/".$[brandname]);
}
else
{
print "No information";
}
}
?>

Thanks for your help !

Bak

Submitted by support on Mon, 2013-06-24 08:10

Hi Bak,

Brand name will be in $parts[1] at that point - have a go with:

<?php
if (($page==1) && ($parts[0]=="brand"))
{
  if (
file_exists("marques/".$parts[1]))
  {
    include (
"marques/".$parts[1]);
  }
  else
  {
    print 
"No information";
  }
}
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Mon, 2013-06-24 08:55

it works great!

Thanks David