Apologies if this has been covered elsewhere, a search revealed nothing.
I am creating a simple voting system for each product. I anticipated using the product id to track the votes per product but it seems that this gets overwritten when the feeds are refreshed. What's the easiest way to track something against a specific product? I was thinking of using the product URL?
Thanks in advance
Cheers David, that appears to have worked! Sorry for bothering you on your holiday...
Hi,
Instead of id, which, as you say, is changed after every import; I would suggest using a hash of "normalised_name" as a VARCHAR(32), which can be indexed quickly.
In your votes table, create an indexed field called nn_hash of type VARCHAR(32), and when inserting / updating vote records, index that table by using the PHP code as follows (wherever a $product is in context - or $mainProduct in html/product.php)
$nn_hash = md5($product["normalised_name"]);
..and then use that to access your votes table, e.g.
$sql = "SELECT * FROM votes WHERE nn_hash='".$nn_hash."'";
Hope this helps!
Cheers,
David.