Hello,
I have installed nop ajax filter plugin.
The plugin works properly on the vendor page. But when I divided the products on the vendor page into sold and unsold tabs. The filter not working anymore.
code for vendor.cshtml
@model VendorModel
<head>
<!--<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">-->
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function () {
$("#tabs").tabs({ active: 0 });
});
</script>
</head>
@{
Layout = "_ColumnsTwo";
}
<div class="page vendor-page">
<div class="page-title">
<h1>@Model.Name</h1>
</div>
<div class="page-body">
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.VendorDetailsTop, additionalData = Model })
@*description*@
@if (!string.IsNullOrWhiteSpace(Model.Description))
{
<div class="vendor-description">
@Html.Raw(Model.Description)
</div>
}
<div id="tabs" style="margin-bottom: 15px;">
<ul>
<li><a href="#tabs-1">Unsold</a></li>
<li><a href="#tabs-2">Sold</a></li>
</ul>
<div id="tabs-1">
@await Component.InvokeAsync("UnsoldProducts", new { vendorId = Model.Id, command = Model.PagingFilteringContext })
</div>
<div id="tabs-2">
@await Component.InvokeAsync("SoldProducts", new { vendorId = Model.Id, command = Model.PagingFilteringContext })
</div>
}
</div>
</div>
</div>
</div>
public IViewComponentResult Invoke(int vendorId, CatalogPagingFilteringModel command)
{
Vendor vendor = _vendorService.GetVendorById(vendorId);
VendorModel vendorModel = _catalogModelFactory.PrepareVendorModel(vendor,command);
var prodcutIds = vendorModel.Products.Select(p => p.Id).ToArray();
var products = _productService.GetProductsByIds(prodcutIds).Where(p => p.StockQuantity > 0).ToList();
var productOverviewModels = _productModelFactory.PrepareProductOverviewModels(products).ToList();
vendorModel.Products = productOverviewModels;
return View(vendorModel);
}
public IViewComponentResult Invoke(int vendorId, CatalogPagingFilteringModel command)
{
Vendor vendor = _vendorService.GetVendorById(vendorId);
VendorModel vendorModel = _catalogModelFactory.PrepareVendorModel(vendor,command);
var prodcutIds = vendorModel.Products.Select(p => p.Id).ToArray();
var products = _productService.GetProductsByIds(prodcutIds).Where(p => p.StockQuantity ==0).ToList();
var productOverviewModels = _productModelFactory.PrepareProductOverviewModels(products).ToList();
vendorModel.Products = productOverviewModels;
return View(vendorModel);
}