Save Basket to Giftlist
Copyright © 1999, William Weiland
Overview
The purpose of giftlist.mv is to allow a customer to place items they desire into a saved file so that others may view their desires and place an order. This is particularly suited for weddings, baby showers, kids wants for Santa, etc.
Initial Setup
Use the Merchant admin upload feature to upload the module giftlist.mv. Click the Add button to add it to the mall/domain.

In admin, under your store, click on the link for the Utilities. Assign the Save Basket to Giftlist module and Update it to install it in your store.

Click the Save Basket to Giftlist tab to enter the configuration setting. Complete the inputs as applicable.

FTP the help file giftlist.htm to the modules/ui/ directory. You can edit that file to add your own information about the Giftlist.

You'll need to FTP a gif file that signifies add to cart consistent with your site. Name it add2cart.gif and put it in /Merchant2/graphics/ or /Merchant/graphics/ depending where your Merchant 2 or 3 is installed.


Configuration Settings
Enter data into the applicable input fields.

Expires After
Enter the number of days a gift list can be good for.

Add To Cart Image URL
Enter the virtual URL of the add to cart image, e.g. graphics/add2cart.gif

View List
The text input is used on the standard submit button. If you also include a virtual path to an image, it will replace the standard submit button.

Save List
The text input is used on the standard submit button. If you also include a virtual path to an image, it will replace the standard submit button.

Screen After Save
After a customer saves a single product to the gift/wish list, you can choose which screen to take the customer to; back to the product or on to the gift/wish list screen.

Add to Cart Image URL
Enter the virtual path to your help file image. The default is the Merchant standard help button.

List Title
This is the text that appears at the top of the browser for the page title.

Remove from List Text
When a customer moves a gift list item to their basket, they have the option of removing the item from the gift list. This entry defines what the label for that process reads.

Location
You can specify which screens (product, basket, or both) the ability to save items to the gift list occurs.

Allow Saving Without Login
Display the Save To prompts only if the customer is logged in.

Footer
Enter a footer message that displays when the customer displays a previously saved gift list.


Editing Requirements (skip if using the OpenUI)
If you are using the Miva Merchant User Interface (mmui) you will need to make some very simple edits to the core files. Be sure to do that with a text editor (NO WYSIWYG editors) such as Programmer's File Editor (PFE) so as not to damage the mv files. ALWAYS BACKUP your unmodified mv files in case you make a mistake.

Several edits are required in the mmui.mv file.

1) In the mmui.mv file, function UIModule_Dispatch, include the following code. Put this code in the latter half of the function, not near the beginning of the UIModule_Dispatch function.
<MvIF EXPR = "{ g.Screen EQ 'GIFT' }">
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME = "l.showtitle" VALUE = "{GiftList_Open_Store()}">
<MvASSIGN NAME="l.ok" VALUE="{MMUI_Begin_Screen(Stores.d.name $ ':' $ Expire.d.listtitle, 0, 0 )}">
<MvIF EXPR = "{g.Action CIN 'VIEWADPR'}">
<MvASSIGN NAME = "g.myphone" VALUE = "{glosub(rtrim(g.myphone),' ','')}">
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Display_Giftlist(toupper(g.fi)$toupper(g.li)$glosub(toupper(g.myphone),'-',''))}">
</MvIF>
<MvIF EXPR = "{g.Action EQ 'ADD'}">
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Save_To_Giftlist()}">
</MvIF>
<MvIF EXPR = "{g.Action EQ 'ADDONE'}">
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Save_One_To_Giftlist_Prompt()}">
</MvIF>
</TD></TR></TABLE>
<MvFUNCTIONRETURN VALUE = "{ MMUI_Close_Store() }">
</MvIF>

2) If you want to give shoppers the ability to save the entire basket to the giftlist with one key press, use this option. In the mmui.mv, function MMUI_DisplayBasket, near the end of the function include the following 7 lines between the last </TABLE> and the </MvIF>. The </TABLE>* and </MvIF>* tags are shown here for orientation.
* </TABLE>
<MvIF EXPR = "{g.Screen EQ 'BASK'}">
<BR>
<TABLE width="100%" border="0">
<TR><TD align="center">
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Basket_Save()}">
</TD></TR></TABLE>
</MvIF>
* </MvIF>

3) If you want to give shoppers the ability to save the product the specific product they are view directly to the giftlist without putting it in the basket first, use this option. In the mmui.mv, function MMUI_ProductDisplay, locate the code that draws the Add to Basket submit button. You will probably want to insert the Save to List button just below the Add button. Be sure it is below the closing </FORM> tag for the Add to Basket button. You will probably want to use the table tags TR and TD to align the button on your page, depending on where you decide to insert the button. Insert the following line at the location you decide.
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME = "l.displaybutton" VALUE = "{Save_One_To_Giftlist_Button()}">

4) You need to have an input for potential gift givers to enter the code for the recipients gift list. The next two are examples of two ways to accomplish this. You can use one or both options.
- Option 1 - In the mmui.mv file you can insert the following line. I choose to put it in the MMUI_Search function.
In Merchant version 3.x locate the end of the search FORM. You will see the lines marked with an asterisk below. Insert the one line between them.
* </FORM>
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Giftlist_Prompt()}">
* <MvIF EXPR = "{ len( g.Search ) }">
In Merchant version 2.x locate the end of the search FORM and its TABLE. You will see the lines marked with an asterisk below. Insert the one line between them.
* </FORM>
* </TABLE>
<BR><MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME="l.ok" VALUE="{Giftlist_Prompt()}"><BR>
* <MvIF EXPR = "{ len( g.Search ) }">
- Option 2 - If you want to display the Gift List lookup form below the category list, you could include the following just after the Category_Tree call and before the last </TABLE> tag in the MMUI_Begin_Screen function.
<MvDO FILE="{g.Module_Root$'modules/util/giftlist.mv'}" NAME = "l.showviewbutton" VALUE = "{GiftList_Open_Store()}">
<FORM METHOD = "post" ACTION = "&[ g.sessionurl ]">
<TR><TD>
<INPUT TYPE = "hidden" NAME = "Store_Code" VALUE = "&[ Stores.d.code:entities ]">
<INPUT TYPE = "hidden" NAME = "Action" VALUE = "VIEW">
<INPUT TYPE = "hidden" NAME = "Screen" VALUE = "GIFT">
<INPUT TYPE = "hidden" NAME = "Module_ID" VALUE = "&[ g.Module_ID:entities ]">
<INPUT TYPE = "text" NAME="myphone" VALUE="" size="17">
<MvIF EXPR = "{len(Expire.d.viewlisti)}">
<INPUT TYPE = "image" ALT = "&[Expire.d.viewlist:entities]" SRC = "&[Expire.d.viewlisti:entities]" BORDER = 0>
<MvELSE>
<INPUT TYPE = "submit" NAME = "NoSave" VALUE = "&[Expire.d.viewlist:entities]">
</MvIF>
 <A TITLE = "Help" HREF = "JavaScript:PopupHelp('&[g.Module_Root:entities]modules/ui/giftlist.htm')"><IMG SRC = "&[Expire.d.helpgif:entities]" BORDER = 0></A>
</TD></TR>
</FORM>

5) In order to provide the Javascript help popup you need to add the following code in mmui.mv, MMUI_Begin_Screen function, just before the </HEAD> tag.
<SCRIPT language="JavaScript">
<!--
function PopupHelp(helpfile)
{
window.open( helpfile , 'Help', 'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=200,height=150' );
}
// -->
</SCRIPT>

6) If you are going to have attributes in your products which could be put on the giftlist, you'll need to add the following in the mmui.mv UIModule_Product_Attributes function just below the hidden input for quantity.
<INPUT TYPE = "hidden" NAME="myphone" VALUE="&[g.myphone:entities]">
<INPUT TYPE = "hidden" NAME="remove" VALUE="&[g.remove:entities]">
Note: Attributes are not stored directly in the gift list record as attributes. They are placed in the comments field which is stored with the record. For example, the recipient might put something like red, blue or green in the comments field. Then when the buyer views the gift list, they will know what to choose from the available attributes at the time of purchase.


Upgrading from Merchant version 1.x
If you are upgrading your giftlist from Merchant version 1.x to 2.x or 3.x, you'll need to copy your dbf and mvx files from the old data directory to the new data directory (eg. 00000001/giftlist/) AFTER you have installed the giftlist module into version 2.x or 3.x.
Usage
When the customer has filled their basket, rather than checking out, they can save the products to a file. It does not save the attributes however, so if there are sizes and colors involved with your products, there is a comments section that the shopper can inform their gift givers of their specific variations.