Hi David,
How can i make this page containing metatags:
{link saved}
Keywords and description from brand, subcat category filter
Thx,
Henk
Hi David,
It doesn't fetch the keywords out the filters , , ,
Thx
Henk
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
Hi David,
Almost, it pulls out the brandfilter only:
and
How can i change:
merchant, brand to webshop and merk.
Thx
Henk
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
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
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
Great thanks,
Is it also possible to translate category to categorie:
category:103kW RVS einddempe:
Thx
Henk
Hi Henk,
Sure - replace this line:
$words = array($pto_q);
...with:
$words = array(str_replace("category","categorie",$pto_q));
Cheers,
David.
--
PriceTapestry.com
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
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
This is the link:
{link saved}
and the error from merk=nike
Thanks
Henk
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
Yes thats right:
This will result in 0 products.
<p> %IFDB_brand%
Merk: <a href='/vergelijken?pto_q=bw:&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:&pto_brandFilter=%DB_brand%'>%DB_brand%</a>
%ENDIFDB_brand%</p>
Henk
Hi Henk,
Can you let me know an example product page URL where the merk link returns 0 results?
Thanks,
David.
--
PriceTapestry.com
Thanks Henk - I'll follow up by email...
Cheers,
David.
--
PriceTapestry.com
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