Scot's Scripts Miva Merchant Module Support

Scot's Scripts Miva Merchant Module Support

Support for our Miva Modules.
Find answers to your installation and usage questions.
This is the place to start if you have questions about our modules. Most of our Miva Modules are fully documented. Do not hesitate to contact us if you can't find the answer you're looking for!

Looking for something? Start typing here:

Scot's Blogger is used to created this support system.

Generic Uploads Quick Help

last updated

Upload Types

Use upload types to create different kinds of upload situations. One could be used for review images, another might be for tax documents, another upload type could be used for customer galleries or profiles. You can create an unlimited number of upload types.

Each upload type has it's own settings that include name, code, upload path, file extensions, maximum size, and more.

Uploading Files

Uploading files requires two Generic Uploads page items. One for the head and one for the spot on the page that will have the drop zone. 

CSS Page Item

Put the CSS page item in just above the closing </head> tag.

<mvt:item name="genericuploads" param="css()" />

DIV_TAG Page Item

The DIV_TAG page item describes how the uploaded file is organized and has several parameters. The DIV_TAG creates the drop zone for uploaded files and takes several parameters of it's own.

<mvt:item name="genericuploads" param="div_tag(upload_code,div_id,file_type,file_code,file_id,placeholder)" />

DIV_TAG Parameters

upload_code and div_id parameters are required. 

The other parameters are optional.

Use spaces for parameters you will not be using:

<mvt:item name="genericuploads" param="div_tag(upload_code,div_id, , , ,drop files here)" />
  • upload_code = the code for the upload type the file will be associated with
  • div_id = the ID tag to use for the drop zone DIV element (configurable so there is no issue with ID conflicts.)
  • file_type = one word file type
  • file_code = custom code, max 64 chars. Can use l.settings and g. style variable names.
  • file_id = NUMBER ONLY 
  • placeholder = text shown in upload box (do not use any commas)

FILE_TYPE: A string that is an overall idea of what the file upload is about, such as review_images.

FILE_CODE: Use this when attaching a file to a store item, such as a product. l.settings:product:code

FILE_ID: Use this to store a numerical ID, such as l.settings:product:id

Customer ID: The Customer id is automatically stored in the upload data.

Loading Files

The page item for loading files has several parameters.

<mvt:item name="genericuploads" param="load(id,DESC,LIMIT#,OFFSET#,upload_type,type_code,type_id#,cust_id#,status)" />

LOAD Page Item

<mvt:item name="genericuploads" param="load(sort_field,sort_dir,limit#,offset#,upload_type,file_code,file_id#,cust_id#,status)" />
  • sort_field = the order of the file array. Can be: id, cust_id, filename, type, type_id, type_code, status, created
  • sort_dir = the direction of the sort, either ASC or DESC
  • limit = numerical value of how many uploads to load
  • offset = numerical value of "where" to start loading (offset of 2 would mean that it skips limit*2 number of files.) Default is to start at the beginning of the list (normally this would be used unless you have a big gallery of uploaded images and need to paginate.)
  • upload_type = the code for one of your upload types
  • file_type = the file type you used in the DIV_TAG above
  • file_code = the (or one of) the file code you used in the DIV_TAG above
  • file_id = the file id you used above in the DIV_TAG
  • cust_id = numerical customer id. Use g.customer:id 
  • status = one of your status codes

Parameters in bold are required.

Use a space to leave a blank/unused parameter.

The file array will be available in l.settings:genericuploads:upload_type where the upload_type is the code you gave to your upload type. If your upload type is review_images the code below will load and then display them.

In the example below, the first 10 files will be loaded by ID and sorted descending from the review_images upload type. In reality this means the last 10 files will be loaded, the most recent 10 files. Loaded files will be associated with a customer id, the "valid" flag, and a product code.

<mvt:item name="genericuploads" param="load(id,DESC,10, ,review_images,l.settings:product:code, ,g.customer:id,valid)" />
<mvt:if expr="miva_array_elements(l.settings:genericuploads:review_images) GT 0">
    <mvt:foreach iterator="upload" array="genericuploads:review_images">
        <img src="&mvt:upload:filename;">

Files Structure

  • id = record id
  • cust_id = customer id
  • type = upload type code
  • type_id = optional custom numerical ID to associate the upload
  • filename = full path to uploaded file
  • created = time_t upload created time
  • create_formatted = formatted version of "created"
  • status = status code (from codes set in the upload type settings)
  • type_code = optional custom code to associated the upload
  • settings:thumbnails:small = if the upload is an image, this is the small thumb IF size is set in the upload settings
  • settings:thumbnails:medium = see above
  • settings:thumbnails:large = see above

Contact Scot's Scripts if you need more examples! We're happy to make them, but we need to know what you are looking for first.