|
| 1 | +--- |
| 2 | +description: "PIM training: Product modeling" |
| 3 | +edition: experience |
| 4 | +page_type: training |
| 5 | +--- |
| 6 | + |
| 7 | +# Product modeling |
| 8 | + |
| 9 | +## Product types |
| 10 | + |
| 11 | +The product type base concept is close to the content type one. |
| 12 | +Like a content type structures a family content items, a product type structures products. |
| 13 | + |
| 14 | +See a first conceptualisation of what a product is, and what a product type is, in [Documentation > PIM (Product management) > Products](products.md). |
| 15 | + |
| 16 | +In fact, a product type is really a content type from the hidden system group `product` with a field of type “Product specification” (`ibexa_product_specification`). |
| 17 | + |
| 18 | +The presence of an `ibexa_product_specification` field is what distinct product type from content type. |
| 19 | +Don't remove this field from a product type (or it will become a unreachable hidden content type). |
| 20 | +Don't add such field to a content type (or it will become an uneditable broken product type). |
| 21 | + |
| 22 | +TODO: What happens if you have several `ibexa_product_specification` fields? |
| 23 | + |
| 24 | +You can trick the system URL to display a product type as a content type but know that this is dangerous and mustn't be exposed to final users. |
| 25 | +Always prefer the dedicated route (as the Back Office does) `/product-type/view/<product_type_identifier` (`ibexa.product_catalog.product_type.view`). |
| 26 | +To view it through `/contenttypegroup/<product_group_id>/contenttype/<product_type_id>` (`ibexa.content_type.view`) is doable. You could even edit it from there. But this is strongly not recommended. |
| 27 | + |
| 28 | +TODO: move to somewhere in the exercise |
| 29 | +If you're curious, after having created a product type, you can run the following SQL query to see the database representation. |
| 30 | + |
| 31 | +```sql |
| 32 | +SELECT cg.group_id, cg.group_name, g.is_system, c.id, c.identifier, c.version |
| 33 | + FROM ezcontentclass AS c |
| 34 | + JOIN ezcontentclass_classgroup AS cg ON c.id = cg.contentclass_id AND c.version = cg.contentclass_version |
| 35 | + JOIN ezcontentclassgroup AS g ON cg.group_id = g.id |
| 36 | + ORDER BY cg.group_id ASC, c.id ASC |
| 37 | +; |
| 38 | +``` |
| 39 | + |
| 40 | +The "Product specification" field type (`ibexa_product_specification`) brings in the power of attributes. |
| 41 | + |
| 42 | +Notice that you don't need to add a field or an attribute for price. |
| 43 | +Prices are handled by a particular side mechanism, the price engine, which is treated later in the training with VAT, currencies, etc. |
| 44 | + |
| 45 | +## Attributes VS Fields |
| 46 | + |
| 47 | +Like fields, attributes are typed. |
| 48 | + |
| 49 | +Unlike fields, attributes are never translatable. |
| 50 | +Attributes are product constant properties. |
| 51 | +Attributes values can't be translated because those properties don't change with the language. |
| 52 | +Only the display of those properties changes with the language. See the following concept examples: |
| 53 | + |
| 54 | +- The color of a product is the same whatever the language is, only the corresponding color name is translated. |
| 55 | +- The radius of a sphere doesn't depend on the language, only its numeral representation need translation according to local length units. |
| 56 | + |
| 57 | +TODO: Later in the training, in the templating part, is shown how to localize the attributes. |
| 58 | + |
| 59 | +Unlike fields, attributes are first defined outside the product types. |
| 60 | +Attributes and attribute groups are to be reused from product type to product type. |
| 61 | + |
| 62 | +An attribute can be used to make product variant. |
| 63 | + |
| 64 | +TODO: Best practices: |
| 65 | +How to think product types? |
| 66 | +How to not have a product type per product? |
| 67 | +How to not want a "god" product type trying to cover everything? |
| 68 | + |
| 69 | +TODO: Variants |
| 70 | +TODO: attribute value display translation |
| 71 | + |
| 72 | +## Product and product variants |
| 73 | + |
| 74 | +Technically, a product is a content item. |
| 75 | + |
| 76 | +But a variant isn't. |
| 77 | + |
| 78 | +TODO: Continue content VS product VS variant |
| 79 | + |
| 80 | +## Exercise: Bikes and bike parts modeling |
| 81 | + |
| 82 | +Exercise: Think about attributes and content type to sell full bicycles and bicycle parts. |
| 83 | + |
| 84 | +The following is an example of a bicycle feature model sketch. |
| 85 | +As you can see, it's a rich and complex matrix. |
| 86 | +And it doesn't involve different brands and models for the same feature yet. |
| 87 | + |
| 88 | +- Bicycle: |
| 89 | + - Frameset: |
| 90 | + - Frame: |
| 91 | + - Size: [XS, S, M, L, XL] |
| 92 | + - Shape/Features: [Diamond, Step-through, Diamond w/ suspension, Folding, Recumbent, Cargo, Tandem, …] |
| 93 | + - Material: [Steel, Aluminium, Titanium, Carbon, Wood, Bamboo, Mixed, …] |
| 94 | + - Paint job: […] |
| 95 | + - Fork |
| 96 | + - Size: [XS, S, M, L, XL] |
| 97 | + - Suspension: yes/no |
| 98 | + - Paint job: […] |
| 99 | + - Handlebar: |
| 100 | + - Shape: [Standard, Drop, Bullhorn, Flat, Riser, …] |
| 101 | + - Paint job: […] |
| 102 | + - Saddle: |
| 103 | + - Shape: [Thin, Large, Noseless, …] |
| 104 | + - Cushion material: [Foam, Gel, …] |
| 105 | + - Cover material: [Spandex, Vinyl, Kevlar, Leather, …] |
| 106 | + - Paint job: […] |
| 107 | + - Saddlepost: |
| 108 | + - Material: [Steel, Aluminium, Titanium, Carbon, Wood, Bamboo, Mixed, …] |
| 109 | + - Type: [Rigid, Suspension, Dropper, …] |
| 110 | + - Attachment: [Quick release, Bolt/nut, Anti-thief, …] |
| 111 | + - Gears: |
| 112 | + - Front gears: |
| 113 | + - Speed count: [1…3] |
| 114 | + - Type: [Single, External, Hub internal, Crank gearbox, …] |
| 115 | + - Control transmission: [Bowden cable, Hydraulic, Electronic, …] |
| 116 | + - Control type: [Lever, Ring, …] |
| 117 | + - Control placement: [Handlebar, Frame, …] |
| 118 | + - Rear gears: |
| 119 | + - Speed count: [1…8] |
| 120 | + - Control type: [Bowden cable, Hydraulic, Electronic, …] |
| 121 | + - Type: [Single, External, Hub internal, Crank gearbox, …] |
| 122 | + - Control transmission: [Bowden cable, Hydraulic, Electronic, …] |
| 123 | + - Control type: [Lever, Ring, …] |
| 124 | + - Control placement: [Handlebar, Frame, …] |
| 125 | + - Transmission: [Chain, Belt, Shaft, …] |
| 126 | + - Wheel set: |
| 127 | + - Rear wheel: |
| 128 | + - Axle attachment: [Quick release, Bolt/nut, Thru, Anti-thief, …] |
| 129 | + - Diameter: [622 mm (road 700C, mountain 29″), 584 mm (road 650B, mountain 27.5″), 559 mm (mountain 26″), 406 mm (mountain 20″), …] |
| 130 | + - Type: [Standard spokes, G3 spokes, Disc, …] |
| 131 | + - Brake: [Caliper, Disk, Roller, Drum, …] |
| 132 | + - Rim material: [Aluminium, Steel, Carbon, …] |
| 133 | + - Tire shape: [City, Race, Mountain, Fat, Mixed, …] |
| 134 | + - Tire insert: [Clincher/Tube, Tubular, Tubeless, Foam, Solid, …] |
| 135 | + - Paint job: […] |
| 136 | + - Front wheel: |
| 137 | + - Same as rear: ☑yes/☐no |
| 138 | + - Axle attachment: [Same as rear, Quick release, Bolt/nut, Thru, Anti-thief, …] |
| 139 | + - Diameter: [Same as rear, 622 mm (road 700C, mountain 29″), 584 mm (road 650B, mountain 27.5″), 559 mm (mountain 26″), 406 mm (mountain 20″), …] |
| 140 | + - Type: [Same as rear, Standard spokes, G3 spokes, Disc, …] |
| 141 | + - Brake: [Same as rear, Caliper, V, Disk, Roller, …] |
| 142 | + - Rim material: [Same as rear, Aluminium, Steel, Carbon, …] |
| 143 | + - Tire shape: [Same as rear, City, Race, Mountain, Fat, Mixed, …] |
| 144 | + - Tire insert: [Same as rear, Clincher/Tube, Tubular, Tubeless, Foam, Solid, …] |
| 145 | + - Paint job: [Same as rear, Same as rear, …] |
| 146 | + - Electric assistance: |
| 147 | + - Electric assistance: ☐yes/☑no |
| 148 | + - Motor placement: [Front wheel, Rear wheel, Crank, …] |
| 149 | + - Battery placement: [Center, Rear, …] |
| 150 | + - Regulation: [EU pedelec, EU speed pedelec, …] |
| 151 | + |
| 152 | +A bad practice would be to try to have a unique product type for modeling all the bikes from the catalog. |
| 153 | +For example, series of product won't necessarily vary on the same attributes. |
| 154 | +TODO: To have one product type per base product can happen. |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | +Mountain Bike (MTB) |
| 160 | +- MTB 4 series |
| 161 | + - Fuji (3776€) (MTBS4-4) |
| 162 | + - Frame: [Diamond, Step-through] |
| 163 | + - TODO |
| 164 | + - Matterhorn (4478€) (MTBS4-5) |
| 165 | + - Annapurna (8091€) (MTBS4-6) |
| 166 | + - Frame: [Diamond w/ suspension] |
| 167 | + - Etna (3369€) (MTBS4-7) |
| 168 | +- MTB 5 series |
| 169 | + - Kilimanjaro (5895€) (MTBS5-0) |
| 170 | + - Stádda (1392€) (MTBS5-1) |
| 171 | + - Aconcagua (6960€) (MTBS5-2) |
| 172 | + - Ventoux (1910€) (MTBS5-3) |
| 173 | + - Castor (4225€) (MTBS5-4) |
| 174 | + |
| 175 | + |
| 176 | +- Create the attribute groups |
| 177 | +- Create the attributes |
| 178 | +- Create the product types |
| 179 | +- Create the products |
| 180 | + |
| 181 | +TODO: Variants |
| 182 | +TODO: [Create custom product code generator strategy](create_product_code_generator.md) |
| 183 | + |
| 184 | +Your new products are in the "Uncategorized products" section of the **Products** admin page. |
| 185 | +It's now time to fix this in the next chapter. |
0 commit comments