start or resume session PERFORM HTM2COB-SESS-START DISPLAY "

    HTM2COB-HIDDEN-SESSION-ID: " HTM2COB-HIDDEN-SESSION-ID"

" *> save all items in session PERFORM WRITE-CART-ITEMS-IN-SESS ?>

## Mars Planet Webshop

##### Sorry, there is no return ticket back to Earth...

### Cart Contents

Item-Nr. | Item | Price ($) | Quantity | Subtotal Price ($)
--- | --- | --- | --- | ---

Total Price ($):

Mars Planet Webshop start page

------------------------------------------------------------------------------ WRITE-CART-ITEMS-IN-SESS SECTION. *>------------------------------------------------------------------------------ INITIALIZE WS-TOTAL-PRICE PERFORM VARYING WS-IND FROM 1 BY 1 UNTIL WS-IND > CAT-ITEM-MAX-IND MOVE WS-CAT-NR OF WS-CAT-ITEM-TAB(WS-IND) TO WS-SEL-CAT-NR MOVE WS-CAT-ITEM-NR OF WS-CAT-ITEM-TAB(WS-IND) TO WS-SEL-ITEM-NR CALL "HTM2COB-POST" USING WS-SEL-CAT-ITEM, WS-QTY END-CALL IF FUNCTION TEST-NUMVAL(WS-QTY) = ZEROES THEN *> save in session MOVE WS-SEL-CAT-ITEM TO HTM2COB-SESS-VAR-NAME MOVE FUNCTION NUMVAL(WS-QTY) TO HTM2COB-SESS-VAR-VALUE PERFORM HTM2COB-SESS-SET END-IF END-PERFORM EXIT SECTION . *>------------------------------------------------------------------------------ READ-CART-ITEMS-FROM-SESS SECTION. *>------------------------------------------------------------------------------ INITIALIZE WS-TOTAL-PRICE PERFORM VARYING WS-IND FROM 1 BY 1 UNTIL WS-IND > CAT-ITEM-MAX-IND MOVE WS-CAT-NR OF WS-CAT-ITEM-TAB(WS-IND) TO WS-SEL-CAT-NR MOVE WS-CAT-ITEM-NR OF WS-CAT-ITEM-TAB(WS-IND) TO WS-SEL-ITEM-NR *> read from session MOVE WS-SEL-CAT-ITEM TO HTM2COB-SESS-VAR-NAME PERFORM HTM2COB-SESS-GET IF V-OK OF LNK-RESULT OF LNK-HTM2COB-SESSION THEN MOVE HTM2COB-SESS-VAR-VALUE TO WS-QTY IF FUNCTION TEST-NUMVAL(WS-QTY) = ZEROES AND FUNCTION NUMVAL(WS-QTY) > ZEROES THEN MOVE WS-CAT-ITEM-PRICE OF WS-CAT-ITEM-TAB(WS-IND) TO WS-PRICE-DISP COMPUTE WS-SUBTOTAL-PRICE = WS-CAT-ITEM-PRICE OF WS-CAT-ITEM-TAB(WS-IND) * FUNCTION NUMVAL(WS-QTY) END-COMPUTE COMPUTE WS-TOTAL-PRICE = WS-TOTAL-PRICE + WS-SUBTOTAL-PRICE END-COMPUTE MOVE WS-QTY TO WS-QTY-DISP MOVE WS-SUBTOTAL-PRICE TO WS-SUBTOTAL-PRICE-DISP MOVE WS-TOTAL-PRICE TO WS-TOTAL-PRICE-DISP DISPLAY "
" "Cat"WS-CAT-NR OF WS-CAT-ITEM-TAB(WS-IND) "-Item" WS-CAT-ITEM-NR OF WS-CAT-ITEM-TAB(WS-IND)"" ""FUNCTION TRIM(WS-CAT-ITEM-NAME OF WS-CAT-ITEM-TAB(WS-IND))"" ""WS-PRICE-DISP"" ""WS-QTY-DISP"" ""WS-SUBTOTAL-PRICE-DISP"" "
" END-DISPLAY END-IF END-IF END-PERFORM EXIT SECTION . *> Implement this section, if you want to set a cookie. *>------------------------------------------------------------------------------ HTM2COB-SET-COOKIE SECTION. *>------------------------------------------------------------------------------ *> get remote address and http user agent of the visitor PERFORM HTM2COB-GET-SESS-ENV-PARAMS *> get session-id from cookie INITIALIZE LNK-HTM2COB-GET-COOKIE MOVE "SESSIONID" TO LNK-COOKIE-NAME OF LNK-HTM2COB-GET-COOKIE CALL "HTM2COB-GET-COOKIE" USING LNK-HTM2COB-GET-COOKIE END-CALL MOVE FUNCTION TRIM(LNK-COOKIE-VALUE OF LNK-HTM2COB-GET-COOKIE) TO HTM2COB-HIDDEN-SESSION-ID *> regenerate session PERFORM HTM2COB-SESS-REGENERATE *> update session-id in cookie string MOVE HTM2COB-HIDDEN-SESSION-ID TO LNK-SESSION-ID-HEX OF LNK-HTM2COB-UPD-SESS-STR CALL "HTM2COB-UPD-SESS-STR" USING LNK-HTM2COB-UPD-SESS-STR END-CALL *> save session-id in cookie INITIALIZE LNK-HTM2COB-SET-COOKIE SET V-SET OF LNK-COOKIE-FUNC OF LNK-HTM2COB-SET-COOKIE TO TRUE MOVE "SESSIONID" TO LNK-COOKIE-NAME OF LNK-HTM2COB-SET-COOKIE MOVE HTM2COB-HIDDEN-SESSION-ID TO LNK-COOKIE-VALUE OF LNK-HTM2COB-SET-COOKIE MOVE 1800 TO LNK-MAX-AGE-SEC OF LNK-HTM2COB-SET-COOKIE MOVE "localhost" TO LNK-DOMAIN-VALUE OF LNK-HTM2COB-SET-COOKIE MOVE "/" TO LNK-PATH-VALUE OF LNK-HTM2COB-SET-COOKIE SET V-YES OF LNK-HTTPONLY-FLAG OF LNK-HTM2COB-SET-COOKIE TO TRUE SET V-YES-LAX OF LNK-SAMESITE-FLAG OF LNK-HTM2COB-SET-COOKIE TO TRUE CALL "HTM2COB-SET-COOKIE" USING LNK-HTM2COB-SET-COOKIE END-CALL *> The last DISPLAY in this section is always with "WITH NO ADVANCING" DISPLAY FUNCTION TRIM(LNK-COOKIE-STR OF LNK-HTM2COB-SET-COOKIE) WITH NO ADVANCING END-DISPLAY EXIT SECTION . ?>