Hi,
Please help me to resolve this problem ...
i am using
" ProductList.DataSource = ProductList.DataSource = ProductDataSource.GetRandomFeaturedProducts(int.Parse(Request.QueryString["cID"].ToString()), true, this.Size);"
and
int categoryId = PageHelper.GetCategoryId();
ProductList.DataSource = ProductDataSource.GetFeaturedProducts(categoryId, true,8);
"GetRandomFeaturedProducts" and "GetFeaturedProducts" both are using for displaying the featured products list , but in this methodology we have to check the "FEATURED" option ,it is not a correct way to display product (Catelog) but on the other hand if i want to display product without checking "FEATURED" option (in admin module)so what we should do...
in this functionality if we are not checking "Featured" option so that products are not displaiyng in catalog list these products are invisible ...
so what we can use instead of featured product for displaying the product in front end.....
Regards
Rohit Srivastava
Featured Product
Re: Featured Product
If you want to show products from some category you can do this as below
Code: Select all
CommerceBuilder.Catalog.CatalogNodeCollection nodes = CommerceBuilder.Catalog.CatalogDataSource.LoadForCategory(categoryId,true);
ProductCollection products = new ProductCollection();
foreach(CommerceBuilder.Catalog.CatalogNode node in nodes)
{
if(node.CatalogNodeType == CommerceBuilder.Catalog.CatalogNodeType.Product)
products.Add((Product)node.ChildObject);
}
ProductList.DataSource = products;
-
- Ensign (ENS)
- Posts: 17
- Joined: Thu Dec 18, 2008 8:28 am
Re: Featured Product
Hi,
Thanks a lot for your help , but please guide me where i have to place this code ?
and can all the products will display without click (check) "Featured" option ?
i have place this code to page load on "FeaturedProductGrid.ascx" and commented previos one...
but it is not working , there is no products are displying whether it is Featured or non Featured
Thanks And regards
Atul khare
Thanks a lot for your help , but please guide me where i have to place this code ?
and can all the products will display without click (check) "Featured" option ?
i have place this code to page load on "FeaturedProductGrid.ascx" and commented previos one...
but it is not working , there is no products are displying whether it is Featured or non Featured
Thanks And regards
Atul khare
Re: Featured Product
Yes this code will list the products belonging to any category you specified in categoryId, it will not care that featured products check box is checked or not. For example if you have a category named "Test Cat" and wants show all its products in featured products grid control then first you have a take a look at the ac_Categories table to find out the CategoryId of this category, suppose the category id for "Test Cat" was 5. Then edit the featrued products grid and locate the following line of code in it.
and change it as below
Where LoadForCategory(5,true) means load all items of "Test Cat"
Code: Select all
ProductList.DataSource = ProductDataSource.GetRandomFeaturedProducts(0, true, this.Size);
Code: Select all
CommerceBuilder.Catalog.CatalogNodeCollection nodes = CommerceBuilder.Catalog.CatalogDataSource.LoadForCategory(5,true);
ProductCollection products = new ProductCollection();
foreach(CommerceBuilder.Catalog.CatalogNode node in nodes)
{
if(node.CatalogNodeType == CommerceBuilder.Catalog.CatalogNodeType.Product)
products.Add((Product)node.ChildObject);
}
ProductList.DataSource = products;
ProductList.DataBind();