You are here:  » Multiple products from the same merchant and Wordpress SEO


Multiple products from the same merchant and Wordpress SEO

Submitted by ivohofland on Tue, 2013-05-07 08:10 in

Hi David,

Thank you for the help with my last question. I've two others.

When I'm mapping a product sometimes there are different color options from the same merchant. To make things more clear I would like to map them all in the same product. But it seems that only one product per merchant is showing in the price compare table. Is it possible to just show all the products even if there are multiple from the same merchant?

Question two is about a plugin called Yoast SEO plugin for Wordpress. Normally this is a handy plugin to optimize pages and blog posts. But in combination with the [pto] tag it is setting the same title for all product pages. Does this ring a bell with you and do you know a possible solution?

Kind regards,

Ivo

Submitted by support on Tue, 2013-05-07 08:30

Hello Ivo,

Duplicate products from the same merchant can be enabled by dropping the UNIQUE key against the dupe_hash field on the `pt_products` table. To do this, create the following script saved as /pt/dbmod.php

<?php
  
require("includes/common.php");
  
$sql "DROP INDEX dupe_filter ON `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Browse to the script once, and after it displays "Done" re-import all feeds and you will then have multiple products of the same name from the same merchant support.

Regarding the page title being generated by your SEO plugin, I added the relevant hooks in version 2 which should resolve this but I think you downloaded just before this was released. If that's the case upgrading to version 2 should do the trick, but if not, or of course if you are already running the latest version let me know and I'll investigate further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Tue, 2013-05-07 20:05

Hi David,

Thank you for the respons. I've modified de database. I'm waiting for the cron job tonight to see if it worked. Is it by the way possible to do a quick import for everything via de admin or do I need command line access for it?

About the wordpress plugin, I indeed had the version 1.0 plugin. I updated it and disabled de SEO plugin. Now the titles are working fine: {link saved}. Although there are some concerns I have. Is it possible to add meta data, description and facebook tags?

Also I see this:

<link rel='prev' title='Contact' href='http://www.example.com/contact/' />
<link rel='next' title='Bakfietsen' href='http://www.example.com/bakfietsen/' />
<link rel='canonical' href='http://www.example.com/vergelijken/' />

That's not really right voor SEO I think. This would mean that the site sais that every product page is from the same source. I don't know exactly where this is coming from, but do you have a filter in de wordpress plugin to overide these settings?

Kind regards,

Ivo

Submitted by ivohofland on Wed, 2013-05-08 08:55

Hi David,

Apparently there are a lot of duplicates now... {link saved} Can I undo the database modification?

An other problem is that the search seems to stopped working. I'm not sure if this happend after the dbmod or the wordpress plugin upgrade or after i made the changes to delete .html. {link saved}. I can debug a bit more if you don't have an instant solution.

Kind regards,

Ivo

Submitted by support on Wed, 2013-05-08 09:22

Hello Ivo,

Regarding the canonical, I notice you mentioned disabling your SEO plugin - with version 2 of PriceTapestry.org in place, if you re-enable the plugin it should now be generating the correct, unique canonical URL for each product.

To undo the removal of duplicate filter unique index, here's the opposite /pt/dbmod.php - note that in order to replace a unique key the pt_products table must be emptied, so the following script will TRUNCATE pt_products before replacing the index, so after running you will need to re-import all feeds:

<?php
  
require("includes/common.php");
  
$sql "TRUNCATE `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "CREATE UNIQUE INDEX dupe_filter ON `".$config_databaseTablePrefix."products` (dupe_hash)";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

You are correct that the search results not working as expected is related to this mod. It is because your example query ("cortina") would have triggered the FULLTEXT index version of the search SQL; however, since permitting duplicates, the word "cortina" became too common in the database and therefore MySQL's FULLTEXT index was ignoring it in the query.

Restoring the filter will resolve this in your case, but for your information this "feature" of FULLTEXT indexing can affect very niche sites, in which case the $config_useFullText setting can be set to FALSE (wp-admin > Settings > PriceTapestry.org) to disable use of the FULLTEXT index...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Wed, 2013-05-08 09:36

Thank you, i will restore the database tonight. Can you advice me what seo plugin will work with pto plugin?

Ivo

Submitted by support on Wed, 2013-05-08 09:47

Hello Ivo,

The hooks are generic so any SEO plugin that generates canonicals or makes use of the page URL in any other way should do the trick so if you re-enable your existing SEO plugin you should see correct canonical URLs.

I will investigate further regardless as even without any SEO plugin running my development instances all generate the correct canonical via WordPress' own built-in canonical generation so I'll check this out further, to which end, could you perhaps confirm what WordPress version you are running and I'll test aginst the same version?

Thanks
David.
--
PriceTapestry.com

Submitted by ivohofland on Wed, 2013-05-08 19:09

Hi David,

I've enabled the SEO plugin again. {link saved}. The output is like this on the product page:

<!-- This site is optimized with the Yoast WordPress SEO plugin v1.4.7 - http://yoast.com/wordpress/seo/ -->
<!-- Bericht voor Admin: deze pagina toont geen meta description omdat er geen is opgegeven. Schrijf er een specifiek voor deze pagina of ga naar het SEO -> Titels menu om een template in te stellen. -->
<link rel="canonical" href="http://www.example.com/vergelijken/" />
<meta property='og:locale' content='nl_NL'/>
<meta property='og:type' content='article'/>
<meta property='og:title' content='Vergelijken - Example.com'/>
<meta property='og:url' content='http://www.example.com/vergelijken/'/>
<meta property='og:site_name' content='Example.com'/>
<meta property='og:image' content='http://www.example.com/wp-content/uploads/2013/04/vergelijken.jpg'/>
<!-- / Yoast WordPress SEO plugin. -->

So the hooks are not really coming through. Could it be something with hook priority? It would be nice if all those details, including meta description are coming right from the product information.

Kind regards,

Ivo

Submitted by support on Wed, 2013-05-08 19:49

Hello Ivo,

I notice that your SEO plugin is generating the same canonical as WordPress' own canonical generation - please could you let me know

- WordPress version
- Any other plugins (and their version numbers) installed

..and I'll create a test install to recreate your set-up and try and see what's going on...

Thanks,
David.
--
PriceTapestry.com

Submitted by ivohofland on Thu, 2013-05-09 06:26

It's quite a installation, I'm not sure if it would be possible to rebuild it.

Wordpress 3.5.1-nl_NL

BulletProof Security .48.4
Contact Form 7 3.4.1
Custom Post Type UI 0.7.2
Google Analyticator 6.4.4.3
KB Robots.txt 1.0.1
Post Types Order 1.5.7
PriceTapestry.org 2.0
Redirection 2.2.13
Regenerate Thumbnails 2.2.4
Wordfence Security 3.6.8
WordPress Importer 0.6.1
WordPress SEO 1.4.7
wp-jquery-lightbox 1.4.1

Chameleon 3.3 by Elegant themes (here in also happens a lot I am afraid)

When I remove the filter from the SEO plugin (add_filter( 'wp_title', array( $this, 'title' ), 15, 3 );) the title is working fine btw.

Submitted by support on Thu, 2013-05-09 07:35

Thanks Ivo, I'll investigate further!

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Sun, 2013-05-12 20:40

Hi David,

Did you already found something? I've done a little bit of searching myself. I've found out that adding a priority to the pto filter for the title is working now:

add_filter('wp_title','pto_title',99);

also the keyword and description meta data is showing:

<meta name='description' content='Price search results for Bakfiets Silverline' />

But this is not the real product description, is that the way it supposed to be?

I also found in de seo plugin the object where the canonical url is coming from. It is using get_queried_object() which wil return the data from the single page.

I Hope you've found some more things about it than I did.

Kind regards,

Ivo

Submitted by support on Mon, 2013-05-13 10:00

Hello Ivo,

I am investigating precedence; it does look like for maximum compatibility that title as well as head needs to be hooked last, I just want to check how this affects the HTML title also (as the pto_title) function sets the post title dynamically also).

Regarding meta description; the actual product description isn't used by default rather the text you are seeing which is a description of what the page contains but you can easily make this the product description instead. At line 347 of pto.php you will find:

$description = str_replace("%PRODUCT_NAME%",htmlspecialchars($pto_productResults[0]->name),$description);

...REPLACE this with:

$description = str_replace("%PRODUCT_NAME%",htmlspecialchars($pto_productResults[0]->name),$description);
$description = str_replace("%DESCRIPTION%",htmlspecialchars($pto_productResults[0]->description),$description);

Then in the Product / Meta Description template (wp-admin > Settings > PriceTapestry.org), REPLACE

Price search results for %PRODUCT_NAME%

...with just:

%DESCRIPTION%

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Thu, 2013-05-16 21:19

I've made some kind of temporary solution now. Based on the api of the SEO plugin:

/* canonical */
function pto_wpseo_canonical(){
return "http".(isset($_SERVER["HTTPS"])?"s":"")."://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
}
add_filter( 'wpseo_canonical', 'pto_wpseo_canonical' );
/* end canonical */
/* product image */
function pto_wpseo_opengraph_image(){
global $pto_productResults;
return $pto_productResults[0]->image_url;
}
add_filter( 'wpseo_opengraph_image', 'pto_wpseo_opengraph_image');
/* end product image */
/* title */
add_filter( 'wpseo_title', 'pto_title');
/* end title */
/* description */
function pto_wpseo_metadesc(){
global $pto_productResults;
return substr($pto_productResults[0]->description, 0, 167);
}
add_filter('wpseo_metadesc', 'pto_wpseo_metadesc');
/* end description */

It's probably not very clean, but it's somehow working now: {link saved}

Submitted by koen on Thu, 2014-05-01 20:50

Hi David,

I was using PTO in combination with Yoast using the "patch" in wp-seo-main.php as described above. Unfortunately, since sometime (updates, grmbl..) my headers don't work using this hack.
It sure makes my titles and canonical link working, but I don't get the meta keywords and description being displayed. The titles and canonical are wrong without using the code, so it some kind of helps...

Please have a look at: {link saved}

The code I use is exactly the code above. Can you help me on this (though...) one?

Thanks a lot, cheers!
Koen

Submitted by support on Fri, 2014-05-02 08:54

Hello Koen,

Altering the hook priority to 1 for pto_head and pto_title might do the trick - in pto.php look for the following code at line 606:

  add_action('wp_head','pto_head',999);

...and REPLACE with:

  add_action('wp_head','pto_head',1);

Similarly, look for the following code at line 614:

  add_filter('wp_title','pto_title');

...and REPLACE with:

  add_filter('wp_title','pto_title',1);

(999 for each would have the opposite effect but may be worth trying also). If still no joy, let me know and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by george-p on Tue, 2015-03-17 18:41

i use the code from abode

/* canonical */
function pto_wpseo_canonical(){
return "http".(isset($_SERVER["HTTP"])?"s":"")."://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
}
add_filter( 'wpseo_canonical', 'pto_wpseo_canonical' );
/* end canonical */
/* product image */
function pto_wpseo_opengraph_image(){
global $pto_productResults;
return $pto_productResults[0]->image_url;
}
add_filter( 'wpseo_opengraph_image', 'pto_wpseo_opengraph_image');
/* end product image */
/* title */
add_filter( 'wpseo_title', 'pto_title');
/* end title */
/* description */
function pto_wpseo_metadesc(){
global $pto_productResults;
return substr($pto_productResults[0]->description, 0, 167);
}
add_filter('wpseo_metadesc', 'pto_wpseo_metadesc');
/* end description */

but this code
/* description */
function pto_wpseo_metadesc(){
global $pto_productResults;
return substr($pto_productResults[0]->description, 0, 167);
}
add_filter('wpseo_metadesc', 'pto_wpseo_metadesc');
/* end description */

makes my home page description disappear

any idea how i can make the code to not applied to home page ? or hard code a different meta description for home page ( i use a static page as home)

i tried this code , but dont work

if ( is_home() ) {

} else {

/* description */
function pto_wpseo_metadesc(){
global $pto_productResults;
return substr($pto_productResults[0]->description, 0, 167);
}
add_filter('wpseo_metadesc', 'pto_wpseo_metadesc');
/* end description */

}

thanks

Submitted by george-p on Tue, 2015-03-17 21:26

update:

after some research, i found how to do it

this code work for me

add_action('wp', 'check_home');
function check_home($param)
{
if (is_front_page()){
}

else {
/* description */
function pto_wpseo_metadesc(){
global $pto_productResults;
return substr($pto_productResults[0]->description, 0, 167);
}
add_filter('wpseo_metadesc', 'pto_wpseo_metadesc');
/* end description */
}
}