Custom Pricing Provider

Vote:
 

Hi, was wondering if (a) is it possible, and (b) has anyone implemented their own pricing provider for commerce? 
Our client stores product pricing in an external database that we'd like to access via the standard commerce pricing interface.

#86461
May 22, 2014 9:31
Vote:
 

Yes, for a it's definitely possible. You'll need to implement IPriceService and IPriceDetailService and then register them in the initialization module.

For b, unfortunately I don't know for sure :)

Regards.

/Q

#86471
May 22, 2014 11:50
Vote:
 

Implementing a custom price service is not very hard. I've created a random price service that creates a random price for an sku if no price exists. Perfect for mocking prices when you don't have your price integration in place.
Is the price source fast enough and reliable enough to integrate it directly? Another solution would be to periodically import the prices to EPi, let's say x times a day. If prices change often or the client needs them to get updated in EPi in almost-real-time you could also make an incremental import every x minutes.

#86881
Jun 03, 2014 23:35
Vote:
 

I am on EPI Server Commerce 7.5. It would be great if I have a refference example on how to create and register your custom pricing module.. 

#87802
Edited, Jun 23, 2014 21:16
Vote:
 

Hi,

As I said, it's quite easy.

In your project, create new two classes:

public class CustomPriceService : IPriceServide

{

//implement custom methods here

}

public class CustomPriceDetailService : IPriceDetailService

{

//implement custom methods here

}

Then you'll need an Initialization module, like this:

[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class InitializationModule : IConfigurableModule
{
public void Initialize(InitializationEngine context)
{

}

public void Preload(string[] parameters)

{

}

public void Uninitialize(InitializationEngine context)
{
}

public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Container.Configure(c => c.For<IPriceServide>().Use<CustomPriceService >());

context.Container.Configure(c => c.For<IPriceDetailServide>().Use<CustomPriceDetailService >());
}

}

Hope this helps.

/Q

#87823
Edited, Jun 24, 2014 10:11
Vote:
 

Hi Quan, 

That's easy now. Is there any chance we can source code for the base IPriceDetailService and IPriceService? 

we will be making very minor change to the current working code so I was wondering if we can utilize the already existing code instead of reinventing the wheel.

Thanks,

syed

#87940
Jun 25, 2014 21:40
Vote:
 

Hi,

I am not allowed to publish source code of EPiServer Commerce - except parts which we made open source. For your purpose, you need to contact our Developer support service or our Expert services for consultant.

Regards.

/Q

#87941
Jun 25, 2014 23:10
Vote:
 


Hi Quan, I thought it was part of the open source. I will contact the development support service. 

Thanks,

Syed

#87942
Jun 25, 2014 23:23
Vote:
 

Hi,

I have implemented my custom price service.

Added both in

Initialization module.


context.Container.Configure(c => c.For<IPriceDetailService>().Singleton().Use<OxxCommerceStarterKit.PriceService.CustomPriceService>());
context.Container.Configure(c => c.For<IPriceService>().Singleton().Use<OxxCommerceStarterKit.PriceService.RandomPriceService>());

But the code is not working when i am importing prices using csv.

Is there anything special i need to do to work it.

Very Urgent.

Please help.

#181315
Aug 16, 2017 9:07
Vote:
 

http://kkhan-episerver.blogspot.nl/2016/12/poc-custom-pricing-provider-works.html

#181328
Aug 16, 2017 13:27
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.