cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to customize Europe1PriceFactory and put your custom logic in it?

kundan1986
Explorer
0 Kudos
727

Hi Experts,

In our project a single product can have a multiple price row with a valid stnd end date and we wanted that the price row should be returned based on the price row creation time i.e the most recently created price row. So we thought of overriding the Europe1PriceFactory class and its method - matchPriceRowForPrice() in this method we want to put our custom logic. But although we created a custom price factory but still the OOTB price factory class is called only. Below are the steps that i followed for overriding the price factory. 1. Crated a new class that extends Europe1PriceFacotory public class EtradeEurope1PriceFactory extends Europe1PriceFactory { public PriceRow matchPriceRowForPrice() {

} }

This class i have created in CustomeB2BCoreExtension.

  1. Then injected the bean into customb2bcore-spring.xml

Any help is highly appreciated here.

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Simply add bean in the spring xml file with your price factory class (I've adde in the CompanyCore extention)

<bean id="europe1.manager" class="com.company.core.price.CompanyCatalogAwareEurope1PriceFactory"
     init-method="init" destroy-method="destroy">
   <property name="retrieveChannelStrategy" ref="retrieveChannelStrategy"/>
</bean>

Class file:

public class CompanyCatalogAwareEurope1PriceFactory extends CatalogAwareEurope1PriceFactory {

    @Override
    public PriceValue getBasePrice(AbstractOrderEntry entry) throws JaloPriceFactoryException {
        super.getBasePrice(entry);
    }
}
rohit31_raj92
Active Participant
0 Kudos

Hi @kundan

Please override the below property to make your new custom price factory changes being reflected.

Name of an extension used as the default PriceFactory from the list of installed extensions

default.pricefactory=europe1

Please let me know if this helps you.

kundan1986
Explorer
0 Kudos

So in my case i need to add below key-value in local.proerties right?

default.pricefactory=customeeurope1

Below is the bean definition in spring.xml file

 <bean id="customeeurope1.manager"
     class="com.custom.b2b.core.jalo.CustomeEurope1PriceFactory"
       init-method="init" destroy-method="destroy">
     <property name="retrieveChannelStrategy" ref="retrieveChannelStrategy"/>
 </bean> 
rohit31_raj92
Active Participant
0 Kudos

Yes, you need to override this with your new price factory value..Go ahead and try. Let me know if this helps you

kundan1986
Explorer
0 Kudos

Still not working

Thanks,