Select Highest Postage Band?
Posted: Fri Dec 03, 2010 3:44 am
Hi,
I am currently working on a shopping cart. Here is an example of my shopping cart database:
id // part // qty // price // band
1 // 659 // 2 // 5.68 // A
1 // 814 // 1 // 96.32 // C
2 // 546 // 1 // 10.63 // B
The session number is the id column and the band is the delivery cost. Lets say the customer currently on my website has the session id 1.
I need to loop through my database (This I do know how to do lol
) and I need to be able to return the highest letter in the band column. I'll explain why so you can understand my objective.
A customer adds part '659' to their cart and the delivery band A is shown. (Delivery band A is $1.99) Then they added part '814' which has a delivery band of C, my postage then should automatically rise to postage band C. ($4.99) Totally forgetting the first part, I just need to be able to return 1x the highest postage band.
I already know how I can achieve this however I'm pretty sure I'll be doing it wrong in a lengthy function that's not necessary. Would like your input on this one to see what options I have.
Thanks,
Alex
I am currently working on a shopping cart. Here is an example of my shopping cart database:
id // part // qty // price // band
1 // 659 // 2 // 5.68 // A
1 // 814 // 1 // 96.32 // C
2 // 546 // 1 // 10.63 // B
The session number is the id column and the band is the delivery cost. Lets say the customer currently on my website has the session id 1.
I need to loop through my database (This I do know how to do lol
A customer adds part '659' to their cart and the delivery band A is shown. (Delivery band A is $1.99) Then they added part '814' which has a delivery band of C, my postage then should automatically rise to postage band C. ($4.99) Totally forgetting the first part, I just need to be able to return 1x the highest postage band.
I already know how I can achieve this however I'm pretty sure I'll be doing it wrong in a lengthy function that's not necessary. Would like your input on this one to see what options I have.
Thanks,
Alex