Addon losing Data? Being overwritten?

I have a strange problem that is making me crazy, and I'm hoping that someone might be able to help, or at least give me some tips on how to trouble shoot this problem.



I followed tbirnseth's “PHP controllers” tutorial and created a very simple add-on that allows me to store a warehouse location code for each product. The addon uses a database table with two columns, a product id and a location string. It couldn't be simpler, and it seems to work fine. However, i have been observing that products where i know (for certain) there was a location saved, have no location set anymore. It seems like there are only a couple of things that could be happening, but i"m not sure how to troubleshoot them. here's what i'm thinking:


  1. the locations are linked by product id, so if the product id changed, the location would become unlinked. – Is there any reason that cscart would change the product id?


  2. when the product info is pulled to populate the manage product page, the location table my not be getting queried correctly, and then when the product is re-saved, it's getting “overwritten” with no info. --I don't see how this could be the case, because i have observed it working normally every time i edit a product.



    I'm stumped. Any ideas?
  1. If the product code is unrecognized during import, a new product_id will be created.
  2. Not clear what you are describing. If it were me, I would simply have used the product_data table and created a new 'type' to be used for your extra info (a serialized array so you could add to it over time if need be).



    If this is the Next Adventure on MLK in PDX, give me a call and we can discuss.