11 lines
352 B
Prolog
11 lines
352 B
Prolog
:- http_handler(root(cart/add/ProductName), cart_add(ProductName), []).
|
|
|
|
% GET /cart/add/ProductName
|
|
cart_add(ProductName, Request) :-
|
|
\+ product(ProductName, _), !,
|
|
http_redirect(see_other, root(.), Request).
|
|
|
|
cart_add(ProductName, Request) :-
|
|
http_session_assert(cart_entry(ProductName)),
|
|
http_redirect(see_other, root(.), Request).
|
|
|