Commerce Server General - Add Products using Catalog API

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > June 2007 > Add Products using Catalog API





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Add Products using Catalog API
Peter Trell

2007-06-26, 1:17 pm

Hi,
I am adding products to a Catalog using Catalog API.
I create a Product & a Inventory SKU.
BUT in site Inventory is not reflected, for all the products I get "Out of
Stock" message. Could this be because of "No Variant" getting created?

How do I remove the "Varient" being mandatory? because for our product we do
not have Varients.

The Code is
Product oProd = baseCatalog.CreateProduct("LPProdDef", sProductID,
dOriginal_Price, sCategory,....);
oProd["Manufacturer"] = sManufacturer; //custom property
oProd.Save();
// Get the product family from the catalog.
ProductFamily productFamily =
(ProductFamily)baseCatalog.GetProduct(sProductID);
// Add the variant to the product family.
productFamily.AddVariant(sProductID);

//now save the inventory...
InventorySku oSku =
oLPInventoryCatalog.CreateSku(sCatalogName, sProductID, dQuantity,
StockStatus.Enabled);
oSku.Backorderable = true;
oSku.StockOutThreshold = 1;
oSku.Save();


Regards
Peter


Tomas Vera

2007-06-30, 1:26 am

Peter,
After you crete the Product/SKU do you "set" the inventory value
before you query it on the website?

I ask because I can see where you "create" the product and set the
inventory threshold, but if you don't set an inventory value > 1, then
you will always get the "Out of Stock" message.

-tomas

(I hope I didn't overlook something: I'm getting back into CS, it's
been a while!)


On Tue, 26 Jun 2007 07:48:03 -0700, Peter Trell
<PeterTrell@discussions.microsoft.com> wrote:

>Hi,
>I am adding products to a Catalog using Catalog API.
>I create a Product & a Inventory SKU.
>BUT in site Inventory is not reflected, for all the products I get "Out of
>Stock" message. Could this be because of "No Variant" getting created?
>
>How do I remove the "Varient" being mandatory? because for our product we do
>not have Varients.
>
>The Code is
> Product oProd = baseCatalog.CreateProduct("LPProdDef", sProductID,
>dOriginal_Price, sCategory,....);
>oProd["Manufacturer"] = sManufacturer; //custom property
> oProd.Save();
> // Get the product family from the catalog.
> ProductFamily productFamily =
>(ProductFamily)baseCatalog.GetProduct(sProductID);
> // Add the variant to the product family.
> productFamily.AddVariant(sProductID);
>
> //now save the inventory...
> InventorySku oSku =
>oLPInventoryCatalog.CreateSku(sCatalogName, sProductID, dQuantity,
>StockStatus.Enabled);
> oSku.Backorderable = true;
> oSku.StockOutThreshold = 1;
> oSku.Save();
>
>
>Regards
>Peter
>

/*-------------------------------
* Tomas Vera
* tomas (at) sbcglobal (dot) net
*-------------------------------
*/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com