Bulk Edit Products

4 years ago
Can I add a field to the Bulk Edit Products Page? I want to edit all of the products that we sell with their weights - can I add Weight as a field to the Bulk Edit Products Page as this will make my job a lot easier?
Thanks.
4 years ago
What you want requires customization work. A probably better way is to export to Excel the products with just the columns you want to update; update them and re-import it
2 years ago
Sederholm wrote:
Can I add a field to the Bulk Edit Products Page? I want to edit all of the products that we sell with their weights - can I add Weight as a field to the Bulk Edit Products Page as this will make my job a lot easier?
Thanks.


This is very easy to do.

Firstly, open Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs and go to the method BulkEditSelect. There, update the productModel variable to this one:

var productModel = new BulkEditProductModel
{
    Id = x.Id,
    Name = x.Name,
    Sku = x.Sku,
    Weight = x.Weight,
    OldPrice = x.OldPrice,
    Price = x.Price,
    ManageInventoryMethod = x.ManageInventoryMethod.GetLocalizedEnum(_localizationService, _workContext.WorkingLanguage.Id),
    StockQuantity = x.StockQuantity,
    Published = x.Published
};


Then, in the same file, go to the BulkEditUpdate method, and update the code block to this ():

product.Name = pModel.Name;
product.Sku = pModel.Sku;
product.Weight = pModel.Weight;
product.Price = pModel.Price;
product.OldPrice = pModel.OldPrice;
product.StockQuantity = pModel.StockQuantity;
product.Published = pModel.Published;
product.UpdatedOnUtc = DateTime.UtcNow;
_productService.UpdateProduct(product);


Now, finally open Presentation/Nop.Web/Areas/Admin/Views/Product/BulkEdit.cshtml.

Under fields (line 135), add this line:

Weight: { editable: true, type: "number" },


Then put this line between 'Sku' and 'Price' tabs (line 193):

{
    field: "Weight",
    title: "@T("Admin.Catalog.Products.Fields.Weight")",
    width: 150,
    editor: function (container, options) {
        $('<input name="' + options.field + '"/>')
            .appendTo(container)
            .kendoNumericTextBox({
                format: "{0:n4}",
                decimals: 4
            });
    }
},


And you can do this for any kind of product feature.
1 month ago
You can use this plugin and enjoy it!
products bulk editor