I have question about multi-domain installation for v3.0.3.6.
I'm new in OpenCart and I'm trying to solve next goals:
* we need single store for multiple domains
* each domain is linked with specific language
* one general main domain still can handle several languages
* we want code customization of observable view part for every domain
* we want single DB and single file storage for whole multi-domain project
* we want single source of logic for admin, catalog, extension, system code bases for whole multi-domain project
* we want single public web access point for images
As result of my analysis of v3.0.3.6 version, I made file structure adjustments and changed it this way:
Code: Select all
\src
\admin (moved from /upload/admin)
\catalog (moved from /upload/catalog)
\extension (moved from /upload/extension)
\system (moved from /upload/system)
\var
\storage (moved from /storage)
\public
\admin
\view (moved from /upload/admin/view)
...
\site.fr
\catalog
\view\{image,javascript,stylesheet,template} (moved from /upload/catalog/view for .fr view customizations)
...
\site.us
\catalog
\view\{image,javascript,stylesheet,template} (moved from /upload/catalog/view for .us view customizations)
\image\{cache,catalog} (moved from /upload/image)
In /public/site.fr, /public.us we locate view-part of open-cart platform. These are web roots and /site.us comprises image folder for originals and caches.
To make it work, I've performed few manual customizations in OpenCard code base.
1. Since '/extensions' now is not located in public web root, I need to consider its folder in twig's constructor - `\Opencart\System\Library\Template\Twig::__construct()`:
Code: Select all
// #mod, add path for extension twigs
// $this->loader = new \Twig\Loader\FilesystemLoader('/', $this->root);
$paths = ['/', '../../src/extension'];
$this->loader = new \Twig\Loader\FilesystemLoader($paths, $this->root);
I added global constant for defining image source host/url path - IMAGE_URL. And performed manual customization in `\Opencart\Application\Model\Tool\Image::resize()`
Code: Select all
// #mod #IK, 2020-11 - Link images to single domain
// return $this->config->get('config_url') . 'image/' . $image_new;
return IMAGE_URL . 'image/' . $image_new;
Could you please review and express your opinion regarding this solution? Please point me to weak sides and what I did right.
My big concern is the fact, that we are moving code away from original structure of OpenCart project. This will complicate framework later updates.
I believe, this friendly OpenCart community could help to find a better way on base of your wide experience.
Shouldn't I review some of my goals?
---
Updated:
Need to say, that I've found multi-domain facility that allows to link categories and products from single store to different domains. This means we can keep all logic on the same domain in orginal platform structure.
I believe, we will be able to adjust styles for each domain. But I'm not sure, what should we do, if we need custom adjustments for pages layouts.
How could we separate them in recommended true way?