You are here:  » brand merchant catergory meta titles


brand merchant catergory meta titles

Submitted by wilkins on Thu, 2016-10-13 15:52 in

Hi david

Using latest version and i want to change the meta title on the brands,category and merchant.

ie not brand:(brand name) but Latest products from (brand name)

Is it possible, I think I did it on an older site, cannot find any record though.

regards

Brent

Submitted by support on Thu, 2016-10-13 17:45

Hello Brent,

Sure - if you edit search.php and look for the following code at line 503:

    $header["title"] = $q;

...and REPLACE with:

    if (isset($parts[1]))
    {
      $header["title"] = "Latest products from ".$parts[1];
    }
    else
    {
      $header["title"] = $q;
    }

Cheers,
David.
--
PriceTapestry.com

Submitted by wilkins on Thu, 2016-10-13 18:25

Hi David

That works great, one question, could the titles be different for each area, brands, category and merchant?

Regards

brent

Submitted by support on Fri, 2016-10-14 08:20

Hi,

You could use a switch() construct against $parts[0], which holds "merchant", "category" or "brand" - have a go with:

    if (isset($parts[1]))
    {
      switch($parts[0])
      {
        case "merchant":
          $header["title"] = "Latest products from merchant ".$parts[1];
          break;
        case "category":
          $header["title"] = "Latest products from category ".$parts[1];
          break;
        case "brand":
          $header["title"] = "Latest products from brand ".$parts[1];
          break;
      }
    }
    else
    {
      $header["title"] = $q;
    }

Cheers,
David.
--
PriceTapestry.com

Submitted by MrHolland on Mon, 2017-02-20 00:45

I was looking to change this so found this topic, let's make it complete :) You also want Meta descriptions.

Adjust both title's & description to your own preferences.

just replace

$header["title"] = $q;

for

    // custom titles
    if (isset($parts[1]))
    {
      switch($parts[0])
      {
        case "merchant":
          $header["title"] = "Prices from ".$parts[1]. " | Online shopping";
          $header["meta"]["description"] = "Compare prices from ".$parts[1]." | All products at ".$parts[1]." online at our website!";
          break;
        case "category":
          $header["title"] = "Compare prices of ".$parts[1]. " | At our website";
          $header["meta"]["description"] = "Find prices of ".$parts[1]." products online. Compare prices ".$parts[1]." online at our website!";
          break;
        case "brand":
          $header["title"] = "Compare".$parts[1]. " product prices | Our Website";
          $header["meta"]["description"] = "Find and compare ".$parts[1]." products and prices. Stop looking for ".$parts[1]." products you will find them here!";
          break;
      }
    }
    else
    {
      $header["title"] = $q;
    }
    // end custom titels

Submitted by support on Mon, 2017-02-20 09:26

Welcome to the forum, MrHolland!

Cheers,
David.
--
PriceTapestry.com

Submitted by wilkins on Fri, 2017-02-24 07:57

Hi David

Is it possible to have a similar title for search results instead of just the search term, it would make it look better in search results.

regards

Brent

Submitted by support on Fri, 2017-02-24 08:49

Hello Brent,

Sure - in the example above, the second to last line generates the title for the default (keyword search) case:

       $header["title"] = $q;

...so to prefix this as required, REPLACE with:

       $header["title"] = "Search results for ".$q;

Or for text after the keyword(s):

       $header["title"] = $q." search results";

...or both before and after:

       $header["title"] = "Text before ".$q." text after";

(note that search.php will automatically append page number from page 2 onwards, and sort order in operation if not default to avoid duplicate titles)

Cheers,
David.
--
PriceTapestry.com