Skip to content

Multi-site configuration #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

mcpuishor
Copy link

The change is allowing to store multiple configurations in the /config/multisite.php. The current configuration is selected from the .env file.

@mcpuishor mcpuishor marked this pull request as draft July 24, 2021 18:25
@maab16
Copy link
Collaborator

maab16 commented Jul 24, 2021

Hi @mcpuishor,
Thanks for creating pull request. Can you explain what's the benefit that user can get from your changes since they can simply change their store URL and other information from .env?

@mcpuishor mcpuishor marked this pull request as ready for review July 25, 2021 09:36
@mcpuishor
Copy link
Author

True, it's a simple procedure to change the connection data from the .env, however it becomes cumbersome when you have to constantly switch from a local dev to a staging to a production configuration. This allows a single point of change and data is stored in the app, in a configuration file, rather than having to pull it from the actual website every single time you have to switch. It's simply a matter of convenience to switch.

I am currently working on a project to integrate WooCommerce with Laravel and I found myself having to switch multiple times a day from a local setup to a remote setup, back and forth.

The ultimate goal is to be able to switch configuration at runtime to allow connections to multiple stores at the same time.

@maab16
Copy link
Collaborator

maab16 commented Jul 29, 2021

Okay. Can you see this issue #12 and let me know what problem you faced here?

Currently I'm passing very busy schedule. I'll check your changes ASAP.

@jarno-peeters
Copy link

@mcpuishor I'm building this application to sync product data between two WooCommerce stores. Does your code support this?

@maab16
Copy link
Collaborator

maab16 commented Jan 2, 2024

Dear @mcpuishor,

Thanks for your contribution. We are glad to know that you are interested in contributing to enhancing the functionalities. Can you brief what is missing and what you did? You can mail us [email protected].

@mcpuishor
Copy link
Author

Dear @mcpuishor,

Thanks for your contribution. We are glad to know that you are interested in contributing to enhancing the functionalities. Can you brief what is missing and what you did? You can mail us [email protected].

Hi,

I am currently working get the package to be able to work with multiple configurations, which can be switched at runtime. My use case involves 4 websites running WooCommerce that are sync-ed from a single backend. Every API sync call is processed via queued jobs. At job dispatch the script decides what product, on which website, at what stock level, and price point.

Given my company's decision to run multiple websites, but rely on a single source of truth for catalog management, it was the only option I could see.

As soon as I have a more robust fork of this package I will submit a new PR, need be.

@maab16
Copy link
Collaborator

maab16 commented Jan 2, 2024 via email

@mcpuishor
Copy link
Author

mcpuishor commented Jan 7, 2024

@maab16 I'm afraid it's not possible to share live links. The app I'm working on is an internal app, running on a local server inside our network.

I am currently testing the forked package to make sure it can switch between configurations during execution of the script.

I've noticed also the other option to alter the Larvel configuration, setting new config options one by one, however that solution is cumbersome and prone to errors.

The solution I'm working on would would simplify the switch. Just an example of calls:

Product::all();

Would retrieve the products from the default store set in configuration file. This is to prevent a braking change.

Product::withConfig('another_store_config_set'):all()

Would attempt to retrieve products from a WooCommerce store defined in the config file, as an array, under another_store_config_set.

It's a similar situation to the Storage interface of Laravel where you can specify Storage::disk().

@maab16
Copy link
Collaborator

maab16 commented Jan 7, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants