Where 10,000 is higher than the total number of products. I don't believe there is currently a method to directly request all products but it would be a good idea to add this as a new feature on the issue tracker as I can see it might be useful.
I too am trying to get a list of products. I've used the following code but get 0 products back. I have installed the fasttrack starter kit and the catalog page shows all the products ok. Am i missing something? I rebuilt the Merchello examine indexes via the umbraco back end but made no difference. THe following code is run in vs from the App_Code folder. I'm using latest merchello and umbraco 7.x
I've just started looking into the merchello api - it looks like there are almost no code examples out there...and i find im wasting my time in reflector...is it just me?
var merchello = new MerchelloHelper();
var allProducts = merchello.Query.Product.Search(0, int.MaxValue).Items.ToList();
Ideally I wanted to use the Serarch method with the search term ....but thought it would be easy to get a basic list of products....i guess not.
UPDATE: My search line of code was wrong - the first page is 1 not 0 - the following worked for me.
// Merchello search - limit search to that configured on the front end.
var allProducts = merchello.Query.Product.Search(q, 1, Convert.ToInt32(maxSearchItems)).Items.ToList();
Get All Merchello Products
Hi guys,
Can anyone guide me on how I can get all products of Merchello, because I want just a drop-down with products Names.
Thank you in advance.
Kind Regards
Hi Simon,
Try something like the following:
Where 10,000 is higher than the total number of products. I don't believe there is currently a method to directly request all products but it would be a good idea to add this as a new feature on the issue tracker as I can see it might be useful.
Cheers, Simon
But with this the query execution will occur so it can be used to skip for pagination.
Are there another way how I can get all products as SQL, as LINQ?
Thank you
Hi Simon
Can I use the GetAll() from https://github.com/Merchello/Merchello/blob/v2.2.0/src/Merchello.Core/Services/ProductService.cs - Product Service?
It returns IEnumberable. I think I can filter using the where clause and execute later on, right?
Kind Regards
Hi,
I too am trying to get a list of products. I've used the following code but get 0 products back. I have installed the fasttrack starter kit and the catalog page shows all the products ok. Am i missing something? I rebuilt the Merchello examine indexes via the umbraco back end but made no difference. THe following code is run in vs from the App_Code folder. I'm using latest merchello and umbraco 7.x
I've just started looking into the merchello api - it looks like there are almost no code examples out there...and i find im wasting my time in reflector...is it just me?
Ideally I wanted to use the Serarch method with the search term ....but thought it would be easy to get a basic list of products....i guess not.
UPDATE: My search line of code was wrong - the first page is 1 not 0 - the following worked for me.
Hi Simon,
Have you achieved to get all products of Merchello? Did you use GetAll()? Can I ask you how did you do to achieve this?
Thanks in advance
is working on a reply...