Adding "Edit Product" in header-links

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi, i want to add link (if you're admin) to have permission to edit product on view page.
You added it in 4.00 Verison, but i', Using 3.70 and i cant do upgrade on newer.

https://prnt.sc/ugxwmi (It need to stands here.)
3 years ago
@if (!string.IsNullOrEmpty(Model.EditPageUrl))
        {
            <a href="@Model.EditPageUrl" class="manage-page">@T("Common.ManagePage")</a>
        }


This is what i need but how can i make this model ?
3 years ago
musoviich wrote:
how can i make this model ?

You have some hints here how to build this feature.
In your case, much easier would be to add simple code, assume you are trying to get a button at the product page only. How to check if the user is admin you already have. So simply add at cshtml file, for example here an URL, like
<a href="/Admin/Product/Edit/@Model.Id">EDIT</a>

Of course, it should be in if statement to prevent visibility by anyone.
Another way it would be to develop a new plugin that will basically do this same but will separate code modification, but that is more difficult than adding a simple line to cshtml.
Just remember to edit proper file (need to be done at the used theme, not default view file).

Regards,
Tom
3 years ago
nop4you wrote:
how can i make this model ?
You have some hints here how to build this feature.
In your case, much easier would be to add simple code, assume you are trying to get a button at the product page only. How to check if the user is admin you already have. So simply add at cshtml file, for example here an URL, like
<a href="/Admin/Product/Edit/@Model.Id">EDIT</a>

Of course, it should be in if statement to prevent visibility by anyone.
Another way it would be to develop a new plugin that will basically do this same but will separate code modification, but that is more difficult than adding a simple line to cshtml.
Just remember to edit proper file (need to be done at the used theme, not default view file).

Regards,
Tom


Hi Tom, thanks for advice, But i updated my version to 4.30 :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.