Upgrading from Minivend 3 to Minivend 4

There were big changes from Minivend 3 to Minivend 4, some of which were incompatible.

Many things were removed as redundant, deprecated, or just plain crufty:

Nested [loop]s

MV3 used a different scheme for creating nested loop lists:

[loop with="-a"* arg="item item item" search="se=whatever"]

which allowed you to refer to the nested values with a [loop-code-a] construct. In Minivend 4, the form is:

    [loop prefix=size list="Small Medium Large"]
        [loop prefix=color list="Red White Blue"]
            [color-code]-[size-code]<BR>
        [/loop]
        <P>
    [/loop]

All frame features removed

Frames are now managed by the user in HTML.

Tags removed

buttonbar

Replace with Variable defined in catalog.cfg. buttonbar was previously used as an SSI-like command for catalog-wide standardized features like navigation bars. In the 3.x catalog.cfg the ButtonBars parameter defines a list of HTML snippets, like

ButtonBars header.html footer.html copyright.html

So [buttonbar 0] substitutes header.html, [buttonbar 1] substitutes footer.html, etc.

In 4.x catalog.cfg, define variables, like

Variable HEADER    <pages/header
Variable FOOTER    <pages/footer
Variable COPYRIGHT <pages/copyright

Then replace all occurrences of [buttonbar 0] with , [buttonbar 1] with , etc.

Note that the old header.html, footer.html, etc. contained HTML code, but were not actually html pages with <html><body> etc, tags. Thus the current practice is to use filenames with no extension or perhaps .txt to differentiate them from complete HTML pages.

random

Replace with [ad random=1] or custom code. See the [ad] tag docs. Random and rotate were used to place random or rotating regions on pages, such as banner ads.

The Random directive in catalog.cfg defines the numbered HTML snippet files, similar to buttonbars above.

rotate

Replace with [ad ...]. See [random] above.

help

No replacement. Use data functions or variables.

body

Replace with templates. Again the body tag [body 1] etc. defines numbered body definitions that could be applied site-wide. However, in this case minivend actually built up the <body ....> substitution using the Mv_* directives in catalog.cfg.

finish_order

[finish_order] was a conditional tag; if the basket contained anything a 'checkout' graphic would be displayed. No replacement; use [if items]Message[/if].

last_page

No replacement - this can be emulated by setting a scratch variable on one page, then using it to build the return URL.

item-link

No replacement, just use [page [item-code]].

loop-link

No replacement, just use [page [loop-code]].

sql-link

No replacement, just use [page [sql-code]].

accessories

Replace with normal data functions.

Compatibility routines

Compatibility routines for many popular tags like [random], [rotate], etc. are provided in the appendix of this document. To use one, copy it to a file and put it in your usertag directory. (Tags in the usertag directory are read in by interchange.cfg by default).

Directives removed

    ActionMap
    AdminDatabase
    AdminPage
    AsciiBackend
    BackendOrder
    ButtonBars
    CheckoutFrame
    CheckoutPage
    CollectData
    DataDir
    Delimiter
    DescriptionTrim
    FieldDelimiter
    FrameFlyPage
    FrameLinkDir
    FrameOrderPage
    FrameSearchPage
    ItemLinkDir
    ItemLinkValue
    MsqlDB
    MsqlProducts
    Mv_AlinkColor
    Mv_Background
    Mv_BgColor
    Mv_LinkColor
    Mv_TextColor
    Mv_VlinkColor
    NewReport
    NewTags
    OldShipping
    OrderFrame
    PageCache
    PriceDatabase
    Random
    ReceiptPage
    RecordDelimiter
    ReportIgnore
    Rotate
    SearchFrame
    SearchOverMsg
    SecureOrderMsg
    SpecialFile
    SubArgs
    Tracking

Minor operations removed

  • auto-substitution of mp= on [loop search=profile], [search-region arg=profile]

  • [tag scan]...

  • [tag sql]...

Many of these are related to one of:

  • Removal of frames logic

  • Removed tags

  • Obsolete methods

  • Old routines for 2.0x compatibility

Search lists

Search tags must now be surrounded by [search_region] tag. This is because multiple searches can be done in a page, with multiple [more-list] entries, multiple [no-match] areas, etc. It was not really possible to avoid this and add the feature.

To find all files containing the search list, do:

 find pages -type f | xargs grep -l '\[search.list'

That will yield a set of files that need to be updated. You should surround all parts of the search area, i.e.:

    [search-region]

  [search-list]
    your search iteration stuff, [item-code], etc.
  [/search-list]

  [more-list]
    [more]
  [/more-list]

  [/search-region]

Search conditionals

Search conditionals should now say [if-item-field field] [/if-item-field] and [if-item-data table column] [/if-item-data]. This allows mixing and nesting of lists. You may find that the old works in some situations, but it will not work in all situations.

Form data updates

Added Scratch variable mv_data_enable to gate the update_data function. You must set it before doing a form update. Prior to this it was possible to update a SQL database willy-nilly.

A quick fix like this will allow the update on a single page:

  [set update_database]
  [set mv_data_enable]1[/set]
  [/set]
  <INPUT TYPE=hidden NAME=mv_click VALUE=update_database>

It will ensure at least that the user loads one form from you for each update. For best security, gate with a userdb entry like this:

  [set update_database]
  [if type=data term="userdb::trusted::[data session username]"]
      [set mv_data_enable]1[/set]
  [else]
      [set mv_data_enable]0[/set]
  [/else]
  [/if]
  [/set]

Checkout changes

Minivend 4 uses in-page error-flagging on the checkout page. Simplest way to convert is probably to use the checkout.html from the simple demo as a start, and move in any customization from the existing site's catalog.html (headers, footers, logos, etc.) A line-by-line comparison of the data fields in the checkout page should be performed, adding any custom fields as needed. Custom error checking in etc/order.profiles may have to be re-worked, or can be added into checkout.html using the in-page order profile capability. (Note that etc/order.profiles is called etc/profiles.order in newly-built Interchange catalogs.)

Remember to update receipt.html and report/report.html with any custom fields, as well.

[if-field] etc.

The least-compatible things in the tag area are [if-field] (needs to be [if-PREFIX-field], where prefix might be item|loop by default depending on the tag. Likewise:

  [if-data table col]  --> [if-PREFIX-data table col]
  [on-change mark]     --> [PREFIX-change mark]
  [if-param param]     --> [if-PREFIX-param param]
  [PREFIX-param N]     --> [PREFIX-pos N] (where N is a digit)

[search-list]

You must always surround search-list with [search_region].

Embedded Perl changes quite a bit. While there are the $Safe{values} and other variable settings, they are automatically shared (no arg="values") and move to:

  $Safe{values}   -->  $Values
  $Safe{cgi}      -->  $CGI
  $Safe{carts}    -->  $Carts
  $Safe{items}    -->  $Items
  $Safe{config}   -->  $Config
  $Safe{scratch}  -->  $Scratch

There are a number of other objects, see the docs.

Most other issues have more to do with the catalog skeleton (i.e. simple or barry or basic or art) than they do the core. For instance, the "basic" catalog produced for MV3 ran unchanged except for the issues discussed above.

Global subs

Accessing globalsubs from [perl] tags is done slightly differently.

Minivend 3 method:

[perl sub]
  myfunsub();
[/perl]

Minivend 4/Interchange method:

[perl subs=1]
  myfunsub();
[/perl]

If you do this wrong, you'll get an error that looks like this:

 115.202.115.237 H8gbq6oK:115.202.115.237 - \
  [28/February/2001:18:58:50 -0500] testcat /cgi-bin/testcat.cgi \
  Safe: Undefined subroutine &MVSAFE::myfunsub called at (eval 283) line 2.

DocBook! Interchange!