Skip to content

Instantly share code, notes, and snippets.

@yokotak0527
Created July 27, 2012 03:07
Show Gist options
  • Save yokotak0527/3185974 to your computer and use it in GitHub Desktop.
Save yokotak0527/3185974 to your computer and use it in GitHub Desktop.
welcart 価格の配列を返すやつ
// 使い方は
// $arr = priceArr(usces_the_firstPrice('return'));
// みたいな感じ。
// 返り値は配列。
// 管理画面で税率は必ず指定しておくこと!
function priceArr($price=0){
global $usces;
$pos = $usces->options;
$tax = (100+$pos['tax_rate'])/100;
$taxMethod = $pos['tax_method'];
switch($taxMethod){
case 'cutting' : // 切り下げ
$incTax = floor($price * $tax) >> 0;
break;
case 'bring' : // 切り上げ
$incTax = ceil($price * $tax) >> 0;
break;
case 'rounding' : // 四捨五入
$incTax = round($price * $tax) >> 0;
break;
}
return array($price,$incTax,$taxMethod,$pos['tax_rate'],$tax);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment