Today I want to dive into Miva Merchants file structure. Specifically, the structure of the file folders on the server. As we saw when we were working with the file rewrite functions, there are two different folders. There is a scripts folder. Each folder has a completely different use. The scripps folder is just your web root. It’s usually called httpdocs. This is where all your public files are going to go. It’s where you’re going to upload your html, your css, your javascript. It’s also where Miva files live that make Miva Merchant work and are public and accessible.
Now the data is the complete opposite. The data is a secure private directory that is located outside the web root, so it’s not accessible via the web. The only way you can get to it is through the control panel or ftp. The data is usally located in a folder called “Private” and then “mivadata.” So anytime you hear someone talk about mivadata, well, they are really just referring to Miva’s private data folder. In a minute we’ll take a look at what type of files are located in this folder.
The last folder to be aware of is the mm5 f older. Now you may have seen this from the url structure. domain.com/mm5/merchant.mvc. We’ve already talked about what merchant.mvc does, it’s Miva’s controller. The mm5 folder is a global folder that holds all the Miva Merchant files. This is in the web root so it’s completely public and it contains all the files needed for Miva Merchant to run; merchant to mvc, admin to mvc, and a lot of other ones. Now, this folder doesn’t have to be called mm5, but it is by default. You may see folders called merchant2, which is the Miva Merchant 4 version of this directory. Some people even rename this to “store” or something custom specific to them. You can even remove it altogether. In the Miva Merchant Admin under domain settings there’s a place to specify this folder. So if you ever do rename it t something else, as long as you update the savings in Miva Merchant everything will work just as you expect. Let’s jump over to ftp and take a look at these folders in more detail.
So here I am logged into my server via ftp. On the left hand side is my local computer. On the right hand side are the files and folders for my remote server. So here the first one we look at is httpdocs. This is the web root. Now your web root might have other files and folders in here and that’s ok. I wanted to show you a bare bones version so you can see what the core files are. Here I have an index.html which is just an index page, a sample htaccess file, and then mm5. Here is that file that folder that has all of the Miva Merchant files and assets. Everything that Miva Merchant needs to run is located within this folder. When I open it you’ll see here’s a file called merchant.mvc. It also has admin.mvc. This is how you login to your Miva Merchant Admin. It has a few files for checkout for Amazon, client side controls all the javascript in the Miva Merchant Admin, it also has a few things for PayPal and PayPal Express Checkout. So these are the core files that make Miva Merchant run.
The graphics folder is the default folder for all of Miva Merchant’s product images. Because you can have multiple stores within a single Miva Merchant installation, every store gets a folder with seven zeroes and then a one, two, three, four, etc. So this just means we’re working with the first store. Now, inside this folder will be the images for every single product within the store. Anytime you upload an image in the admin for a product, it automatically gets put here. Because the image machine resizes the images automatically, you’ll see some of these have dimensions added to the end of them. So here’s the original image and here’s some resized images. Let me jump back out of a couple folders here.
Frameworks contains any frameworks you have within the store and again, you’ll see the seven zeroes and a one folder. This folder structure is used throughout Miva Merchant. It has a couple frameworks, a couple pkg files that we have in our store.
I’m going to skip over our fonts folder. This just has some of our fonts in it.
The CSS folder is Miva’s default css folder. Again, you go into it and you will see the 00000001 folder inside and then cssui.css file which is Miva’s default style sheet and there’s a separate one for the mini basket css.
Now, if you’ve built in a Miva Merchant store, you can choose to put your css in here if you like. If you upload the css file to Miva Merchant’s Admin, which it allows you to do, it will automatically show up in this folder. However, there’s nothing wrong with putting the css in this root folder here or sometimes outside the mm5 folder. We’ll create a css folder here and use that. It’s kind of a personal preference so where you want to put it, it doesn’t matter to Miva one way or another.
Here, this 5.00 folder, this is the core where all of Miva’s files live. Now, we’re not going to go into all of them and 99% of the time you won’t need to go into this folder. Really the main thing I want to point out is this module folder. So if I go into this I want you to see that there are different types of modules. Fulfillment modules, import modules, system extension modules, utility modules, they are each grouped within their own folder. If I click on one of these folders you’ll see all of the modules that are utility modules. These are where the modules live that are part of the core software and also third party modules. If you install a third party module that’s a utility module, it will automatically get uploaded here. If that module then has an item associated with it, well that item is going to point back to this module located here. You normally won’t ever need to go into this folder. But it’s important to know where these modules live on the server.
So I’m going to jump back to the root of my directory structure outside the httpdocs folder we were just in. Inside this “private” folder here you’ll see a folder called “mivadata.” Now, this is the typical set up, “private/mivadata.” However, it doesn’t have to be that way. It all depends on your server configuration. However, most the time this is what you should see inside your private folder there should be a folder called mivadata. This is Miva’s data folder. This is outside the web root so it’s not publically accessible. The only way you can get to it is through the control panel or ftp. If I open the mivadata folder, you’ll see it has a few files, some logging files, xml files, but this one here, this merchdb.dat, this is an important file. This contains Miva Merchants database connection string. So it stores the database name, the database username and then an encrypted database password to allow Miva to connect to a database. Now, you shouldn’t ever change this file manually unless you really know what you’re doing. However, it’s important to know that this is where it lives. Now you see a file here from Merchant5 and then you have this s01. So this is store01. So, in the mm5 folder every store specific folder is named with 00000001. In the mivadata folder, it’s just s01. If I had multiple stores it would be s02, s03, etc. Now if I drill into here there’s an export folder. This is Miva Merchant’s default folder when you export files. Say you exported all the products in the store, you have the option to email it to yourself, which most people typically do. However the actual file gets written here, if for example it is too big to email. You need to ftp to the server, navigate to this folder and pull it down manually. Imports get created here as well. I don’t have any imports here currently, but if I imported products via a spreadsheet, an import folder would be created and that file would live there.
That’s really the core of what there is to know about Miva Merchants file structure. A key take away is that there’s two distinct folders; one for data and one for scripts. The scripts folder is the web root and that’s completely web accessible. That contains all the Miva Merchant files and folders that Miva Merchant needs to run. Then, there’s the Miva data folder which has all the private data, all the non web accessible data, things like imports and exports, database connection strings, private keys, etc. It’s important to know and understand the difference between these two folders and the rolls they play within the Miva Merchant architecture.