For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

How to set up an on-the-fly item

If you set the OnFly local configuration directive to the name of a Sub or UserTag, then Interchange will be able to add items to the cart that are not in the DefaultTables table(s).

Interchange supplies an internal "onfly" subroutine, which will work according to the examples given below.

If you have the following your local (catalog.cfg) configuration: 

OnFly  onfly

then a basic link can be generated like this:

<a href="[area form=|
    mv_todo=refresh
    mv_order_item=000101
    mv_order_fly=description=An on-the-fly item|price=100.01
|]"
>
Order item 000101</a>

The mv_order_fly form parameter value can contain any number of fields, separated by a pipe (|) character, which will set corresponding parameters in the item attributes.  The field(s) are expected to contain name=value pairs, and will be URI encoded by the [area] tag, in the example above.  You can use this to set parameters such as the size and colour of your on-the-fly item.

The special mv_price attribute can be used in conjunction with the "$" CommonAdjust atom to set the price for checkout and display.

The [item-description] sub-tag, when used with an [item-list] tag, will use the item's description" attribute to display the product description in the cart.  Note that [item-field description] and [item-data products description] will NOT work, as both of these sub-tags reference an actual column value for a row in the "products" table, and this is obviously not appropriate for on-the-fly items.  Similarly, an attempt to generate a flypage for an on-the-fly item ([area 000101], for example) will fail, resulting in the display of the "missing" SpecialPage.

If you want to set up a UserTag to process on-the-fly items, it should accept a call like this:

your_usertag(mv_item_code, mv_item_quantity, mv_order_fly)

The "mv_item_code" and "mv_order_fly" parameters are required to trigger Interchange's add_item routine, along with mv_todo=refresh to set the action.

The item will always act as if SeparateItems, or mv_separate_items, is set.

Multiple items can be ordered at once by stacking the variables.  If there is only one mv_order_item instance, however, you can stack the "mv_order_fly" variable so that all are concatenated together as using "|" symbols.  The above example could be done as:

[area form="
    mv_todo=refresh
    mv_order_item=000101
    mv_order_fly=description=An on-the-fly item
    mv_order_fly=price=100.00
"]

Multiple items would need multiple instances of mv_order_item, with a corresponding "mv_order_fly" for each mv_order_item.  You can order both "000101" and "000101" as follows:

[area form="
    mv_todo=refresh

    mv_order_item=000101
    mv_order_fly=description=An on-the-fly item|price=100.00

    mv_order_item=000102
    mv_order_fly=description=Another on-the-fly item|price=200.00
"]

The following two forms correspond to the above two examples, in order, with the slight refinement of adding a quantity:

<form action="[area process]" method=POST>
    <input type=hidden name=mv_todo value="refresh">
    <input type=hidden name=mv_order_item value="000101">
    Qty: <input size=2 name=mv_order_quantity value="1"><br>
    <input type=hidden name=mv_order_fly value="description=An on-the-fly item|price=100.00">
    <input type=submit value="Order button">
</form>

<form action="[area process]" method=POST>
    <input type=hidden name=mv_todo value="refresh">
    <input type=hidden name=mv_order_item value="000101">
    Qty: <input size=2 name=mv_order_quantity value="1"><br>
    <input type=hidden name=mv_order_fly value="description=An on-the-fly item|price=100.00">
    <input type=hidden name=mv_order_item value="000102">
    Qty: <Input size=2 name=mv_order_quantity value="1"><br>
    <input type=hidden name=mv_order_fly value="description=Another on-the-fly item|price=200.00">
    <input type=submit value="Order two different with a button">
</form>

Category:  Tutorials
Last modified by: Kevin Walsh
Modification date: Thursday 28 June 2007 at 5:27 PM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us