Multiple Storefronts Off The Same Database
Posted 15 December 2009 - 10:54 AM
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 hrefs)?
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, html, head, etc.
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 and storefront-layout.ini. 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 directory (avactis-layouts), 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. Layout:
SiteURL = "http://www.oldstore.com/"
SitePath = "/var/www/vhosts/oldstore.com/httpdocs/"
TemplateDirectory = avactis-templates
$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 files, storefront-files and avactis-templates directories from /var/www/vhosts/oldstore.com/httpdocs/ to /var/www/vhosts/newstore.com/httpdocs/
I copy storefront-layout.ini to newstore-layout.ini
(it is done in oldstore.com/httpdocs/avactis-layouts/)
I edit newstore-layout.ini:
SiteURL = "http://www.newstore.com/"
SitePath = "/var/www/vhosts/newstore.com/httpdocs/"
I edit newstore.com/httpdocs/init.php:
$layout_file_path = 'newstore-layout.ini';
When your browser opens www.newstore.com, the first line of index.php includes init.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 oldstore.com.
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.
Posted 28 May 2010 - 08:27 AM
Posted 28 May 2010 - 09:37 AM
Posted 21 June 2010 - 07:37 PM
Posted 26 July 2010 - 11:23 AM
Posted 11 August 2010 - 04:44 PM
New Creation Designs
Website and Graphic Design Services
Posted 11 August 2010 - 06:43 PM
Posted 22 September 2010 - 05:52 PM
Posted 09 November 2010 - 01:28 AM
You can't use a single license for both stores because technically they are 2 separate installations, with 2 different databases.
The method described by David allows creation of different "faces" of the same installation - single database, product catalog, customer list. Equal prices.
So far, Avactis does not support customer groups with different pricing for each group, so your setup is not possible with a single installation of Avactis.
Please ask more questions and don't be afraid of their nature. It is always better to over-explain
Any update on this question of multistore functionality?
Here is our situation: We are looking to have multiple storefronts at different domains that offer different selections of products from the same database (e.g., one master store would have all products, but then there may be a separate domain (or subdirectory) that is specialized and only offers some of the products. As far as I can tell from the initial post in this thread, this should be possible, but I don't see any clear confirmation of this. I understand that each may need its own license, but I am not sure as they will share a database - can you clarify this?
Thanks for your input.
Posted 09 November 2010 - 10:33 AM
Posted 27 February 2012 - 12:13 PM
I have successfully created a multistore - a second front running off the same backend database - using Avactis 2.1.1
I copied the main root php files, and the themes folder. I had trouble with the page not loading... and I ended up copying a lot of the admin folder over, admin/modules, admin/core, admin/conf, created a new cache and backup folder under admin.. ajax_actions_maps... basically almost a reproduction of the avactis-system folder.
I copied and renamed the layouts.ini ... and edited the Store Path within that... as was suggested above.
I was still having trouble with the site not loading past a few lines - part of the header etc - and tried so much to fix - looking at the templates and so on.. I couldn't figure it out... until I simply deleted the new store's cache folder and then everything came online... so if you are having trouble setting up the store and you've tried everything, maybe just delete the contents of the cache folder - just in case...
Once the new store was up and running, I can see Storefront 1 and Storefront 2 buttons in Admin. On some pages I can see a few more doubled entries for the two layouts.
I cannot edit pages in Page Manager ... for that I had to load up admin from the other domain... and edit the layouts from that admin interface... I also had to be careful that I didn't edit our 'Welcome Text' on one, because it is global content.... I had to create a new set of content and menus for the new storefront... then work through all the pages in page manager (from admin in the new domain) and set the menus to the copied version... and set the content to the copied content.
Once that is done, there is no daily need to enter Admin from the new domain. You can alter the Products and Categories using the main admin interface and the content is pulled from one single database...
Another requirement I have was that users registering on the new website, were added into a new Customer Group.
This requires a modification at code level...
function addAccount($account, $password, $aff_id="", $group_id=2)
$tables = $this->getTables();
$customers_table = $tables['ca_customers']['columns'];
$query = new DB_Insert('ca_customers');
$query->addInsertValue(modApiFunc('MultiLang', 'getLanguage'), $customers_table['customer_lng']);
$query->addInsertValue(modApiFunc('MultiLang', 'getLanguage'), $customers_table['notification_lng']);
On one storefront I have set the default value of $group_id to 1 and on the other to 2... Ideally I could then add $group_id to the RegisterCustomer code... and then to the HTML_Form ... etc... and perhaps add it in as a hidden field to a template...
I have edited Product List on both stores to point to a SubCategory below Home. So products assigned to one store can be kept separate from Products in the second store. Visitors in either store could be directed to the other store and the purchases would all use the same Cart... my client packs all Products from the same location anyway... All Product Types can also be assigned to a specific Customer Group. Ideally I would like to remove 'Home' from the Breadcrumbs... but I've set the Home category to only show items in the Home category, which should prevent users from seeing products they shouldn't see.
So for now I appear to have two storefronts, running off the same backend product/category/user database.
I have yet to test making an order, and paying through WorldPay - because the callback for WorldPay will be sent to the primary domain... ? I presume the orders will all be managed from the primary admin interface still... Or does the callback that I send, take precedence over the callback set for the WorldPay installation...
If anyone has a difficulty setting it up, I'll try to give a clearer answer regarding how I achieved it.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users