Skip to Content
author's profile photo Former Member
Former Member

AddPart - pass a custom price

Hi all

Last month I posted regarding how to use the AddPart function AddPart function

Thanks to everyone who helped me getting it to work.

I used the below version of the AddPart function

public extern bool AddPart(string partno, int quantity, string catalogcode, string categorycode, NPPartPricingMaster priceList);

However I now want to be able to alter the price when I add a part, for example calculating 10% and discounting the price before adding it. I thought the function below would do this as it allows you to pass the price.

public NPOrderDetail AddPart(string partno,int quantity,double price,string catalogcode,string categorycode,int parentOrderDetailID,NPPartPricingMaster priceList);

I've tested this but it just ignores the price value and just adds the part with the default price.

Is it possible to add a custom price using the function above? As it just seems to overwrite what you pass.

Thanks in advance, Andy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 02:05 PM

    Hi Andy,

    Prices are recalculated on cart, shipping and billing pages.

    Most likely what is happening is your discount is being overwritten during the checkout process. You would need to override the system price on all of these pages to get this to work.

    If you are on 2007, you may try tackling the problem in a different way. You could manually add a discount. Take a look at the discounts area in the admin and see if you can buil a discount that suits your needs.

    To apply the disount you would need something like this:

    NPBasePage bp = (NPBasePage)Page;
    NPOrder _order = new NPOrder(bp.UserID, bp.SessionID);
    NPOrderDiscount discount = new NPOrderDiscount("10pctDiscount", bp..ConnectionString);
    int failedCondition = discount.ProcessDiscount(_order, bp.PriceList, bp.CatalogCode);
    if (failedCondition > 0){
    //  handle failure

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.