Firstly, test what you have done so far, to show that the session variable is being set and that the return works properly.
If this is OK, then step 2 needs a little bit of thought. (I haven't used ecart for a few months - if I don't get this right, perhaps someone from Webassist can step in)
From what i recall, there is a block of code on the cart page like this...
while (!$YOURCARTNAME->EOF()) were YOURCARTNAME is whatever you called your cart instance.
I think this is where the code loops through the cart array and sends it to the page
I think the best thing, is to do some 'if' statements within this loop, to check if the product id you are looking for is in the cart.
if it is, set a variable to true or something like that.
outside of this loop, test for true, and then set the session variable accordingly.
without looking at it in detail, i am guessing a bit, so i hope i don't led you astray.
Hopefully on of the WA guys can come in here too and advise.
Hope this helps
** What do you know, Jason got in there before me with what looks like an easier solution **