You should use the column that is unique. If you don't have a single column that is unique, then you could create a calculation that will be unique by concatenating multiple columns.
I don't know the specific location you are trying to add that code, so I can't comment on whether that one line is correct out of context.
$this can only be used if you are editing the class. Most likely you would be using the $eCart1 reference instead on your page. $this->ID doesn't make sense since your cart will have multiple IDs.