Jump to content

Saving gift card data to basket


dachshund

Recommended Posts

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,

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.