Commerce Server General - Creating products from code

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > April 2005 > Creating products from code





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 Creating products from code
Tomas Vera

2005-03-02, 6:03 pm

hello all,

I'm creating a web page that will be used to create new products for
addition to our catalog.

I've got most of the code working except that I am unable to set the
display name of the product.

When I call GetProductProperties, it seems that I only get the items
that are in the "CATALOGNAME_Catalogproducts" table, but not the items
in the "CATALOGNAME_en-US_Catalog" table (which holds the DisplayName
column).

We are only using an english language catalog, so I only have to worry
about the "en-US" language set. But still, I can't set the product's
display name.

Can someone look over this code and tell me where I'm going wrong?

Thank,

-tomas



==== CODE SNIPPET ========
private int CreateNewProduct()
{
Microsoft.CommerceServer.Interop.Catalog.Product product3;;
Microsoft.CommerceServer.Interop.Catalog.ProductCatalog
prodCat3;
IProduct3 newProduct;
string catalogName = lbCatalogs.SelectedValue;
decimal listPrice;
int ccode;



//---------------------------------------------------------------------
// Init the locals

//---------------------------------------------------------------------
ccode = 0;

Microsoft.CommerceServer.Interop.Catalog.CatalogManagerClass
catMan3;


//---------------------------------------------------------------------
// Allocate a new catalog manager class object

//---------------------------------------------------------------------
catMan3 = new CatalogManagerClass();


//---------------------------------------------------------------------
// init the catalog manager

//---------------------------------------------------------------------
catMan3.Initialize(strConnectionString,true);


//---------------------------------------------------------------------
// Get the catalog we need

//---------------------------------------------------------------------
prodCat3 = catMan3.GetCatalog(catalogName);


//---------------------------------------------------------------------
// Set the catalog language to english

//---------------------------------------------------------------------
prodCat3.Language = "en-us";


//---------------------------------------------------------------------
// If there is no bcast cost entry, use the DVD cost,
// otherwise use the Broadcast cost

//---------------------------------------------------------------------
if(tbBcastCost.Text.Length == 0)
listPrice = decimal.Parse(tbDvdCost.Text);
else
listPrice = decimal.Parse(tbBcastCost.Text);


//---------------------------------------------------------------------
// Create the product

//---------------------------------------------------------------------
newProduct = prodCat3.CreateProduct(
"Product_DefName",
tbProductId.Text,
listPrice,
string.Empty);



//---------------------------------------------------------------------
// Get the product we just created

//---------------------------------------------------------------------
product3 = prodCat3.GetProduct(tbProductId.Text);

ADODB._Recordset records;

//---------------------------------------------------------------------
// Get the product properties

//---------------------------------------------------------------------
records = product3.GetProductProperties;


//---------------------------------------------------------------------
// Set the product field values

//---------------------------------------------------------------------
records.Fields["Title"].Value = tbTitle.Text;
records.Fields["Artist"].Value = "Tomas Arstist";

// --- THE FOLLOWING LINE DOES NOT FAIL, BUT
// THE ITEM IS NOT WRITTEN TO DATABASE
records.Fields["DisplayName"].Value = tbTitle.Text;

// I've also tried the following lines with no success
//records.Fields["DisplayName_en-US"].Value = tbTitle.Text;
//records.Fields["DisplayName_en-us"].Value = tbTitle.Text;


product3.SetProductProperties(records,true);

return ccode;
}

======= END OF SNIpPET =========
Vinayak Tadas[MSFT]

2005-03-02, 6:03 pm

Since we did not have DisplayName support for products the
SetProductProperties method will not allow you to save the display name for
the product. You will have to add a custom multilingual property to the
product definition and use it as the display name for the product?
Are you on CS2002 or CS2002 FP1?

--------------------
From: Tomas Vera <tavera@NO_SPAM_sbcglobal.net>
Newsgroups: microsoft.public.commerceserver.general
Subject: Creating products from code
Message-ID: <siub21lb943q7b5blsakkcgsb4e26n0ire@4ax.com>
X-Newsreader: Forte Free Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 136
NNTP-Posting-Host: 216.52.212.200
X-Complaints-To: abuse@prodigy.net
X-Trace: newssvr21.news.prodigy.com 1109785385 ST000 216.52.212.200 (Wed,
02 Mar 2005 12:43:05 EST)
NNTP-Posting-Date: Wed, 02 Mar 2005 12:43:05 EST
Organization: SBC http://yahoo.sbc.com
X-UserInfo1:
SCSGGTCECJWWSVH]]RKB_UDAZZ\DPCPDLXUNNHPI
MASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\
^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_
BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN
Date: Wed, 02 Mar 2005 17:43:05 GMT
Path:
TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fas
twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!newscon02.news.pr
odigy.com!prodigy.net!newsmst01a.news.prodigy.com!prodigy.com!postmaster.new
s.prodigy.com!newssvr21.news.prodigy.com.POSTED!2080ae30!not-for-mail
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15693
X-Tomcat-NG: microsoft.public.commerceserver.general

hello all,

I'm creating a web page that will be used to create new products for
addition to our catalog.

I've got most of the code working except that I am unable to set the
display name of the product.

When I call GetProductProperties, it seems that I only get the items
that are in the "CATALOGNAME_Catalogproducts" table, but not the items
in the "CATALOGNAME_en-US_Catalog" table (which holds the DisplayName
column).

We are only using an english language catalog, so I only have to worry
about the "en-US" language set. But still, I can't set the product's
display name.

Can someone look over this code and tell me where I'm going wrong?

Thank,

-tomas



==== CODE SNIPPET ========
private int CreateNewProduct()
{
Microsoft.CommerceServer.Interop.Catalog.Product product3;;
Microsoft.CommerceServer.Interop.Catalog.ProductCatalog
prodCat3;
IProduct3 newProduct;
string catalogName = lbCatalogs.SelectedValue;
decimal listPrice;
int ccode;



//---------------------------------------------------------------------
// Init the locals

//---------------------------------------------------------------------
ccode = 0;

Microsoft.CommerceServer.Interop.Catalog.CatalogManagerClass
catMan3;


//---------------------------------------------------------------------
// Allocate a new catalog manager class object

//---------------------------------------------------------------------
catMan3 = new CatalogManagerClass();


//---------------------------------------------------------------------
// init the catalog manager

//---------------------------------------------------------------------
catMan3.Initialize(strConnectionString,true);


//---------------------------------------------------------------------
// Get the catalog we need

//---------------------------------------------------------------------
prodCat3 = catMan3.GetCatalog(catalogName);


//---------------------------------------------------------------------
// Set the catalog language to english

//---------------------------------------------------------------------
prodCat3.Language = "en-us";


//---------------------------------------------------------------------
// If there is no bcast cost entry, use the DVD cost,
// otherwise use the Broadcast cost

//---------------------------------------------------------------------
if(tbBcastCost.Text.Length == 0)
listPrice = decimal.Parse(tbDvdCost.Text);
else
listPrice = decimal.Parse(tbBcastCost.Text);


//---------------------------------------------------------------------
// Create the product

//---------------------------------------------------------------------
newProduct = prodCat3.CreateProduct(
"Product_DefName",
tbProductId.Text,
listPrice,
string.Empty);



//---------------------------------------------------------------------
// Get the product we just created

//---------------------------------------------------------------------
product3 = prodCat3.GetProduct(tbProductId.Text);

ADODB._Recordset records;

//---------------------------------------------------------------------
// Get the product properties

//---------------------------------------------------------------------
records = product3.GetProductProperties;


//---------------------------------------------------------------------
// Set the product field values

//---------------------------------------------------------------------
records.Fields["Title"].Value = tbTitle.Text;
records.Fields["Artist"].Value = "Tomas Arstist";

// --- THE FOLLOWING LINE DOES NOT FAIL, BUT
// THE ITEM IS NOT WRITTEN TO DATABASE
records.Fields["DisplayName"].Value = tbTitle.Text;

// I've also tried the following lines with no success
//records.Fields["DisplayName_en-US"].Value = tbTitle.Text;
//records.Fields["DisplayName_en-us"].Value = tbTitle.Text;


product3.SetProductProperties(records,true);

return ccode;
}

======= END OF SNIpPET =========


Thanks
Vinayak Tadas
Microsoft
http://blogs.msdn.com/vinayakt

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Get Secure! For more info visit http://www.microsoft.com/security. Please
reply to the newsgroups only. Thanks

Tomas Vera

2005-03-02, 6:03 pm

Thank you for your quick response.

I'm on FP1.

I've gone over many of the examples on the web, but I'm a bit
confused.

I know how to use the BusinessDesk to create a new multilungual text
property. And I know how to add the property to my product definition
that I use to create the prduct.

But how would I set the value for this property through code?

A code snippet would be much appreciated.

Thanks,

-tomas vera

On Wed, 02 Mar 2005 18:34:01 GMT, vtadas@online.microsoft.com
("Vinayak Tadas[MSFT]") wrote:

>Since we did not have DisplayName support for products the
>SetProductProperties method will not allow you to save the display name for
>the product. You will have to add a custom multilingual property to the
>product definition and use it as the display name for the product?
>Are you on CS2002 or CS2002 FP1?
>
>--------------------
>From: Tomas Vera <tavera@NO_SPAM_sbcglobal.net>
>Newsgroups: microsoft.public.commerceserver.general
>Subject: Creating products from code
>Message-ID: <siub21lb943q7b5blsakkcgsb4e26n0ire@4ax.com>
>X-Newsreader: Forte Free Agent 2.0/32.652
>MIME-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>Lines: 136
>NNTP-Posting-Host: 216.52.212.200
>X-Complaints-To: abuse@prodigy.net
>X-Trace: newssvr21.news.prodigy.com 1109785385 ST000 216.52.212.200 (Wed,
>02 Mar 2005 12:43:05 EST)
>NNTP-Posting-Date: Wed, 02 Mar 2005 12:43:05 EST
>Organization: SBC http://yahoo.sbc.com
>X-UserInfo1:
> SCSGGTCECJWWSVH]]RKB_UDAZZ\DPCPDLXUNNHPI
MASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\
>^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_
>BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN
>Date: Wed, 02 Mar 2005 17:43:05 GMT
>Path:
>TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fas
>twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!newscon02.news.pr
>odigy.com!prodigy.net!newsmst01a.news.prodigy.com!prodigy.com!postmaster.new
>s.prodigy.com!newssvr21.news.prodigy.com.POSTED!2080ae30!not-for-mail
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15693
>X-Tomcat-NG: microsoft.public.commerceserver.general
>
>hello all,
>
>I'm creating a web page that will be used to create new products for
>addition to our catalog.
>
>I've got most of the code working except that I am unable to set the
>display name of the product.
>
>When I call GetProductProperties, it seems that I only get the items
>that are in the "CATALOGNAME_Catalogproducts" table, but not the items
>in the "CATALOGNAME_en-US_Catalog" table (which holds the DisplayName
>column).
>
>We are only using an english language catalog, so I only have to worry
>about the "en-US" language set. But still, I can't set the product's
>display name.
>
>Can someone look over this code and tell me where I'm going wrong?
>
>Thank,
>
>-tomas
>
>
>
>==== CODE SNIPPET ========
>private int CreateNewProduct()
> {
> Microsoft.CommerceServer.Interop.Catalog.Product product3;;
> Microsoft.CommerceServer.Interop.Catalog.ProductCatalog
>prodCat3;
> IProduct3 newProduct;
> string catalogName = lbCatalogs.SelectedValue;
> decimal listPrice;
> int ccode;
>
>
>
>//---------------------------------------------------------------------
> // Init the locals
>
>//---------------------------------------------------------------------
> ccode = 0;
>
> Microsoft.CommerceServer.Interop.Catalog.CatalogManagerClass
>catMan3;
>
>
>//---------------------------------------------------------------------
> // Allocate a new catalog manager class object
>
>//---------------------------------------------------------------------
> catMan3 = new CatalogManagerClass();
>
>
>//---------------------------------------------------------------------
> // init the catalog manager
>
>//---------------------------------------------------------------------
> catMan3.Initialize(strConnectionString,true);
>
>
>//---------------------------------------------------------------------
> // Get the catalog we need
>
>//---------------------------------------------------------------------
> prodCat3 = catMan3.GetCatalog(catalogName);
>
>
>//---------------------------------------------------------------------
> // Set the catalog language to english
>
>//---------------------------------------------------------------------
> prodCat3.Language = "en-us";
>
>
>//---------------------------------------------------------------------
> // If there is no bcast cost entry, use the DVD cost,
> // otherwise use the Broadcast cost
>
>//---------------------------------------------------------------------
> if(tbBcastCost.Text.Length == 0)
> listPrice = decimal.Parse(tbDvdCost.Text);
> else
> listPrice = decimal.Parse(tbBcastCost.Text);
>
>
>//---------------------------------------------------------------------
> // Create the product
>
>//---------------------------------------------------------------------
> newProduct = prodCat3.CreateProduct(
> "Product_DefName",
> tbProductId.Text,
> listPrice,
> string.Empty);
>
>
>
>//---------------------------------------------------------------------
> // Get the product we just created
>
>//---------------------------------------------------------------------
> product3 = prodCat3.GetProduct(tbProductId.Text);
>
> ADODB._Recordset records;
>
>//---------------------------------------------------------------------
> // Get the product properties
>
>//---------------------------------------------------------------------
> records = product3.GetProductProperties;
>
>
>//---------------------------------------------------------------------
> // Set the product field values
>
>//---------------------------------------------------------------------
> records.Fields["Title"].Value = tbTitle.Text;
> records.Fields["Artist"].Value = "Tomas Arstist";
>
> // --- THE FOLLOWING LINE DOES NOT FAIL, BUT
> // THE ITEM IS NOT WRITTEN TO DATABASE
> records.Fields["DisplayName"].Value = tbTitle.Text;
>
> // I've also tried the following lines with no success
> //records.Fields["DisplayName_en-US"].Value = tbTitle.Text;
> //records.Fields["DisplayName_en-us"].Value = tbTitle.Text;
>
>
> product3.SetProductProperties(records,true);
>
> return ccode;
> }
>
>======= END OF SNIpPET =========
>
>
>Thanks
>Vinayak Tadas
>Microsoft
>http://blogs.msdn.com/vinayakt
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>You assume all risk for your use. © 2002 Microsoft Corporation. All rights
>reserved.
>Use of included script samples are subject to the terms specified at
>http://www.microsoft.com/info/cpyright.htm
>Get Secure! For more info visit http://www.microsoft.com/security. Please
>reply to the newsgroups only. Thanks


Tomas Vera

2005-03-02, 6:03 pm

One more question:

The catalog manager is able to edit/update the DisplayName in the
<CATALOG_NAME>_en-US_Catalog table.

How does the catalog manager update the display name for the products
it is creating/editing?

What APIs can we use to mimic this behavior? Or do we need to use SQL
to get/set the DisplayName.

Thank for your help.

-tomas




On Wed, 02 Mar 2005 18:34:01 GMT, vtadas@online.microsoft.com
("Vinayak Tadas[MSFT]") wrote:

>Since we did not have DisplayName support for products the
>SetProductProperties method will not allow you to save the display name for
>the product. You will have to add a custom multilingual property to the
>product definition and use it as the display name for the product?
>Are you on CS2002 or CS2002 FP1?
>
>--------------------
>From: Tomas Vera <tavera@NO_SPAM_sbcglobal.net>
>Newsgroups: microsoft.public.commerceserver.general
>Subject: Creating products from code
>Message-ID: <siub21lb943q7b5blsakkcgsb4e26n0ire@4ax.com>
>X-Newsreader: Forte Free Agent 2.0/32.652
>MIME-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>Lines: 136
>NNTP-Posting-Host: 216.52.212.200
>X-Complaints-To: abuse@prodigy.net
>X-Trace: newssvr21.news.prodigy.com 1109785385 ST000 216.52.212.200 (Wed,
>02 Mar 2005 12:43:05 EST)
>NNTP-Posting-Date: Wed, 02 Mar 2005 12:43:05 EST
>Organization: SBC http://yahoo.sbc.com
>X-UserInfo1:
> SCSGGTCECJWWSVH]]RKB_UDAZZ\DPCPDLXUNNHPI
MASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\
>^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_
>BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN
>Date: Wed, 02 Mar 2005 17:43:05 GMT
>Path:
>TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fas
>twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!newscon02.news.pr
>odigy.com!prodigy.net!newsmst01a.news.prodigy.com!prodigy.com!postmaster.new
>s.prodigy.com!newssvr21.news.prodigy.com.POSTED!2080ae30!not-for-mail
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15693
>X-Tomcat-NG: microsoft.public.commerceserver.general
>
>hello all,
>
>I'm creating a web page that will be used to create new products for
>addition to our catalog.
>
>I've got most of the code working except that I am unable to set the
>display name of the product.
>
>When I call GetProductProperties, it seems that I only get the items
>that are in the "CATALOGNAME_Catalogproducts" table, but not the items
>in the "CATALOGNAME_en-US_Catalog" table (which holds the DisplayName
>column).
>
>We are only using an english language catalog, so I only have to worry
>about the "en-US" language set. But still, I can't set the product's
>display name.
>
>Can someone look over this code and tell me where I'm going wrong?
>
>Thank,
>
>-tomas
>
>
>
>==== CODE SNIPPET ========
>private int CreateNewProduct()
> {
> Microsoft.CommerceServer.Interop.Catalog.Product product3;;
> Microsoft.CommerceServer.Interop.Catalog.ProductCatalog
>prodCat3;
> IProduct3 newProduct;
> string catalogName = lbCatalogs.SelectedValue;
> decimal listPrice;
> int ccode;
>
>
>
>//---------------------------------------------------------------------
> // Init the locals
>
>//---------------------------------------------------------------------
> ccode = 0;
>
> Microsoft.CommerceServer.Interop.Catalog.CatalogManagerClass
>catMan3;
>
>
>//---------------------------------------------------------------------
> // Allocate a new catalog manager class object
>
>//---------------------------------------------------------------------
> catMan3 = new CatalogManagerClass();
>
>
>//---------------------------------------------------------------------
> // init the catalog manager
>
>//---------------------------------------------------------------------
> catMan3.Initialize(strConnectionString,true);
>
>
>//---------------------------------------------------------------------
> // Get the catalog we need
>
>//---------------------------------------------------------------------
> prodCat3 = catMan3.GetCatalog(catalogName);
>
>
>//---------------------------------------------------------------------
> // Set the catalog language to english
>
>//---------------------------------------------------------------------
> prodCat3.Language = "en-us";
>
>
>//---------------------------------------------------------------------
> // If there is no bcast cost entry, use the DVD cost,
> // otherwise use the Broadcast cost
>
>//---------------------------------------------------------------------
> if(tbBcastCost.Text.Length == 0)
> listPrice = decimal.Parse(tbDvdCost.Text);
> else
> listPrice = decimal.Parse(tbBcastCost.Text);
>
>
>//---------------------------------------------------------------------
> // Create the product
>
>//---------------------------------------------------------------------
> newProduct = prodCat3.CreateProduct(
> "Product_DefName",
> tbProductId.Text,
> listPrice,
> string.Empty);
>
>
>
>//---------------------------------------------------------------------
> // Get the product we just created
>
>//---------------------------------------------------------------------
> product3 = prodCat3.GetProduct(tbProductId.Text);
>
> ADODB._Recordset records;
>
>//---------------------------------------------------------------------
> // Get the product properties
>
>//---------------------------------------------------------------------
> records = product3.GetProductProperties;
>
>
>//---------------------------------------------------------------------
> // Set the product field values
>
>//---------------------------------------------------------------------
> records.Fields["Title"].Value = tbTitle.Text;
> records.Fields["Artist"].Value = "Tomas Arstist";
>
> // --- THE FOLLOWING LINE DOES NOT FAIL, BUT
> // THE ITEM IS NOT WRITTEN TO DATABASE
> records.Fields["DisplayName"].Value = tbTitle.Text;
>
> // I've also tried the following lines with no success
> //records.Fields["DisplayName_en-US"].Value = tbTitle.Text;
> //records.Fields["DisplayName_en-us"].Value = tbTitle.Text;
>
>
> product3.SetProductProperties(records,true);
>
> return ccode;
> }
>
>======= END OF SNIpPET =========
>
>
>Thanks
>Vinayak Tadas
>Microsoft
>http://blogs.msdn.com/vinayakt
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>You assume all risk for your use. © 2002 Microsoft Corporation. All rights
>reserved.
>Use of included script samples are subject to the terms specified at
>http://www.microsoft.com/info/cpyright.htm
>Get Secure! For more info visit http://www.microsoft.com/security. Please
>reply to the newsgroups only. Thanks


Vinayak Tadas[MSFT]

2005-04-07, 8:47 pm

See this link. Tgis wil guide you how to use the assemblies
http://blogs.msdn.com/vinayakt/archive/2004/5/28.aspx

Thanks
Vinayak Tadas
Microsoft
http://blogs.msdn.com/vinayakt

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/_cpyright.htm
Get Secure! For more info visit http://www.microsoft.com/secur_ity.
Please
reply to the newsgroups only. Thanks

--------------------
From: Tomas Vera <tavera@NO_SPAM_sbcglobal.net>
Newsgroups: microsoft.public.commerceserver.general
Subject: Re: Creating products from code
Message-ID: <626c21luq9662029m6fj88u4nuta7igq53@4ax.com>
References: <siub21lb943q7b5blsakkcgsb4e26n0ire@4ax.com>
<ITyvqZ1HFHA.1140@TK2MSFTNGXA02.phx.gbl>
X-Newsreader: Forte Free Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Lines: 207
NNTP-Posting-Host: 216.52.212.200
X-Complaints-To: abuse@prodigy.net
X-Trace: newssvr21.news.prodigy.com 1109792953 ST000 216.52.212.200 (Wed,
02 Mar 2005 14:49:13 EST)
NNTP-Posting-Date: Wed, 02 Mar 2005 14:49:13 EST
Organization: SBC http://yahoo.sbc.com
X-UserInfo1:
TSU& #91;@I_AO@SQB]\Y\JKD]_\@VR]^@B@MCPWZKB]M
PXHDUWYAKVUOPCW[ML\JXUCKVFDYZKBMSFX^
OMSAFNTINTDDMVW& #91;X\THOPXZRVOCJTUTPC\_JSBVX\KAOTBAJBVM
ZTYAKMNLDI_MFDSSOLXINH__
FS^\WQGHGI^C@E[A_CF\AQLDQ\BTMPLDFNVUQ_VM
Date: Wed, 02 Mar 2005 19:49:13 GMT
Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTCMTY1.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP0
8.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!
news-FFM2.ecrc.net!newscon06.news.prodigy.com!prodigy.net!newsmst01a.news.pr
odigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr21.news.prodigy.com
.POSTED!2080ae30!not-for-mail
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15697
X-Tomcat-NG: microsoft.public.commerceserver.general

One more question:

The catalog manager is able to edit/update the DisplayName in the
<CATALOG_NAME>_en-US_Catalog table.

How does the catalog manager update the display name for the products
it is creating/editing?

What APIs can we use to mimic this behavior? Or do we need to use SQL
to get/set the DisplayName.

Thank for your help.

-tomas




On Wed, 02 Mar 2005 18:34:01 GMT, vtadas@online.microsoft.com
("Vinayak Tadas[MSFT]") wrote:

>Since we did not have DisplayName support for products the
>SetProductProperties method will not allow you to save the display name

for
>the product. You will have to add a custom multilingual property to the
>product definition and use it as the display name for the product?
>Are you on CS2002 or CS2002 FP1?
>
>--------------------
>From: Tomas Vera <tavera@NO_SPAM_sbcglobal.net>
>Newsgroups: microsoft.public.commerceserver.general
>Subject: Creating products from code
>Message-ID: <siub21lb943q7b5blsakkcgsb4e26n0ire@4ax.com>
>X-Newsreader: Forte Free Agent 2.0/32.652
>MIME-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>Lines: 136
>NNTP-Posting-Host: 216.52.212.200
>X-Complaints-To: abuse@prodigy.net
>X-Trace: newssvr21.news.prodigy.com 1109785385 ST000 216.52.212.200 (Wed,
>02 Mar 2005 12:43:05 EST)
>NNTP-Posting-Date: Wed, 02 Mar 2005 12:43:05 EST
>Organization: SBC http://yahoo.sbc.com
>X-UserInfo1:
> SCSGGTCECJWWSVH]]RKB_UDAZZ\DPCPDLXUNNHPI
MASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_

\
>^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C

_
>BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN
>Date: Wed, 02 Mar 2005 17:43:05 GMT
>Path:
>TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fa

s
>twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!newscon02.news.p

r
>odigy.com!prodigy.net!newsmst01a.news.prodigy.com!prodigy.com!postmaster.ne

w
>s.prodigy.com!newssvr21.news.prodigy.com.POSTED!2080ae30!not-for-mail
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15693
>X-Tomcat-NG: microsoft.public.commerceserver.general
>
>hello all,
>
>I'm creating a web page that will be used to create new products for
>addition to our catalog.
>
>I've got most of the code working except that I am unable to set the
>display name of the product.
>
>When I call GetProductProperties, it seems that I only get the items
>that are in the "CATALOGNAME_Catalogproducts" table, but not the items
>in the "CATALOGNAME_en-US_Catalog" table (which holds the DisplayName
>column).
>
>We are only using an english language catalog, so I only have to worry
>about the "en-US" language set. But still, I can't set the product's
>display name.
>
>Can someone look over this code and tell me where I'm going wrong?
>
>Thank,
>
>-tomas
>
>
>
>==== CODE SNIPPET ========
>private int CreateNewProduct()
> {
> Microsoft.CommerceServer.Interop.Catalog.Product product3;;
> Microsoft.CommerceServer.Interop.Catalog.ProductCatalog
>prodCat3;
> IProduct3 newProduct;
> string catalogName = lbCatalogs.SelectedValue;
> decimal listPrice;
> int ccode;
>
>
>
>//---------------------------------------------------------------------
> // Init the locals
>
>//---------------------------------------------------------------------
> ccode = 0;
>
> Microsoft.CommerceServer.Interop.Catalog.CatalogManagerClass
>catMan3;
>
>
>//---------------------------------------------------------------------
> // Allocate a new catalog manager class object
>
>//---------------------------------------------------------------------
> catMan3 = new CatalogManagerClass();
>
>
>//---------------------------------------------------------------------
> // init the catalog manager
>
>//---------------------------------------------------------------------
> catMan3.Initialize(strConnectionString,true);
>
>
>//---------------------------------------------------------------------
> // Get the catalog we need
>
>//---------------------------------------------------------------------
> prodCat3 = catMan3.GetCatalog(catalogName);
>
>
>//---------------------------------------------------------------------
> // Set the catalog language to english
>
>//---------------------------------------------------------------------
> prodCat3.Language = "en-us";
>
>
>//---------------------------------------------------------------------
> // If there is no bcast cost entry, use the DVD cost,
> // otherwise use the Broadcast cost
>
>//---------------------------------------------------------------------
> if(tbBcastCost.Text.Length == 0)
> listPrice = decimal.Parse(tbDvdCost.Text);
> else
> listPrice = decimal.Parse(tbBcastCost.Text);
>
>
>//---------------------------------------------------------------------
> // Create the product
>
>//---------------------------------------------------------------------
> newProduct = prodCat3.CreateProduct(
> "Product_DefName",
> tbProductId.Text,
> listPrice,
> string.Empty);
>
>
>
>//---------------------------------------------------------------------
> // Get the product we just created
>
>//---------------------------------------------------------------------
> product3 = prodCat3.GetProduct(tbProductId.Text);
>
> ADODB._Recordset records;
>
>//---------------------------------------------------------------------
> // Get the product properties
>
>//---------------------------------------------------------------------
> records = product3.GetProductProperties;
>
>
>//---------------------------------------------------------------------
> // Set the product field values
>
>//---------------------------------------------------------------------
> records.Fields["Title"].Value = tbTitle.Text;
> records.Fields["Artist"].Value = "Tomas Arstist";
>
> // --- THE FOLLOWING LINE DOES NOT FAIL, BUT
> // THE ITEM IS NOT WRITTEN TO DATABASE
> records.Fields["DisplayName"].Value = tbTitle.Text;
>
> // I've also tried the following lines with no success
> //records.Fields["DisplayName_en-US"].Value = tbTitle.Text;
> //records.Fields["DisplayName_en-us"].Value = tbTitle.Text;
>
>
> product3.SetProductProperties(records,true);
>
> return ccode;
> }
>
>======= END OF SNIpPET =========
>
>
>Thanks
>Vinayak Tadas
>Microsoft
>http://blogs.msdn.com/vinayakt
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>You assume all risk for your use. © 2002 Microsoft Corporation. All rights
>reserved.
>Use of included script samples are subject to the terms specified at
>http://www.microsoft.com/info/cpyright.htm
>Get Secure! For more info visit http://www.microsoft.com/security. Please
>reply to the newsgroups only. Thanks



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com