Showing results for 
Search instead for 
Did you mean: 

AddPart - pass a custom price

Former Member
0 Kudos

Hi all

Last month I posted regarding how to use the 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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (0)