简体   繁体   中英

How to set prices dynamically : nopcommerce

I have created a plugin for NOPCommerce system. The admin add/attach pricing table to the product and store information in new table. Since, i don't wanted to override the original price for the product rather i will change it dynamically.

Because different USER can select different pricing plan when adding product to cart.

Same example: https://www.nopcommerce.com/en/boards/topic/45339/dynamic-pricing-based-on-textbox-product-attributes

If there is any idea/solution related to dynamic price handling for nopcommerce stores, please let me know. Thanks for your time.

You can implement your own pricing logic in your plugin with overriding one of the PriceCalculationSerivce or TaxService services.

Tip: Add this line in Dependency registrar

namespace Nop.Plugin.Misc.MyNewMethod
{
    public class DependencyRegistrar : IDependencyRegistrar
    {
        public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
        {
            builder.RegisterType<NewServiceMyPlugin>().As<IPriceCalculationSerivce>().InstancePerLifetimeScope();
        }
        public int Order
        {
            get
            {
                return 10;
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM