Hello dear webmasters! This may be a somewhat hidden feature (and it's not in much use) but Avactis actually does support multiple storefronts. In this post I'll do my best to show you how it works.
First off, here's the process of a store page generation:
When your browser opens one of Avactis store pages, the first thing that's happening is that your web server includes (reads and executes) init.php
. That's of course because <?include("init.php")?>
is (and should be) the first line of every Avactis storefront file.
Now, if you look into init.php
, you will see that it does just two things:
1. Sets the name of the layout file that will be used during generation of this page;
2. Includes (loads and executes) avactis-system/store.php
which starts system initialization.
Then the system initializes itself. It reads configuration files, cookies (if any), connects to the database, reads settings, all the necessary data, creates core system objects, looks for available modules, and stuff like that.
Somewhere in the middle of this process it reads the specified layout file. From the settings in this file, the system learns where it should look for all the necessary files and folders: templates, categories, product pages, cart, checkout pages, customer login/password/orders pages, etc. This information is used throughout the whole system to answer 2 main questions:
a. Where to read templates to generate storefront blocks from?
b. Which pages link to from the storefront (what to put in the href
It's also used to generate .htaccess rewrite rules for SEO URLs feature.
Then the system processes all necessary actions. For example, if you added a product to cart, the system actually updates the cart, sets variables in user session, decreases the product's stock level, adds data to reports, etc.
Note that all this stuff takes place at the very first line of the page: <?include("init.php")?>
When all the necessary work is done, PHP continues processing the page after init.php
. Most often it starts to output page header: DOCTYPE
Then it encounters an Avactis tag like <?Breadcrumb()?>
. So what does it do? Not much: just calls the function Breadcrumb
. This function already exists in memory, because it has been created somewhere in the process of system initialization. This function reads various variables to determine what is the current path, reads its templates from avactis-templates/catalog/breadcrumb/default/
, composes the corresponding HTML code, and outputs it. Of course it generates its links according to layout file settings.
That's basically it.
So, the whole process is ruled by two files: init.php
. They determine what is used and what is not.
To create a new storefront for the same product catalog (database), you need to do the following:
* Make a copy of the old storefront and template directory in a different location;
* Make a copy of the old storefront-layout.ini
file in the same
), under a new name;
* Edit it to specify the correct location of the new storefront files and templates;
* Edit init.php
in the new storefront to specify the new layout file name.
We have a storefront at www.oldstore.com
SiteURL = "http://www.oldstore.com/"
SitePath = "/var/www/vhosts/oldstore.com/httpdocs/"
TemplateDirectory = avactis-templatesinit.php
$layout_file_path = 'storefront-layout.ini';
I want to make a new store at www.newstore.com
with a different design.
I create a new domain newstore.com
I copy all .php
directories from /var/www/vhosts/oldstore.com/httpdocs/ to /var/www/vhosts/new
I copy storefront-layout.ini to newstore
(it is done in old
I edit newstore
SiteURL = "http://www.new
SitePath = "/var/www/vhosts/new
I edit new
$layout_file_path = 'newstore-layout.ini';
When your browser opens www.newstore.com
, the first line of index.php
, which sets layout to newstore-layout.ini
, which sets templates and other files to newstore.com
, and uses the system from oldstore.com
You should always access Admin Area from old
You may also rename avactis-templates
to just templates
and reflect this change in layout.ini
. Or rename any file listed there as well.
Having several .ini files in avactis-layouts
will make your admin area display several "Storefront
" links and several sections of settings (for each storefront) in several places.I would like to emphasize: this feature is experimental and you may encounter bugs. Please don't hesitate to contact us to resolve any.