dachshund Posted December 1, 2013 Share Posted December 1, 2013 Hi, In my current online store the basket stores the item's ID and size (1,2,3,4,5) in an array, which can then be echoed back out when the customer is on the basket page before checkout. So the array would look something like this - 918s2,967s3 (the 2 and the 3 being the size). For christmas I now want to add gift cards, for which I need to be able to save the customer's email and personal message in the basket as well. Does anyone have any ideas how I could do this? Thanks, Quote Link to comment Share on other sites More sharing options...
maxxd Posted December 1, 2013 Share Posted December 1, 2013 I'm assuming from your description that you're working procedurally and putting the 'cart' array into a session variable? if so, it'd be possible to add more session variables ('gcNumber', 'message', and 'eAddy', perhaps) then unset them at checkout once the total has been calculated and you've recieved a success message from your payment gateway. Or at least after the data has been processed in whatever way it's being processed - as long as the script doesn't just blithely keep subtracting the gift card discount amount from the cart amount if the user hits refresh. Although, honestly, it may be worth your while to look into updating to an object oriented style where you've got a store class that aggregates a cart object, where you would store individual item objects that include the size and id. The cart object would then keep track of and handle the gift card, personal message, and e-mail information at the proper time in the store class's timeline. Quote Link to comment 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.