Skip to content

Instantly share code, notes, and snippets.

@gohanman
Created April 26, 2017 17:08
Show Gist options
  • Save gohanman/188d5530e65e4f968ac2ae3b898010aa to your computer and use it in GitHub Desktop.
Save gohanman/188d5530e65e4f968ac2ae3b898010aa to your computer and use it in GitHub Desktop.
switch ($infoW["minType"]) {
case "Q": // must purchase at least X
case "Q+": // must purchase more than X
case "Q-": // must purchase at least one, no more than X
$minQ = "select case when sum(ItemQtty) is null
then 0 else sum(ItemQtty) end
" . $this->baseSQL($transDB, $coupID, 'upc');
$minR = $transDB->query($minQ);
$minW = $transDB->fetch_row($minR);
$validQtty = $minW[0];
if ($infoW['minType'] == 'Q+' && $validQtty <= $infoW["minValue"]) {
return $this->errorOrQuiet(_('coupon requirements not met'), $quiet);
} elseif ($infoW['minType'] == 'Q' && $validQtty < $infoW['minValue']) {
return $this->errorOrQuiet(_('coupon requirements not met'), $quiet);
} elseif ($infoW['minType'] == 'Q-' && $validQtty < 1) {
return $this->errorOrQuiet(_('coupon requirements not met'), $quiet);
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment