Question: I am new in Magento and need to learn. I have a platform based on Magento 1.9 developed by another developer. i have addeded custom option of color. but there is size custom option already added before. in the frontend, the tile appear at the bottom of the new color custom option is the size custom option and the validation also inherit the size custom optio. Where can fix this ?

[![enter image description here](https://i.stack.imgur.com/Yff6R.png)](https://i.stack.imgur.com/Yff6R.png)

Answer: 
With ternary conditional operator

```
books.GroupBy(b => b.Price < 10 ? 10 : (b.Price < 20 ? 20 : 30));

```
If you are not necessarily bound by specific category values, but rather want to group your books by price rates that are divisible by `10` (i.e. `10`, `20`, `30`, `40`, and so on), you could achieve this by rounding the `Price` up to the nearest `10` and use that as your group-by-value.

Here is an example, using [`Math.Ceiling()`](https://learn.microsoft.com/en-us/dotnet/api/system.math.ceiling?view=net-6.0) to do the rounding:

```
Math.Ceiling(value / 10) * 10 // Round 'value' upwards to nearest 10

```

Applied as the group-by-condition:

```csharp
List<(decimal Category, List<Book> Books)> groupedBooks = books
    .GroupBy(book => Math.Ceiling(book.Price / 10) * 10,
        (category, booksInCategory) => ( 
            Category: category, 
            Books: booksInCategory.ToList() ))
    .OrderBy(gr => gr.Category)
    .ToList();

```

Using your provided example list for `books`, the resulting `groupedBooks` contains:

> 
> Category: 10  
> 
> Book: { Id: 4 Name: DD Price: 9.0000 }  
> 
>   
> 
> Category: 20  
> 
> Book: { Id: 1 Name: AA Price: 19.0000 }  
> 
> Book: { Id: 2 Name: BB Price: 18.0000 }  
> 
>   
> 
> Category: 30  
> 
> Book: { Id: 3 Name: CC Price: 30.0000 }
> 
> 
> 

Example fiddle [here](https://dotnetfiddle.net/Ff0DNM).