The mgiBuyMe Tag

Tag Behavior

Use the mgiBuyMe tag to add a product to the shopping basket. The mgiBuyMe tag is used in conjunction with products hard-coded on a page or with products from a database.


Tag Syntax

The mgiBuyMe tag has one required parameter and 20 optional parameters. The tag form is:

<mgiBuyMe productID="Product ID" name="Product Name" 
description="Product Description" price="Product Price" 
shipping="Product Shipping Price" quantityMultiplier="integer" 
qualifierPostArgument1="Post Argument Name" 
qualifierPostArgument2="Post Argument Name" 
qualifierPostArgument3="Post Argument Name" 
qualifierPostArgument4="Post Argument Name" 
qualifierPostArgument5="Post Argument Name" 
productDB="Database Name" inventoryFieldName="Field Name" 
productIDFieldName="Field Name" weight="Product Weight"
priceRule="Price Rule Name" shippingRule="Shipping Rule Name" 
taxRule="Tax Rule Name" defaultValue="Integer" 
mode="Visible/Hidden/Checkbox" size="Integer">

Required Parameters:

  • productID - The product ID is the unique identification code of the product.

Optional Parameters:

  • name - The name is the short description or title of the product. In the automatic shopping basket configuration, the name appears as the product description in the shopping basket.
  • description - The description is the long description of the product.
  • price - The price is the price of the product. (see also priceRule parameter below).
  • shipping - The shipping is the shipping price of the product. (see also shippingRule parameter below).
  • quantityMultiplier - The quantityMultiplier is the integer to multiply by the quantity entered to get the actual quantity of products being purchased. The quantityMultiplier parameter is useful for products only sold in multiple quantities.
  • qualifierPostArgument1 - The qualifierPostArgument1 is the name of a form field (i.e., a post argument name for a text box, popup menu, etc.) that contains a qualifying characteristic of the product. For example, if you have a popup menu of product colors, enter the name of that popup menu as a qualifierPostArgument.
  • qualifierPostArgument2 - The qualifierPostArgument2 is the name of a form field that contains a qualifying characteristic of the product.
  • qualifierPostArgument3 - The qualifierPostArgument3 is the name of a form field that contains a qualifying characteristic of the product.
  • qualifierPostArgument4 - The qualifierPostArgument4 is the name of a form field that contains a qualifying characteristic of the product.
  • qualifierPostArgument5 - The qualifierPostArgument5 is the name of a form field that contains a qualifying characteristic of the product.
  • productDB - The productDB is the name of the database that contains the product information for inventory control.
  • inventoryFieldName - The inventoryFieldName is the name of the database field that contains inventory values.
  • productIDFieldName - The productIDFieldName is the name of the database field that contains the unique product identification codes for inventory control.
  • weight - The weight is the weight of the product. The weight may be a decimal number.
  • priceRule - The priceRule is the name of the price algorithm applied to the product. Price rules must have a scope of "item" to be applied in the mgiBuyMe tag. Price rules are defined in the administration interface of the mgiShoppingBasket tag.
  • shippingRule - The shippingRule is the name of the shipping algorithm applied to the product. Shipping rules must have a scope of "item" to be applied in the mgiBuyMe tag. Shipping rules are defined in the administration interface of the mgiShoppingBasket tag.
  • taxRule - The taxRule is the name of the tax algorithm applied to the product. Tax rules must have a scope of "item" to be applied in the mgiBuyMe tag. Tax rules are defined in the administration interface of the mgiShoppingBasket tag.
  • defaultValue - The defaultValue is the default quantity of products ordered.
  • mode - The mode determines the display of the quantity box (text field) created by the mgiBuyMe tag. If the mode parameter value is "Visible", then the mgiBuyMe tag displays a visible quantity box (text field) input. If the mode parameter value is "Hidden", then the mgiBuyMe tag creates a hidden quantity box (text field) input. Hidden quantities may still be added to a shopping basket. If the mode parameter is "Checkbox", then the mgiBuyMe tag displays a checkbox with a value equal to 1 unless the defaultValue parameter is present to override it. The default value is "Visible".
  • size - The size is the length of the quantity box (text field) that is created by the mgiBuyMe tag. The size of a quantity box determines the number of characters that can display. The default value is "3".


Example Usage and Output

Hard-Coded

<mgiToken>

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

<mgiBuyMe productID="0-395-75283-3" name="Smart Eating" 
description="Smart Eating, Choosing Wisely, Living Lean. 
By Covert Bailey and Ronda Gates" price="6.99" 
qualifierPostArgument1="Cover Type" 
defaultValue="1"> 

<select name="Cover Type">
<option value="">Choose One
<option>Hard-Cover
<option>Soft-Cover
</select>

<mgiButton name="Add Book to Basket">

</form>

</mgiToken>

In this example, the information in the parameters of the mgiBuyMe tag is hard-coded directly into the tag. This mgiBuyMe tag would display a quantity box with the default value of 1 displayed. When this product is added to the shopping basket, the productID, name, description, price, and cover type is stored for this product.

Database Results

<mgiToken>

<p>
<table width="500" cellspacing="0" cellpadding="3" border="1">
<tr bgcolor="#eeeeee">
  <th>ISBN</th>
  <th>Title/Description</th>
  <th>Price</th>
  <th>Quantity</th>
</tr>

<mgiSearchDatabase databaseName="Products"
keyFieldName="ProductName" fieldValue="*"
orderByField="ProductID" resultsPerPage="20">

<tr>
  <td>&mgiDBFieldProductID;</td>
  <td><b>&mgiDBFieldProductName;</b> 
<p>&mgiDBFieldProductDescription;</td>
  <td align="right">$&mgiDBFieldProductPrice;</td>
  <td align="center">
<mgiBuyMe productID="&mgiDBFieldProductID;" 
name="&mgiDBFieldProductName;" price="&mgiDBFieldProductPrice;">
</td>
</tr>

</mgiSearchDatabase>

<tr>
  <td colspan="4" align="right">
<mgiButton value="Add to Shopping Basket"></td>
</tr>
</table>

</mgiToken>

In this example, the information in the parameters of the mgiBuyMe tag is provided by placeholders in the results of a database search. This mgiBuyMe tag displays a quantity box. When this product is added to the shopping basket, the productID, name, description, and price is stored for this product.


Suggested Usage

  • Shopping Basket


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


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