Hai friends,
I need a help regarding BSP Shopping cart.My doubt is,i have a page where i can add items to my shopping basket.the items page contains a button(value=add to cart") and mat no, mat description,net price..etc...if i click on particular button only that item sholud add to my cart(means i have to collect these records to another internal table).how can i do this... if you give some sample code that will be good help
urjent..
thanks in advance
leoiz
Hello Leoiz,
could be this the answer to your question?
I assume, that you are ready to display the items on the layout. Thsi could be the content of an internal table:
basket_items:
int_no type syindex,
mat_no type matnr,
description type string,
net_price type numc10,
currency type cuky.
...
<table>
<%loop at basket_items into basket_item.%>
<tr><td><%=basket_item-mat_no%></td>
<td><%=basket_item-description%></td>
...
<td><input type="button" value="Add to cart" onClick="addToCart('<%=basket_item-int_no%>'"></td></tr>
<%endloop.%>
So you need a javascript function 'addToCart' which
stores the value of the selected row := basket_item-int_no into a abap-field declared at the page types (autoflag on) and submitting a post to the page. After this you will be able to process the data in the event:
onInputProcessing.
The major step will be to store the data, if you are dealing with anonymous login.
That's only a rough explanation.
Regards, Stefan
Add a comment