See the "Building a Multiple Item Add to Cart Interface (eCart 3)" Tutorial in the Archived Documentation section of the eCart support page:
ecart/
For the order history, when a user logs in, their ID should be captured in a session variable, this session variable is used by the Order History tutorial to retrieve the users past order, it is not assigning the value, rather using the value ti get orders the logged in user has placed.