Attribute Import and Export |
Copyright © 2000, William Weiland |
Overview Import attributes into your Merchant store directly from a flat file. |
|
Initial Setup and Usage 1) In admin, click Add Modules link (fig 2) 2) Click the file upload button 3) Browse to find the attrimpt.mvc file on your hard drive and upload (fig 3) 4) Click Add to add it to the domain 5) In admin, click Add Modules link (fig 2) 6) Click the file upload button 7) Browse to find the attrexpt.mvc file on your hard drive and upload (fig 3) 8) Click Add to add it to the domain 9) Import and Export modules automatically reside in each store within a domain so there is no need to update them to the store Export: Click on the plus to the left of the word Utilities under the store. Then click on the plus for Export Data. Then click on the link for Export Attributes and Options to Flat File. The prompt will ask for the flat file name. Only put the file name, no path. For example, attribex.dat Import: Click on the plus to the left of the word Utilities under the store. Then click on the plus for Import Data. Then click on the link for Attribute and Option Import from Flat File. The prompt will ask for the flat file name. Only put the file name, no path. Headstart |
|
Understanding the Flat File Format The data elements which comprise the attributes and options are pulled from the flat file in a specific order. Since there is no artificial intelligence involved in this flat file import, it is imperative that the data be placed in a flat file in the same order that the program expects it to be. Any variance from that is likely to result in corrupt data in your database. Creating the Flat File When importing, be sure that the last line of the flat file is a blank
line. Format the Flat File
All of the other fields will contain actual data, not the words you see
in the following four lines. These 4 lines represent the exact format.
If a data element is blank, you still need to account for it, eg. || In
all additions, there must be 13 fields for attributes and 11 fields for
options. Note: If your version of Merchant is older than PR7 you will
only need 12 fields in the attributes. The inventory field (13) can be
included but will be ignored in the older versions. With deletions, only 2
fields are needed.
As examples, consider the following 6 lines from a flat file:
1st - Adds a required, radio attribute with code "version" to product 1AA00004
The 4th field in the attribute lines is "type". There are five types of
attributes used by MIVA Merchant; radio, select, checkbox, text, memo.
The radio and select both require option lines. The checkbox, text and
memo do not use option lines. There is a sixth type, template, which is
not really a type. It is template. Be sure all types are entered as
lower case. You can import the template type IF 1) you have enabled
templates in your store, 2) you have already created the template in admin
and 3) if you include the template code (which IS CASE SENSITIVE) as the
10th field in the Attribute entry line. If you are using template, it will
override your other settings (eg prompt, price).
The 13th field in the attribute lines is "inventory". It is included in
Merchant version PR7 which is a January 2010 streaming update. If you
leave it blank, no change in the inventory setting will be made. If you enter a 0
then inventory will not be tracked at the attribute level for this product. This is the
normal setting. If you enter a 1, then that attribute is tracked for
inventory. That means that immediately after importing these settings
you will need to go to each of those products which were set to 1 and
update/add their actual inventory. If they are set to 1 and you do not have
any inventory included in those product records, the product cannot be ordered
as it will be considered out of stock.
If for some reason you want to delete attributes or options, you can
include the D action for a product.
This line would delete ALL of the attributes and options associated with
product code 1AA00006. Only two fields are used in deletions; D and the
product code, separated with a | delimiter. Let's say you want to remove
an option from your existing attribute for a product.
Example: I want to remove the 1X and modify the 2X and 3X. I would put
the following in the flat file.
If all you want to do is change data in the line, you do not need to
delete the group first. For example, if you want to change:
Note: Simple modifications without deletion first can be made as long as
you are NOT changing the attribute or option CODE. Changing the code
requires removal of the old code or you will end up with two sets of
attributes and options doing the same thing for a product.
Templates give you the ability to enter an attribute/option template which
can be used by many products. A change to the template makes that change
available to all products using it. When the customer views a product
record, the program checks to see if the attribute record type is a
template or not. If it is, it uses the global template for that code.
Consider the line from our previous example. I've added the template
code as the 10th field in the line and changed the type from radio to
template. As long as you have previously created a template with the
corresponding code through your admin interface, you can import the
template from a flat file and the product display will use the template.
You do not even need to include the lines for options in the flat file
because it will use the options previously setup in the template.
When you import, each product code is checked to see if the attribute codes
and option codes already exist with that product code. If they do, it
updates the store databases from the flat file. If they do not, it adds
them to the databases.
If you are importing many attributes, you may need to break your attrib.dat
flat file up into smaller files to prevent the MIVA Engine from timing out.
This is particularly true with Merchant 5.x as the SQL is slower than the
previous xbase files with adding records.
If you are having time-out problems with exporting, you may need to run
that using MIVAMia on your hard drive (where you have control of time-out
settings).
I highly recommend adding only a few attributes in the flat file until
you are sure you thoroughly understand the flat file format. Since an
attribute and option export module is supplied with this system, it would
be best if you export your existing attributes and options to a flat file
before you add any. Then you can study that file and add to it.
|
Fig 1: Main admin screen
Fig 2: Add a new module Fig 3: Upload the module to the server |