Hi all, i would like to do a sales order page for my client to create sales order online when they are outside. What i want is letting customer to add as many products as they wan together with the product quantity of order into a list, and only update all the record to database once they submit the sales order. I was thinking maybe can do like all the product add to an array and render using cgridview or clistview, is this the right way to do it, or is there any better solution?
Thanks in advance.
Sorry to bumping this topic, coz I really need help on this. I have been googling for so long but still can’t find any solution.
Basically you want a shopping cart. But a special one…
To render the results, you may want to write your own class, handling and rendering the data. As my experience tells, there’s always a special part of the needs, where you/the client wants something particular.
You may waste 2-3 days to think, create and develop your custom class, but upon finished it will do exactly what you want.
Thanks szfjozsef. At least I know I will have to create it myself now. I was thinking either use session or database to store the cart, which one is recommended?
You may do like this:
[font="Courier New"]id (primary, auto-increment)
datetime_updated (unix timestamp)
Never delete any records, just set the quantity to 0. This way, when a user takes out and then reintroduces a product in cart 100 times, will not waste 100 auto-increment values. Thus, auto-increment will not grow uncontrolled. Just ignore the 0-quantity records when reading. To reflect the order of products introduced into cart, sort on datetime_updated.
I hope it helps…
Thanks alot, i get the idea now!