Created
August 16, 2012 10:50
-
-
Save ivuorinen/3369247 to your computer and use it in GitHub Desktop.
Verkkokaupan tuotteiden tilaukseen PHP-looppaus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$obj = 0-> | |
title-> Koko | |
options-> l = L | |
xl = XL | |
xxl = XXL | |
1-> | |
title-> Väri | |
options-> musta = Musta | |
vihrea = Vihreä | |
2-> | |
title-> Leikkaus | |
options-> X = X | |
Y = Y | |
Tuoteominaisuudet loopattuna tauluun josta massatilaus onnistuu helpommin: | |
Koko Väri Leikkaus | Määrä | |
------------------------------------ | |
L Musta X | 0 | |
L Musta Y | 0 | |
L Vihreä X | 0 | |
L Vihreä Y | 0 | |
XL Musta X | 0 | |
XL Musta Y | 0 | |
XL Vihreä X | 0 | |
XL Vihreä Y | 0 | |
XXL Musta X | 0 | |
XXL Musta Y | 0 | |
XXL Vihreä X | 0 | |
XXL Vihreä Y | 0 | |
- Otsikoita voi olla teoriassa kuinka monta vain, mutta vähintään yksi. | |
- "Määrä" on <input type="number"> johon määritellään kuinka monta kyseistä tuotetta tilataan. |
Author
ivuorinen
commented
Aug 16, 2012
- Ongelman matemaattinen ratkaisu: http://en.wikipedia.org/wiki/Cartesian_product
- Ongelman ratkaisu PHP:llä: http://stackoverflow.com/a/6313346
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment