Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.