Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce Starts Here!

Zen Cart Gift Wrap

Note: this contribution has been obsoleted by Gift Wrapping at Checkout.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

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?
  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. 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.
  3. Copy the contents of the unzipped folder to the root directory of your shop. There are two new files in this mod.
  4. Login to admin and in Modules->Order Total you will see 'Gift Wrap' listed along with all the other modules available.
  5. Click on 'Gift Wrap' to highlight the module and click on 'Install'
  6. Perform configuration as described below:
  7. Donate! Show your appreciation by supporting my efforts.

Configuration:

  1. Cart Configuration
    1. Did you back up everything? If not, now's the time.
    2. 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
    3. 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.
    4. 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.
    5. Repeat the previous step for every category for which gift wrapping is offered.
    6. 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.
  2. Mod Configuration
    The module is configured under Modules->Order Total->Gift Wrap
    1. Choose a fee for gift wrapping
    2. Enter the ID number of the gift wrapping option name in the Gift Wrapping Option Name ID field.
    3. Enter the ID number of the gift wrapping requested option value in the Gift Wrapping Option Requested Value ID field.
    4. 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.
    5. 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."


  3. 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.php Look 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.
Since you have additional gift wrapping offerings, edit the file includes/modules/order_total/ot_giftwrap.php Look 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);


Marketing

If you want to describe your gift wrapping service on your product page, you can save time by using my Boilerplate Text in Description tip.

Extensions

If 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.

Files

(new) includes/languages/english/modules/order_total/ot_giftwrap.php
(new) includes/modules/order_total/ot_giftwrap.php