Re: [garyhoffmann] Manually writing to Category tables
Hi Gary,
Wow, that's a tricky one. This is outside of what we normally offer for support, but I thought I'd try to help you out! :)
We have a utility function you can call which should sort everything out. Insert your new record with the parentCategory field filled out and bogus values (see below) for the special category fields, then call updateCategoryMetadata().
When you INSERT, I think you'll want to set the category fields like this:
globalOrder = 0,
siblingOrder = 99999999,
lineage = '',
depth = 0,
breadcrumb = ''
Then, immediately after inserting, call the function to set those values. Note that you'll need to set some globals first before you call this function:
global $escapedTableName, $schema;
$escapedTableName = mysql_escape( getTableNameWithPrefix('my_category_table') );
$schema = loadSchema('my_category_table');
updateCategoryMetadata();
I've tested this out here and it seems to work. I hope it works for you too!
All the best,
Chris