Created
June 21, 2017 14:28
-
-
Save kevinruscoe/1776ec2ccc8985e5ac75c5e5c61e1e1e 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
protected function updateQuantityRelative($item, $key, $value){ | |
if (preg_match('/\-/', $value) == 1) { | |
$value = floatval(str_replace('-', '', $value)); | |
if (($item[$key] - $value) > 0) { | |
$item[$key] -= $value; | |
} | |
} elseif (preg_match('/\+/', $value) == 1) { | |
$item[$key] += floatval(str_replace('+', '', $value)); | |
} else { | |
$item[$key] += floatval($value); | |
} | |
return $item; | |
} | |
protected function updateQuantityNotRelative($item, $key, $value) | |
{ | |
$item[$key] = floatval($value); | |
return $item; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment