Commerce Server General - Filtering a product collection

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > June 2004 > Filtering a product collection





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 Filtering a product collection
Telmo Brito

2004-06-20, 11:04 pm

Hi,

I would like to know how can I show just the products of a given author?

I am using the searchoptions and I would like to add something like a WHERE clause in the searchoptions. For ex. Where author = 'Mark Spencer'

The code that I have is as follows:

CatalogSearchOptions searchOptions = new CatalogSearchOptions();

searchOptions.ClassTypes = CatalogClassTypes.ProductClass;
searchOptions.SortProperty = "classified_date";
searchOptions.SortAscending = false;

ProductCollection productList = new ProductCollection(catalogName,CategoryNa
me, searchOptions);


Thank-you,

Telmo Brito

Vinayak Tadas[MSFT]

2004-06-20, 11:28 pm

CatalogSearchOptions searchOptions = new CatalogSearchOptions();

searchOptions.ClassTypes = CatalogClassTypes.ProductClass;
searchOptions.SortProperty = "classified_date";
searchOptions.SortAscending = false;
searchOptions.PropertiesToReturn="[ProductId],[cy_list_price]"; // Add
additional properties you are interested in
CatalogSearch catalogSearch = new CatalogSearch(searchOptions );
catalogSearch.SqlWhereClause = " [author] = N'Mark Spencer' ";
int totalRecords = 0;
DataSet products = catalogSearch.Search(out totalRecords);

totalRecords will return the number of records that match [author] =
N'Mark Spencer'
products is the dataset containing product information which you can bind
to a control

See this link if it helps
http://weblogs.asp.net/vinayakt/arc.../04/125476.aspx





--------------------
Thread-Topic: Filtering a product collection
thread-index: AcRSI58wJ21dRNC7QXmEQz3M/WdtXA==
X-WBNR-Posting-Host: 81.193.124.143
From: "=?Utf-8?B?VGVsbW8gQnJpdG8=?=" <Telmo Brito@discussions.microsoft.com>
Subject: Filtering a product collection
Date: Mon, 14 Jun 2004 08:24:02 -0700
Lines: 21
Message-ID: <9391DCD3-6529-4BCD-9EFB-71B089415E40@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 127.0.0.1
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.commerceserver.general:13985
X-Tomcat-NG: microsoft.public.commerceserver.general

Hi,

I would like to know how can I show just the products of a given author?

I am using the searchoptions and I would like to add something like a WHERE
clause in the searchoptions. For ex. Where author = 'Mark Spencer'

The code that I have is as follows:

CatalogSearchOptions searchOptions = new CatalogSearchOptions();

searchOptions.ClassTypes = CatalogClassTypes.ProductClass;
searchOptions.SortProperty = "classified_date";
searchOptions.SortAscending = false;

ProductCollection productList = new
ProductCollection(catalogName,CategoryNa
me, searchOptions);


Thank-you,

Telmo Brito



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

Telmo Brito

2004-06-26, 10:49 am

Hi Vinayak,

Thanks for your reply. I'm new to .net and commerce I would like do know how can this Dataset be a ProductCollection. I don't want to change to much code from the code that I have.

Thanks,
Telmo Brito

"Vinayak Tadas[MSFT]" wrote:

> CatalogSearchOptions searchOptions = new CatalogSearchOptions();
>
> searchOptions.ClassTypes = CatalogClassTypes.ProductClass;
> searchOptions.SortProperty = "classified_date";
> searchOptions.SortAscending = false;
> searchOptions.PropertiesToReturn="[ProductId],[cy_list_price]"; // Add
> additional properties you are interested in
> CatalogSearch catalogSearch = new CatalogSearch(searchOptions );
> catalogSearch.SqlWhereClause = " [author] = N'Mark Spencer' ";
> int totalRecords = 0;
> DataSet products = catalogSearch.Search(out totalRecords);
>
> totalRecords will return the number of records that match [author] =
> N'Mark Spencer'
> products is the dataset containing product information which you can bind
> to a control
>
> See this link if it helps
> http://weblogs.asp.net/vinayakt/arc.../04/125476.aspx
>
>
>
>
>
> --------------------
> Thread-Topic: Filtering a product collection
> thread-index: AcRSI58wJ21dRNC7QXmEQz3M/WdtXA==
> X-WBNR-Posting-Host: 81.193.124.143
> From: "=?Utf-8?B?VGVsbW8gQnJpdG8=?=" <Telmo Brito@discussions.microsoft.com>
> Subject: Filtering a product collection
> Date: Mon, 14 Jun 2004 08:24:02 -0700
> Lines: 21
> Message-ID: <9391DCD3-6529-4BCD-9EFB-71B089415E40@microsoft.com>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="Utf-8"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Content-Class: urn:content-classes:message
> Importance: normal
> Priority: normal
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> Newsgroups: microsoft.public.commerceserver.general
> NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 127.0.0.1
> Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> Xref: cpmsftngxa10.phx.gbl microsoft.public.commerceserver.general:13985
> X-Tomcat-NG: microsoft.public.commerceserver.general
>
> Hi,
>
> I would like to know how can I show just the products of a given author?
>
> I am using the searchoptions and I would like to add something like a WHERE
> clause in the searchoptions. For ex. Where author = 'Mark Spencer'
>
> The code that I have is as follows:
>
> CatalogSearchOptions searchOptions = new CatalogSearchOptions();
>
> searchOptions.ClassTypes = CatalogClassTypes.ProductClass;
> searchOptions.SortProperty = "classified_date";
> searchOptions.SortAscending = false;
>
> ProductCollection productList = new
> ProductCollection(catalogName,CategoryNa
me, searchOptions);
>
>
> Thank-you,
>
> Telmo Brito
>
>
>
> 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

Telmo Brito

2004-06-26, 10:49 am

Hi Vinayak,

Solved the ProductCollection problem, just changed it to:
ProductSearchCollection productList = new ProductSearchCollection(catalogSearchRes
ult);

I'm having trouble in showing only the products of a specific author in a specific category. It shows me always the same products of the correct author but the product doesn't belong to that category.

Thanks again,
Telmo

"Telmo Brito" wrote:
[vbcol=seagreen]
> Hi Vinayak,
>
> Thanks for your reply. I'm new to .net and commerce I would like do know how can this Dataset be a ProductCollection. I don't want to change to much code from the code that I have.
>
> Thanks,
> Telmo Brito
>
> "Vinayak Tadas[MSFT]" wrote:
>
Vinayak Tadas[MSFT]

2004-06-26, 10:49 am

I am not sure what code you have but if you are having a problem with the
products from another category being displayed then you can fix this by
setting the
CategoryName property to the desired category. The search will then display
only the results in this category.
Something like
CatalogSearch catalogSearch = new CatalogSearch(searchOptions );
catalogSearch.CategoryName = "Category to search";

--------------------
Thread-Topic: Filtering a product collection
thread-index: AcRa3xNrM483QkVIQdGEH6rPr68E5w==
X-WBNR-Posting-Host: 81.193.124.143
From: "=?Utf-8?B?VGVsbW8gQnJpdG8=?=" <TelmoBrito@discussions.microsoft.com>
References: <9391DCD3-6529-4BCD-9EFB-71B089415E40@microsoft.com>
<IYaXUuDVEHA.1996@cpmsftngxa10.phx.gbl>
<D96CF534-340E-46DD-930D-BEFF6F1B13A3@microsoft.com>
Subject: RE: Filtering a product collection
Date: Fri, 25 Jun 2004 11:06:02 -0700
Lines: 106
Message-ID: <C50AADA8-C51E-40EE-9FC2-83432E6D47F9@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 127.0.0.1
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.commerceserver.general:14085
X-Tomcat-NG: microsoft.public.commerceserver.general

Hi Vinayak,

Solved the ProductCollection problem, just changed it to:
ProductSearchCollection productList = new
ProductSearchCollection(catalogSearchRes
ult);

I'm having trouble in showing only the products of a specific author in a
specific category. It shows me always the same products of the correct
author but the product doesn't belong to that category.

Thanks again,
Telmo

"Telmo Brito" wrote:

> Hi Vinayak,
>
> Thanks for your reply. I'm new to .net and commerce I would like do know

how can this Dataset be a ProductCollection. I don't want to change to much
code from the code that I have.[vbcol=seagreen]
>
> Thanks,
> Telmo Brito
>
> "Vinayak Tadas[MSFT]" wrote:
>
bind[vbcol=seagreen]
Brito@discussions.microsoft.com>[vbcol=seagreen]
WHERE[vbcol=seagreen]
rights.[vbcol=seagreen]
rights[vbcol=seagreen]
Please[vbcol=seagreen]


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