Last active
November 12, 2020 10:46
-
-
Save unlocomqx/fcc0a46cfb543e064af8b9ee9f6a8403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function findValue($items, $value) | |
{ | |
/** @var GridColumn[]|GridRow[] $item_values */ | |
$item_values = array_values($items); | |
$count = count($item_values); | |
if (isset($item_values[0]) && $value <= $item_values[0]->value) { | |
return $item_values[0]->id; | |
} | |
for ($i = 0; $i < $count - 1; $i++) { | |
if ($value > $item_values[$i]->value && $value <= $item_values[$i + 1]->value) { | |
return $item_values[$i + 1]->id; | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--> copy to /modules/dynamicproduct/classes/models/grids/Grid.php
--> screenshot: https://scr.prestalife.net/sc5v1i1