How to model a large catalogue with many different types of products and attributes in PimCore 5+ - pimcore

I am an experienced full-stack web dev, but new to PimCore. I’m organising a large catalogue of many types of items in PimCore and have looked through the documentation many times, but I still don’t know how to tackle two basic issues I have organising my product data into classes. I hope some more experienced PimCore users or devs can shine some light on this.
Issue 1: how to model general product attributes that apply to all products in the catalogue.
All of the products in my catalogue will have a name and a description, so I thought it made sense to make a Product class that has these fields and make all of my specific product classes subclasses of that Product class so I wouldn’t have to add name and description fields to each subclass individually.
I tried to set this up, but in the object editor of the specific subclass the layout fields that I added to the generic Product superclass don’t show up. Am I missing something here? Should my approach actually work? If not, what would be the PimCore approach to modelling this?
Issue 2: how best to model products with multiple options, ie. variants over more than one dimension.
For example, T-shirts with both color and size options (let’s say, 3 colors and 3 sizes for a total of 9 variants). I would want to create one single T-shirt product in the object tree and then add 3 color options and 3 size options for an (automatic) total of 9 variants. I want the T-shirt to appear as a single product in the e-commerce frontend and let the end customer determine the value of both options.
I am wondering if it is at all possible to do this in a way that allows me to specify the 3 color options and the 3 sizes independently of each other. The examples I find in the documentation all show me a fully expanded object tree covering all options (eg., 1 T-shirt object, with 3 subobjects for each size, each with 3 subobjects for each color in that size). Although data inheritance helps with the management of this info, a change in the available colors would still have to be made once for every size option. I can’t imagine there is not a better way to set up object variants in multiple dimensions in PimCore, but days of searching have led me nowhere. Am I missing something here? Or does PimCore actually force you to create objects/variants for every combination of product options? If not, what would be the PimCore approach to modelling this?
I hope someone with a little experience in this field is willing to shed some light on these two issues. Thank you so much!!

Received very helpful answers on the PimCore forums, by user fash:
Issue 1: Pimcore DataObject classes cannot inherit from each other. The way to go would be to create one product class (that
contains all common product attributes) and then use object bricks or
classification store groups to model category specific attributes.
Then on object level, the corresponding object brick or classification
store group can be added to the product object (depending on its
category or other criteria).
Issue 2: As you already noticed, the default way of dealing with different variants of a product is to create an object instance for
each variant and utilize data inheritance to reduce data maintenance
effort (like in the demo). Also as Andrew already pointed out, adding
some helper functionality like a generate variants button is easily
possible.
The reason why we create a unique data object for each variant most of
the time is, that normally each SKU has a unique product number and
also in terms of e-commerce it needs to be possible to reference the
exact variant that was ordered. As an alternative you of course could
use data structures like field definitions or block to follow your
approach and have to attributes (like color, size, etc.) and add
multiple values to them and then deal on the output channel with the
variant generation. It is really up to your use case and your system
what fits better.
An hybrid solution would be to define possible variants with variant
attributes, and then generate the actual object variants on the fly
when one is ordered.

Related

Is there a way to group items based on a broader category (e.g., skittles and snickers get labeled as "candy")?

I'm wondering if there is a way (specific package, process, etc.) of grouping items based on an overall category? For example, I'm looking at empty search results and want to see what category customers are most interested in.
Let's say I have a list of searched terms: skittles, laundry, snickers and detergent. I would want to group these items based on a broader category (i.e., skittles and snickers are "candy" and laundry and detergent would be "cleaners").
I've done some research on this and have seen similar (but not exact) ways of doing this (e.g., common keyword grouping using NLP) but not sure if something like this exists in the world when there isn't necessarily any commonality. Any help or direction would be greatly appreciated.
Update here: The best way to handle this scenario is to use pretrained word embeddings using something like Google's BERT algorithm as the first pass and then layer on another ML model that is specific to the use case.

Difference between variants and classification

What is the difference between a Variant and a Classification System?
I don't really understand why is there an ApparelSizeVariantProduct in the *-items.xml file only for a size variation. Isn't it easier to create a classification for a category that holds a "size" feature instead of creating a new type ? What is the purpose of these "variants" ?
It depends on what you are sell and price strategy. For example in fashion, you need to manage stocks by size, but price managed by base product model. Some companies also manage price by color variant. So you need another variant for color.
Example: BaseProduct > ColorVariant > SizeVariant
You cannot manage price or stock with classification. Also there is another concept exists: attributes.
These functionalities are power of hybris, other solutions maybe solve same challenge different way.

What is the advantage of a product variant?

I am confused by product variants in Hybris.
For example, why would you choose to use a variant for size or color?
Wouldn't expanding the product item to include both style and size as attributes simplify the resulting data model?
Any insight would be greatly appreciated.
Variants are a common concept in eCommerce systems. Hybris supports this as do others:
http://docs.shopify.com/api/product_variant
http://msdn.microsoft.com/en-us/library/ms962267%28v=cs.70%29.aspx
http://guides.spreecommerce.com/developer/products.html
So why do we do this? Mainly this is for ease of management.
If we take an Apparel example, perhaps we have Products with no size or colour (maybe sunglasses) variations, we have products with only Colour variations (hats?) and we have Products with Size and Colour variations (t-shirts perhaps).
Here is our setup:
Product
Product Blue
Product Blue/S
Product Red
Product Red/M
Product Green
Product Green/S
Product Green/XL
In this example we need configure only one Price, on 'Product'. We need only configure 3 images, on 'Product Blue', 'Product Red' and 'Product Green'. We can then configure Stock Levels on the "leaf" variants.
So different products will have different numbers of variations and different ways to vary. As a result we don't want to fill up the Product table with lots of Null columns representing all these possible variations for every product. A more extensible approach is taken via the VariantType MetaType.
Via this approach you can create 'concrete' Variants (as I call them) via your items.xml, or 'dynamic' Variants via run time definition using impex. Only concrete Variants can be used in code directly (i.e. using instanceof) but cannot be added with a deployment and an updatesystem. Dynamic variants require more clever coding to determine the VariantAttributes on the item but this is in general a much better approach and more extensible.
There is of course an argument that multi level variant structures are a bit redundant and slightly false. There is no "direction" to variants. You do not naturally navigate Product > Blue > Small, you simply select the Blue Small Product. So it could be argued that all variant structures should only be 1 level deep.
You will need a variant product to manage the price for example. For some colors it could be possible that the product will cost more than for another color. You can't manage this in one product. Also it is possible that you will define another description / productname for your variant product. It is way easier to do this with a variant product than using the custom product.

Core Data - relationships or attributes?

I have a very basic, functioning, checklist application that I'd like to improve.
Essentially, it's just a list of 37,000 (and growing) items.
Right now, I have two entities:
1) Checklist: This includes the following attributes: name, numberOwned, imageName, groupName, etc - 14 in all. All are Strings
2) Keywords: This includes a single attribute: words, with a one-to-many nameKeywords relationship. This stores the normalized name for searching
My question is: Is there any reason to be using multiple entities in this type of situation? Should I remove the Keywords relationship and just add that as an additional attribute? Or should be be going the other route, minimizing the attributes and adding more entities?
I'd like to keep it as simple as possible (I'm not an experienced programmer, and the app isn't a source of revenue - it's available free on the store) - but I would like to make the searches more efficient if possible to make my users happy. Right now when a user searches for an item, it searches the normalized name in the Keyword entity, but it can take a while if they are trying to search through all items.
As usual, I apologize if this question is to vague. I'm happy to provide clarifications and code snippets as needed!
Zack
To increase the speed of search, you can use indexes for attributes, but it'll help if you can show your model of database

Magento: Attribute with thousands of values/options

I'm creating a Book store in Magento and am having trouble figuring out the best way to handle the Authors of a Book (which would be the product).
What I currently have is an Attribute called "authors" which is multi-select and a thousand [test] values. It's still manageable but does get a little slow when editing a product. Also, when adding an option/value to the authors attribute itself, a huge list is rendered in the HTML making this an inefficient solution.
Is there another approach I should take?
Is it possible to create an Author object (entity type?) which is associated to a product through a join table? If yes, can someone give me an explanation about how that is done or point me to some good documentation?
If I'd take the Author object approach, could that still be used in the layered navigation?
How would I show the list of all books for a single author?
Thanks in advance!
PS: I am aware of extensions like Improved Navigation but AFAIK it adds something like attributes to attributes themselves which is not what I'm looking for.
For Googlers: The same would apply for Artists of a music site or manufacturers.
If you create an author entity type, you'll just increase your work trying to add it to layered navigation, and I don't see a reason why it would be faster.
Your approach seems the best fit to the problem, given the way Magento is set up. How are you going to display 1,000 (which presumably pales in comparison to the actual list) authors in layered navigation?
Depending on the requirements, you could go the route of denormalizing the field and accepting text for it. That would still allow you to display it, search based on it, etc, but would eliminate the need to render every possible artist to manipulate the list. You could add a little code around selecting the proper artist (basically add an AJAX autocomplete to the backend field) to minimize typos as well.
Alternatively, you could write a simple utility to add a new artist to the system without some of the overhead of Magento's loading the list. To be honest, though, it seems that the lag that this has the potential to create on the frontend will probably outweigh the backend trouble.
Hope that helps!
Thanks,
Joe

Resources