ba87ad1f by Ean Schuessler

Fixed errors in variant instruction

1 parent 3a39f97b
...@@ -112,71 +112,67 @@ Complete workflow for creating a new product variant with features, pricing, and ...@@ -112,71 +112,67 @@ Complete workflow for creating a new product variant with features, pricing, and
112 ## Overview 112 ## Overview
113 113
114 This workflow creates a new variant product by: 114 This workflow creates a new variant product by:
115 1. Finding the parent product 115 1. Finding an existing variant to clone from (not the virtual parent)
116 2. Cloning parent to create the variant (or creating a new product) 116 2. Cloning the variant to create a new one with the same structure
117 3. Applying distinguishing features to identify this variant 117 3. Updating distinguishing features to identify this variant
118 4. Setting pricing (Current and List prices) 118 4. Setting pricing (if different from cloned variant)
119 5. Linking variant to virtual parent 119 5. Linking variant to virtual parent
120 120
121 ## Step 1: Find Parent Product 121 **Important:** Always clone from an existing variant (e.g., `DEMO_VAR_BU_SM`), not the virtual parent. This ensures the new product has the correct product type, asset settings, and feature structure.
122 122
123 Locate the virtual parent product to clone from. 123 ## Step 1: Find an Existing Variant to Clone
124
125 Locate an existing variant product to use as a template. Choose one with the same size if possible.
124 126
125 ```bash 127 ```bash
126 moqui_browse_screens( 128 moqui_browse_screens(
127 path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct", 129 path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditAssocs",
128 parameters={productId: "DEMO_VAR"} 130 parameters={productId: "DEMO_VAR"}
129 ) 131 )
130 ``` 132 ```
131 133
132 **Expected Result:** 134 **Expected Result:**
133 - Product list showing `DEMO_VAR` with its pseudoId 135 - Shows parent's selectable features and existing variant associations
134 - Note the internal `productId` from the response (or use pseudoId for search) 136 - Find a variant to clone (e.g., `DEMO_VAR_BU_SM` for Blue Small)
135 - Click product link to navigate to EditProduct screen 137 - Note the variant's pseudoId for the next step
136 138
137 **Next Step:** Use the parent product ID for cloning. 139 **Next Step:** Navigate to the variant and clone it.
138 140
139 ## Step 2: Clone Product to Create Variant 141 ## Step 2: Clone Existing Variant
140 142
141 Clone the parent product to create a new variant. This copies features and prices. 143 Navigate to an existing variant's EditProduct screen and clone it.
142 144
143 ```bash 145 ```bash
144 moqui_browse_screens( 146 moqui_browse_screens(
145 path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct", 147 path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct",
146 action="cloneProduct", 148 action="cloneProduct",
147 parameters={ 149 parameters={
148 productId: "DEMO_VAR", 150 productId: "DEMO_VAR_BU_SM",
149 newProductId: "DEMO_VAR_PUR_SM", 151 pseudoId: "DEMO_VAR_PUR_SM",
150 newProductName: "Demo with Variants Purple Small", 152 productName: "Demo with Variants Purple Small",
151 copyFeatures: "Y", 153 copyFeatures: "Y",
152 copyPrices: "Y", 154 copyPrices: "Y",
153 copyCategories: "Y", 155 copyCategories: "Y"
154 copyAssocs: "N",
155 copyContent: "N",
156 copyInventory: "N",
157 copyFacilities: "N",
158 copyProductStore: "N"
159 } 156 }
160 ) 157 )
161 ``` 158 ```
162 159
163 **Parameters:** 160 **Parameters:**
164 - `productId`: Parent product to clone (use pseudoId or internal ID) 161 - `productId`: Existing variant to clone (use pseudoId or internal ID)
165 - `newProductId`: New product's pseudoId (user-visible identifier) 162 - `pseudoId`: New product's pseudoId (user-visible identifier)
166 - `newProductName`: Display name for the variant 163 - `productName`: Display name for the new variant
167 - `copyFeatures`: "Y" to copy features from parent 164 - `copyFeatures`: "Y" to copy features (will need to update color)
168 - `copyPrices`: "Y" to copy pricing from parent 165 - `copyPrices`: "Y" to copy pricing from source variant
169 166
170 **Expected Result:** 167 **Expected Result:**
171 - Response with `status: "executed"` 168 - Response with `status: "executed"`
172 - `actionResult.result.productId` contains the **internal product ID** of the new variant 169 - New variant created with same structure as source
173 - Save this `productId` for all subsequent operations
174 170
175 **Next Step:** Find the new variant product to get its internal `productId`. 171 **Next Step:** Find the new variant and update its features.
176 172
177 ## Step 3: Find New Variant Product 173 ## Step 3: Find New Variant Product
178 174
179 Search for the newly created variant to get its internal `productId`. 175 Search for the newly created variant.
180 176
181 ```bash 177 ```bash
182 moqui_browse_screens( 178 moqui_browse_screens(
...@@ -187,45 +183,47 @@ moqui_browse_screens( ...@@ -187,45 +183,47 @@ moqui_browse_screens(
187 183
188 **Expected Result:** 184 **Expected Result:**
189 - Product list shows `DEMO_VAR_PUR_SM` 185 - Product list shows `DEMO_VAR_PUR_SM`
190 - Click product link to navigate to EditProduct 186 - Note the internal `productId` from the row ref
191 - The response includes the `productId` field - **use this internal ID for all next steps** 187 - The cloned product has Blue features that need to be changed to Purple
188
189 **Next Step:** Update the distinguishing features.
190
191 ## Step 4: Update Distinguishing Features
192 192
193 **Next Step:** Apply distinguishing features to the variant. 193 Remove the copied color feature and apply the correct one. The cloned product has Blue - change to Purple.
194 194
195 ## Step 4: Apply Distinguishing Features 195 First, view current features:
196 ```bash
197 moqui_browse_screens(
198 path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct",
199 parameters={productId: "DEMO_VAR_PUR_SM"}
200 )
201 ```
196 202
197 Apply features that make this variant unique (e.g., Purple color, Small size). 203 Then update the color feature using `updateProductFeatureAppl` to expire the old one and `applyProductFeatures` to add the new one:
198 204
199 ```bash 205 ```bash
200 moqui_browse_screens( 206 moqui_browse_screens(
201 path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct", 207 path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct",
202 action="applyProductFeatures", 208 action="applyProductFeatures",
203 parameters={ 209 parameters={
204 productId: "100000", 210 productId: "DEMO_VAR_PUR_SM",
205 productFeatureIdList: ["ColorPurple", "SizeSmall"], 211 productFeatureIdList: ["ColorPurple"],
206 applTypeEnumId: "PfatDistinguishing", 212 applTypeEnumId: "PfatDistinguishing"
207 fromDate: "2026-01-23"
208 } 213 }
209 ) 214 )
210 ``` 215 ```
211 216
212 **Parameters:** 217 **Parameters:**
213 - `productId`: **Internal product ID** from Step 3 (NOT the pseudoId!) 218 - `productId`: The new variant's ID
214 - `productFeatureIdList`: Array of feature IDs to apply 219 - `productFeatureIdList`: Array of feature IDs to apply
215 - Must be existing features (use `moqui_get_screen_details` to list available options) 220 - `applTypeEnumId`: "PfatDistinguishing" for variants
216 - Example: `["ColorPurple", "SizeSmall"]`
217 - `applTypeEnumId`: "PfatDistinguishing" for variants (NOT "PfatSelectable")
218 - `fromDate`: Optional, defaults to current date
219
220 **Expected Result:**
221 - Response with `status: "executed"`
222 - ProductFeatures grid shows the applied features
223 221
224 **Available Feature Types:** 222 **Available Feature Types:**
225 - Colors: `ColorRed`, `ColorBlue`, `ColorGreen`, `ColorPurple`, `ColorBlack`, `ColorWhite` 223 - Colors: `ColorRed`, `ColorBlue`, `ColorGreen`, `ColorPurple`, `ColorBlack`, `ColorWhite`
226 - Sizes: `SizeSmall`, `SizeMedium`, `SizeLarge`, `SizeXL` 224 - Sizes: `SizeSmall`, `SizeMedium`, `SizeLarge`, `SizeXL`
227 225
228 **Next Step:** Set pricing for the variant. 226 **Next Step:** Update pricing if needed.
229 227
230 ## Step 5: Add Current Price 228 ## Step 5: Add Current Price
231 229
......