on 2025 Jan 24 12:59 PM
Hello Community,
I am trying to enable Variants and tried few things which failed:
1. I wanted to snyc existing catalog to new catalog, copy them to baseproducts with suffix _B and change them to GenericVariantProduct while changing the TypePkString in DB, which failed
2. I tried to write groovy Scripts, but they mostly stopped with timeouts from DB.
3. I tried to export the products but it looks like, that not everything was exported.
My Question here is: is there a simple way to deeply copy Products to save them as GenericVariantProducts with small Category changes? Or can I somehow use the CatalogSyncJob to help me out here?
Maybe Groovy was the right answer, but how can I stop the process from running into timeout?
Or ist here a simple way to use flexible Search in impex to add columns from different table?
I hope someon can help me here, the existing two posts in this board were not helpful.
Cheers,
Serdar
Request clarification before answering.
Additionally, you can programmatically disable the interceptor before saving to bypass the validation.
protected ProductModel convertToVariantProduct(final ProductModel product, final ProductModel baseProduct){
final ComposedTypeModel productType = typeService.getComposedTypeForClass(GenericVariantProductModel.class);
int rows = jdbcTemplate.update("UPDATE products SET TypePkString = ?, p_baseproduct = ? WHERE PK = ?", productType.getPk().getLong(), baseProduct.getPk().getLong(), product.getPk().getLong());
if(rows != 1){
LOG.warn("Could not update TypePK of product {}", product.getCode());
return null;
}
Utilities.invalidateCache(product.getPk());
final GenericVariantProductModel variantProduct = modelService.get(product.getPk());
try {
List<CategoryModel> categories = new ArrayList<>();
variantProduct.setSupercategories(categories);
modelService.save(variantProduct);
return variantProduct;
} catch (Exception ex){
LOG.error("An exception occurred while trying to convert variant product {}", product.getCode(), ex);
}
return null;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good Morning,
sorry for my late response, this wsa a very difficult task for me and it took a lot of time and effort.
First of all ,the links you asked: https://community.sap.com/t5/crm-and-cx-q-a/convert-existing-product-item-type-to-genericvariantprod... and https://community.sap.com/t5/crm-and-cx-q-a/converting-a-non-variant-product-to-variant-product/qaq-...
Actually, the idea of writing a cronjob which synchronize everything from one catalog to another was not a full failure.
I mean I cound not snyc the products to genericvariantproducts, it just created products and I needed to delete them lal, but on the other hand I received all images and other medias which I coud just use.
I could not imagine a full-automated solution but a working one, which took a lot of file-editing time.
1. I exported the products from the old catalog in backoffice using two different impexes.
- I exported text-based information like name, description, summary...
- I exported all codes for other informaiton like unit, medias etc
because I did not have rel variants now, I just created 1:1 relations like for each product in the old catalog I created a baseproduct and a variantproduct in the new catalog in form as <code>_B for baseproduct and <code> for genericvariantproduct, therefore
2. I just created two (Actually 4) impex files where I put simple information for the baseproduct and added _B to code.
To not get cought in timeouts I separeted the impexes between simple information and additional information like medias
Thank you for your help anyway.
Cheers
- Serdar
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.