You are here:  » Name Field, Brand Field, and Decimal Point


Name Field, Brand Field, and Decimal Point

Submitted by kend on Thu, 2015-04-09 17:44 in

Hi David,

The problem is that name-field pulls in name like "7.3 BrandName ProductName", however the brand-field pulls the brand in as "73 BrandName". So the brand page navigation doesn't work.

It's an odd brand name, and my first inclination is to drop it, and not deal with it, but in the interests of getting things right would you have a recommendation for this? My concern is that while right now only one vendor carries the brand, another may add it at some time.

I tried using the filter to modify the brand name but got the same "73 BrandName" result.

Revision 14/06A

Thanks!
Ken.

Submitted by support on Thu, 2015-04-09 17:47

Hi Ken,

"." can be safely enabled in the imported brand name - in includes/admin.php look for the following code at line 217:

  $importRecord["brand"] = tapestry_normalise($importRecord["brand"]);

...and REPLACE with:

  $importRecord["brand"] = tapestry_normalise($importRecord["brand"],".");

Changes will be applied at next import...

Cheers,
David.
--
PriceTapestry.com

Submitted by kend on Thu, 2015-04-09 18:20

Hi David,

Thank you for the help. The field change worked as expected but my navigation problem still exists (and it moved up a navigation tier). The dot in the URL should not break the link, so there must be another issue going on. I'll look into it.

My brand list redirects to a modified/hard-paged brand page which includes search.php for the brand results.

My modified .htaccess looks okay to me:

RewriteRule ^brand/([^/]+).html$ brand-single.html?q=$1 [NC]
RewriteRule ^brand/([^/]+)/([^/]+)$ brand-single.html?q=$1&page=$2 [NC]

All the other brands nav links work except for decimal point brand. :-(

Ken.

Submitted by support on Fri, 2015-04-10 07:39

Hello Ken,

There's nothing in those rules that would prevent period from being passed through to your brand-single pages so I wonder if $_GET["q"] is being normalised without permitting the period character before including search.php... If you're using tapestry_normalise() e.g.

  $_GET["q"] = tapestry_normalise($_GET["q"]);

...make sure that "." is permitted by adding the second parameter in the call e.g.

  $_GET["q"] = tapestry_normalise($_GET["q"],"\.");

(the "\" is required as the value is a REGEXP and therefore "." needs to be escaped)

If you're still not sure, if you could post a snippet from brand-single.html showing how search.php is included (and if applicable any modifications at the top of search.php) and I'll check it out further for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by kend on Fri, 2015-04-10 14:49

Hi David,

I think I found the problem. The query returns no results with the period (LIKE '%7.3%') included, but does return results by removing "(search_name LIKE '%7.3%') AND" from the following query:

SELECT SQL_CALC_FOUND_ROWS id,COUNT(id) AS numMerchants,MIN(price) AS minPrice FROM `pt_products` WHERE (search_name LIKE '%7.3%') AND (search_name LIKE '%MyBrand%') AND (search_name LIKE '%MyName%') GROUP BY search_name

So the period seems to be a problem in the query. I tried Googling the problem but results are unclear. Might you have any idea here?

Ken.

Edited from "WHERE (search_name LIKE '%7.3%') AND" to "(search_name LIKE '%7.3%') AND".

Submitted by support on Fri, 2015-04-10 14:52

Hello Ken,

`search_name` is a spaces removed version of the normalised_name (URL safe / non alpha-numeric characters removed) field, so would not include periods, so that will be all it is.

`search_name` can easily be changed to be based on the full product name and not the normalised version if you prefer. To do this, edit includes/admin.php and look for the following code at line 336:

  $searchName = tapestry_search($normalisedName);

...and REPLACE with:

  $searchName = tapestry_search($importRecord["name"]);

Re-import all feeds, and your custom hard coded search result pages should then work as expected.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by kend on Fri, 2015-04-10 15:08

Yes that worked.

Now I can click on the brand name and it navigates to a page with all the products paginated. However, when I click the "Compare 3 Prices" button, I get no product information, only related product information.

"Price search results for 7.3 MyBrand MyName (product no longer available)"

Ken.

Submitted by support on Fri, 2015-04-10 15:23

Hi Ken,

Ah - it sounds like you are using filters to construct the compound product name, in which case, since "." is now being permitted in the brand name, it should also be permitted in the normalised version of the product name. To do this, edit includes/admin.php and look for the following code at line 330:

  $normalisedName = tapestry_normalise($importRecord["name"]);

...and REPLACE with:

  $normalisedName = tapestry_normalise($importRecord["name"],".");

This supersedes the previous modification, so with this in place, line 336 can be reverted to:

  $searchName = tapestry_search($normalisedName);

Don't forget to run a full import after applying the changes.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by kend on Fri, 2015-04-10 15:44

Yes all of that helped, thank you! It all works now including my modified parts.

I have been using this script / platform for about 8 years now, so great script. Great updates too. And great support.

Thank you again!
Ken.