function basic_cart_price_format in Basic cart 7.2
Same name and namespace in other branches
- 7.3 basic_cart.cart.inc \basic_cart_price_format()
Formats the input $price in the desired format.
Parameters
float $price: The price in the raw format.
Return value
$price The price in the custom format.
10 calls to basic_cart_price_format()
- basic_cart_block_view in ./
basic_cart.module - Implements hook_block_view().
- basic_cart_cart_flat.tpl.php in ./
basic_cart_cart_flat.tpl.php - Basic cart shopping cart html template
- basic_cart_cart_render_block.tpl.php in ./
basic_cart_cart_render_block.tpl.php - Basic cart shopping cart block
- basic_cart_checkout in ./
basic_cart.cart.inc - Checkout form implementation.
- basic_cart_checkout_form_submit in ./
basic_cart.cart.inc - Checkout form submit proccess. Register order and send emails.
1 string reference to 'basic_cart_price_format'
- basic_cart_admin_content_type in ./
basic_cart.admin.inc - Callback for the admin configuration page.
File
- ./
basic_cart.cart.inc, line 231 - Basic cart shopping cart implementation functions.
Code
function basic_cart_price_format($price) {
$format = variable_get('basic_cart_price_format');
$currency = check_plain(variable_get('basic_cart_currency'));
$price = (double) $price;
switch ($format) {
case 0:
$price = number_format($price, 2, ',', ' ') . ' ' . $currency;
break;
case 1:
$price = number_format($price, 2, '.', ' ') . ' ' . $currency;
break;
case 2:
$price = number_format($price, 2, '.', ',') . ' ' . $currency;
break;
case 3:
$price = number_format($price, 2, ',', '.') . ' ' . $currency;
break;
case 4:
$price = $currency . ' ' . number_format($price, 2, ',', ' ');
break;
case 5:
$price = $currency . ' ' . number_format($price, 2, '.', ' ');
break;
case 6:
$price = $currency . ' ' . number_format($price, 2, '.', ',');
break;
case 7:
$price = $currency . ' ' . number_format($price, 2, ',', '.');
break;
default:
$price = number_format($price, 2, ',', ' ') . ' ' . $currency;
break;
}
return $price;
}