an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Development > General Programming > Help Getting ProductId available in the Product...
Last Post 12/9/2009 6:51:36 AM By tusselman. 2 replies.
12/8/2009 2:50:16 PM
tusselman
Posts: 2
Joined: 9/17/2009
Help Getting ProductId available in the ProductAttributeValue class
Hi,
 
I have a requirement to check the live available quantity in our WMS system and only show attributes for items that are in stock. I am having trouble getting the productId from inside of the ProductAddributeValue class. I would like to have the productId available in the following method:
 
 
     public bool LoadFromDataRow(DataRow row) 
            productAttributeValueId = (int)row["productAttributeValueId"];
            attributeValue = (string)row["value"];
            priceAdjustment = Utils.Round((decimal)row["priceAdjustment"]);
 
Looking for something like this.
            lookUpProduct = product.productid
 
 
Then I can run a method to set the quantity somthing like this:
quantity = myMethod.GetOnhand(lookUpProduct,attributeId);
 
 
// quantity = DBHelper.ToNullableInt(row["quantity"]);
            imageId = DBHelper.ToNullableInt(row["imageId"]);
            string cf = row["CustomFields"] as string;
            CustomFields = new List<CustomField>();
            if (!string.IsNullOrEmpty(cf))</span>
                CustomFields = Utils.FromXml<List<CustomField>>(cf);
            Return true;
        }
 
 
 
Thanks,
Tom Usselman
12/8/2009 5:18:57 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Help Getting ProductId available in the ProductAttributeValue class
You can change store procedure[dbo].[DSC_Product_GetDetailByTempTable] to return extra productId field (see below yellow background)
 
 -- DSC_Product_Attribute_Value
 SELECT pav.*, pa.productId
 FROM dbo.DSC_Product_Attribute_Value pav
 JOIN dbo.DSC_Product_Attribute_Map pa
   ON pa.productAttributeId = pav.productAttributeId
 JOIN #subset_Product products
   ON products.productId = pa.productId
 
Then you can use the following code to get productId.
 
int productId = (int)row["productId"];
DotShoppingCart Staff
12/9/2009 6:51:36 AM
tusselman
Posts: 2
Joined: 9/17/2009
Re: Help Getting ProductId available in the ProductAttributeValue class
Perfect! Thanks for the help!
 
Tom Usselman