Codexshaper / laravel-woocommerce

WooCommerce Rest API for Laravel
MIT License
189 stars 59 forks source link

Multi-site configuration #76

Open mcpuishor opened 2 years ago

mcpuishor commented 2 years ago

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

maab16 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

maab16 commented 6 months ago

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 codexshaper@gmail.com.

mcpuishor commented 6 months ago

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 codexshaper@gmail.com.

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 commented 6 months ago

Thanks for your reply,

Can you share your live site links and screenshots of where you want to implement these features?

On Tue, Jan 2, 2024 at 9:00 PM Robert @.***> wrote:

Dear @mcpuishor https://github.com/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 @.***

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.

— Reply to this email directly, view it on GitHub https://github.com/Codexshaper/laravel-woocommerce/pull/76#issuecomment-1874134783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE66J2TJRRQPKFBZP7ZVQ7LYMQOHNAVCNFSM5A5WLP4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXGQYTGNBXHAZQ . You are receiving this because you commented.Message ID: @.***>

mcpuishor commented 6 months ago

@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 commented 6 months ago

Hello @Robert @.***>,

Thanks for your explanation. I'll check your pull request and get back to you soon.

On Sun, Jan 7, 2024 at 7:36 PM Robert @.***> wrote:

@maab16 https://github.com/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');

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

— Reply to this email directly, view it on GitHub https://github.com/Codexshaper/laravel-woocommerce/pull/76#issuecomment-1880062237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE66J2VU4UT66UCMPHAJ54DYNKQHBAVCNFSM5A5WLP4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGAYDMMRSGM3Q . You are receiving this because you were mentioned.Message ID: @.***>