Developer forum

Forum » Development » Can't Get Product info in a Custom Module

Can't Get Product info in a Custom Module

Michael Pedersen
Reply

So i'm developing my first custom module and i'm trying to get informations about eCommerce Products based on the products ProductID.

code:

if (!String.IsNullOrEmpty(Request.QueryString["ProductID"]))

    prodId = Request.QueryString["ProductID"].ToString();

Product p = new Product(prodId);

string name=p.Name;

 

My problem seems to be getting a hold of the Product in the first case, is this incorrect use of the Product constructor?

I can't seem to find any documentation that tells me how to get product information, but it seems to me that it should be a rather common issue so i'm probably not looking in the right places.

 


Replies

 
Mikkel Høst
Reply

Hi Michael.

Try 

Dynamicweb.eCommerce.Products.Product.GetProductByID(prodId);
 
Mikkel Høst
Reply

and FYI - When you find yourself in a situation like this in DW reflect the dll - this is the best documentation you can get.

 

http://ilspy.net/

 

 
Michael Pedersen
Reply

getProductById doesn't seem to be available in the assembly i'm working with. I'm coding for DynamicWeb version 19.2.7.0 assembly version 18.9.1.1.

It's a fairly old build, but my client doesn't want to upgrade, so what can a man do...

 
Michael Pedersen
Reply

i'm probably gonna have to default to getProductBySQL, but thx for your input, and thx for the tip on the decompiler, should be usefull.

 
Mikkel Høst
Reply

NP have fun :)

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Michael,

 

In DW7.2, you can use either the constructor or the static Product.Create. Both should work. GetProductByID was added in DW8.

 

- Jeppe

 

You must be logged in to post in the forum