Zen Cart Gift WrapNote: this contribution has been obsoleted by Gift Wrapping at Checkout.
Donate: This is free software. Show your appreciation by supporting my efforts.
Support Thread: Gift Wrap Support Thread
Cost: Free, but donation appreciated
Location: Zen Cart Plugins, under Other Modules.
Download: Gift Wrapping in Zen Cart Plugins (Version 1 only)
Overview:A very simple no-download-required way to add gift wrapping to your Zen Cart is described in my Easy Giftwrapping tip. But this tip has the following disadvantages:
- No easy way to discount giftwrapping services since the price is set for each product
- No easy way to raise giftwrapping prices globally
- No easy way to set a maximum giftwrapping fee
- Gift wrapping fee is embedded into the product rather than broken out
- Tedious to have to type the price in every time.
Another approach that people use is to have a "giftwrapping" product that customers add to their cart. While this approach minimizes the amount of work that the shopowner needs to do, it has the following disadvantages:
- Requires extensive custom coding to permit dynamic pricing based on number of items in the cart.
- Requires the customer to type in the names of the products to be wrapped, which is error prone.
- Less intuitive; not used on most major retailer shopping carts (e.g. Amazon).
This mod addresses these shortcomings. It permits a shop to dynamically price gift wrapping services at checkout time. Gift wrapping may be specified by an attribute which is a checkbox, a set of radio buttons, or a dropdown. The mod will total the number of these and provide a price, which may be optionally subject to tax.
Installation Instructions:Note: this contribution has been obsoleted by Gift Wrapping at Checkout. Are you sure you want to install this version?
- Back up everything! Try this in a test environment prior to installing it on a live shop.
- If you already have the Gift Wrap module installed, please deinstall your old copy by going to Admin->Modules->Order Total, selecting "Gift Wrap" and pressing the "Remove" button. Make a note of your settings so you can apply them to the new version.
- Copy the contents of the unzipped folder to the root directory of your shop. There are two new files in this mod.
- Login to admin and in Modules->Order Total you will see 'Gift Wrap' listed along with all the other modules available.
- Click on 'Gift Wrap' to highlight the module and click on 'Install'
- Perform configuration as described below:
- Donate! Show your appreciation by supporting my efforts.
- Cart Configuration
- Did you back up everything? If not, now's the time.
- Go to Catalog->Option Name Manager. Add the option name "Gift Wrapping." You may use a checkbox, a dropdown list or a radio button, depending on your needs. Make a note of the ID of the newly added option name
- Press the Option Values button. In the dropdown box, select option name "Gift Wrapping," which you just added. Use the value "Yes." Make a note of the ID of the newly added option value. If you wish to add multiple values (such as "Economy" and "Premium" or "Yes" and "Add Ribbon and Bow"), make note of the IDs of each of them.
- Go to Catalog->Attributes Controller, and pull up the category you wish to do gift wrapping for. For each product in that category for which you wish to allow gift wrapping, scroll down to "Adding New Attributes" and select Option Name "Gift Wrapping" and Option Value "Yes." Note that it is not necessary to add a price in the Attributes Controller the way it was in the Easy Giftwrapping tip.
- Repeat the previous step for every category for which gift wrapping is offered.
- Note that if your products already have attributes, then instead of adding these fields one at a time, you may use one of the "Add ALL Option Values" features back on the Catalog->Option Name Manager screen.
- Mod Configuration
The module is configured under Modules->Order Total->Gift Wrap
- Choose a fee for gift wrapping
- Enter the ID number of the gift wrapping option name in the Gift Wrapping Option Name ID field.
- Enter the ID number of the gift wrapping requested option value in the Gift Wrapping Option Requested Value ID field.
- If you have more gift wrapping options (such as "Premium" or "Add Ribbon and Bow", as described above), you will add these later outside the admin screen.
- By default the sort order is just below "Shipping" on the checkout page. If you wish to move it, be sure you keep it above "Tax" if your "Re-calculate Tax" is set to "Standard."
- Additional Customization
If you have more gift wrapping options (such as "Premium" or "Add Ribbon and Bow", as described above), you will need to do additional customization to the file
includes/modules/order_total/ot_giftwrap.phpLook at the function add_extra_fees(). It comes with an example of how to add a fee of $2 for a hypothetical option name and value.
Detailed Example with Multiple Options
- Add the option name "Gift Wrapping" as a radio button. Assume the id is 5.
- Add the following option values: "Wedding" (id 12), "Premium Wedding" (id 13), "Birthday" (id 14), "Anniversary" (id 15)
- Wedding is priced at $2.00, as are Birthday and Anniversary. Premium Wedding is priced at $5.00.
- Create a second option name "Gift Wrapping Extras" as a checkbox. Assume the id is 8. Add the following option values: "Bow" (id 21), "Ribbon" (id 22). Both Bow and Ribbon are priced at $1.00.
- In the Admin screen, under Modules->Order Total->Gift Wrap, set Gift Wrapping Option Name ID to 5, and Gift Wrapping Option Requested Value ID to 12.
includes/modules/order_total/ot_giftwrap.phpLook at the function add_extra_fees(). Add the following lines to it below the example:
// Premium wedding is $5; option name 5, value 13 $extrafee += $this->calculate_wrap_fee_oneitem( 5, 13, 5, $product); // Birthday, anniversary are $2; name 5, value 14, 15 $extrafee += $this->calculate_wrap_fee_oneitem( 5, 14, 2, $product); $extrafee += $this->calculate_wrap_fee_oneitem( 5, 15, 2, $product); // Ribbons and Bows are $1 - option name 8, values 21,22 $extrafee += $this->calculate_wrap_fee_oneitem( 8, 21, 1, $product); $extrafee += $this->calculate_wrap_fee_oneitem( 8, 22, 1, $product);
MarketingIf you want to describe your gift wrapping service on your product page, you can save time by using my Boilerplate Text in Description tip.
ExtensionsIf your shop has special requirements for gift wrap pricing, the gift wrapping contribution may be extended in a variety of ways; please contact me with your detailed requirements for a price quote.