IF product ID is equal to a NUMBER do things.

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

I am trying to style something with CSS i have these product discount ribbons with text. I have styled them.. but i want to changed the background color of a ribbon based on a product/category ID.

What can i do here?

is it possible to add on a default cshtml simple product page a class with the product ID and then change the background of the color, and if it is possible how would i add the product.id or category.id on the <html> class.

Or can i use a IF statement == to ID 9 for instance.

@if(Model.ProductId == "9") {
  <div style="background-color: orange">
  HTML.
</div>
}

Thanks in advance
6 years ago
yeah! you can see one way to do that in Nop.Admin/Order/List.cshtml


@if (!Model.IsLoggedInAsVendor)
{
    //a vendor does not have access to this functionality
    <text>{
    field: "OrderStatus",
    title: "@T("Admin.Orders.Fields.OrderStatus")",
    width: 100,
    template: '<span class="grid-report-item ' +
        '# if(OrderStatusId == 10) {# yellow #} #' +
        '# if(OrderStatusId == 20) {# blue #} #' +
        '# if(OrderStatusId == 30) {# green #} #' +
        '# if(OrderStatusId == 40) {# red #} #' +
        '">#=OrderStatus#</span>'
},</text>

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