You are here:  » Category Dropdown Description is truncated


Category Dropdown Description is truncated

Submitted by pricetapid on Fri, 2014-06-06 02:17 in

Hi, the Category description of the dropdown is truncated for one of the retailers I promote.

How can I make sure the full Category description gets imported? I'm using an XML import.

Thanks.

Submitted by support on Fri, 2014-06-06 09:05

Hi,

When I re-worked the indexes in 13/03A to improve performance it was necessary to shorten the `category` field so that it could be included in a compound index. I have currently used 32 as the limit, but in fact, it should be safe to double that, or depending on collation increase quite significantly. Use the following dbmod.php script to adjust the length to 64 characters;

<?php
 
require("includes/common.php");
 
$config_databaseDebugMode TRUE;
 
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
           CHANGE `category` `category` VARCHAR(64) NOT NULL default ''"
;
 
database_queryModify($sql,$result);
 print 
"Done.";
?>

...or as required (change at line 5 of the above code).

Cheers,
David.
--
PriceTapestry.com

Submitted by pricetapid on Sat, 2014-06-07 13:49

I tried running the script, but, I get an error:

...[#1071 Specified key was too long; max key length is 1000 bytes]Done.

I tried deleting the category index and then increasing the length to 80, but, I still got the error.

It worked when I set it to a length of 64.

This is really odd since I noticed there are indices on fields that are 255.

So, then I changed the setup.sql file and changed the category field to 80 in there and re-installed PT. But, the product table didn't get created. When I changed it to 64, it got created. Do you know why that might be? Seems really odd. Is there a limit to the number of indices on a column?

Submitted by support on Sat, 2014-06-07 16:04

Hi,

That what would be expected as there is a maximum length for an individual key; however this varies depending on the collation of a table (because of how many bytes a character takes to store under that collation).

If 64 is still insufficient for the type of category values you need to import let me know and I'll follow up by email with you with regards to checking the table collation and working out the maximum possible length as other fields can be shortened to compensate - for example if you are never likely to have a `brand` value greater than 15 characters the difference can be handed over to `category`....

Cheers,
David.
--
PriceTapestry.com

Submitted by pricetapid on Sat, 2014-06-07 22:53

Yes, can you please follow up by email (on my account).

BTW, b/c of what you mentioned, I dropped the merchant, brand, and filename indices since this installation is for one retailer only.

I also shortened the length for the brand and merchant by 16 characters each, and the filename to 64 from 255. I only increased the category length to 80 from the default of 32. Note that increasing to 64 without any of the previous changes worked.

Anyways,I still get the error.

So, maybe I misunderstood what needs to be done. Does that mean the collation has to change? I've definitely shortened the table.

Submitted by robah on Sun, 2014-06-08 14:38

Hi

Im also having a problem with categories. When trying to streamline them using filters they are 'cut off' and you have to guess exactly what it might say.

eg

Bathroom Bathroom Accessories Ba, Bathroom Bathroom Accessories Li, Bathroom Bathroom Accessories Sh, Bathroom Bathroom Accessories To, Bathroom Bathroom Accessories Wa, Bathroom Bathroom cabinets stora,

Is there a way to show the complete category name?

This would make it easier to use the find and replace filters.

PS i dont know how to run the dbmod file.

Regards

Rob

Submitted by support on Mon, 2014-06-09 09:07

Hi pricetapid / Rob,

I've just created a modification script that will restore the original index structure and resize the category / brand / merchant fields to the original full 255 characters. There performance changes are really only necessary for very large installations, but if you do notice a difference let me know and I'll look at custom indexing for you based on niche / size etc.

To do this, create a new script called reindex.php containing the following code, and upload to the top level folder of your Price Tapestry installation:

<?php
  set_time_limit
(0);
  
header("Content-Type: text/plain");
  require(
"includes/common.php");
  
$config_databaseDebugMode TRUE;
  
$table $config_databaseTablePrefix."products";
  
$sqls = array();
  
$sqls[] = "TRUNCATE `".$table."`";
  
$sqls[] = "DROP INDEX search_name_merchant_price_id ON `".$table."`";
  
$sqls[] = "DROP INDEX search_name_category_price_id ON `".$table."`";
  
$sqls[] = "DROP INDEX search_name_brand_price_id ON `".$table."`";
  
$sqls[] = "ALTER TABLE`".$table."` CHANGE `merchant` `merchant` VARCHAR(255) NOT NULL default ''";
  
$sqls[] = "ALTER TABLE`".$table."` CHANGE `category` `category` VARCHAR(255) NOT NULL default ''";
  
$sqls[] = "ALTER TABLE`".$table."` CHANGE `brand` `brand` VARCHAR(255) NOT NULL default ''";
  foreach(
$sqls as $sql)
  {
    print 
$sql."\n";
    
database_queryModify($sql,$result);
  }
  print 
"Done.";
?>

Browse to the script on your site e.g. http://www.example.com/reindex.php and then delete the file (since it TRUNCATEs the products table!). Finally, re-import all feeds to complete the change.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com