wmguk Posted October 9, 2007 Share Posted October 9, 2007 hey guys, I'm creating a VERY basic cart from scratch, basically as a person comes to the page, php generates a unique code and sets a session variable for that visitor so, I've got the unique code creation ready <?PHP // random key generator function getrand() { // random key paramters $keyset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $length = 4; // first 14 chars of transaction_id are date, last 4 random // Random Key Generator $randkey = ""; $max = strlen($keyset)-1; for ($i=0; $i<$length; $i++) { $randkey .= substr($keyset, rand(0,$max), 1); } return $randkey; } // end function getrand() $date = date("YmdHis"); //puts in format YYYYMMDDhhmmss $rand_str = getrand(); $transactionID = $date . $rand_str; ?> now i need to enter this code as orderid in a session variable. its for a photography site, and basically, there could be up to 500 pics per album, each picture is available in up to 6 sizes (these sizes are pulled from a MySQL database) and so i could order image 1, 5x6, 6x8 etc etc, I would need the image name, then each size required and the cost of each item placed in to a basket... I dont know if ive tried to explain this very well, but say the customer orders each picture in each size, could be 3000 items in a basket. and this can be passed about... however also I would like a drop down to select quantity for each picture, so someone ordering 10 of each picture in each size, makes 30,000 images on order (wont EVER happen, but you never know lol) also each order needs to visable on a screen for me to view... so im guessing the whole thing will be in MySQL database... can anyone give me any pointers? Quote Link to comment https://forums.phpfreaks.com/topic/72515-help-with-a-simple-cart-please/ Share on other sites More sharing options...
Barand Posted October 9, 2007 Share Posted October 9, 2007 A couple of things spring to mind. Are you going to create the image size options when you upload the original image (hungry on disk space) or do you intend to resize dynamically from the original when ordered (hungry on server resources). As always, it's a tradeoff. If you offer 5x6 and 6x8 there is going to some distortion of the image, as the aspect ratios are different unless there is some cropping involved (therefore the crop areas will need to be defined for various sizes) Quote Link to comment https://forums.phpfreaks.com/topic/72515-help-with-a-simple-cart-please/#findComment-365675 Share on other sites More sharing options...
wmguk Posted October 9, 2007 Author Share Posted October 9, 2007 A couple of things spring to mind. Are you going to create the image size options when you upload the original image (hungry on disk space) or do you intend to resize dynamically from the original when ordered (hungry on server resources). As always, it's a tradeoff. If you offer 5x6 and 6x8 there is going to some distortion of the image, as the aspect ratios are different unless there is some cropping involved (therefore the crop areas will need to be defined for various sizes) sorry the sizes I listed up were just a idea lol.. the images are uploaded then a script runs and counts the images and displays them as thumbnails, then they are viewable on the site. basically all im trying to work out is how to retain info of images ordered. and process that info... it sounds so easy, bit it cant be... Quote Link to comment https://forums.phpfreaks.com/topic/72515-help-with-a-simple-cart-please/#findComment-365712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.