Gift Certificate Module

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

Hi all,

I am in the process of writing a module for gift certificates. I so far have it so that the creation of the gift certificate is done manually by an administrator following the purchase of a "gift certificate product". An admin would choose which user and amount from an admin screen. Then the user can apply the certificate on any given future purchase he/she makes.

I would like to change this so that the certificate is autmatically created when a user buys the gift certificate. Does anybody have suggestions on the best way to implement this. I imagine I need to create a custom product type. Perhaps someone could suggest some ubercart code to look at that would steer me in the right direction.

Thanks

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Well, I believe the thing to do here is to let us define a new feature. Eye-wink

There are several modules like yours... file product, roles, this, where folks need to add features to products on a per-product basis. There isn't a good way to display/modify this information now, but we'd like to make it happen.

For more information, view the following thread:
http://www.ubercart.org/forum/development/872/product_features_spec
http://www.ubercart.org/forum/announcements/972/product_features_system_...

You'll need to use hook_order() to see if someone checks out an order w/ a certain product on it. You would use the update $op to do this, but you'll want to hold off a day or two while I right documentation for the new order status system. Sorry the timing is so bad, but it really will make your life a lot easier!

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

Thanks Ryan,

Looking forward to the new documentation.

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Bumping this up for visibility, and also to show my support for a gift UC Gift Certificates module. I have almost 300 gift certificates with our current cart system, and would love to be able to keep the old cert codes with UC but to generate new ones as well.

Purchasing gift certificates is popular on our site, so making it an actual product would be handy. If I can do anything to help with the creation process please let me know.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Thanks for the bump, torgosP! We are planning a mailer in the wake of our launch that will include a coupon but we also have a series of gift certs out in the field that periodically come back to us now. It would be awesome to fold that manual system to into our shiny new Ubercart!

I second the motion to help as needed.

Posts: 203
Joined: 09/06/2007

Coupon produces you a "coupon" now it all but needs to be sold.
Basically a product typ that shows the actually coupon-id after the order is done and completed. Thus we needed a cck field that hides the coupon to be sold, basically it is autofilled with the next available out of the coupon stock, if empty create a new one with coupon api!

So, the actually coupon thus is emailed after the order is placed and on the thank you for your order page we show it from the coupon node.

Then we email the product type node with the cck attribute "coupon-id to the user...

I think we have all we need to get something up and running, but i do not enough api at this point for ubercart where to display it and all.

Posts: 203
Joined: 09/06/2007

Folks, this should really work, all I need to know is by what ubercart api I get access to all the fields of a processed order right after the order was placed:

See, this is what would work with coupon type.

if in the just placed order is an item of cck gift certificate ( we can produce here more than one like Xmas gift certificate 99 bucks and regular one 10 dollar), then we autofill drupalexecute the build me a coupon api in the coupon module, then we email the coupn code to the buyer.

The cool addon would be that in pane we get the naem of the one the gift certificate is for, the email address and a personal text, then we create a cck node gift certificate pickup, which is password protected with cck password, then the "friend" can come and see his graphical personalized Xmas certificate here on our site even...

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

TCS, I have committed the product features system to the development repository. You can start coding your gift certificate module based on it if you want. I haven't fully documented it, but I posted a lot about it in this thread with an example module:

http://www.ubercart.org/forum/announcements/972/product_features_system_...

Guest (not verified)

Ryan,

Thanks for the heads up! I should have a chance soon to finish work on the module.

Posts: 203
Joined: 09/06/2007

hook_order[SUBMIT]

is in order the product typ coupon1? how many times?

-> how can i check order typ what hook?

invoke autofill/execute form create coupon with random 16 char coupon code.

-> could do!

create pickup-node for product type coupon1 and display its link+password
on the thank you for your order page after checkout

-> how to express on post sale screen? with hook_sale?

This pickupnode can be printed via pdf and should be cck password protected

-> could do

Email all this data to buyer.

-> could do

coupon module changes: set up "user anybody" meaning guests can use this coupon 2

ADD ON: How can i use, better where in the code to print out $items, $item and $arg1
after hook_order SUBMIT?

Question: When I make a hook_order SUBMIT that sends out a coupon, and another
hook_order files that the payment via cc did not go thru ... Point: How can my hook here
be the LAST to be executed??

Posts: 203
Joined: 09/06/2007

all you basically need to do is to check the order (hook_order) if the sku matches to any specific SKUs of product type node gift certificate! then you activate the coupon code function of coupon module by hand to enter a new coupon into sql database with your terms such as coupon code, name, etc. which you then also can email to the buyer Smiling I am happy to walk anybody thru it!!! Cool (All you have to make sure is that the coupon price = your gift certificate one Laughing out loud)

Posts: 94
Joined: 08/09/2007
Uber DonorBug Finder

What's the status of this module? Is there any development version available? Is any help needed? Thanks!

--

Biodiesel * (ubercart + drupal) = Sundays Energy

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

I was taken away by urgent projects, but will be posting an initial version of the module soon to get feedback. Ryan's product features system is a big help.

Cheers!

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Giving this a bump Smiling I would love to see the Gift Certificate module (and the ability to purchase a certificate as well) .. please let us know when you have a module we can start testing!

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Guest (not verified)

I'm 'bumping' this too...as it would be a fantastic tool.

Posts: 7
Joined: 11/05/2007

Hi there,

the gift certificate module is exactly what we've been looking for.

Do let us know if there's any way we can help, we'll do anything. Although I warn that we are total noobies - so we'll try and help with anything, and you never know we might be useful.

any news as to how you're getting on?

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

Hi muirland,

Yes, The gift certificate module is essentially complete and we will be posting it hopefully in the next couple of days.

Cheers

Posts: 2
Joined: 11/05/2007

Great! looking forward to getting my hands on it and having a play! cheers.

Posts: 7
Joined: 11/05/2007

That's great TCS...excited already

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

I will be posting the gift certificate module shortly as I would like feedback; I am cleaning up the code a bit first and putting together an instructional readme. The way that things work is a little different than other gift certificate systems; it is not necesary for the recipient of a gift certificate to enter a code. When a user buys a gift certificate, they enter the email of the recipient. If there is already a user associated with this email, the certificate is issued to this user. Otherwise a new user is created and the certificate is issued to them. Then an email is sent informing the recipient that "somebody has purchased a gift certificate for you valued at x dollars, this amount will be credited to your next purchase" (The email is configurable from the settings page). This way it is not necessary for a user to enter a certificate code.

The module handles the case of multiple certificates (and the certificate value >= the order total) properly. There is also the functionality for an admin to create gift certificates for users as well. The recipient of the certificate can be chosen from an autocomplete field or a pulldown list (configurable from the settings page).

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Sweet! Can't wait to see your latest code. I'll be putting it into good use very shortly!

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 42
Joined: 09/12/2007
Getting busy with the Ubercode.

A heads up to anyone following this thread that we have now posted the gift certificate module here: http://www.ubercart.org/contrib/1758. Any comments or suggestions are welcome.

Cheers!

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Awesome. Thanks for the announcement, TCS.