You are here:  » Main product from the preferred merchant


Main product from the preferred merchant

Submitted by lecolet on Thu, 2012-06-07 05:47 in

Hi, David,

I'm trying to understand how are the main products for the search results are chosen. I have several merchants, but only one of them has a "rating" field in the feed that I would like to use to sort search results by. I've made all the changes to the script, calling this field "rating_core" and using it as a default sorting order, but it works only for the products that are available only from this merchant. When a product is available from several merchants, a product from a different merchant is chosen as a main product under which products from the other merchants are grouped on the search results page, and since it doesn't have a "rating" field in the feed, the "rating_core" is 0. How can I make sure that if the product is available from that particular merchant, then it's chosen to be the main product for the search results page. I've seen the forum topics about assigning description and picture from a preferred merchant, but this seems to be a different issue.

Thank you, Lana

Submitted by support on Thu, 2012-06-07 08:23

Hello Lana,

Search results are actually generated using a summary query; so other than the summary fields (e.g. MIN(price) as minPrice) it is undefined which product record the other fields will be selected from (although it will be consistent per import). Hence, you will have found the other threads regarding preferred merchant from which to use the product image etc.

My first question is whether for this site you have (or need) user interaction (reviews) in place. If not, then a post import process could easily be created that copies the rating field from your merchant that does have values into the existing "rating" field; which is used by the rating sort order. Because of the way summary queries work as described above it would need to be copied so that the same value exists in all product records - which is exactly what the "Backfill Reviews" process does post-import...

This could still be done of course if you do want to have user reviews; but accept that products with a feed rating will override the customer rating...

Cheers,
David.
--
PriceTapestry.com

Submitted by lecolet on Thu, 2012-06-07 09:14

When you say that it is consistent per import... is there a way to control it? I've tried changing file names, changing the order in which feeds are registered and imported, and it doesn't seem to help.

And regarding the post-import process, I have the "rating" field, which is filled up when a review is written, and a "rating_core" field, which is imported from that one feed from a particular merchant. I've changed the pto_search.php , so that the "rating" in pto.php

$pto_sort = (isset($pto_sort)?$pto_sort:"rating");

is picked up from the "rating_core", and not from the "rating". I don't display it anywhere, just use it for sorting the search results, and the "rating" is displayed on the product page. So, yes, I need this "rating_core" field to be copied to all the products, and still keep the "rating", because "rating_core" is not 1-2-3-4-5 stars, it's 3, or 520, or 6000, or 12040 - depending on the sales rating, and it's not helpful to display it in place of the "rating" stars. I don't know if it's an easy thing to do.

Submitted by support on Thu, 2012-06-07 09:23

Hello Lana,

It just occurred to me that adding MAX(rating_core) AS rating_core to the SQL and using rating_core as the sort field should do the trick... If you would like to email me your latest version of pto_search.php (just incase you have made other changes you wish to preserve) I'll make that change for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by lecolet on Thu, 2012-06-07 13:48

Thank you, David, it works great!