Create ProductListPrice for ProductBO

70 Views Asked by At

Is it possible to create product list price on ProductBO object? I know how to do it with ProductPO:

productPriceMgr.createProductListPrice(product, new Money("EUR", BigDecimal.ZERO));

But I can't find equivalent with Product business object.

Thank you for your help!

2

There are 2 best solutions below

2
On BEST ANSWER

Although i'm not 100% sure, i don't think it's possible to create a list price on a ProductBO object. Looking at the default ISH pipelets it seems like all the list price modifications are done on ProductPO objects and never on ProductBO objects.

As a workaround you could convert your ProductBO to a ProductPO with this generic conversion method:

public <T extends PersistentObject> T convertBOToPersistentObject(BusinessObject bo) 
{
    return bo.getExtension(PersistentObjectBOExtension.class).getPersistentObject();
}
0
On

The ProductBO API is serving as a generic thing. If the functionality to create a product list price is not available, I'd say you need to write a BO extension that will provide you with exactly that. Here you can find documentation on that topic: https://support.intershop.com/kb/index.php/Display/27K270

One note of advice: When creating objects in the database, a transaction must be in progress. Also CSRF token must be present in order to start the transaction. I don't know your use case, but I'd rather think that this functionality must be accessible to management backoffice users only.