Hello everyone
I sure wish I knew more than I did about this so I could explain it clearly but i don't
I'm trying though! I've been trying to figure this out for 4 days, I just CANT get it.
What I need to do is add the $tax amount (that seems to be working good) to the $total_price value.
I can't do something simple and add it using another name for $total_price as it's being called through out the program. (It sends it via emails and displays it to users).
I've tried to put: $total_price = ($tax + $tot_price);
And it does the math correctly, but, it doesn't store the value in the $total_price function.
I'm sorry for my newness. I sure would appreciate any help, I hope its something simple.
//calculate and format total, discount, shipping
function photoshop_format_price($temp_price, $cd_counter, $error='', $template){
global $lang_photoshop, $SHOP_CONFIG;
$out =array();
$discount_calc = calculate_discount($temp_price, $cd_counter);
$shipping_calc = calculate_shipping();
$discount = number_format(($discount_calc),2);
$shipping = number_format(($shipping_calc),2);
$tot_price = number_format(($temp_price[1]+$temp_price[0]+$shipping_calc-$discount_calc),2);
$tax = number_format(($tot_price*.0825),2);
$cd_price = number_format($temp_price[1],2);
$photo_price = number_format($temp_price[0],2);
if ($cd_price > 0) {
$cd_price2 = "{$lang_photoshop['on_cd']}: {$cd_counter['cd']} {$lang_photoshop['pics']} :: $cd_price{$lang_photoshop['USD']} <br />";
} else $cd_price2 = '';
if ($photo_price > 0) {
$photo_price2 = "{$lang_photoshop['for_print']}: {$cd_counter['photo']} {$lang_photoshop['pics']} :: $photo_price{$lang_photoshop['USD']} <br />";
} else $photo_price2 = '';
if ($tot_price > 0) {
if ($shipping > 0) {
$total_price = "{$lang_photoshop['shipping']} :: ".$shipping."{$lang_photoshop['USD']} <br>";
}
else $total_price = "";
if ($discount > 0) {
$total_price .= "{$lang_photoshop['discount']} :: % {$discount}{$lang_photoshop['USD']} ";
}
$total_price .= "<hr size=\"1\" width=\"200\" align=\"right\" /> ";
$total_price .= "{$lang_photoshop['total']}: {$tot_price}{$lang_photoshop['USD']} ";
} else $tot_price = '';
$out['html'] = <<<EOT
<tr>
<td colspan="6" align="center">
<hr size="1" />
</td>
</tr>
<tr>
<td colspan="6" align="right">
{$photo_price2}
{$cd_price2}{$error}
Tax.:{$tax}{$lang_photoshop['USD']} <br>
{$total_price}
</td>
</tr>
EOT;
$out['text'] = sprintf("%+63s\n\n", '');
if ($photo_price > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['for_print'].': '. $cd_counter['photo'].' '.$lang_photoshop['pics'].' :: '.$photo_price.$lang_photoshop['USD']); }
if ($cd_price > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['on_cd'].': '. $cd_counter['cd'].' '.$lang_photoshop['pics'].' :: '.$cd_price.$lang_photoshop['USD']); }
if ($shipping > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['shipping'].' :: '.$shipping.$lang_photoshop['USD']); }
if ($discount > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['discount'].' :: %'.$discount.$lang_photoshop['USD']); }
$out['text'] .= sprintf("%+63s\n", 'Tax: '.$tax.$lang_photoshop['USD']);
$out['text'] .= sprintf("%+63s\n", '--------------------------');
$out['text'] .= sprintf("%+63s\n", $lang_photoshop['total'].': '.$tot_price.$lang_photoshop['USD']);
return $out[$template];
I guess the cliff's notes version is, I would like it to add $tot_price and $tax values, and store that value in $total_price.