on 2019 Jul 05 5:35 PM
Hello,
I have created a custom attribute in PriceRowModel, say someCustomAttr. I need this attribute to be available on the front end as well for the product page. I have multiple price rows for each product and I choose the appropriate PriceInformation using some condition in the PriceService which internally uses PriceFactory. Below is the code snippet for it:
PriceInformation selectedPrice = null;
final List<PriceInformation> prices = getPriceService().getPriceInformationsForProduct(product);
for (final PriceInformation price : prices)
{
if(some filter condition)
{
selectedPrice = price;
}
}
return selectedPrice;
Now that I have the PriceInformation, I can create a PriceData object and assign to the Product. Below is the code snippet for it:
protected PriceData createPriceData(final PriceDataType priceType, final PriceInformation priceInfo)
{
return getPriceDataFactory().create(priceType, BigDecimal.valueOf(priceInfo.getPriceValue().getValue()),
priceInfo.getPriceValue().getCurrencyIso());
}
But how can I populate my custom attribute from PriceRowModel to PriceData. Kindly provide a recommended approach for this.
Thanks in advance!
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 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.