cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to modify the europe1 price factory methods

Former Member
0 Kudos

Hi Experts,

We have a requirement where we will have two prices based on different value in our PriceRow Model. PriceType=A or B.

We need to fetch both the values of these product prices .to achieve this we have extended the DefaultCommercePriceService's getWebPriceForProduct () method.

we are facing a challenge here Since PriceRow is a JALO layer class we dont have an access to our newly added attribute "priceType".

How can we fetch the price for Product.What is the best solution for such scenario?.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

  1. You will need to create a CustomPriceRowModel to add you prop "priceType" and then you may have to change the uniqueKeyAttributeQualifier so you don't have a duplicate key.

  2. Then you have to make sure you always create a CustomPriceRowModel instead of the standard. Make sure you use your custom createPriceInformation function. you can extend CatalogAwareEurope1PriceFactory

with

     <bean id="customeurope1.manager" class="<your.package>.core.catalog.jalo.CustomCatalogAwareEurope1PriceFactory"
       init-method="init" destroy-method="destroy">
     <property name="retrieveChannelStrategy" ref="retrieveChannelStrategy"/>
     </bean>


In the end, you can filter your priceRowModel in your CustomCommercePriceService => getWebPriceForProduct () method.

And finally tell hybris to use your factory

 default.pricefactory=customeurope1


Hope it helps.

Former Member
0 Kudos

Thanks for your reply. Added my Comments below

Answers (6)

Answers (6)

Former Member
0 Kudos

thanks for the response, this is a very interesting scenario. Now if I understand it correct, a retail price is per unit of a product/item and wholesale price would be for multiple units (like a box, a dozen, a carton). I think the approach you are taking involves lots of risks when it comes to calculations, you don't want to change calculation services to create a tight dependency. I found this from wiki, it might be helpful, perhaps this might be the solution for you. https://wiki.hybris.com/display/release5/europe1+Pricing+System+Guide#europe1PricingSystemGuide-Scal...

P.s: I've not tried this, but I can try this tomorrow if I get some time and check if it works though. If you happen to try, do let me know.

Former Member
0 Kudos

Thanks AK for your responcse.BTW for us Retail and WholeSale price is per piece of the product.

What we want is to use the wholeSale price of the product always.and our Retail price is for display purpose.

So logic here should be chk the PriceType of priceRow and if it is wholesale then set the price.

But i cant do this simple logic as all our Pricing is done on Price which is JALO :(

Former Member
0 Kudos

ok, your terminology is so confusing. Looks like hybris don't have a concept for List price and Sale price. If you are using only one price always, then refer to this link below. check the comment by Luke/. https://answers.sap.com/questions/12756728/is-there-an-ootb-functionality-to-show-the-actual.html

I would say this would be the best solution, not a lot of code changes, and no changes to calculation service.

Former Member
0 Kudos

Thanks AK for your response,

Which solution you feel is Good?.

The question for us still remains open how do we filer if it is WholeSale or Retail Price?. Since to compare those we need access to those Pricetype values in our Service which i Don't have.

I wonder why anyone not faced this issue before,looks like a common scenario.Same as your question.

Former Member
0 Kudos

from the previous link I shared, creating another attribute to PriceRow say retailPrice in your case, and the wholesale price should be read from OoB price field from PriceRow, would be the best solution. If you still want to stick to your approach of priceType attribute, from what @Jean suggested, pricerow.getAttribute("customProp"); should work. But remember you need to tell the calculationservices what price to pull which is not that easy. And this is not a common scenario, I don't think anyone would recommend what you are trying to do.

Former Member
0 Kudos

is something finalized on this?

Former Member
0 Kudos

Hi Sagar, Could you tell me how this PriceType is defined? is it based on a usergroup or any other criteria?

Former Member
0 Kudos

Hi ak,

Its one of the attribute in PriceRowModel "PriceType" (has possible value of wholeSale or Retail).

We need to show both the prices on our Pages.Listing is it is fine as i can get the PriceRowModel and Get access to my PriceType attribute.

But on rest pages and calculation is little tricky as all pricing works on Price(which is JALO Type) and here i dont have access to "priceType" attribute so i cant filer the prices as WholeSale ot Retail price.

Former Member
0 Kudos

posted as another answer, due to character limit.

Former Member
0 Kudos

Hi Experts,

Any solution for above question?

Former Member
0 Kudos

Hi , What we are looking at is to modify the filter PriceRow to include one more attribute "priceType".

in DefaultCommercePriceService --> getWebPriceForProduct() we dont have an access to PriceRowModel model.What we get is PriceInfomation. final List prices = getPriceService().getPriceInformationsForProduct(product);

The priceInformation have PriceRow which is JALO class.And aslo PriceInformation we are getting is already filtered based unit,minquantity and currency.

In our case we have two prices with same Currency and min quantity (They are differenciated based on PricType say A and B).So the code is ignoring the second price.

we cant extend the method as it works on PriceRow which is Jalo and it dont have any information about PriceType.

How should we go ahead?.

Former Member
0 Kudos

I think you should override the price factory as said and you may go with Jalo class in order to get your right price.

Former Member
0 Kudos

What we are looking is: In your suggested method :getPriceInformationForProduct() we are fetching the prooduct(JALO ) and then working on those

// TODO: Re-Implement with PriceFactoryService final Product productItem = (Product) getModelService().getSource(product); final User userItem = getModelService().getSource(currentUser);

The Product is a JALO class. And priceInformation is also JALO class.We dont have access to our new attributes on which we can write a filtering logic.

Can you help us to find a solution?.

Former Member
0 Kudos

You can access custom properties with getAttribute on Jalo class. like

 pricerow.getAttribute("customProp");

former_member537989
Contributor
0 Kudos

Its not clear what are you looking for - if you need to get attribute from PriceRow - just call a method getAttribute(String attributeName) on PriceRow instance

Former Member
0 Kudos

Anyone Has done this before?