Nexopos Multi store modules install problems and solves

Nexopos Multi store modules install problems and solves

Multi Store

·

2 min read

MultiStore module install problem and solves

I have been using Nexopos for several years and I have checked its updates regular basis and recently had to install multi-store modules in the local environment. There are some conditions you should consider before installing Nexopos and its modules on a server or in the local environment.

Development Environment

My local development environment is

  • wsl2

  • ubuntu 20.04

  • PHP 8.1

  • mysql8

  • Nginx

You can consider the same as all Unix-based systems. Let's dive into all my considerations and what I discovered while installing and using it in different environments.

Should be consider

  • Nexopos should be installed in the main domain or subdomain and on port 80. It's true for local or server environments. Example or domain google.com pos.google.com or nexopos.test or dev.nexopos. This is the best fit and no issue at all.

  • You can also install under port rather than 80 then you have to adjust the .env file and some modules may need code adjustment.

  • Another consideration is that the project folder or document root should be owned by a web server like Apache or nginx user and common is www-data.

The problem I face with installing a multistore module in the local server

Modules are independent chunks of code that extend Nexopos core and provide some more functionality. Multi-store modules provide a facility to manage multiple branches of a business. In a server with a subdomain, there is no issue but when I try to install the same module with port raises an issue like URL not found. I found that happened for not considering port. check the code below.

$domain = pathinfo(env('APP_URL'));
$fullDomain = $domain['filename'].(isset($domain['extension']) ? '.'.$domain['extension'] : '');

So what's the issue with the code? In the $domain['extension'] has com or org and if the port exists then the port is part of the extension as well like com:8080. Url nexopos.com:8080 will turn into nexopos.com:8080:8080 and show URL not found issue. check the below image. If you look into the console you will find it.

So what will be the solution? I add simple few line code and then then load the system properly. Code is as below

if(isset($domain['extension']) && explode(':', $domain['extension'])) {
    $extension = explode(':', $domain['extension'])[0];
    $fullDomain =  $domain['filename']. '.' . $extension;
}

Contact

If anyone is interested in checking their PHP application or environment or needs installation help you can contact me.

Did you find this article valuable?

Support NZIAN blog by becoming a sponsor. Any amount is appreciated!