8000 `Product` and `ShopProduct` in a real world · Issue #1275 · shuup/shuup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Product and ShopProduct in a real world #1275

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
Pikkupomo opened this issue Jun 6, 2018 · 16 comments
Open

Product and ShopProduct in a real world #1275

Pikkupomo opened this issue Jun 6, 2018 · 16 comments

Comments

@Pikkupomo
Copy link
Contributor

Background

If my memory serves me well, the original ideology behind Product and ShopProduct was to allow so-called "Base Products" to be available in a single Shuup installation in a multi-store environment. These Product's would then provide unchangeable data for all the merchants to use whereas the ShopProduct just defines the price and other, store-by-store changing, information.

Real world

In a real-world situation, this setup will bring nothing to the table it only adds complexity to the implementations. It also slows down our implementations as we do constant queries back and forth between Product and ShopProduct.

I give you an example of an environment where this won't work at all:

I have a multi-store environment, where I sell Coca-Cola bottles, who is the one who decides how big the bottle is, what is the SKU etc.

  • Is it the first who gets to create it?
  • Can other merchants modify this information or not?
  • What if the data is fundamentally wrong?

I think you all are already starting to see a problem with this implementation

In a real world situation, the merchant should have power over the product information they sell, all of it. I would also point out that having a implementation like this (Product and ShopProduct separated) causes developers to build mediocre solutions to their projects when trying to go around this issue.

Solution

Even though this was built multi-stores in mind, it seems it's a flawed solution and relies too much into sunny cases. So, preparing to Shuup 2.0 release, I suggest we move all the fields from ShopProduct to Product and remove ShopProduct altogether.

Thoughts?

@tulimaki
Copy link
Contributor
tulimaki commented Jun 6, 2018

I think having something like this would require that after product create fields should be uneditable and the updates for products would go through marketplace-admin through requests/tasks.

We already discussed this with @Pikkupomo here and agree there is something we need to do for this.

@tulimaki
Copy link
Contributor
tulimaki commented Jun 6, 2018

@suutari-ai do you have any thoughts regarding this?

@tulimaki tulimaki closed this as completed Jun 6, 2018
@tulimaki tulimaki reopened this Jun 6, 2018
@chessbr
Copy link
Contributor
chessbr commented Jun 6, 2018

My thoughts.

I agree to move all attributes to Product. I understand the idea behind Product and ShopProduct, but this normalization brought this kind of issues to the table. Moreover, other models need the shop attribute to work in a real scenario, like product type, order status and many other models that that will be managed by any merchant who have access to them.

In Marketplace mode, there is no reason to share product information, IMO, like in Amazon or even eBay. The merchant just create an account and create their products. All the shipping and payment methods should be provided by the system through the superuser or something.

In multi-stores we can have two scenarios:

  1. You install Shuup as the platform in a single database and it should just behave like creating a database for each shop, nothing is shared, or conflicts or leaks to other shops.
  2. Shops share information like products, order statuses and product types. Is there any use case for this at all? This is the current Shuup implementation.

If the point is to avoid duplicating data, the end result is bad as @Pikkupomo mentioned. We can make things faster when creating products like creating products from template as base or presets, then we could have some separated model which one can create this template and things are just copied (not referenced, as that could bring more complexity). Nowadays, data is cheap and duplicating info in this kind of level shouldn't be a problem for the rare use cases.

@suutari-ai
Copy link
Contributor

Originally multi-shop features were not designed for this kind of use cases where Shops are managed by distinct people/companies. The point was to allow serving several "sites" (i.e. shops) to the same product catalog where the products share same stocks. For this kind of use case, there is a real need for the shared P roduct instance, since that's where the stock counts are linked to.

Serving multiple separately managed shops from the same Shuup instance is totally different use case. For that case where the shops don't co-operate, there is no point in sharing the Product instances between the shops. I think this could still be easily done with the current architecture. Shop A can create their coca-cola which has Product P-COKE-A and ShopProduct SP-COKE-A and shop B creates P-COKE-B and SP-COKE-B. Only problem here is if they want to use same SKUs for their Cokes. That could probably be solved by just making the SKU field non-unique in Product table and add the constraint to ShopProduct's Shop-SKU pair. It could be a setting if the shops are co-operative or not and that would then determine if duplicate SKUs are be allowed in Product table or not.

@chessbr
Copy link
Contributor
chessbr commented Jun 7, 2018

@suutari-ai so, if we remove the uniqueness of SKU and modify supplier modules to calculate stocks from SKU instead of product id, do you see any possible issue? If reason for that is just the stocks, so maybe the SKU is the right info to pass to supplier.

@suutari-ai
Copy link
Contributor
suutari-ai commented Jun 8, 2018

Why would you pass just the SKU to supplier? IMHO Product is more appropriate, especially in a setup where you have two different Products with the same SKU, i.e. when shop A has a Product with SKU "COKE" and shop B has a different product with SKU "COKE", then there is no way to distinguish them from each other just by the SKU (but through Product instance or id it is easy, of course).

@suutari-ai
Copy link
Contributor

... and if those products in shop A and B with SKU "COKE" are sharing the same stocks, then they really should be using the same Product instance anyway, since they are the same product. I can't think of any situation where two shops (managed by the same or different companies) would share the stocks but can't co-operatively decide on the details of the product catalog they have stored in their common warehouse.

@chessbr
Copy link
Contributor
chessbr commented Jun 8, 2018

Hum, well, I though in SKU because it could contain all these info to distinguish one product from another (https://en.wikipedia.org/wiki/Stock_keeping_unit)
But as we also have GTIN and barcode, this won't be nice a good idea at all.
So, removing the SKU uniqueness solves issues partially. How would we add some unique constraint in (ShopProduct.shop, ShopProduct.product.sku) ? Should be handle that manually or move the SKU and other fields (GTIN, barcode) to ShopProduct?

@suutari-ai
Copy link
Contributor

Here's my vision on how to implement this:

There should be a setting which kind of multi-shop configuration the Shuup instance is using, i.e. centrally managed shops (by the same vendor) or separately managed shops (by different vendors).

  • If this SHUUP_MULTISHOP_MODE is set to 'centrally-managed', then duplicate SKUs for Product instances should be forbidden. (This also forbids duplicate ShopProduct SKUs too, of course.)
  • If SHUUP_MULTISHOP_MODE is set to 'separately-managed', then duplicate SKUs for Product instances are allowed, but it still should be forbidden to create a duplicate shop-SKU pairs i.e. it shouldn't be possible to create ShopProducts to the same shop for two different products which share the same SKU.

These rules cannot be forced on the table level, so they must be implemented in the clean and save methods of Product and ShopProduct models.

@tulimaki
Copy link
Contributor
tulimaki commented Jul 5, 2018

We need to add option for projects with either 'centrally-managed' or 'separately-managed' products. Now we offer 'centrally-managed' products.

And this is somewhat related to these. Which is now only used by API and we need to decide whether to actually fix this thing and offer admin edit+actually use these at front.

@suutari-ai what is your thoughts about those shop product names and descriptions?

Mainly because I think I am removing those instead of fixing the admin, front and themes.

  1. I think it should be some flag on product level whether the product is shared or not and the admin module can then check whether the edit of these fields are allowed by staff or not.
  2. Also from xtheme we have soon all kinds of tools to customize the per product per shop deals or info.
  3. Maybe the shop products should be limited to per shop visibility and price configurations only (like it used to be before these custom names).
  4. If 'separately-managed' products we don't need these.
  5. If 'centrally-managed' products then some flag at product should help admin to know whether the product information is editable for staff. I think often in these cases the products are imported/managed from 3rd party inventory systems.

@suutari-ai
Copy link
Contributor
suutari-ai commented Jul 5, 2018
  1. I think it should be some flag on product level whether the product is shared or not and the admin module can then check whether the edit of these fields are allowed by staff or not.

I like this idea and I think it's better than my idea of having this as a per installation configuration option. It could even be extended to use cases like these:

  • There would be two kind of Products: shared products and shop specific products. This would be controlled by the flag that you proposed, e.g. named Product.is_shared.
  • Following limitations would apply for the SKUs:
    • [a] SKUs of shared products are unique within the Shuup installation.
    • [b] SKUs of shop specific products are unique within a shop and cannot conflict with the SKUs of the shared products.
  • A Shop Administrator (for a certain shop) could
    • [c] create and modify any shop specific products within the shop (including all Product and ShopProduct related details of them), and
    • [d] edit any shop specific details (stored in the ShopProduct part) of any shared product which already has a ShopProduct for the shop. Shared products which don't have ShopProduct for the shop would be invisible to the Shop Admininistrator except for the SKUs being unavailable.
  • A General Administrator (i.e. administrator of the whole Shuup installation and all of its shops) could
    • [e] do all the same things as Shop Administrators can and additionally
    • [f] create shared products from scratch or by converting existing shop specific products to shared products,
    • [g] unshare a shared product, i.e. convert it to a set of shop specific products, one for each previously existing ShopProduct, and
    • [h] manage sharing of the shared products to the shops by creating or deleting ShopProduct instances. See also [d].

@suutari-ai
Copy link
Contributor

what is your thoughts about those shop product names and descriptions?

I'm not sure about this. If there is no shop specific names and descriptions then a shop administrator wouldn't be able to change those details for a shared product (see [d] in my last comment). Though it could also be a good thing, since then the General Administrators would be more in control and they could still allow editing of those details by unsharing the product (see [g]). So maybe I'm leaning towards removal of those from the ShopProduct.

@chessbr
Copy link
Contributor
chessbr commented Aug 20, 2018

@suutari-ai @tulimaki And what about other models? Like Attributes, ProductTypes, Manufacturers, etc.. we have being adding shops or shop attributes on them. Could we make something similar to shared ShopProduct or we just continue adding shops to models and following these rules:

  • A Shop Administrator can create/edit/delete instances that only contains the shop in shops field, and only see those which shops are either blank or contain more than one 1 (self included)
  • A General Administrator can delete/create/delete any instance and manage shops attributes for the instances.

IMO maybe we just add a shop attribute on each model and if it is None it is shared, otherwise it is specific for the shop. We added shops in some of them but maybe it was not a wise decision.

@suutari-ai
Copy link
Contributor

IMO maybe we just add a shop attribute on each model and if it is None it is shared, otherwise it is specific for the shop.

Seems like a good idea to me.

We added shops in some of them but maybe it was not a wise decision.

Having just a single nullable FK to shop feels simpler to me and IMHO would be better.

@tulimaki
Copy link
Contributor
tulimaki commented Aug 29, 2018

In progress. We are going pretty much the suggestion @suutari-ai made in Jul 5.

@tulimaki tulimaki self-assigned this Aug 29, 2018
@tulimaki tulimaki removed their assignment Jan 17, 2019
@Pikkupomo
Copy link
Contributor Author

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

No branches or pull requests

4 participants
0