You are here:  » Product Title too long


Product Title too long

Submitted by NiceGuyEddie on Tue, 2016-04-12 15:28 in

Hi,

One of the merchants I promote uses really long product titles. When I import the feed, the long titles are truncated and I am unable to use product mapping for these products.

How can I change the threshold length of the title so it doesn't get truncated?

Thanks

Paul

Submitted by support on Tue, 2016-04-12 16:12

Hello Paul,

For search performance reasons a number of compound indexes are created against the `products` table combining the name field (or rather search_name version of it) with other fields e.g. category / brand etc. However this only really comes into significance for very large databases. The maximum key length for MyISAM tables is 1000 bytes but in terms of characters that depends on character set / collation, so the option is available to remove the compound indexes and then increase the length of the name fields accordingly.

The following dbmod.php script (run once from Price Tapestry installation folder and then delete the file) will apply this with name fields changed to a length of 512 (double the default of 255) but if no errors are generated this could be increased - the script enables database debug mode so that you will be able to see if index thresholds are reached.

<?php
  $size 
512;
  
set_time_limit(0);
  require(
"includes/common.php");
  
$config_databaseDebugMode TRUE;
  
$sql "DROP INDEX search_name_price_id ON `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "DROP INDEX search_name_merchant_price_id ON `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "DROP INDEX search_name_category_price_id ON `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "DROP INDEX search_name_brand_price_id ON `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CHANGE `name` `name` VARCHAR("
.$size.") NOT NULL default '',
            CHANGE `search_name` `search_name` VARCHAR("
.$size.") NOT NULL default '',
            CHANGE `normalised_name` `normalised_name` VARCHAR("
.$size.") NOT NULL default '',
            CHANGE `original_name` `original_name` VARCHAR("
.$size.") NOT NULL default ''
            "
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

You can increase the value of $size to try increasing lengths if necessary - on subsequent runs the DROP INDEX queries will raise an error as the index will have already been removed but they can be ignored...

After making table changes a full import will be required to import with the longer types.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by NiceGuyEddie on Wed, 2016-04-13 13:14

Hi David,

It didn't work I am afraid. I tried increasing the limit to 512 and 1024, both failed to fix the problem.

Any ideas?

Cheers

Submitted by support on Wed, 2016-04-13 13:40

Hi Paul,

I double checked the dbmod.php script and it should have made the size changes correctly - if your long product names are still being cropped VARCHAR fields can have a size right up to 65535 so you could still try significantly larger values (a VARCHAR field only takes up table space to the size of the actual data plus a small overhead).

Once the names are being imported fully (as revealed in search results / product pages), if you're still then having difficulty setting up Product Mapping entries with such long names let me know and I'll check that out further with you of course...

Cheers,
David.
--
PriceTapestry.com