The mgiShoppingBasket Tag

Tag Behavior

Use the mgiShoppingBasket tag to display the contents of a visitor's shopping basket and define shopping basket configurations.


Tag Syntax

The mgiShoppingBasket tag has a beginning tag with one required parameter and six optional parameters, a body, and an ending tag. The tag form is:

<mgiShoppingBasket handle="Configuration Name" 
mode="Mode" priceRule="Price Rule Name" 
shippingRule="Shipping Rule Name"
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">
Custom Shopping Basket Product Template
</mgiShoppingBasket>

Required Parameters:

  • handle - The handle is the name of the shopping basket configuration to use. Shopping basket configurations are defined using the admin mode of the mgiShoppingBasket tag. When using admin mode, the handle parameter is not required.

Optional Parameters:

  • mode - The mode is the function of the mgiShoppingBasket tag. In "admin" mode, the shopping basket creates a web-based interface that allows you to configure multiple shopping baskets with options for tracking, customer information, price rules, shipping rules, tax rules, inventory and order processing. When using admin mode, the handle parameter is not required.
  • priceRule - The priceRule is the name of the price algorithm to apply to products in the shopping basket. Price rules included in the mgiShoppingBasket tag must have a scope of "basket" in order to be applied to all products in the shopping basket. Price rules are defined in the admin mode of the mgiShoppingBasket tag.
  • shippingRule - The shippingRule rule is the name of the shipping algorithm to apply to products in the shopping basket. Shipping rules included in the mgiShoppingBasket tag must have a scope of "basket" in order to be applied to all products that are purchased.
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, shopping basket information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.


Technical Notes

  • Custom Shopping Basket Display - The body of the mgiShoppingBasket tag contains a template display that is repeated for each product in the shopping basket. If the body of the mgiShoppingBasket tag is left empty, the default template will be used. To create a custom shopping basket display, use HTML, MGI, text , and the following placeholders in the body of the mgiShoppingBasket tag. The placeholders will be replaced with each product's specific information.
    • &mgiDBFieldQuantity; is the quantity of the product.
    • &mgiDBFieldQuantityMultiplier; is the quantity multiplier of the product.
    • &mgiDBFieldProductID; is the product ID.
    • &mgiDBFieldName; is the product name (short description).
    • &mgiDBFieldDescription; is the product description
    • &mgiDBFieldPrice; is the product price.
    • &mgiDBFieldShipping; is the product shipping cost.
    • &mgiDBFieldQualifier1; is the first product qualifier.
    • &mgiDBFieldQualifier2; is the second product qualifier.
    • &mgiDBFieldQualifier3; is the third product qualifier.
    • &mgiDBFieldQualifier4; is the fourth product qualifier.
    • &mgiDBFieldQualifier5; is the fifth product qualifier.
    • &mgiDBFieldWeight; is the product weight.
    • &mgiSBDeleteTrashcan; is a clickable trashcan icon that removes the product from the shopping basket.
    • &mgiSBDeleteRadioButtons; is a set of Keep/Remove radio buttons that allows the product to be removed from the shopping basket.
    • &mgiSBModifiableQuantity; is a text input containing the quantity purchased for the product. This value can be modified.
    • &mgiSBItemPriceTotal; is the price of a product multiplied by the quantity purchased and includes any price rules that have been applied.
  • Variables - The mgiShoppingBasket tag sets the following page variables. The value of these page variables can be displayed anywhere on the page after the mgiShoppingBasket tag by using an mgiGet tag.
    • mgiSBShippingTotal is the shipping price of the order after all shipping rules have been applied.
    • mgiSBTotal is the total price of the order after all price rules have been applied.
  • Price, Shipping and Tax Rules - Price, shipping and tax rules can be configured in the admin mode of mgiShoppingBasket.
    • Shopping basket rules are shared across all shopping basket handles within a region.
    • Only "basket" type rules may be applied in the mgiShoppingBasket tag. Apply "item" type rules in the mgiBuyMe tag.


Example Usage and Output

Default Shopping Basket

<mgiToken>

<form action="shoppingbasket.mgi" method="post">

<mgiShoppingBasket handle="Books">
</mgiShoppingBasket>

<mgiButton name="Modify Products">

</form>

<a href="checkout.mgi">Checkout Now</a>

</mgiToken>

In this example, the mgiShoppingBasket tag will display the contents of the shopping basket based on the "Books" configuration using the default shopping basket display. The default shopping basket displays a trashcan icon to delete items, a modifiable quantity field, the product ID, product name, product price, extended product price, shipping total and total (does not include tax which is added in the mgiConfirmOrder tag).

Custom Shopping Basket

<form action="shoppingbasket.mgi" method="post">

<p><table cellpadding="5" cellspacing="1" border="0">
<tr bgcolor="#EEEECC">
<td align="center"><font size="-1" 
face="helvetica, arial, sans-serif">
<b>Remove</b></font></td>
<td><font size="-1" face="helvetica, arial, sans-serif">
<b>Qty</b></font></td>
<td><font size="-1" face="helvetica, arial, sans-serif">
<b>Description</b></font></td>
<td><font size="-1" face="helvetica, arial, sans-serif">
<b>Price</b></font></td>
</tr>

<mgiShoppingBasket handle="Default">

<tr>
<td align="center">&mgiSBDeleteTrashcan;</td>
<td>&mgiSBModifiableQuantity;</td>
<td><font size="-1" face="helvetica, arial, sans-serif">
&mgiDBFieldName;</font></td>
<td align="center">
<font size="-1" face="helvetica, arial, sans-serif">
$&mgiSBItemPriceTotal;</font></td>
</tr>

</mgiShoppingBasket>

<tr bgcolor="#EEEECC">
<td colspan="2"><font size="-2" 
face="helvetica, arial, sans-serif">
Tax and Shipping will be calculated during Checkout.
</font></td>
<td><font size="-1" face="helvetica, arial, sans-serif">
<b>Subtotal</b></font></td>
<td><font size="-1" face="helvetica, arial, sans-serif">
<b>$<mgiGet name="mgiSBTotal"></b></font></td>
</tr>
</table>

If the default shopping basket does not fit with your site design, you may customize the shopping basket layout and the content of the shopping basket using the mgiShoppingBasket placeholders and variables. With a custom layout you can add font properties, cell colors, images, etc.

In a custom shopping basket, the code in the body of the mgiShoppingBasket tags is repeated for each item in the shopping basket and the placeholders are replaced with the item's specific information. After the mgiShoppingBasket tags, the shopping basket variables display information calculated from the current shopping basket contents. The custom shopping basket in this example displays this format:

Admin Mode

<mgiShoppingBasket mode="admin">
</mgiShoppingBasket>

In this example, the mgiShoppingBasket tag will display the admin interface.

In the admin mode of mgiShoppingBasket you create shopping basket configurations (handles) with options for customer checkout information, price rules, shipping rules, tax rules, inventory, and order processing.


Suggested Usage

  • Shopping Basket


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]