|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
multi-dimensional array help
i have a shopping cart. the shopping cart is really freaking complex. it's using OOP. i currently use 2 MD arrays to store all of the cart products. they are setup like this:
product array: array_id => product_id => quantity option/spec array: array_id => spec_id => product array id in order to correlate the option/spec array with the product array, i use the "product array id". let's say a user has productA with optionA + optionB in their cart. they also have productB with optionC. they then decide that they don't want productA with the 2 options. my problem is that of updating the option/spec array's product array id with the new array_id in the product array. it's so complex right now, i can't think straight anymore. should i just unset the array and repopulate it? surely there is a more appropriate way... thanks! |
|
#2
|
|||
|
|||
|
I may be totally wrong here, but it looks to me like you over complicated the situation by working with two MD arrays.
At first glance I wonder why not just store it all in one array, where the item's options were just under another key called 'options'. I would take steps to make that part simpler and I think everything will fall in-line thereafter.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > multi-dimensional array help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|