Results 1 to 10 of 2237

Threaded View

  1. #11
    Join Date
    Apr 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: MultiSite Module Support Thread

    utomo,

    Here is the codes of my configuration. I don't know if my configuration will be suitable for others. If most people find that it is useful and workable to them, I can contact Gerome later to let him know my changes.

    Re: Please refer to my previous post in case you don't know why I am including my codes here.

    The primary site is http://YOUDOMAINNAME.com which is redirected to http://YOUDOMAINNAME.com/primarystorename
    The sub-site can be http://subsitename.YOUDOMAINNAME.com, http://www.subsitename.YOUDOMAINNAME.com, http://YOUDOMAINNAME.com/substename, or http://www.YOUDOMAINNAME.com/subsitename.

    One copy of zen-cart is installed under public_html/primarystorename.

    The file structure is like:

    Code:
    public_html
       |__primarystorename
             |__admin
             |__includes
                |__configure.php (3)
          |__includes
             |__config_sites
                |__sites_switch.php (1)
                |__yoursubsitename.YOURDOMAINNAME.com_config.php (2)
             |__templates
                |__tpl_subsitename1  (template for subsitename1) 
                |__tpl_subsitename2  (template for subsitename2)
                |__tpl_subsitename3  (template for subsitename3)
             |__configure.php (4)
       |__subsitename1
          |__.htaccess (6)
       |__subsitename2
          |__.htaccess
       |__subsitename3
          |__.htaccess
       |__.htaccess (5)
    NOTE: I don't know too much about .htaccess. I may have done something wrong. They worked fine on my website.

    The code for supporting different shippings and payments are not included yet.

    -----------------------------
    (1) code in my includes/config_sites/sites_switch.php:

    Code:
    /* Since I have set rules in .htaccess (included at the bottom of this page), my uri is guaranteed to have something like YOURDOMAINNAME.com/primarystorename or YOURDOMAINNAME.com/subsitename */
        $site_name = explode('/', $_SERVER['REQUEST_URI']);
        if ($site_name[1] == '' || $site_name[1] == 'primarystorename') {
            $template_dir = 'tpl_primarystorename';
            if(file_exists("includes/config_sites/www.YOURDOMAINNAME.com_config.php")) {
                include("includes/config_sites/www.YOURDOMAINNAME.com_config.php");
            }
            define('DIR_WS_CATALOG', '/primarystorename/');
            define('DIR_WS_HTTPS_CATALOG', '/primarystorename/');
            define('SITE_NAME', 'primarystorename');
        } else {
            $template_dir = 'tpl_' . $site_name[1];        /* set before 'include'; if you don't want to use the default template, you can overwrite it in yoursubsitename.YOURDOMAINNAME.com_config.php */ 
            if(file_exists("includes/config_sites/$site_name[1].YOURDOMAINNAME.com_config.php")) {
      include("includes/config_sites/$site_name[1].YOURDOMAINNAME.com_config.php");
            }
            /* define DIR_WS_CATALOG, DIR_WS_HTTPS_CATALOG and SITE_NAME after 'include';  If you don't want to use the default settings, you can overwrite tehm in yoursubsitename.YOURDOMAINNAME.com_config.php; If the file was not found, the default settings are used. */
            define('DIR_WS_CATALOG', '/'. $site_name[1] . '/');
            define('DIR_WS_HTTPS_CATALOG', '/' . $site_name[1] . '/');
            define('SITE_NAME', $site_name[1]);
            define('STORE_OWNER_EMAIL_ADDRESS', $site_name[1] . '@YOURDOMAINNAME.com'); /* optional */
            define('CONTACT_US_LIST', STORE_OWNER . '<' . STORE_OWNER_EMAIL_ADDRESS .'>'); /* optional */
        }
        
        //The order for this site will be seen for ORDER_SITE from the admin section
        define('ORDER_SITE', SITE_NAME);
    -----------------------------
    (2) possible codes for each subsite - includes/config_sites/yoursubsitename.YOURDOMAINNAME.com_config.php; This file is optional. If you don't need to have different definitions, you don't have to have this file. The major definitions are done in the site_switch.php. If you want to have different db for each site, put your db settings here.

    Code:
        define('STORE_NAME','John Doe');                // used in tagline
        define('STORE_OWNER','John Doe');
        define('COLUMN_RIGHT_STATUS','1');
        define('COLUMN_LEFT_STATUS','0');
        define('COLUMN_WIDTH_LEFT', '200px');
        define('BOX_WIDTH_LEFT','200px');
        define('STORE_NAME_ADDRESS','<strong>'. STORE_OWNER . '</strong><br/>123 xyz Ave.<br/>New York, NY 12345<br/>');
    -----------------------------
    (3.1) In admin/includes/configure.php, insert the following code at the beginning of the file

    Code:
    $site_name = explode('/', $_SERVER['REQUEST_URI']);
      if ($site_name[1] == '' || $site_name[1] == 'primarystorename') {
       define('DIR_WS_ADMIN', '/primarystorename/admin/');
       define('DIR_WS_CATALOG', '/primarystorename/');
           define('DIR_WS_HTTPS_ADMIN', '/primarystorename/admin/');
           define('DIR_WS_HTTPS_CATALOG', '/primarystorename/');
           define('SITE_NAME', 'primarystorename');
      } else {
           define('DIR_WS_ADMIN', '/'. $site_name[1] . '/admin/');
           define('DIR_WS_CATALOG', '/'. $site_name[1] . '/');
           define('DIR_WS_HTTPS_ADMIN', '/' . $site_name[1] . '/admin/');
           define('DIR_WS_HTTPS_CATALOG', '/' . $site_name[1] . '/');
           define('SITE_NAME', $site_name[1]);
      }
      unset($site_name);
    (3.2) Change the definition of DIR_FS_ADMIN & DIR_FS_CATALOG

    Code:
      define('DIR_FS_ADMIN', '/whatever/whatever/public_html/primarystorename/admin/');
      define('DIR_FS_CATALOG', '/whatever/whatever/public_html/primarystorename/');
    ------------------------------
    (4.1) In includes/configure.php, add the following code at the beginning of the file

    Code:
    include_once('includes/config_sites/sites_switch.php');
    (4.1) Change the definition of DIR_FS_CATALOG

    Code:
    define('DIR_FS_CATALOG', '/whatever/whatever/public_html/primarystorename/');
    ------------------------------
    (5) In publc_html/.htaccess, add the following code.

    (5.1) # point "http://YOURDOMAINNAME.com/subsitename" to "http://YOURDOMAINNAME.com/subsitename/"

    Code:
    RewriteRule /subsitename$ /subsitename/ [R]
    (5.1) # redirect http://YOURDOMAINNAME.com or http://www.YOURDOMAINNAME.com to http://YOURDOMAINNAME.com/primarystorename/; There might be better way to do this. If so, please let me know.

    Code:
    RedirectMatch temp ^/$ http://YOURDOMAINNAME.com/primarystorename/
    RedirectMatch temp ^www.YOURDOMAINNAME.com$ http://YOURDOMAINNAME.com/primarystorename/
    ------------------------------
    (6) In publc_html/subsitename/.htaccess, add the following code. These point sub-site (sub-domain) to the primary site. Only one copy of code is needed!

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} subsitename.YOURDOMAINNAME.com$ [OR]
    RewriteCond %{HTTP_HOST} www.subsitename.YOURDOMAINNAME.com$
    RewriteCond %{HTTP_HOST} !www.YOURDOMAINNAME.com$
    RewriteRule /(.*)$ http://www.YOURDOMAINNAME.com/subsitename/ [L,R=301]
    
    RewriteRule ^(.*)$ /primarystorename/$1 [L]
    -------------------------------

    A text file is attached.

    Attached Files Attached Files
    loop4ever

    360square.com

    Display & Sell Your Artwork for Free
    Buy Directly from Artists

 

 

Similar Threads

  1. v154 WorldPay Module version 3.0 - Support thread
    By countrycharm in forum Addon Payment Modules
    Replies: 115
    Last Post: 20 Jul 2021, 04:00 PM
  2. Bambora/Beanstream Payment Module Support Thread
    By swguy in forum Addon Payment Modules
    Replies: 127
    Last Post: 26 Mar 2021, 04:13 PM
  3. WorldPay Module version 2.0 - Support thread
    By philip_clarke in forum Addon Payment Modules
    Replies: 729
    Last Post: 4 Nov 2017, 08:23 AM
  4. PC Configurator Module [Support Thread]
    By lebrand2006 in forum All Other Contributions/Addons
    Replies: 254
    Last Post: 22 Aug 2012, 03:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR