Static Catalog Generator (StatCat)
Copyright © 2000, William Weiland
Overview
The StatCat module is both an admin module and a basket interface module. The primary purpose of StatCat is to generate static catalog pages (indexes and sub-pages) directly from your Miva Merchant products and category databases so that search engines will add your pages to their index. Presumably this will allow customers to find your store amongst the millions of web sites on the Internet. As such, the pages generated are basic html pages with links to sub-pages, basket page and individual product pages in your Miva Merchant system. Each page contains your store title, meta description, and meta keywords along with the products.
Initial Setup
Use the Merchant admin upload feature to upload the statcat.mv(c) module. Once uploaded, click the Add button to add it to the mall/domain.

In admin, under your store, click on the link for Utilities Configuration Screen. Assign the module and Update it to install it in your store.

After you have installed the module, a new folder will be found in your script directory called 00000001/catalog/. If your store is #2, that will be 00000002/catalog/ instead. Likewise, for other store numbers. You will need to FTP upload a graphic called add2cart.gif to the new directory. You can use your own add2cart.gif graphic or use the one on my site. For variety, you'll probably want to use your own.

Click the link for Static Catalog Generator to enter the configuration settings.

The compiled version of this module licensed on or after November 7, 2003 has a new file called cim_new.mvc which you need to install. Install through admin as a store system extension module.


Configuration Settings
Enter data into the applicable input fields.

Site Title
Enter your web site name.

Store URL
Enter the full URL to your merchant.mv file.

Title Image URL
If your store has an image logo, you'll probably use that here.

Title Background and Text Color
This will be the color of your top nav bar which contains the store title or image.

Meta Description and Keywords
When the pages are generated, this text will appear in the head of all of the pages.

Add to Basket, then go to
Choose where you want customers to be redirected to when they add products to their basket from the static pages.

Price on static pages
You can optionally leave off the price from the pages. If you are using price groups in your store, you will probably hide the prices on these static pages since static pages have no way to determine customer status in real time.

Storefront Page
You can create a store front in html just as you did in the welcome screen within Merchant.

Storefront Footer
Your pages can have a footer if you enter text into this block.

Category Column
Enter the color, size and font characteristics for the category column.

Product Column
Enter the color, size and font characteristics for the product column.


Editing Option (skip if using the OpenUI)
Note: You do not need to edit the mmui.mv if you are not using the return to static pages option after adding a product to the basket. Most people do not use that option as they want customers to stay within Miva Merchant once they have added a product to the basket.
If you are using the Miva Merchant User Interface (mmui) you will need to make some very simple edits to the core files. Be sure to do that with a text editor (NO WYSIWYG editors) such as Programmer's File Editor (PFE) so as not to damage the mv files. ALWAYS BACKUP your unmodified mv files in case you make a mistake.

1) Skip this paragraph if using compiled Merchant and you licensed this module after Nov 7, 2003. In the mmui.mv file, function UIModule_Dispatch, include the following code. Put this code in the latter half of the function, not near the beginning of the UIModule_Dispatch function.
<MvIF EXPR = "{ g.Screen EQ 'SCRX' }">
<MvIF EXPR = "{g.CatReturn}">
<MvASSIGN NAME = "l.filedirectory" VALUE = "{ g.Module_Root $ padl( Stores.d.id, 8, '0' ) $ '/catalog/' }">
<MvASSIGN NAME = "l.newtarget" VALUE = "{l.filedirectory $ g.CatReturn $ '.html'}">
<MvIF EXPR = "{sexists(l.newtarget)}">
<MvIF EXPR = "{len(g.im_error_code) OR len(g.im_error_message)}">
<TABLE border="1" cellspacing="3" cellpadding="3" bgcolor="#d3d3d3">
<TR><TD><FONT color="#000000">
<B>Non-Fatal Error</B><BR>
Error code:</FONT> <FONT color="#ff0000"><MvEVAL EXPR = "{g.im_error_code}"></FONT>
<BR><FONT color="#000000">Error description:</FONT> <FONT color="#ff0000"><MvEVAL EXPR = "{g.im_error_message}"></FONT>
</TD></TR>
</TABLE>
<BR>
<A HREF = "&[l.newtarget:entities];">Return</A>
<MvELSE>
<MvIF EXPR = "{(g.Merchant_Version GE 4.00) AND ('4.' IN Domain.d.base_url EQ 0)}">
<MvASSIGN NAME = "l.newurlbase" VALUE = "{Domain.d.base_url $ g.Merchant_Version $ '/' $ padl( Stores.d.id, 8, '0' ) $ '/catalog/'}">
<MvELSE>
<MvASSIGN NAME = "l.newurlbase" VALUE = "{Domain.d.base_url $ padl( Stores.d.id, 8, '0' ) $ '/catalog/'}">
</MvIF>
<BASE HREF = "&[l.newurlbase:entities];">
<MvDO FILE = "{l.newtarget}">
<MvEXIT>
</MvIF>
<MvELSE>
<MvASSIGN NAME = "l.ok" VALUE = "{ MMUI_BasketContents() }">
</MvIF>
<MvELSE>
<MvASSIGN NAME = "l.ok" VALUE = "{ MMUI_BasketContents() }">
</MvIF>
</MvIF>

2) You'll need to add the following line in the mmui.mv file, UIModule_Product_Attributes function just below the hidden input for quantity.

If using uncompiled Merchant or you licensed this module before Nov 7, 2003. <MvIF EXPR = "{ g.Screen EQ 'SCRX' }">
<INPUT TYPE = "hidden" NAME="CatReturn" VALUE="&[g.CatReturn:entities];">
</MvIF>


If using compiled Merchant and you licensed this module after Nov 7, 2003. <MvIF EXPR = "{ g.SubScreen EQ 'SCRX' }">
<INPUT TYPE = "hidden" NAME="CatReturn" VALUE="{encodeentities(g.CatReturn)}">
</MvIF>


Usage
Click on the triangle to the left of Store Utilities. Then click the link Static Catalog Generator to run the page generator. Once the static html pages are created, there will be a c-index.html (for category sorted) and an a-index.html (for alphabetical sorted) catalogs. Either or both of those should be linked from your top level page, e.g. your index.html in your root directory or a site map page. You should not make that an invisible link, as search engines will pick up on that. The words or image you use as the links are up to you.
Image URLs
Thumbnail image links are developed from the location specified in your products database. The link in the database can either be the full URL or a virtual URL BELOW the Merchant2 directory. If virtual, StatCat will build the full URL from virtual URLs by combining the store base directory with the virtual path in the products database. This full URL will then allow you to place the StatCat generated pages on any server and the images will still be available.
Distributing Static Pages
Distributing the pages to other servers. You can copy the pages in your catalog directory to another server(s). By doing this you increase your chance of search engines indexing your store. One thing to keep in mind if you do the remote server distribution: if you select the option to return to the static catalog after placing an item in the basket, Merchant will only be able to return to a static catalog on the same server as itself. So if you want the customer to shop on static pages, ensure you leave the static pages generated by StatCat in the catalog directory on your Merchant server. If you don't, Merchant will realize the static pages are not local and will default back to the Merchant.mv store pages. As long as you leave the original static pages on the local Merchant server, you can duplicate the catalog on as many remote servers as you have access to.
Caution
While it is possible that you can edit the code in this module to get a slightly different layout, eg. in the individual product pages, you must exercise extreme caution. You should be an experienced Mivascript coder and ALWAYS keep a backup of the original file.

If you are using Merchant 4.0 and its Inventory Management system that deducts products from inventory when they are placed in the basket, you should select to NOT use the Add to Basket buttons if you have one-of-a-kind items. The reason for this is that some robots and other indexing software may even follow links which contain the ? and & characters. This could result in the stock level decrementing to zero and out-of-stock emails being sent. The products won't be removed from inventory completely, as they will be re-stocked when you run the Admin:Delete Expired Shopping Baskets. This undesirable situation does not exist in Merchant versions 2.x or 3.x. It is also not a problem in Merchant 4.x if your store does not use the Miva Corp Inventory Management or your product stock levels are not likely to be depleted with one or two passes of the indexing program.


Upgrade Note
If you are upgrading from a previous version of this module to the compiled version, this paragraph may apply to you. The compiled version of this module licensed on or after November 7, 2003 has a new link for posting to the add to basket. Therefore, after upgrading the module, you should re-run the static catalog pages. You will also be installing a new file called cim_new.mvc.
.htaccess re-write
If you have the compiled version of Static Catalog Generator distributed after April 11, 2004, you can create directory style links from the static pages back to your merchant.mvc. There is an onscreen (in admin) example of the .htaccess file. However, you will need to work with your web host for creating the actual file for your store. We do not provide support or further instructions on how to write the file and install it on your server.