You are here:  » Metatags


Metatags

Submitted by henk on Fri, 2012-12-28 12:57 in

Hi David,

How can i make this page containing metatags:

{link saved}

Keywords and description from brand, subcat category filter

Thx,
Henk

Submitted by support on Fri, 2012-12-28 13:29

Hello Henk,

Sure - I see in your modified pto.php that you have this code starting at line 188:

    print "<meta name='keywords' content='".htmlentities($pto_q,ENT_QUOTES,get_settings("blog_charset"))."' />\n";
    print "<meta name='description' content='Zoekresultaten voor ".htmlentities($description,ENT_QUOTES,get_settings("blog_charset"))."' />\n";

Try replacing that with something like:

    global $pto_brandFilter;
    global $pto_categoryFilter;
    global $pto_subcatFilter;
    $words = array($pto_q,$pto_brandFilter,$pto_categoryFilter,$pto_subcatFilter);
    $keywords = implode(",",$words);
    $description = "Zoekresultaten voor ".implode(" ",$words);
    print "<meta name='keywords' content='".htmlentities($keywords,ENT_QUOTES,get_settings("blog_charset"))."' />\n";
    print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_settings("blog_charset"))."' />\n";

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Fri, 2012-12-28 15:41

Hi David,

It doesn't fetch the keywords out the filters , , ,

Thx
Henk

Submitted by support on Fri, 2012-12-28 15:55

Hi Henk,

Ah - they need to be accessed through $_GET directory - have a go with the following replacement, also modified to ignore empty values (so no ",," in the meta tag output)

    $words = array($pto_q);
    if (isset($_GET["pto_brandFilter"]) && $_GET["pto_brandFilter"]) $words[] = $_GET["pto_brandFilter"];
    if (isset($_GET["pto_categoryFilter"]) && $_GET["pto_categoryFilter"]) $words[] = $_GET["pto_categoryFilter"];
    if (isset($_GET["pto_subcatFilter"]) && $_GET["pto_subcatFilter"]) $words[] = $_GET["pto_subcatFilter"];
    $keywords = implode(",",$words);
    $description = "Zoekresultaten voor ".implode(" ",$words);
    print "<meta name='keywords' content='".htmlentities($keywords,ENT_QUOTES,get_settings("blog_charset"))."' />\n";
    print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_settings("blog_charset"))."' />\n";

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Fri, 2012-12-28 18:57

Hi David,

Almost, it pulls out the brandfilter only:

and

How can i change:

merchant, brand to webshop and merk.

Thx
Henk

Submitted by support on Sat, 2012-12-29 11:29

Hello Henk,

It looks like the additional variables haven't been parsed into the $_GET array at the point at which the above code is executed; have a go with the following:

    parse_str($_SERVER['QUERY_STRING'],$query);
    $words = array($pto_q);
    if (isset($query["pto_brandFilter"]) && $query["pto_brandFilter"]) $words[] = $query["pto_brandFilter"];
    if (isset($query["pto_categoryFilter"]) && $query["pto_categoryFilter"]) $words[] = $query["pto_categoryFilter"];
    if (isset($query["pto_subcatFilter"]) && $query["pto_subcatFilter"]) $words[] = $query["pto_subcatFilter"];
    $keywords = implode(",",$words);
    $description = "Zoekresultaten voor ".implode(" ",$words);
    print "<meta name='keywords' content='".htmlentities($keywords,ENT_QUOTES,get_settings("blog_charset"))."' />\n";
    print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_settings("blog_charset"))."' />\n";

/merchant and /brand in the URL can be changed in wp-admin > Settings > PriceTapestry.org as the values for the Merchant and Brand as the values for Merchant Base HREF and Brand Base HREF respectively. To change merchant: and brand: as they appear in $pto_q is more complex as these map directly to database fields as it stands, but it can be done, it just needs a translation in place at the point where the SQL is constructed - let me know if you want to do that and I'll work through the changes with you!

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Sat, 2013-02-09 08:55

Hi David,

The result from this one is:

keywords: category:Beeld en geluid,Array
Description: Zoekresultaten voor category:Beeld en geluid Array

It pulls out a Array?

Thank you
Henk

Submitted by support on Sat, 2013-02-09 09:31

Hello Henk,

Now that your filters are arrays the above would need to be changed to account for that - have a go with:

    parse_str($_SERVER['QUERY_STRING'],$query);
    $words = array($pto_q);
    if (isset($query["pto_brandFilter"]))
    {
      foreach($query["pto_brandFilter"] as $word)
      {
        $words[] = $word;
      }
    }
    if (isset($query["pto_categoryFilter"]))
    {
      foreach($query["pto_categoryFilter"] as $word)
      {
        $words[] = $word;
      }
    }
    if (isset($query["pto_subcatFilter"]))
    {
      foreach($query["pto_subcatFilter"] as $word)
      {
        $words[] = $word;
      }
    }
    $keywords = implode(",",$words);
    $description = "Zoekresultaten voor ".implode(" ",$words);
    print "<meta name='keywords' content='".htmlentities($keywords,ENT_QUOTES,get_settings("blog_charset"))."' />\n";
    print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_settings("blog_charset"))."' />\n";

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Sat, 2013-02-09 10:10

Great thanks,

Is it also possible to translate category to categorie:

category:103kW RVS einddempe:

Thx
Henk

Submitted by support on Sat, 2013-02-09 10:53

Hi Henk,

Sure - replace this line:

$words = array($pto_q);

...with:

$words = array(str_replace("category","categorie",$pto_q));

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-02-11 15:35

Hi David,

I have this error on this page:

http://www.example.com/vergelijken?pto_q=sony&pto_merchantFilter=&pto_categoryFilter=&pto_brandFilter=Acer&pto_minPrice=&pto_maxPrice=

Warning: Invalid argument supplied for foreach() in /home/{code saved}/public_html/wp-content/plugins/pto/pto.php on line 193

Warning: Invalid argument supplied for foreach() in /home/{code saved}/public_html/wp-content/plugins/pto/pto.php on line 200

Thx
Henk

Submitted by support on Mon, 2013-02-11 15:45

Hello Henk,

Thanks for the file - the warnings above relate to lines that have been modified since making the list version of the sidebar filters mod (where pto_merchantFilter, $pto_categoryFilter etc. need to be presented as PHP arrays), however the link:

http://www.example.com/vergelijken?pto_q=sony&pto_merchantFilter=&pto_categoryFilter=&pto_brandFilter=Acer&pto_minPrice=&pto_maxPrice=

...is still presenting single value (non-array) versions of the filter variables. So the problem, rather than being in pto.php is where the link is being generated, which should now be:

http://www.example.com/vergelijken?pto_q=sony&pto_merchantFilter[]=&pto_categoryFilter[]=&pto_brandFilter[]=Acer&pto_minPrice=&pto_maxPrice=

If you could post the URL of the page on which the link that leads to the error is displayed (or describe the page and form field selections) I should be able to work out where the modification needs to be made...

Thanks,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-02-11 15:54

This is the link:

{link saved}

and the error from merk=nike

Thanks
Henk

Submitted by support on Mon, 2013-02-11 16:03

Hi Henk,

That looks to be hard coded into the Product / Main template (wp-admin > Settings > PriceTapestry.org) - I notice that similar links to "Categorie", "Sub Categorie" etc. appear correctly using the array version of the links, so I think that is all that needs to be changed is in that template, search for

brandFilter=

...and REPLACE with:

brandFilter[]=

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-02-11 16:11

Yes thats right:

This will result in 0 products.

<p> %IFDB_brand%
Merk: <a href='/vergelijken?pto_q=bw:&amp;pto_brandFilter[]=%DB_brand%'>%DB_brand%</a>
%ENDIFDB_brand%</p>

This will, only with errors

<p> %IFDB_brand%
Merk: <a href='/vergelijken?pto_q=bw:&amp;pto_brandFilter=%DB_brand%'>%DB_brand%</a>
%ENDIFDB_brand%</p>

Henk

Submitted by support on Mon, 2013-02-11 16:27

Hi Henk,

Can you let me know an example product page URL where the merk link returns 0 results?

Thanks,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-02-11 20:37

Hi David,

Here a link:

{link saved}

Thx
Henk

Submitted by support on Tue, 2013-02-12 08:49

Thanks Henk - I'll follow up by email...

Cheers,
David.
--
PriceTapestry.com