|
|
||||
The products you'll be selling in your netShop are stored in a single file named "products". This file, located in your shopping cart directory, is a flat file database which stores the names and attributes for each of your products.
There are two ways that the data in this file can be formatted, transitional (basic) and preferred (advanced). This document covers the structure of both formats as well as the pros and cons of each.
The transitional (basic) version of the "products" file makes use of four attributes per product: Product ID, Product Name, Price and Tags. Of these, the only one who's purpose isn't immediately guessed is "Tags". This attribute is actually pretty flexible and can contain any information you wish. Each of the attributes available in this format is separated by a colon in the "products" file like so:
0125KF:Kung Fu Masters Vol. 125:2500:DVD,/images/kungfu-mastvol125.jpg
As you can see from the example above, this product has the following attributes:
As stated above, the Tags attribute can contain any information and, in this example, we've chosen to store two values here. The first is the media that this movie comes on, DVD. The next value is a partial URL to an image, which is presumably, the cover of this movie. By separating these values with a comma, we enable them to be called individually inside the cart. Calling these, and the other product attributes, is covered in the IC Tech. Ref. Document: netShop - III.The Catalog Pages. You can store up to 10 comma separated values in the Tags attribute.
| Pros | Cons |
|
|
Like the transitional (basic) product list, the preferred (advanced) version makes use of attributes to help you provide information on your products. However, instead of the 4 attributes that the transitional list limits you to, you're allowed an unlimited number of attributes with the preferred version.
To better understand the differences between the two formats, compare the following product, appearing in the preferred product list format, to the above example, which appears in the transitional list format.
netShop products version: 2.0 DVD-0125KF name=Kung Fu Masters Vol. 125 price=2500 fmt=DVD img=/images/kungfu-mastvol125.jpg
The first thing you'll notice is the line above the product attribute information. This line denotes this products file as using the preferred format. Without it, the netShop would not parse this file correctly.
The next point of note is that the attributes no longer appear on the same line. The product ID is now flush with the left margin with all of the other product attributes following on separate lines. In this example these attributes are tabbed away from the margin for easier reading but any amount of whitespace (1 space, 2 spaces, 1 tab, 2 tabs, etc.) will work.
The third difference is that each attribute is now named right in the "products" file. This gives you the ability to create as many attributes as you need. Having an attribute "fmt" might come in handy if you want to sort or categorize your products.
| Pros | Cons |
|
|
Related Items