I've been experiencing a similar issue when paging through specification attributes in the admin area. The same attributes that were shown on page 1 being shown on page 2, and page 2 missing some attributes I'd expect to be there (because they weren't on page 1 and there are only 2 pages). It only occurs when you have multiple specification attributes with the same
DisplayOrder (e.g. all set to the default 0). The function that grabs the specification attribute list from the database is only ordered by DisplayOrder so I'd guess that whatever SQL is being generated by entity framework under the covers is non-deterministic with respect to the order of the results if each attribute doesn't have a unique DisplayOrder value.
The simple solution is just to assign a unique DisplayOrder value to each of your specification attributes.
If you're using the source code version then it's an even easier fix. In the Nop.Services project find function
GetSpecificationAttributes in the
SpecificationAttributeService class and add
sa.Name and
sa.Id to the orderby list:
public virtual IPagedList<SpecificationAttribute> GetSpecificationAttributes(int pageIndex = 0, int pageSize = int.MaxValue)
{
var query = from sa in _specificationAttributeRepository.Table
orderby sa.DisplayOrder, sa.Name, sa.Id
select sa;
var specificationAttributes = new PagedList<SpecificationAttribute>(query, pageIndex, pageSize);
return specificationAttributes;
}
This orders by DisplayOrder first, then alphabetically by Name, then by the attribute's Id which ensures that the order of results is always the same and keeps the paging consistent. (The Id bit is probably unecessary but since you can create multiple specification attributes with the same name it's safer).
The same issue might also affect some of the other functions that order results only by DisplayOrder but I haven't noticed any others yet.
Edit: Work item has been created
https://nopcommerce.codeplex.com/workitem/12863