You are here:  » Normal title category and brandpage with autmatic description


Normal title category and brandpage with autmatic description

Submitted by wesse249 on Thu, 2015-10-08 07:50 in

Hello David,

Is it possible to ad a normal h1 title to a category page? Between the breadcrumb and the filter box?

And also ad a short description under the the title like this: on this page you find our "category or brand" assortment.

Thanks

Submitted by support on Thu, 2015-10-08 08:34

Hi,

Sure, I would plumb this in to html/banner.php. Add the following code at the very end of the file:

<?php if (isset($banner["h1"])): ?>
<h1><?php print $banner["h1"]; ?></h1>
<?php endif; ?>
<?php if (isset($banner["description"])): ?>
<p><?php print $banner["description"]; ?></p>
<?php endif; ?>

Then to set the h1 / description values, edit search.php look for the following code at line 528:

  require("html/banner.php");

...and REPLACE with:

  if (($parts[0]=="category") || ($parts[0]=="brand"))
  {
    $banner["h1"] = $parts[1];
    $banner["description"] = "on this page you find our ".$parts[1]." assortment.";
  }
  require("html/banner.php");

Notice how $parts[1] contains the category or brand value being displayed and can be used as required in the values for h1 / description.

If you wanted to show the description only on page 1 to avoid duplicate content issues, you put an IF condition around the code to set the $banner["description"] value e.g.

  if ($page==1)
  {
    $banner["description"] = "on this page you find our ".$parts[1]." assortment.";
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Thu, 2015-10-08 10:17

Hello David,

I think i did everything like you said. But it don't show up?

Greetings JR

Submitted by support on Thu, 2015-10-08 10:31

Sorry JR there was a mistake in the replacement code in search.php, this line:

  if (($parts[1]=="category") || ($parts[1]=="brand"))

...should have been:

  if (($parts[0]=="category") || ($parts[0]=="brand"))

Corrected above.

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Thu, 2015-10-08 12:05

Hello David,

Thank you works great! What is code to put the product description in the meta description?

$header["meta"]["description"] = "".$q." koopt u snel en simpel via ".$config_subdomains[$merchant]." de plek voor voordelige ".$q.". Bespaar op ".$q." en koop via ".$config_subdomains[$merchant]." uw ".$q.".";

Thanks

Submitted by support on Thu, 2015-10-08 12:22

Hi TJ,

On a product page (so products.php) you can use the product array variable:

$product["products"][0]["description"]

(just like $q or $config_subdomains[$merchant] in your above code)

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Thu, 2015-10-08 18:53

Thanks!

This is my meta code:

$header["meta"]["description"] = "".$q." - ".$product["products"][0]["description"].".";

But i have al html quotes in my meta description like this:

Batterij voor Radio Fence kleine honden - PetSafe Batterij PRFA67<p>B

How can i remove these?

And is it possible to trim the description 50 words?

Thanks.

Submitted by support on Sat, 2015-10-10 07:57

Hi,

It sounds like the HTML will be in the description coming from your merchant. If you're happy to keep this HTML in your main page body (be careful as I have come across deep links in description HTML that are not your affiliate URL!!) then you can use strip_tags within the above code, and also make use of the script function tapestry_substr() which is a tidy substring function that will split at the next space character after the length required - have a go with:

$desc = $product["products"][0]["description"];
$desc = strip_tags($desc);
$desc = tapestry_substr($desc,50);
$header["meta"]["description"] = $q." - ".$desc.".";

Alternatively, if you wanted to remove the HTML at import time, use a Strip HTML filter against the description field for the feed that this particular example was coming from...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Wed, 2016-01-13 10:24

Hello David,

I have category title and description on my category page. {link saved}

But when the page is a searchquery like this: {link saved}

The description looks like this:

category:Tuinartikelen:
Op zoek naar category:Tuinartikelen:? Bekijk hier alle category:Tuinartikelen: en vind snel de voordeligste!

How can i remove category: in title and description?

Thank you,

Jan Roel

Submitted by support on Wed, 2016-01-13 10:52

Hello Jan,

In your code to set $header["title"] / $header["meta"]["description"] where you are currently using the variable:

$q

...REPLACE that with:

str_replace(array("merchant","category","brand",":"),"",$q)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com