multicloud_rule_manager 1.1.87 → 1.1.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/retrieveproduct.js +75 -71
- package/package.json +1 -1
|
@@ -196,80 +196,84 @@ export default {
|
|
|
196
196
|
|
|
197
197
|
console.log(`📂 Totale categorie: ${categories.length}`);
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
for (const child of children) {
|
|
229
|
-
rows1.push({
|
|
230
|
-
"Product Name": !lastProductWritten ? product.name : "",
|
|
231
|
-
"Product Eligible": !lastProductWritten
|
|
232
|
-
? productStructureRoot.eligible
|
|
233
|
-
: "",
|
|
234
|
-
"Category Name": isNewCategory ? cat.name : "",
|
|
235
|
-
"Category Visible": isNewCategory ? cat.visible : "",
|
|
236
|
-
"Category Visible Cart": isNewCategory
|
|
237
|
-
? cat.visible_cart
|
|
238
|
-
: "",
|
|
239
|
-
"Category Min Qty": isNewCategory ? cat.min_qty : "",
|
|
240
|
-
"Category Dft Qty": isNewCategory ? cat.default_qty : "",
|
|
241
|
-
"Category Max Qty": isNewCategory ? cat.max_qty : "",
|
|
242
|
-
"Child Product Name": child.name,
|
|
243
|
-
"Child Visible": child.visible,
|
|
244
|
-
"Child Visible Cart": child.visible_cart,
|
|
245
|
-
"Child Min Qty": child.min_qty,
|
|
246
|
-
"Child Dft Qty": child.default_qty,
|
|
247
|
-
"Child Max Qty": child.max_qty,
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
lastProductWritten = true;
|
|
251
|
-
lastCategory = cat.name;
|
|
252
|
-
|
|
253
|
-
if (!child.product_id) continue;
|
|
254
|
-
|
|
255
|
-
const families = await getFamilies(child.product_id);
|
|
256
|
-
|
|
257
|
-
for (const f of families) {
|
|
258
|
-
for (const attr of f.attributes) {
|
|
259
|
-
for (const dom of attr.domains) {
|
|
260
|
-
rows2.push({
|
|
261
|
-
product: product.name,
|
|
262
|
-
category: cat.name,
|
|
263
|
-
child: child.name,
|
|
264
|
-
family: f.name,
|
|
265
|
-
attribute: attr.name,
|
|
266
|
-
domain_value: dom.value,
|
|
199
|
+
let lastProductWritten = false;
|
|
200
|
+
let lastCategory = null;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
for (const cat of categories) {
|
|
204
|
+
const children = getChildren(cat.guid);
|
|
205
|
+
|
|
206
|
+
console.log(
|
|
207
|
+
`➡️ Categoria "${cat.name}" → ${children.length} children`
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
totalChildren += children.length;
|
|
211
|
+
|
|
212
|
+
const isNewCategory = lastCategory !== cat.name;
|
|
213
|
+
|
|
214
|
+
if (children.length === 0) {
|
|
215
|
+
rows1.push({
|
|
216
|
+
"Product Name": !lastProductWritten ? product.name : "",
|
|
217
|
+
"Product Eligible": !lastProductWritten
|
|
218
|
+
? productStructureRoot.eligible
|
|
219
|
+
: "",
|
|
220
|
+
"Category Name": isNewCategory ? cat.name : "",
|
|
221
|
+
"Category Visible": isNewCategory ? cat.visible : "",
|
|
222
|
+
"Category Visible Cart": isNewCategory
|
|
223
|
+
? cat.visible_cart
|
|
224
|
+
: "",
|
|
225
|
+
"Child Product Name": "",
|
|
267
226
|
});
|
|
227
|
+
|
|
228
|
+
lastProductWritten = true;
|
|
229
|
+
lastCategory = cat.name;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
for (const child of children) {
|
|
233
|
+
rows1.push({
|
|
234
|
+
"Product Name": !lastProductWritten ? product.name : "",
|
|
235
|
+
"Product Eligible": !lastProductWritten
|
|
236
|
+
? productStructureRoot.eligible
|
|
237
|
+
: "",
|
|
238
|
+
"Category Name": isNewCategory ? cat.name : "",
|
|
239
|
+
"Category Visible": isNewCategory ? cat.visible : "",
|
|
240
|
+
"Category Visible Cart": isNewCategory
|
|
241
|
+
? cat.visible_cart
|
|
242
|
+
: "",
|
|
243
|
+
"Category Min Qty": isNewCategory ? cat.min_qty : "",
|
|
244
|
+
"Category Dft Qty": isNewCategory ? cat.default_qty : "",
|
|
245
|
+
"Category Max Qty": isNewCategory ? cat.max_qty : "",
|
|
246
|
+
"Child Product Name": child.name,
|
|
247
|
+
"Child Visible": child.visible,
|
|
248
|
+
"Child Visible Cart": child.visible_cart,
|
|
249
|
+
"Child Min Qty": child.min_qty,
|
|
250
|
+
"Child Dft Qty": child.default_qty,
|
|
251
|
+
"Child Max Qty": child.max_qty,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
lastProductWritten = true;
|
|
255
|
+
lastCategory = cat.name;
|
|
256
|
+
|
|
257
|
+
if (!child.product_id) continue;
|
|
258
|
+
|
|
259
|
+
const families = await getFamilies(child.product_id);
|
|
260
|
+
|
|
261
|
+
for (const f of families) {
|
|
262
|
+
for (const attr of f.attributes) {
|
|
263
|
+
for (const dom of attr.domains) {
|
|
264
|
+
rows2.push({
|
|
265
|
+
product: product.name,
|
|
266
|
+
category: cat.name,
|
|
267
|
+
child: child.name,
|
|
268
|
+
family: f.name,
|
|
269
|
+
attribute: attr.name,
|
|
270
|
+
domain_value: dom.value,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
268
275
|
}
|
|
269
276
|
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
277
|
|
|
274
278
|
// =========================
|
|
275
279
|
// 📊 RISULTATI
|