Alter Product Sort in Bulk Edit Product Variants

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
Hi just wondering I'd like to order all my products by sku in the bulk edit product variants screen.. and IF POSSIBLE in the Manage Products screen as well (if not the Manage Products Screen definitely in the Bulk Edit Screen) I've tried:

gridModel.Data = productVariants.Select(x =>
            {
                var productVariantModel = new BulkEditProductVariantModel()
                {
                    Id = x.Id,
                    Name =  x.FullProductName,
                    Sku = x.Sku,
                    OldPrice = x.OldPrice,
                    Price = x.Price,
                    ManageInventoryMethod = x.ManageInventoryMethod.GetLocalizedEnum(_localizationService, _workContext.WorkingLanguage.Id),
                    StockQuantity = x.StockQuantity,
                    Published = x.Published
                };

                return productVariantModel;
            }).OrderBy(pv => pv.Sku);


in the bulkeditcontroller but with no success..
just wondering if someone could help me out?
Cheers,
Tom
Il y a 12 ans
I've also tried this on the client side but with no luck:
  @(Html.Telerik().Grid<BulkEditProductVariantModel>()
        .Name("productvariants-grid")
        .DataKeys(keys =>
        {
            keys.Add(pv => pv.Id);
        })
        .ToolBar(commands =>
        {
            commands.SubmitChanges();
        })
        .DataBinding(dataBinding =>
            dataBinding.Ajax()
                .Select("BulkEditSelect", "ProductVariant")
                .Update("BulkEditSave", "ProductVariant")
        )
        .Columns(columns =>
        {
            columns.Bound(pv => pv.Name).ReadOnly().Width(300);
            columns.Bound(pv => pv.Sku).Width(100);
            columns.Bound(pv => pv.Price).Width(100);
            columns.Bound(pv => pv.OldPrice).Width(100);
            columns.Bound(pv => pv.ManageInventoryMethod).ReadOnly().Width(150);
            columns.Bound(pv => pv.StockQuantity).Width(100);
            columns.Bound(pv => pv.Published).Width(100);
            columns.Command(commands => commands.Delete()).Width(180);
        })
        .ClientEvents(events => events.OnDataBinding("Grid_onDataBinding").OnError("Grid_onError").OnSubmitChanges("Grid_onSubmitChanges"))
        .Editable(editing => editing.Mode(GridEditMode.InCell))
        .Pageable(settings => settings.PageSize(gridPageSize).Position(GridPagerPosition.Both))
        .Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(o => o.Sku).Ascending()).SortMode(GridSortMode.MultipleColumn)
        )
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.