You are here:  » Search Results


Search Results

Submitted by Bigmac on Thu, 2011-01-27 18:17 in

Hi David,

I am trying to deliver slightly better search results so the compare prices feature works for all products with the same name. Let me explain.

I have several products in the database that are exactly the same however, the merchants have either listed them as 'Brand Name' & 'Product Name' or, alternatively, 'Product Name' & 'Brand Name'.

Now, although the search results deliver both products, I have 1 listing with 'more information' and the second listing with 'compare prices'.

Is there anyway in which I can modify the search to deliver the 1 product with 'compare prices' no matter whether the merchants have used either 'Brand Name' & 'Product Name' or 'Product Name' & 'Brand Name'?

Also, can I use more than 1 instance of the search and replace filter for the same merchant? I have tried removing text and placing '%brand%' at the front however, if I then add another filter like remove 'brand name' (not %brand%) and leaving the replace as a blank field, it won't remove it.

Many thanks.

Hamish

Submitted by support on Thu, 2011-01-27 19:42

Hi Hamish,

Unfortunately, whilst trivial for a human to see that "Brand - Product" and "Product - Brand" are the same thing, it's actually extremely difficult for a computer program - amongst a database of thousands of products that may or may not have brand names included in the product name (and at any position) to come to the same conclusion.

Ordinarily, this is where you would use the Product Mapping featured to link together products that you know are the same, but are named slightly differently by different merchants. More details on that in the documentation.

However, you mentioned using filters, multiple search and replace filters against a single field (yes - that's no problem, you can have as many as you want and they are applied in sequence) - but also using the placeholders e.g. %brand%.

Whilst this isn't coded in, it's easy to add - so you can use %fieldname% as a placeholder in the Search field of a Search and Replace filter. To do this, look for the following code at line 49 of includes/filter.php:

return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));

...and REPLACE that with:

$filter_data["search"] = filter_recordPlaceholders($filter_data["search"]);
return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));

Don't forget that the field name between the % characters must match the field name as you see it in the sample data on Feed Registration (Step 1), e.g %brand% (if it's a CSV file and all field names are lower case in this particular example), or maybe %BRAND% for an XML field where all field names are UPPER CASE regardless of how they appear in the actual XML...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Bigmac on Thu, 2011-01-27 20:36

Hi David,

Thank you for your prompt reply.

I take on board your point regards the search funcion and will play around with your suggestions.

Tell me, could I change the 'Related Products' to be more to the search criteria I am after? I ask as some of the random ones the script generates don't always include the same product with the alternative title. Just a thought.

Thanks again,

Hamish

Submitted by support on Fri, 2011-01-28 09:08

Hi Hamish,

The Related Products selection is based on a full text index search WHERE name is not equal to the main product name of the page; and the category is the same if there is a category value associated with the main product.

You could experiment with restricting to the same brand which might give better results in your niche. In products.php look for the following code around line 70:

      if ($product["products"][0]["category"])
      {
        $where .= "category = '".database_safe($product["products"][0]["category"])."' AND ";
      }

...and REPLACE with:

      if ($product["products"][0]["category"])
      {
        $where .= "category = '".database_safe($product["products"][0]["category"])."' AND ";
      }
      if ($product["products"][0]["brand"])
      {
        $where .= "brand = '".database_safe($product["products"][0]["brand"])."' AND ";
      }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Rocket32 on Tue, 2014-07-22 04:10

Do I use this filter if I am trying to replace some dynamic text inside of the buy url or any other registered field with a placeholder value? An example adding brand to url in dynatmic section of buyurl below

click-815-11034749?sid=xxxx&7740==

I would like to replace xxxx with a placeholder like %brand% or name, etc.

Submitted by support on Tue, 2014-07-22 06:34

Hi Rocket32,

The above modification will only apply the placeholder replacement to the Search parameter, but if you use the following replacement instead:

  $filter_data["search"] = filter_recordPlaceholders($filter_data["search"]);
  $filter_data["replace"] = filter_recordPlaceholders($filter_data["replace"]);
  return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));

...you will then be able to exactly as you suggest. Don't forget that the field name between the % characters e.g. %brand% must match exactly the field names used by the feed - the best thing to do is copy them from the Sample Data shown on Feed Registration Step 2. One thing to do would be to open this page in a new window whilst setting up filters so that you can copy and paste between them...

Cheers,
David.
--
PriceTapestry.com

Submitted by Rocket32 on Tue, 2014-07-22 21:41

Thanks David. Works perfect.