The mgiShoppingBasket Tag

Tag Behavior

The mgiShoppingBasket tag formats and displays the contents of the shopping basket.


Tag Syntax

The mgiShoppingBasket tag has a beginning tag with no required parameters and five optional parameters, a body, and an ending tag. The tag form is:

<mgiShoppingBasket productDatabaseFileLocation="File Path" 
productTableName="Name" productIDFieldName="Database Field"
formatFileLocation="File Path" templateFileLocation="File Path" 
discount="Price Discount">
SBPrice tag and/or SBShippingCost tag
</mgiShoppingBasket>

or

<mgiShoppingBasket mode="Mode" recordAgeInWeeks="Integer">

Required Parameters:

  • None.

Optional Parameters:

  • productDatabaseFileLocation="File Path" where "File Path" is the relative path to the database containing the product information (product ID, etc.) for the items that can be added to the shopping basket. This parameter is not required for hard-coded shopping baskets using the mgiBuyMe tags. This parameter is required if product information is accessed from a database.
  • productTableName="Name" where "Name" is the name of the database table containing the product information (product ID, etc.) for the items that can be added to the shopping basket. This parameter is not required for hard-coded shopping baskets using the mgiBuyMe tags. This parameter is required if product information is accessed from a database.
  • productIDFieldName="Database Field" where "Database Field" is the database field name that contains the unique productID for each item that can be added to the shopping basket. This parameter is not required for hard-coded shopping baskets using the mgiBuyMe tags. This parameter is required if product information is accessed from a database. The product ID field must be a short text field.
  • formatFileLocation="File Path" where "File Path" is the relative path to the shopping basket format file which specifies the format of the shopping basket. The default format file structure includes a table with columns for Keep/Remove, Quantity, ProductID, Description, Price (ea.), and Total. The default format file structure also includes table summary rows with the Shipping Total (mgiSBShippingCostSubtotal) and Total (mgiSBTotal). To create a custom format file, use text, HTML and the format file variables listed below. If you include the formatFileLocation parameter, the templateFileLocation parameter is required.
  • templateFileLocation="File Path" where "File Path" is the relative path to the shopping basket template file which specifies the format of each product in the shopping basket. The default template file structure includes a table row with the Keep/Remove radio buttons (mgiSBKeepRemoveRadioButtons), Quantity (mgiSBQuantityModify), ProductID (mgiSBProductID), Description (mgiSBBriefDescription), Price (mgiSBPrice), and Total (mgiSBItemTotal) for each product. To create a custom template file, use text, HTML and the template file variables listed below. If you include the templateFileLocation parameter, the formatFileLocation parameter is required.
  • discount="Price Discount" where "Price Discount" is the percent deducted from the price of each item in the shopping basket represented as a decimal number (e.g., to give a 20% discount on all prices, enter ".20").

Record Purge Optional Parameters: Note: The first time you implement the purge mode, delete any existing MGI Shopping Basket database in the MGI Data folder. It is recommended that you delete the folder during a down time since it will contain the contents of any customer using the shopping basket at the time you delete the database.

  • mode="Mode" where "Mode" is the mode of the shopping basket. The only valid mode is "Purge". In purge mode, shopping basket records in the internal MGI shopping basket are deleted based on the date they were created. Records older than the number of weeks listed in the recordAgeInWeeks parameter are deleted when the mgiShoppingBasket tag is accessed in Purge mode.
  • recordAgeInWeeks="Integer" where "Integer" is the number of weeks records are allowed to remain in the internal MGI shopping basket database when the database is purged. A record in the internal MGI shopping basket database is an individual item (of any quantity). If the recordAgeInWeeks is not included, the default purge value is 4 weeks.

Tag Body:

  • mgiSBPrice - The mgiSBPrice tag is not required for hard-coded shopping baskets using mgiBuyMe tags. The mgiSBPrice tag is required in the body of the mgiShoppingBasket tag when using a product database. See the mgiSBPrice tutorial for more tag details.
  • mgiSBShippingCost - The mgiSBShippingCost tag is not required for hard-coded shopping baskets using mgiBuyMe tags. The mgiSBShippingCost tag is required in the body of the mgiShoppingBasket tag when using a product database. See the mgiSBShippingCost tutorial for more tag details.

Format File Variables: The format file specifies the static structure of the shopping basket display (e.g. the table headers and summary variables). You may customize the display of the shopping basket by indicating a format file path in the "formatFileLocation" parameter and including any of the following summary variables in your format file. To include a summary variable in the format file, use the mgiGet tag with the following syntax:

<mgiGet name="VariableName">
  • mgiSBProductList - The location of the template file structure for each product in the shopping basket appears at the location of the mgiSBProductList variable.
  • mgiSBPriceSubtotal - The subtotal of the extended item prices (i.e. price multiplied by quantity) for all products in the shopping basket appears at the location of the mgiSBPriceSubtotal variable.
  • mgiSBBaseShippingCost - When using the BasePlusPerItem shipping method, the mgiSBBaseShippingCost variable displays the base shipping cost for the order.
  • mgiSBShippingCostPerPound - When using the Weight shipping method, the mgiShippingCostPerPound variable displays the shipping rate per pound for the order.
  • mgiSBTotalWeight - When using the Weight shipping method, the mgiTotalWeight variable displays the sum of weights for all items in the shopping basket.
  • mgiSBShippingPercentage - When using the Percentage shipping method, the mgiSBShippingPercentage variable displays the shipping percentage rate for the order.
  • mgiSBShippingCostPerItem - When using the TotalItems shipping method, the mgiSBShippingCostPerItem variable displays the per item shipping rate for the order.
  • mgiSBShippingCostSubtotal - The subtotal of the extended shipping costs (as defined by the shipping method) for all products in the shopping basket appears at the location of the mgiSBShippingCostSubtotal variable.
  • mgiSBTotal - The grand total, including the mgiSBPriceSubtotal and the mgiSBShippingCostSubtotal, appears at the location of the mgiSBTotal variable. In the shopping basket format file, the mgiSBTotal variable does not include tax information (tax information is added in the shopping basket display of mgiConfirmOrder).

Template File Variables: The template file specifies the structure of each item in the shopping basket (whether there are 2 items or 100). You may customize the display of records in the shopping basket by indicating a template file path in the "templateFileLocation" parameter and including any of the following variables in your template file. To include item variables in the template file, use the mgiGet tag with the following syntax:

<mgiGet name="VariableName">
  • mgiSBKeepRemoveRadioButtons - The mgiSBKeepRemoveRadioButtons variable displays two radio buttons labeled "Keep" and "Remove". Modifying the shopping basket with the "Remove" button selected will remove the product from the shopping basket.
  • mgiSBKeepRemoveCheckbox - The mgiSBKeepRemoveCheckbox variable displays a checkbox labeled "Remove". Modifying the shopping basket with the checkbox selected will remove the product from the shopping basket.
  • mgiSBKeepRemoveTrashcan - The mgiSBKeepRemoveTrashcan variable displays a trashcan image as a button. Clicking the trashcan image will remove the product from the shopping basket.
  • mgiSBKeepRemoveHyperlink - The mgiSBKeepRemoveHyperlink variable displays the word "Remove" as a link. Selecting the link will remove the product from the shopping basket.
  • mgiSBQuantity - The mgiSBQuantity variable displays the quantity of each product in the shopping basket.
  • mgiSBQuantityModify - The mgiSBQuantityModify variable displays the quantity of each product in the shopping basket as a modifiable quantity text field.
  • mgiSBProductID - The mgiSBProductID variable displays the unique productID for each product in the shopping basket.
  • mgiSBBriefDescription - The mgiSBBriefDescription variable displays the brief description and any values from mgiSBPopUp tags for each product in the shopping basket.
  • mgiSBPrice - The mgiSBPrice variable displays the single-product price of each product in the shopping basket.
  • mgiSBItemPriceTotal - The mgiSBItemPriceTotal variable displays the price multiplied by the quantity for each product in the shopping basket.
  • mgiSBShippingCost - When using the BasePlusPerItem shipping method, the mgiSBShippingCost variable displays the single-product shipping price of each product in the shopping basket.
  • mgiSBItemWeight - When using the Weight shipping method, the mgiSBItemWeight variable displays the weight of each product in the shopping basket.
  • mgiSBItemWeightTotal - When using the Weight shipping method, the mgiSBItemWeightTotal variable displays the weight multiplied by the quantity for each product in the shopping basket.
  • mgiSBItemShippingCostTotal - The mgiSBItemShippingCostTotal variable displays the shipping cost multiplied by the quantity for each product in the shopping basket.
  • mgiSBItemTotal - The mgiSBItemTotal variable displays the sum of the mgiSBItemPriceTotal and mgiSBItemShippingCostTotal for each product in the shopping basket.


Example Usage and Output

<mgiShoppingBasket>
</mgiShoppingBasket>

The default mgiShoppingBasket tag displays the contents of a shopping basket in the following format. The function of the Keep/Remove buttons is determined by the form tags surrounding the mgiShoppingBasket tag and an mgiButton.


Suggested Usage

  • Hard-Coded Shopping Baskets
  • Database-Driven Shopping Baskets


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]