Change Product URL and redirect to affiliated website

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello !!

I am using NopCommerce 3.80. I have added two more columns in Product database which is IsURL(bit) and URL(nvarchar(max)).

I have changed the admin controller and model to add the data for IsURL and URL and its working great.

The problem is I am not able to fetch the data of IsURL and URL in _ProductBox.cshtml.
For e.g: in database IsURL is true but in _ProductBox.cshtml it shows false (@Model.IsURL).

I have changed the Nop.Web Models also but not able to get the data.

Purpose of doing this: I want to add product from our affiliated partner's website so if the product has IsURL = true it will use the redirect link given in URL. If IsURL = false it will work as default.

Stuck in this more than a week.

Please help !!!

Thank you.
6 years ago
Are you trying get value of @Model.IsURL in Razor code or jquery/javascript code?

Thanks,
Jatin
6 years ago
forefront wrote:
Are you trying get value of @Model.IsURL in Razor code or jquery/javascript code?

Thanks,
Jatin



In Razor Code in _ProductBox.cshtml
6 years ago
SSeBookStore wrote:
Are you trying get value of @Model.IsURL in Razor code or jquery/javascript code?

Thanks,
Jatin


In Razor Code in _ProductBox.cshtml


         <h2 class="product-title">
            @if (Model.IsURL)
            {
                <a href="@Model.URL" target="_blank">@Model.Name</a>
            }
            else
            {
                <a href="@Url.RouteUrl("Product", new { SeName = Model.SeName })">@Model.Name</a>
            }
        </h2>
6 years ago
It's working completely fine from Admin Side(Saving data in Database), but don't know why I am not able to get the data from Database in Razor file (_ProductBox.cshtml).

Please Help on this...

Thank you.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.