This content has been marked as final. Show 8 replies
I think a better approach might be to push the "ordered" item into an array. Then when they go to their shopping cart, create clips and textfields from the array.
Thanx kglad, works like a charm. =)
Now I just need to format the output into categories and sub categories.
eg.. Item 1 (category) Item 1 color (sub category)
I am not too familiar with Arrays, so I don't know how to create clips and fields from an array. I guess it couldn't be too hard tho.
What would be the advantage of doing it this way?
To me it just seems to make sense. Keep a list of the things you need, make those things. As opposed to randomly do some stuff without paying attention to it and then find it later.
You also mention formating the output. I'm not quite clear on exactly what you mean there, but if you mean that the order they selected items might not be the order it is displayed in, then arrays make sense too. Arrays are made to hold chunks of info and then do things with them. So if you need to sort things arrays are good for that. To me it makes more sense to collect some info organize it and then do something with it.
Since the things you need to find are being created by user action it should be easy to track them. The exact nature of how to set it up depends upon a lot of things so I can't be sure exactly what to tell you. But here is some general outline.
Before you begin somewhere create an array perhaps something like this:
var curOrder:Array=new Array();
Then somewhere you could define your different catalog items. I would probably use objects. Depending upon your needs you may do something completely different but anyways something like this:
Of course your code could get the values to put after the object properties from the text fields. Then when it comes time to generate your shopping cart you can just go through all the items in the array:
var curItem=curOrder ;
// create a clip for the curItem
// add some text to the clip
Let's say you wanted all things of each color together you could use use the sort on before your loop. Something like this:
I always forget that [ i ] makes things italic. So here
I think you know exactly what im looking for. I have a small job to do real quick, a few days at most. I wouldn't have much time to practice what you teach me.
Would you still help me with your idea when i come back to this Shopping Basket please?
ohh and sorry for not being clear on what I mean by Formatting the output.
What I meant was, formatting the text from an array when displaying the viewer's order.
If I was to do it your way, and read from the array, then create a textArea to display the contents (order), I would like the text to be formatted like..eg..
Item 1 - Jeans
color - black
size - XL
quantity - 20
Item 2 - Shirt
color - orange
size - L
then at the end, I will need to send this info (order) to a PHP script, which will send the info to a email. I hope there is a way to keep the text format/layout when sending to email.
anyway, I hope to be back at this really soon, I think it's about time i learn more about arrays and they're benefits.
Thank you for all your help so far. =)
Sure. Complete whatever project you need to in the best way you can. But I really recommend that this approach will be very useful for all sorts of things in the future. So when you have a chance learn it. :)