I would like to achive something similiar to TypedProductContentFromCollection but I want to get products from multiple collections.
I have a category search where users can select multiple categories and one they click on the filter button, the system will get all products in those categories.
Now I want something where it keeps also track of the pagination, like passing the page and itemsperpage.
The problem is with the methods available in 2.1.0 we don't have a way to query across multiple collections and without that DB query, the performance is going to be really bad assuming you have more than a few products per collection (which I assume you do since you're interested in paging).
To give you an idea - but you'll have to follow it through to the service layer which I've implemented as internal methods since the plan for 2.3.0 to only expose those through new MerchelloHelper methods.
I should have the majority of this working in the mdev-230 branch later this week but we're not planning on releasing that version until mid to late September as there are a few more things we have planned to get into it.
As an interim solution you could do the page query directly again the database using PetaPoco using the KeyDto class (you just need the GUIDs) and then fetch each result through the MerchelloHelper class. This will normally get the construct the full IProductContent from the Examine index. We will be releasing Merchello 2.2.0 this week which I would recommend upgrading to as we've include quite a few performance enhancements for the IProductContent retrieval ...
Appreciate your workings. I dont know if it is possible to include this specific feature of get products from multiple collections in the coming version (2..20) since it is very useful . Or else appreciate as soon as possible because we needed urgently.
We just released version 2.2.0 today and the code I've been working on to get this feature into the core has now been merged into the merchello-dev branch. I'm continuing to work on the back office UI today and likely through midday Thursday.
Once the back office and API integration points are in the core, you could grab a pre-release version by either building the merchello-dev branch or from the MyGet feed (but I'd suggest the first if your not comfortable working with the source since we're constantly pushing dev code which has not been fully tested). Of course we also appreciate pull requests if you want to get in there and help with the API bits.
After that is complete, we still need to come up with a high level API implementation and do some experiments (which we're doing in a separate actual site build).
Unfortunately, I can't promise anything more - we are pretty strapped resource wise and are obligated to get certain features done - luckily this one is a priority and is in progress and I'd be happy to answer any questions you might have as we work through the feature =)
TBH - I've never tried to install an upgrade over an existing package (for any package) but I would say to be conservative don't because of the PackageActions.
This may change with the Umbraco version 8 package updates and as we start concentrating more on Migration based installs.
I've included a zip file (NOT A PACKAGE) here:
Download that, UNZIP it locally and merge the contents into your solution.
It contains two directories - Merchello has the updated Merchello files, and FastTrack which respectively contains the updated FastTrack files (which you won't need if your not using a starter kit).
If you don't have any reason not to upgrade to Umbraco 7.5.2, I'd do that upgrade first ... but I did run the build on Umbraco 7.4.3.
I merged the current code into the merchello-dev branch at the end of the day yesterday. The back office is essentially done (but not thoroughly tested).
I'll be working on the exposing some extension methods over the next few days to query the multiple collections.
I'm getting pretty close on this but please realize this is not FINAL ... it's a working concept that we need to review. Naming may change and there is still quite a bit of testing to do.
In Merchello 2.3.0 we are introducing the notion of product filters, which is essentially the same thing as a collection, but the context in the way they are related to a product is a bit different. Data wise, there is essentially no difference at all ...
var merchello = new MerchelloHelper();
// these are IEnumerable<IProductCollection>
var allCollections = Merchello.Collections.Product.GetAll();
var rootCollections = Merchello.Collections.Product.GetRootLevelCollections();
// this is IEnumerable<IProductFilterGroup>
var filterGroups = merchello.Filters.Product.GetAll();
var group = filterGroups.FirstOrDefault();
var filters = group.Filters;
// The current concept is to provide a Fluent pattern
/*
PagedCollection<IProductContent> products =
merchello.ProductQueryBuilder()
.Page(2) // defaults to 1
.ItemsPerPage(20) // defaults to 10
.ConstrainBy([IProductFilter])
.ConstrainBy([IEnumerable<IProductFilter>])
.ConstrainBy([IProductCollection])
.ConstrainBy([IEnumerable<IProductCollection>])
.ConstraintByCollectionKey([IEnumerable<Guid>])
.ConstrainByCollectionKey([Guid])
.OrderBy([ProductSortField], [SortDirection]) // defaults to Name, Ascending
.Clusivity([FilterQueryClusivity]) // weird word - values are: ExistsInAllCollectionsAndFilters and DoesNotExistInAnyCollectionsAndFilters - defaults to ExistsInAllCollectionsAndFilters
.Execute();
*/
var products2 = merchello.ProductQueryBuilder().ConstraintBy(filter).Execute();
var products3 = merchello.ProductQueryBuilder().ConstraintBy(filter).ConstraintBy(collection).OrderBy(ProductSortField.Price, SortDirection.Descending).Execute();
// I think you should be able to do this ...
var multipleCollectionKeys = // your collection keys
var products4 = merchello.ProductQueryBuilder().ConstraintBy(multipleCollectionKeys).Execute();
Again, this is very preliminary but any feedback would be great to hear. The code has been merged into the merchello-dev branch if you want to have a look.
Filters are essentially attributes that can be tagged onto an entity. We've only implemented filters for products, but the underlying structures are there to extend to invoices and customers as well ...
Unlike product options, they do not really have any physical characteristics, meaning they won't generate variants and are not intended to be used to convey any information about a purchase to the store owner. Instead, filters are used to quickly place products into logical sub sets to make it easier to find products.
Example:
I went to the historical fiction "Category" on Amazon and found that I could refine my list by a descriptive time period (Ancient, Medieval, Renaissance ...).
In Merchello, to replicate this, you can now create a ProductCollection named "Historical Fiction" and a ProductFilterGroup named "Historical Time Period" which contains the ProductFilters -> Ancient, Medieval ...
This if a new feature in the new Merhcello, because my current merhcello version just have Collections, and can create collection as a child collection.
We are a ways out for version 2.3.0 to be final - shooting for the end of the month. The code has been merged into the merchello-dev branch if you want to build it and see if it works for you ... but again, that's sort of use at your own risk =)
I am working with the normal package which i have downloded 2.2.0 upgrade. How should i include the changes on the dev branch to check its work fine? Thanks
That sort of depends on how you have your solution setup.
If your using source control, I'd do it in another branch =)
You may consider setting up a quick test site (download Umbraco and install the package in that one) and then play around in App_Code to see if it works.
Or - backup your /bin/Merchello*.dll in the project you are working on and grab the ones from that install.
If using one of the newest methods to get products in multiple collections, as part of the return, will I have accessibility to get the total results of all pages please?
Also Rusty, since I am quiet urgent for this to use, can I have please the .dlls files of the new one in order start using it, unless testing is not ready, please?
Just the dlls to replace the current ones please?
I have download the merhcello dev branch and rebuilded to generate the dlls files.
Then I copy and paste the dll files to get the latest version and the below error occurs:
Method not found: 'Merchello.Web.Models.VirtualContent.IProductContent Merchello.Web.MerchelloHelper.TypedProductContentBySlug(System.String)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'Merchello.Web.Models.VirtualContent.IProductContent Merchello.Web.MerchelloHelper.TypedProductContentBySlug(System.String)'.
Source Error:
Then I had downloaded the
Merchello.2.2.0.upgrade.zip and eveything is working fine.
Now I want to test the new search that we have talked about.
All I am doing is :
1) Downloading the merhcello dev branch
2) Open it in visual studio.
3) Rebuild Solution
4) Then copy the 5 Merhcello.*dll files from the respective project to my bin folder (Core, Providers, Web, Web.Store and Examine).
I can't think of any. I just moved a bunch of stray methods out of the MerchelloHelper into extensions as it was a better place for them. I was actually thinking I could squeak that one in under the radar ... but you caught it right off so I think it needs to be documented in the release notes =)
And something else Rusty, do you think that I should go ahead with the overwrite over the last version (copy the Merchello.*.dlls) cause I need to do the search immediately and have everything set up, including basket, checkout etc...?
Do you think that by the end of this week the release will be out? Because Ideally I would update via nuget since copying the ddls files are not working.
On a side note, do you have an alternative by any side for my simple task.
All I have is that I have umbraco categories nodes ids that user want to search in (those are passed to the search method) and I want to get all products in those categories, distinctly if such product is two different categories..
I want the query to be paginated. Are there an easy way to do it because I would like to wait until the final release of the next Merchello version.
I have updated everything..through umbraco package.. but now when trying the var currentCustomer = new CustomerContext(umbracoHelper.UmbracoContext).CurrentCustomer;
You should not need to instantiate a CustomerContext every time you want the current customer.
Have your controller inherit from MerchelloSurfaceController which itself inherits from Umbraco's SurfaceController and provides you with a property CurrentCustomer as well as a few other Merchello bits (like the MerchelloHelper).
If you don't want to do that, instantiate it once in the controller constructor and use at as a property in your controller.
We just had a conversation about making this a request singleton in an upcoming version to protect against multiple instances of the CustomerContext being used that are not in sync with one another based on execution order.
I have updated to 2.3.2 and now my Controller is taking from MerchelloRenderMvcController and still, when user is logged in, it is returning the following error:
A member with the name 'Key' already exists on 'Merchello.Core.Models.ICustomerAddress'. Use the JsonPropertyAttribute to specify another name.
on
var currentUserBasketItems = CurrentCustomer.Basket().Items;
For now, I just need an immediate solution instead of having to install 2.3.0 beta.
All I want is an alternative where I can find products by categories and by simple search text. Categories are the umbraco categories node ids. I just simple need a query so that will be able to use for pagination so that not request everything by first call.
I would imagine that someone before have this particular task.
Get List Of Products from Collections - Merchello
Hi Guys,
I would like to achive something similiar to
TypedProductContentFromCollection
but I want to get products from multiple collections.I have a category search where users can select multiple categories and one they click on the filter button, the system will get all products in those categories.
Now I want something where it keeps also track of the pagination, like passing the page and itemsperpage.
Any help would be much appreciated.
Thank you
Kind Regards
Hey Simon,
Ironically it sounds like your trying to do what we're building into Version 2.3.0 :-). You can see my progress on this in the mdev-230 branch.
The solution requires some repository / service adds so that we can use a direct sql calm to build the Page we want.
I'm releasing 2.2.0 this week but still have some work to do in 2.3.0 -
What version of Merchello are you working with?
Hi Rusty
I am using the latest one. I have installed it last two weeks.
I appreciate the feature that i mentioned above would be ready as soon as possible cause i have a site ans needs to go live.
When do you think will be ready? And are there any alternatives to the current version?
Thank you rusty.
Hi Simon,
The problem is with the methods available in 2.1.0 we don't have a way to query across multiple collections and without that DB query, the performance is going to be really bad assuming you have more than a few products per collection (which I assume you do since you're interested in paging).
Here is main query method I wrote for 2.3.0 https://github.com/rustyswayne/Merchello/blob/mdev-230/src/Merchello.Core/Persistence/Repositories/ProductRepository.cs#L943
To give you an idea - but you'll have to follow it through to the service layer which I've implemented as internal methods since the plan for 2.3.0 to only expose those through new MerchelloHelper methods.
I should have the majority of this working in the mdev-230 branch later this week but we're not planning on releasing that version until mid to late September as there are a few more things we have planned to get into it.
As an interim solution you could do the page query directly again the database using PetaPoco using the
KeyDto
class (you just need the GUIDs) and then fetch each result through the MerchelloHelper class. This will normally get the construct the fullIProductContent
from the Examine index. We will be releasing Merchello 2.2.0 this week which I would recommend upgrading to as we've include quite a few performance enhancements for theIProductContent
retrieval ...Hi Rusty,
Thank you for your reply.
Appreciate your workings. I dont know if it is possible to include this specific feature of get products from multiple collections in the coming version (2..20) since it is very useful . Or else appreciate as soon as possible because we needed urgently.
Appreciate in advance your effort
Thank you Rusty.
Kind regards.
Hi Rusty
Any response on this please?
Thank you
We just released version 2.2.0 today and the code I've been working on to get this feature into the core has now been merged into the merchello-dev branch. I'm continuing to work on the back office UI today and likely through midday Thursday.
Once the back office and API integration points are in the core, you could grab a pre-release version by either building the merchello-dev branch or from the MyGet feed (but I'd suggest the first if your not comfortable working with the source since we're constantly pushing dev code which has not been fully tested). Of course we also appreciate pull requests if you want to get in there and help with the API bits.
After that is complete, we still need to come up with a high level API implementation and do some experiments (which we're doing in a separate actual site build).
Unfortunately, I can't promise anything more - we are pretty strapped resource wise and are obligated to get certain features done - luckily this one is a priority and is in progress and I'd be happy to answer any questions you might have as we work through the feature =)
Hi Rusty,
So I can just install the package over the current one and no data will be changed? right?
I am using Umbraco 7.4
TBH - I've never tried to install an upgrade over an existing package (for any package) but I would say to be conservative don't because of the PackageActions.
This may change with the Umbraco version 8 package updates and as we start concentrating more on Migration based installs.
I've included a zip file (NOT A PACKAGE) here:
Download that, UNZIP it locally and merge the contents into your solution.
It contains two directories - Merchello has the updated Merchello files, and FastTrack which respectively contains the updated FastTrack files (which you won't need if your not using a starter kit).
If you don't have any reason not to upgrade to Umbraco 7.5.2, I'd do that upgrade first ... but I did run the build on Umbraco 7.4.3.
Hi Rusty,
Are there any progress where I can view about this feature?
Kind Regards
Hi Simon,
I merged the current code into the merchello-dev branch at the end of the day yesterday. The back office is essentially done (but not thoroughly tested).
I'll be working on the exposing some extension methods over the next few days to query the multiple collections.
Hi Rusty
Thank you.
Can you please let me know when it is done and can download the new version?
Thank you once again.
Will do!
Hi Simon,
I'm getting pretty close on this but please realize this is not FINAL ... it's a working concept that we need to review. Naming may change and there is still quite a bit of testing to do.
In Merchello 2.3.0 we are introducing the notion of product filters, which is essentially the same thing as a collection, but the context in the way they are related to a product is a bit different. Data wise, there is essentially no difference at all ...
Again, this is very preliminary but any feedback would be great to hear. The code has been merged into the merchello-dev branch if you want to have a look.
Hi Rusty,
I download the dev-branch and seems very interesting and will do exactly what we need, to get list of products from collections.
Code seems very neat.
Can you please explain a bit more about filters and what are they?
Looking forward for Merchello 2.3.0.
Can you please, once it is final, let me know so that I can override files with the existing merchello installation.
thank you
Kind Regards
Hey Simon,
Regarding filters:
Filters are essentially attributes that can be tagged onto an entity. We've only implemented filters for products, but the underlying structures are there to extend to invoices and customers as well ...
Unlike product options, they do not really have any physical characteristics, meaning they won't generate variants and are not intended to be used to convey any information about a purchase to the store owner. Instead, filters are used to quickly place products into logical sub sets to make it easier to find products.
Example:
I went to the historical fiction "Category" on Amazon and found that I could refine my list by a descriptive time period (Ancient, Medieval, Renaissance ...).
In Merchello, to replicate this, you can now create a ProductCollection named "Historical Fiction" and a ProductFilterGroup named "Historical Time Period" which contains the ProductFilters -> Ancient, Medieval ...
Oh I see,
This if a new feature in the new Merhcello, because my current merhcello version just have Collections, and can create collection as a child collection.
Hi Rusty,
I have already got an implementation of Merhcello and some of the work is ready as categories etc...products.. etc..
Everything will work fine after I upgrade to Merhcelo 2.3.0 when it will be released?
Thank you
Hi Rusty
Are there any updates on this please?
Thank you very much.
We are a ways out for version 2.3.0 to be final - shooting for the end of the month. The code has been merged into the merchello-dev branch if you want to build it and see if it works for you ... but again, that's sort of use at your own risk =)
SO you are the tesing phase?
I am working with the normal package which i have downloded 2.2.0 upgrade. How should i include the changes on the dev branch to check its work fine? Thanks
Here is the latest build from AppVeyor - https://ci.appveyor.com/project/rustyswayne34779/merchello/build/2.3.0.604/artifacts
Sorry for asking again Rusty.
But which one should I download and how should I install it?
Thank you
Hey Simon,
That sort of depends on how you have your solution setup.
If your using source control, I'd do it in another branch =)
You may consider setting up a quick test site (download Umbraco and install the package in that one) and then play around in App_Code to see if it works.
Or - backup your /bin/Merchello*.dll in the project you are working on and grab the ones from that install.
Hi Rusty,
Any updates on this please?
Thank you in advance.
Kind Regards
Hey Simon
Here is a link to the agile board for 2.3.0 so you can track the progress http://issues.merchello.com/youtrack/rest/agile/Merchello-1/sprint/2.3.0
Hi Rusty,
Hope you're ok.
I have two questions:
If using one of the newest methods to get products in multiple collections, as part of the return, will I have accessibility to get the total results of all pages please?
Also Rusty, since I am quiet urgent for this to use, can I have please the .dlls files of the new one in order start using it, unless testing is not ready, please? Just the dlls to replace the current ones please?
Thank you Rusty,
Hearing from you.
Hi Rusty,
Any feedback on the last message please?
Thank you
Kind Regards
Hi Rusty,
I have download the merhcello dev branch and rebuilded to generate the dlls files.
Then I copy and paste the dll files to get the latest version and the below error occurs:
Any idea?
Thanks
Yep - sorry about that. That's a minor breaking change that I was hoping to get away with =)
I've moved that method to an Extension method.
Add
To your file.
Hi Rusty,
I have already
Merhcello.Web
.. but it is not working :/I am accessing it just through the MerhcelloHelper:
Hi Rusty,
Any feedback on this error?
I am just copying the 5 Merhcello.*dll files in my bin folder and that's it.
Then it throws the above error.
I already have Merhcello.Web.. and don't know exactly how I can refer to TypedproductContentBySlug...
Thank you in advance.
You must not have all of your dependencies sorted. Are you sure all references to Merchello binaries are the same version?
Here is the method:
https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/MerchelloHelperExtensions.cs#L83
Firstly, I installed Merhcello via Nuget.
Then I had downloaded the Merchello.2.2.0.upgrade.zip and eveything is working fine.
Now I want to test the new search that we have talked about.
All I am doing is :
1) Downloading the merhcello dev branch 2) Open it in visual studio. 3) Rebuild Solution 4) Then copy the 5 Merhcello.*dll files from the respective project to my bin folder (Core, Providers, Web, Web.Store and Examine).
And Error is throwing up.
Ideally I think that I should update it via Nuget.. what do you think?
Or else I will wait a bit and installed via nuget once it is released. Hopefully in the coming days.
Any Idea rusty about this, why it does not worked? Because now I installed the nugetpackage, I will only install the Merhcello.Core, which I need.
But I do not know exactly why the error is being thrown since I have all references.
Ok Rusty, no problem.
Are there any other breaking changes that i need to change?
Thanks
I can't think of any. I just moved a bunch of stray methods out of the MerchelloHelper into extensions as it was a better place for them. I was actually thinking I could squeak that one in under the radar ... but you caught it right off so I think it needs to be documented in the release notes =)
Hi Rusty,
If I try the following:
the list of paged collection will have access to the total Items of the search so that I can build up a pagination?
And to the above, how can I search also by product name?
Thank Rusty in advance
Kind Regards
Hey Simon,
You can add the product name or SKU by adding another
ConstrainBy
The result is a PagedCollection - see https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Models/PagedCollection.cs
Hi Rusty,
I cannot find a way how I can filter with my properties.
Can there be a solution for the ability to search by more properties, including custom ones, as described here: https://our.umbraco.org/projects/collaboration/merchello/merchello/81871-productcontentquery-order-by-product-document-type-properties-like-createdate?
Thanks
And something else Rusty, do you think that I should go ahead with the overwrite over the last version (copy the Merchello.*.dlls) cause I need to do the search immediately and have everything set up, including basket, checkout etc...?
Thank you Rusty.
Kind Regards
Hi Rusty,
Do you think of any other issues that I may encounter when overwriting the current version dll files with the new ones from the dev-branch please?
Thank you
Kind Regards
No - there are just some in progress features in there (product filters). I would not use those at the moment as we're still tweaking things.
Hi Rusty,
When do you think I would be able to try it out and start using it?
All I want is to filter products only by multiple collections and by product name, that's all.
Thanks Kind Regards
Any feedback Rusty?
Thank you
Kind Regards
You can pull from the merchello-dev branch anytime you'd like or grab one of the builds from appveyor (like https://ci.appveyor.com/project/rustyswayne34779/merchello/build/2.3.0.643/artifacts)
The actual release is still a ways out - here is the progress http://issues.merchello.com/youtrack/rest/agile/Merchello-1/sprint/2.3.0
So I can try it out the Search Functionality.
All I need is the product search, the new one but with multiple collections and also by text name.
Kind Regards
Hi Rusty,
Hope this message finds you well.
Do you think that by the end of this week the release will be out? Because Ideally I would update via nuget since copying the ddls files are not working.
Thank you in advance.
Kind Regards
Sorry bud - we're probably not going to be releasing 2.3.0 for a couple of weeks yet.
You can grab the packages from AppVeyor builds and load them locally through your NuGet manager if you'd like.
Here is the URL from last night: https://ci.appveyor.com/project/rustyswayne34779/merchello/build/2.3.0.665/artifacts
Ok I will try.
Do I need the ones which .symbols.nupkg?
Hi Rusty,
On a side note, do you have an alternative by any side for my simple task.
All I have is that I have umbraco categories nodes ids that user want to search in (those are passed to the search method) and I want to get all products in those categories, distinctly if such product is two different categories..
I want the query to be paginated. Are there an easy way to do it because I would like to wait until the final release of the next Merchello version.
Appreciate any help.
Kind Regards
Hi Rusty,
I have updated everything..through umbraco package.. but now when trying the
var currentCustomer = new CustomerContext(umbracoHelper.UmbracoContext).CurrentCustomer;
it is always returning an Anonymous user :/
Have done something wrong?
Hi Rusty, I have update the merhcello.config to accept members of My type:
Now I am getting the below error:
when executing the below code:
I need that inhering from merhcello Controller since I need access to RedirectToCurrentUmbracoPage etc...
Any idea how to solve it pleasE?
Hi Simon,
You should not need to instantiate a CustomerContext every time you want the current customer.
Have your controller inherit from
MerchelloSurfaceController
which itself inherits from Umbraco'sSurfaceController
and provides you with a propertyCurrentCustomer
as well as a few other Merchello bits (like the MerchelloHelper).If you don't want to do that, instantiate it once in the controller constructor and use at as a property in your controller.
We just had a conversation about making this a request singleton in an upcoming version to protect against multiple instances of the CustomerContext being used that are not in sync with one another based on execution order.
Ok I will try it out. I just have one customer instance so don't know why exactly it is happpening.
By any chance Rusty, do you have an alternative for my need please instead of having to install the latest one?
I have explained it here: https://our.umbraco.org/projects/collaboration/merchello/merchello/80405-get-products-from-multiple-collections
Thanks
Hi Rusty,
I have updated to 2.3.2 and now my Controller is taking from MerchelloRenderMvcController and still, when user is logged in, it is returning the following error:
on
I don't know what I am doing wrong.
Solved it by updating the newtonsoft to 9.0.0.0
For now, I just need an immediate solution instead of having to install 2.3.0 beta.
All I want is an alternative where I can find products by categories and by simple search text. Categories are the umbraco categories node ids. I just simple need a query so that will be able to use for pagination so that not request everything by first call.
I would imagine that someone before have this particular task.
Appreciate nay suggestions.
is working on a reply...