on 08-03-2007 11:05 AM
Hi all
I'm adding some new functionality to the partdetail page. The idea is to hide the current 'add to basket' button and replace it with my own. This button will then link to my own custom page that validates the quantity the user enters, if its invalid then it will send them back to the partdetail page with an error, the problem I am having is when it is valid. I then need to still do the functionality that the old button did, i.e. ad the item to the cart.
I've found the AddPart function in the netpoint.api help file, but a little unsure how to use it, and which one to use, as there are 4 different versions. Any help would be great. Thanks in advance, Andy
Hi all, been away on holiday for two weeks so haven't posted regarding this. I've got the add part function working now, so thanks guys for helping me out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andy,
For your purposes you can use
public bool AddPart(string partno, int quantity, string catalogcode, string categorycode, NPPartPricingMaster priceList)
The method that takes the parentODID is used for BOMs and Variants. If you are not using them, don't worry about it.
The other method is different only in that it takes notes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can make that call anywhere in your code to add the particular part. I think the partpricing master pricelist value should be the ID of your base price list. You would have to find that in the netpoint PartsPricingmaster table. That tells the order which pricelist to retreive the price from for the item you are adding.
I'm still getting an error
The type or namespace name 'NPPartPricingMaster' could not be found (are you missing a using directive or an assembly reference?)
Here is my code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using netpoint;
using netpoint.classes;
using netpoint.api.commerce;
using netpoint.commerce;
public partial class catalog_controls_validateItem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AddPart("5899 10 0", 16, "Online Catalog", "catcode", 1);
}
public bool AddPart(string partno, int quantity, string catalogcode, string categorycode, NPPartPricingMaster priceList);
}
Thanks for all your help on this Curtis, I am now getting the following error
The best overloaded method match for 'catalog_controls_validateItem.AddPart(string, int, string, string, netpoint.api.catalog.NPPartPricingMaster)' has some invalid arguments
Which I think means that I'm not passing the values correctly, they look ok to me, but I'm unsure on NPPartPricingMaster.GetPriceList
public partial class catalog_controls_validateItem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AddPart("5899 10 0", 16, "catalog", "108-32-226-527", NPPartPricingMaster.GetPriceList);
}
public extern bool AddPart(string partno, int quantity, string catalogcode, string categorycode, NPPartPricingMaster priceList);
}
Its an aspx page with nothing else in it, all it needs to do is add a part to the users shopping cart. Is this possible?
Here is the current code, I'm getting a crazy error though.
public partial class catalog_controls_validateItem : netpoint.classes.NPBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
NPBasePage bp = (NPBasePage)Page;
AddPart("5899 10 0", 16, "catalog", "108-32-226-527", bp.PriceList);
}
public extern bool AddPart(string partno, int quantity, string catalogcode, string categorycode, NPPartPricingMaster priceList);
}
Crazy error:
Could not load type 'catalog_controls_validateItem' from assembly 'App_Web_validateitem.aspx.594775ed.gfvc9nja, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the method 'AddPart' has no implementation (no RVA).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'catalog_controls_validateItem' from assembly 'App_Web_validateitem.aspx.594775ed.gfvc9nja, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the method 'AddPart' has no implementation (no RVA).
Hey Andy,
Not sure why you are doing this:
public extern bool AddPart
All you need to do is add this to your Page_Load:
NPBasePage bp = (NPBasePage)Page;
NPOrder order;
order = new NPOrder(this.bp.UserID, this.bp.SessionID);
order.AddPart("5899 10 0", 16, "catalog", "108-32-226-527", bp.PriceList);
Did you try the suggestion in this posting:
Hey Andy,
Not sure why you are doing this:
public extern bool AddPart
All you need to do is add this to your Page_Load:
NPBasePage bp = (NPBasePage)Page;
NPOrder order;
order = new NPOrder(this.bp.UserID, this.bp.SessionID);
order.AddPart("5899 10 0", 16, "catalog", "108-32-226-527", bp.PriceList);
still no joy
Version 5.9.6.43135
Message Object reference not set to an instance of an object.
Source netpoint
Stack at netpoint.common.controls.header.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.UserControl.OnInit(EventArgs e)
at netpoint.common.controls.header.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child)
at netpoint.classes.NPBasePage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolea)
hey Andy,
You should be able to get the users order with this code
NPOrder order = new NPOrder(this._bp.UserID, this._bp.SessionID);
then you need to call the order.AddPart function and pass the appropriate information including the base price list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the quick reply, I'm getting this error wehn I added the above code.
The type or namespace name 'NPOrder' could not be found (are you missing a using directive or an assembly reference?)
I'm importing the following
<%@ Import Namespace="netpoint.api" %>
<%@ Import Namespace="netpoint.classes" %>
and in the code behind:
using netpoint;
using netpoint.classes;
Also once the above works do I use the order.AddPart function like this
order.AddPart(pass values in here)
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.