You are here:  » Additional index field to filter

Support Forum



Additional index field to filter

Submitted by marco@flapper on Thu, 2012-03-15 08:09 in

Hi,
I'm setting up a new PT site with the performance mod (http://www.pricetapestry.com/node/4084) and I'm trying to add an additional filter to it. I want it just for the sake of filtering so I used(http://www.pricetapestry.com/node/3094) this code to add an additional field.

After the dbmod.php I registered the feed and tried to import but it didn't import and in admin page the registration isn't there. I checked the products table and there are no products added.

Any ideas what to do?

Submitted by support on Thu, 2012-03-15 09:03

Hi Marco,

That sounds like one of the database mods (probably to the `feeds` table) wasn't applied correctly as that would be consistent with the feed failing to register.

If you enable database debug mode by changing line 6 of config.advanced.php as follows:

  $config_databaseDebugMode = TRUE;

...then attempt to re-register a feed the MySQL error should indicate the problem. If you're not sure from the message displayed; or if nothing is displayed; let me know what (if any) MySQL error is shown and I'll check it out...

Cheers,
David.
--
PriceTapestry.com

Submitted by marco@flapper on Thu, 2012-03-15 09:55

Thanks, I overlooked that. I renamed Keywords to something else but didn't change change the variable name in $config_fieldSet["keywords"] = "Keywords";

After this I want to migrate some PT sites to the performance mod where I added an additional indexed field which should enable to enter a custom value (like you can with Category and Brand).

I guess this needs some more modifications so that de database index is included. Can you help me with that?

Submitted by support on Thu, 2012-03-15 10:28

Hi Marco,

For each new field that you want treated just like category/brand etc. you just need to add a new index as follows, based on the "keywords" example:

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$sql "TRUNCATE `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  
$sql "CREATE INDEX search_name_keywords_price_id ON `".$config_databaseTablePrefix."products` (search_name,keywords,price,id)";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Note: TRUNCATE still included in the above, it is much better to add the indexes to an empty table and re-import all feeds subsequently...!

Cheers,
David.
--
PriceTapestry.com

Submitted by marco@flapper on Thu, 2012-03-15 11:28

ok, so drop the products table and remove the line with truncate?

{code saved}

Submitted by support on Thu, 2012-03-15 11:32

Sorry Marco - I was just explaining why I had left the TRUNCATE line in rather than suggesting that it should be removed - use the code as-is from my post as a dbmod.php; but bear in mind you will need to re-import all feeds afterwards of course...

Cheers,
David.
--
PriceTapestry.com