Discount Problem

Hi,

I have to apply one critical discount in Commerce Server. Summary is like this ::

I want to apply the discount that is more benficiary to merchant
Let's suppose we say that we created three order header discount
Discount 1 : 20% (Order Subtotal 10000)
Discount 2: 500 Amount off (Order Subtotal 10000)
Discount 3: 20 % (Order Subtotal 10000)

While Order will be placed we have to apply only that discount which is more benifecery to merchant Is it possible in the commerce server




Answer this question

Discount Problem

  • mikebk

    I take it that you are talking about how to pass values to the Pipeline Context, if so then the following will help:

    The following sample shows how to pass Context values to the Pipeline object.

    Basket basket = CommerceContext.Current.OrderSystem.GetBasket(userID);
    PipelineInfo pipeinfo = new PipelineInfo("Basket");

    pipeinfo["OrderContext"] = CommerceContext.Current.OrderSystem;

    basket.RunPipeline(pipeinfo);

    The following code shows how to retrieve the Context passed into the Pipeline.

    using System;
    using System.Collections.Generic;
    using System.Text;

    using System.Runtime.InteropServices;
    using Microsoft.CommerceServer.Interop;
    using Microsoft.CommerceServer.Runtime;
    using Microsoft.CommerceServer.Interop.Orders;
    using Microsoft.CommerceServer.Runtime.Orders;

    namespace CustomPipeline
    {
    [ComVisible(true)]
    [GuidAttribute ("5904C354-F1B8-485c-89DD-883D26BCE85D")]
    public class Class1 : IPipelineComponent
    {
    // Status codes for pipeline components
    private const Int32 StatusSuccess = 1; // success
    private const Int32 StatusWarning = 2; // warning
    private const Int32 StatusError = 3; // error

    #region IPipelineComponent Members
    public void EnableDesign(int fEnable){}

    public int Execute(object pdispOrder, object pdispContext, int lFlags)
    {
    Int32 ReturnValue = StatusSuccess;

    // How to get our Custom OrderContext
    IDictionary Context = (IDictionary)pdispContext;
    OrderContext myOrderContext = (OrderContext)Context["OrderContext"];

    // How to get MessageManager Context
    IMessageManager MessageManager = (IMessageManager)Context["MessageManager"];

    return ReturnValue;

    }
    #endregion
    }}
    }

    This might help, take a look at the following:

    Commerce Server 2002 Content Selection Framework, Pipeline, and Core Objects

    I know it's 2002 but the idea is the same.

    Good luck,

    -Max



  • polocar

    This does not help me.

    Max, I have two other questions

    Can be add new dictionary in the Context dictionary. If yes then how

    How can be cast the discount cache to use in custom component.

    Thanks



  • fbalas

    I would look into:

    How to Set Discount Interaction Policies

    Also look into creating a Targeting Context and then create an expression based on the Targeting Context. At runtime set the value so the discount can be applied.

    -Max



  • Discount Problem