Thought the code would be useful to some
modify the following files;-
for Category edit
\Presentation\Nop.Web\Models\Catalog\CategoryModel.cs
add the following property
public bool DisplayAdminLink { get; set; }
\Presentation\Nop.Web\Controllers\CatalogController.cs
in method
public ActionResult Category(int categoryId, CatalogPagingFilteringModel command)
after
var model = category.ToModel();
add the following line
model.DisplayAdminLink = _permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel);
\Presentation\Nop.Web\Views\Catalog\CategoryTemplate.ProductsInGridOrLines.cshtml
add whereever you want the edit link to appear
@if (Model.DisplayAdminLink)
{
<a href="/Admin/Category/Edit/@Model.Id" target="_blank">Edit</a><br />
}
for product edit
\Presentation\Nop.Web\Models\Catalog\ProductModel.cs
add the following property
public bool DisplayAdminLink { get; set; }
\Presentation\Nop.Web\Controllers\CatalogController.cs
in method
protected ProductModel PrepareProductDetailsPageModel(Product product)
after
var model = product.ToModel();
add
model.DisplayAdminLink = _permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel);
\Presentation\Nop.Web\Views\Catalog\ProductTemplate.SingleVariant.cshtml
\Presentation\Nop.Web\Views\Catalog\ProductTemplate.VariantsInGrid.cshtml
add whereever you want the edit link to appear
@if (Model.DisplayAdminLink)
{
<a href="/Admin/Product/Edit/@Model.Id" target="_blank">Edit</a><br />
}
I didn't bother with the mobile side as imo editing the shop on a mobile is not something I want to encourage.
HTH
Dave