UC Gift Wrap

Contrib type: 
Module
Status: 
Complete and working
Moderation: 
Awaiting moderation
Latest version: 
1.0

Downloads

Compatibility: 
Ubercart 1.x

This modules enables the customer to specify if he wants gift wrapping during checkout. There is also an optional text area for a gift card message.

There are presently two settings you can modify:

(1) Calculate gift wrap fee per order or per item.
(2) Gift wrap fee (defaults to $3.00 for no particular reason).

So if you use the settings "per item" and "$2.00" a customer who purchases 3 items in the same order will get charges $6 for the gift wrapping.

Update 1/20/2009:

- added functionality for setting gift wrap available/unavailable on a product level (some of our vendors drop ship and therefore for some products we cannot offer gift wrapping).

Update 2/11/2009:

- sat default to "gift wrap available" for product level availability

PreviewAttachmentSize
uc_gift_wrap.zip3.41 KB
Abilnet's picture
Offline
Uber DonorBug Finder
Joined: 12/28/2007
Juice: 718
Re: UC Gift Wrap

Thanks for the module, appreciated! ...however, there seems to be a small bug with the currency... for me the module seems not get the currency sign from Ubercart settings (hard coded to USD?)

hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Re: Re: UC Gift Wrap

Thanks for pointing that out. To fix, replace the case 'view' (line 75-94) with the code below (or just use the attached files).

case 'view':
$per_item = variable_get('uc_gift_wrap_per_item', 1);
$charge = variable_get('uc_gift_wrap_charge', 3.00);
$currency_sign = variable_get('uc_currency_sign', '$');
$description = t('');
$contents['gwcheck'] = array(
'#type' => 'checkbox',
'#title' => t('Add gift wrapping (' . $currency_sign . number_format($charge,2) . ($per_item ? ' per item' : '') . ')'),
'#description' => t(''),
'#default_value' => $arg1->gift_wrap['chk'],
);
$contents['gwtext'] = array(
'#type' => 'textarea',
'#maxlength' => 200,
'#cols' => 30,
'#rows' => 3,
'#title' => t('Gift card message (optional)'),
'#description' => t(''),
'#default_value' => $arg1->gift_wrap['text'],
);

return array('description' => $description, 'contents' => $contents);

AttachmentSize
uc_gift_wrap.zip 2.4 KB
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3467
Re: Re: Re: UC Gift Wrap

You should be using uc_currency_format() instead of trying to format the currency yourself.

<tr>.
hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Re: Re: Re: Re: UC Gift Wrap

Thanks for the help. Changed to using uc_currency_format().

AttachmentSize
uc_gift_wrap.zip 2.42 KB
Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Hi, I found it much nicer if

Hi,

I found it much nicer if you can choose wrapping in the cart view.
There you can choose to wrap a individual product, or the hole cart.

Best Regards,

Jurgen
www.iGadgets.be

hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Re: Hi, I found it much nicer if

I agree that would be a good functionality. Will see if/when I can get around to implementing it.

By the way, just added functionality to set gift wrap available/unavailable on a product level (download from main post on the top).

ragavendra_bn's picture
Offline
Joined: 01/10/2009
Juice: 68
Re: UC Gift Wrap

Waiting for D6 version of this module for http://www.fashionjewelery.co.in/

anea01's picture
Offline
Joined: 02/19/2009
Juice: 13
Re: UC Gift Wrap

May I second that request? I had a quick go at putting the module through Deadwood (http://drupal.org/project/deadwood) but it could not complete the conversion and I don't have any knowledge about UC hooks/APIs etc. Sad

Regards and thanks

Adam

Danny_Joris's picture
Offline
Joined: 05/09/2009
Juice: 200
Re: Re: UC Gift Wrap

I third that request for a D6 version. It looks exactly what i need.

cybertoast's picture
Offline
Joined: 12/25/2008
Juice: 33
Drupal 6 port on GitHub

I've just ported and done a rudimentary test of the D6 port of UC-Gift-Wrap. It's at http://github.com/cybertoast/uc_gift_wrap

Although I would prefer GitHub since it's easier to manage, please report issues at either place (i.e., here or there).

cybertoast's picture
Offline
Joined: 12/25/2008
Juice: 33
Updated Drupal 6 version

The last version I uploaded to git had a number of issues. I've updated the code (at the same location), and it now should work (better?) Smiling

domineaux's picture
Offline
Joined: 05/27/2009
Juice: 197
Re: Updated Drupal 6 version

I need to remove the gift wrap part.

What I need is the ability for the customer to write a sentiment in the text box to accompany the gift, but I don't need the gift wrap part.

It would also be nice, if I could apply more additional information about the text entry so customers would better understand what the text box was about.

Thought I'd ask before I start messing with the code.

aasarava@drupal.org's picture
Offline
Joined: 04/29/2009
Juice: 15
Updates to D6 version

Cybertoast, thanks for getting the Drupal 6 port started. I tested the version found at the link below and noticed a couple porting issues:
http://github.com/cybertoast/uc_gift_wrap/tree/master

I'm attaching a patch that fixes the issues. The issues are:
- Improper set up of system settings form didn't allow settings to be saved.
- Use of old hook_form_alter parameters didn't allow node form to get updated.

Any chance you'll be setting this up as a proper project on Drupal.org? I know github can be really handy, but putting this on Drupal.org with all the other modules will help others find it, let us keep better track of issues, and may encourage others to contribute patches.

Thanks!

AttachmentSize
uc_gift_wrap_6.x-1.x-dev-system-settings.patch 1.61 KB
backdrifting's picture
Offline
Joined: 10/03/2008
Juice: 373
Gift wrap by product?

Is it possible to add this checkbox selection to each product in the cart? I'd like my shoppers to be able to specify gift wrapping per product in the cart/checkout process.

-backdrifting

sacredjewelry's picture
Offline
Joined: 10/21/2009
Juice: 14
Ubercart 2?

Does anyone know if this works with Ubercart v2?

TIA

Sacred Jewelry, Art, & Gifts
http://www.ShopSacred.com

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Updates to D6 version

I have forked the original git branch and incorporated the patch into it. Available here: http://github.com/hiddentao/uc_gift_wrap

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Re: Updates to D6 version

I've added some JS code so that when you select or deselect the gift wrap checkbox the order total on the page gets updated.

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: UC Gift Wrap

Perhaps it's time to submit this module to Drupal.org as a project?

sue
sue's picture
Offline
Joined: 06/09/2010
Juice: 4
Total on Checkout Page

It is a shame that this module doesn't update the total until the customer goes through to the review order page.

Technically it makes the Total incorrect on the checkout page. I notice that you said you had written some JS to do this.

Being awful at JS and noticing your post I wander if you would kindly contribute your code.

An eternally grateful Sue

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Total on Checkout Page

Hi Sue, yes I have written some JS to have the total updated on the checkout page itself. The latest code for this is available from the my GitHub repository at http://github.com/hiddentao/uc_gift_wrap.

I've attached a ZIP of the latest source code to this comment for your convience.

AttachmentSize
hiddentao-uc_gift_wrap.zip 4.47 KB
jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
total does not update in checkout

hiddentao, this is a great module and I appreciate it but the total still does not update for me in the checkout page. Any chance that you can fix this?

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: total does not update in checkout

@jpdaut, the updating on the page is done via Javascript. Are you getting any Javascript errors? (Use Firefox + Firebug to see errors).

niteshade's picture
Offline
Joined: 05/30/2010
Juice: 17
not showing up in product purchase screen

hi there

setting up ubercart, and gift wrap functionality would be nice. I've installed the uc_gift_wrap module, and it seems installed ok... a check box for gift wrap shows up in the product edit page, and the capability to get gift wrapping (for the whole order) shows up in the order page.

However, I'd like to have per item gift wrapping, selected as a checkbox before putting into the cart. If the uc_gift_wrap module is supposed to do this, it's not working for me. I checked the box in the checkout settings page ("Charge per item rather than per order"), but it doesn't seem to change any behavior.

I tried hiddentao's GitHub version, as well as the one with the JS update patch... same deal with both. Drupal 6.17

Any ideas?
-allan

jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
Re: Re: total does not update in checkout

hiddentao Thank you for replying. I looked into it and indeed your javascript code works fine. In the configuration page I had set the wrap-job on a per-item basis and your code does not handle that case, it only handles when the wrap-job is per-order. Because in my case the nb of items in an order vary greatly (1 to 10 or 20) I wanted the gift-wrap price to apply per item, for each item in the order. Would it be possible to save the total gift wrap charge per order? How would I go about doing that?

I'd like to make another point also: I thought may be we should not show the text box unless the gift wrap option was checked first. My concern is that people will think that gift wrapping and gift card message are different. So they won't check the box for gift wrapping ($$), but write some text to put on a card as a message, thinking that's free. Is there a way to hide/display the text box based on the "Add gift wrapping" checkbox? Could you give me some hint on how to achieve that? I would really appreciate it. Thanks!

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Re: Re: total does not update in checkout

Hey guys, I've made some changes -> http://github.com/hiddentao/uc_gift_wrap

The 'per item' gift wrapping now works. You should see the order total update correctly when turning on gift wrapping.

@jpdaut your suggestion for disallowing a gift wrap message when gift wrapping is turned off is a good one. Rather than not show the text box I've decided to disable it instead. So that if gift wrapping is initially turned off the user is still aware that they can add a message if they were to turn it on.

I haven't tested the functionality with the order review page (the page that gets shown after you submit in checkout). Please let me know if everything works as expected.

Also, if none of the products support gift wrapping then the gift wrap option isn't shown at all.

jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
Re: Re: Re: Re: total does not update in checkout

hiddentao thank you. Everything works nicely: order total, fee-per-item, greyed-out/active text box on toggling checkbox. I verified also the pane is not shown if no product supports gift wrapping, and that order review page is correct.

Your module really deserves greater exposure, on drupal.org!

niteshade's picture
Offline
Joined: 05/30/2010
Juice: 17
still no worky

I'm still having problems... Drupal 6.17/uc2, all updates, ran cron, other JavaScript works ok.

Trying to get the per-item gift wrap to work. "Charge per item" box is checked in admin/store/settings/checkout/gift_wrap, and "Gift wrap" box is checked in node/edit. No option to select gift wrapping shows up on the node view pages.

I am using a custom node-product.tpl.php file... what php function outputs this option? Is it in the "features" section, or do I need to add a new to my code?

Quote:

If none of the products support gift wrapping then the gift wrap option isn't shown at all.

Is there something I have to do to enable gift wrapping for a particular product (apart from checking the box in node/edit)? Pardon me If I'm missing something obvious... still somewhat an ubercart n00b.

Thanks!

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
@niteshade Checking the box

@niteshade

Checking the box in node/edit should be sufficient. The gift wrap pane isn't template-driven. It adds itself to the list of checkout panes if it is able to find atleast one product in the shopping cart for which gift wrapping is turned on (http://github.com/hiddentao/uc_gift_wrap/blob/master/uc_gift_wrap.module...).

I can't think why it's not working on your installation. I wonder if perhaps the gift wrap pane is being set but then being unset elsewhere. Your custom node-product.tpl.php is likely not the reason for it not showing up.

niteshade's picture
Offline
Joined: 05/30/2010
Juice: 17
@hiddentao yeah, I don't know

@hiddentao

yeah, I don't know what is up. I don't think I'm doing anything fancy (don't have the drupal/uc skills yet to be very dangerous)...

I uninstalled and deleted the module, and used a fresh download from github, and things still don't work. Could there be a conflict with another module? In terms of ubercart, I only have the uc_giftcertificate, reports and catalog modules activated.

I'd appreciate any course of action you can recommend for me to isolate the problem... I suppose I can try a fresh install of drupal and ubercart, but I guess I'd prefer to try other things first.

sorry to be a raincloud here! I appreciate your work on this module.

niteshade's picture
Offline
Joined: 05/30/2010
Juice: 17
Re: @hiddentao yeah, I don't know

perhaps you can tell me which modules you have installed? Maybe I'm *missing* a module.

instinct's picture
Offline
Joined: 08/18/2010
Juice: 9
Gift wrapping with cart selection

Hi there,

I needed a module where a user can mark individual cart items for gift wrapping. This module came near this functionality so I customized this module until it fits my needs. I saw that some more people needed this so maybe I can make them happy with my share. I also needed the functionality to force the user to use gift wrapping so I added this option too (it will remove the checkbox on the checkout page).

All the settings can be configured on the same gift wrapping settings page, the options are disabled by default. When "cart gift selection" is enabled and the user selected no products as gifts, then the script will automatically turn off gift wrapping on the checkout page and the user won't be charged with gift wrapping costs. The admins can see which products are selected as gifts in the products table on the "admin/store/orders/%ordernr%" page.

By the way, while editing the module I came across a bug affecting the total charge on the checkout page. In the old version, the total charge doesn't take the quantity of the products with it's calculation, but it does on the ending calculation of the review page. That was a big problem form so I fixed that in my version.

Note: I extended the version of Hiddentao on http://github.com/hiddentao/uc_gift_wrap from august 8 (2010 Sticking out tongue).

AttachmentSize
uc_gift_wrap.zip 5.38 KB
hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Gift wrapping with cart selection

@niteshade Sorry about the late reply. I have the following modules enabled:

Ubercart 6.x-2.2
Shipping 6.x-2.2
Google Analytics for Ubercart 6.x-2.2
Out of stock notificator 6.x-1.4
Auto-calculate shipping 6.x-1.1
Flatrate 6.x-2.2
UC Gift Wrap (latest version from Github)
Paypal 6.x-2.2

@instinct I haven't checkout your code but it sounds good. Not sure if you're aware but it might be easy for you to just fork my code at Github (http://github.com/hiddentao/uc_gift_wrap). That way we'll both be able to track your changes easier (does require using Git though!).

instinct's picture
Offline
Joined: 08/18/2010
Juice: 9
Re: Re: Gift wrapping with cart selection

Alright I think that's a nice idea. Never heard of github actually but I have signed up right now and will try to figure out how it works. Do I need to put my changes in my own repository or do I need to update yours? (if that's possible anyway?)

Oh by the way, I'm updating my version of this gift wrapping module so it is also possible to add a message per gift in the cart, and maybe also a possibility to make a choice of gift card layout.

hiddentao's picture
Offline
Joined: 04/29/2010
Juice: 51
Re: Re: Re: Gift wrapping with cart selection

@instinct You put your changes into your own repository by first forking from my repository (see the 'Fork' button on http://github.com/hiddentao/uc_gift_wrap) - you and I will both be able to see the changes and where you forked from in the Network view (http://github.com/hiddentao/uc_gift_wrap/network). Trust me, once you get going with this you'll love it Smiling

The other changes sound good too.

domineaux's picture
Offline
Joined: 05/27/2009
Juice: 197
Re: UC Gift Wrap

I haven't installed this yet, but one thing needed was a text box for the sentiment message.

The one text line entry is not sufficent for many users.

I would think about 10 to 15 lines x 80 would be sufficient.

Some people want to write a darn book, especially for gifts going as sympathy items.

domineaux's picture
Offline
Joined: 05/27/2009
Juice: 197
Re: UC Gift Wrap

I installed and it seems to work fine, but the interdepency between the click on and text box is not good..

It is not uncommon on many orders for customer to want to send a sentiment message with a gift, but there is no gift wrap involved.

Nor is it necessary to say it is a gift. The sentiment message adequately conveys that message.

Is it possible to just have a text box that works all the time, regardless of whether gift wrap is selected?

-------------------------------------------------

Also, it is also common as well to have different sentiment messages per each item.

When Granny sends a packet of candies to each grandchild at the same address she wants to send a personal message along with each item.

Yeah... I know this make things a bit more cumbersome.

This is very common, and remember Granny doesn't want to make three separate orders going to the same house when the items are the same.

This is an important addition to the Ubercart for many of us following this thread

Thanks very much

instinct's picture
Offline
Joined: 08/18/2010
Juice: 9
Hey Domineaux, As I already

Hey Domineaux,

As I already told in post #33 I will work on a new update where you can give up a message per item, I think tomorrow will be the day.

Yes that is possible about what you said. I think the solution would be that there must be another option in the gift wrapping settings page which says 'Automatic turn off gift wrapping when no gifts are selected'. I will take that within the new update.

About the size of the textbox, it is themable in css and it is possible for the user to manually resize the box, so there is no problem right?

domineaux's picture
Offline
Joined: 05/27/2009
Juice: 197
Re: UC Gift Wrap

I really appreciate your work on this. I have been maintaining several ecommerce sites for very small businesses.

The gift wrap and sentiment message will make an excellent addon.

You mentioned changing the CSS. I can agree, but if it can be done through a module and update processes that is best.

People lose track of changes they make to accomodate modules, and drupal and ubercart are constantly coming out with updates.

As a site maintainer I can tell you I hate when site admins make changes and I have to go back and try to find all the issues.

It's like putting out fires with someone pouring gasoline on as fast as I put out a fire. LOL

Thank you very much for this addition

gbell12's picture
Offline
Joined: 09/30/2007
Juice: 8
Database updates not happening

There's a bug:

function uc_gift_wrap_settings_form_submit($form, $form_values) {
variable_set('uc_gift_wrap_per_item', $form_state['per_item']);
variable_set('uc_gift_wrap_charge', $form_state['charge']);
}

should be:

function uc_gift_wrap_settings_form_submit($form, $form_values) {
variable_set('uc_gift_wrap_per_item', $form_values['values']['per_item']);
variable_set('uc_gift_wrap_charge', $form_values['values']['charge']);
}

no "form_state" is defined anywhere....

sorry, don't know how to use git and no time right now.

gakshay's picture
Offline
Joined: 11/18/2010
Juice: 3
My Gifts per user

Hey,

Simple and great module indeed. I need to have custom fields in the gift wrap pane e.g. To: , Email: , From: etc along with personal message and gift wrap option (that incurs some cost).

A view for user to view "My Gifts" with the recipient's name (from field), purchase date etc. How to achieve the same without hacking much ??

Possible solution:
* new attributes e.g to, from inside uc_gift_wrap table.
* Form to show respective fields
* Save the fields in the uc_gift_wrap table on Form Submit
* new hook_menu item callback to display all the gifts per user (some db queries)

Please give suggestion/feedback to achieve the same functionality,

jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
sales tax is not carried over to Review Order page

@hiddentao, I uncovered a problem with Gift wrap: a taxable line item, it is correctly taxed in the Order Checkout page, however it appears this is not carried over to the Order Review page: it was no longer taxed there in my tests. This is a bug: could you give me instructions on how to fix it or could you fix it? Thank you.

schaub123's picture
Offline
Bug FinderGetting busy with the Ubercode.PayPal Hero
Joined: 10/08/2007
Juice: 458
Re: sales tax is not carried over to Review Order page

Yes, this is definitely a bug, I see it too. My guess is that item is being added too late and the tax conditional action doesn't have the updated line items. I've seen this before in other modules that rely on conditional actions. The conditional actions code should really just fetch the order and create a new order object, not rely on what is being passed because it can be stale.

Christopher Schaub

jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
Re: Re: sales tax is not carried over to Review Order page

Too late? But the tax conditional action has already acted properly, even earlier, in the checkout page: gift wrap is taxed as expected there.

So why is this lost in the Review Order page?

bennyB's picture
Offline
Joined: 06/14/2011
Juice: 7
Re: UC Gift Wrap

Hi ! Thanks for this awesome Module ! I works great overall, but I have noticed one small odd behavior: in the edit order page of admin section of ubercart, like admin/store/orders/XX/edit, it does not seem that the removal function works that well. When I click the red cross in front of the line item corresponding to gift wrap, popup notification appears alright and even confirmation message appears, but the line item is not actualy deleted (even by clicking on the red cross and then hitting the submit changes button).
Could this be related to the way hook_order is implemented ?

rkdarwin13's picture
Offline
Joined: 02/21/2012
Juice: 8
D7 / UC3

hey, is there any chance this can get updated to D7/UC3
I'm fairly new and don't really know what I am doing, so any help would be appreciated.