Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Stramm - Photo_shop Plug ??s -- Adding Taxes to the total  (Read 4884 times)

0 Members and 1 Guest are viewing this topic.

Jasondt2001

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Stramm - Photo_shop Plug ??s -- Adding Taxes to the total
« on: January 02, 2009, 09:58:42 pm »

Stramm, I swear I've tried and tried and tried to do this myself and I just can't get it... Please, would you help me? I've learned alot going about it on my own but not enough to make this one work.

What I'm trying to do is add tax to the TOTAL and have that be the total amount emailed and listed to the user and the administrator.
I've screen shotted and will give you an example, and I also have the tax code setup working the way I need it to. The problem is I can NOT figure out how to add tax to the total amount.


Here is the code I'm using in coppermine/plugins/photo_shop/include/functions.inc.php
Code: [Select]
//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']}&nbsp;<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']}&nbsp;<br />";
} else $photo_price2 = '';

if ($tot_price > 0) {
if ($shipping > 0) {
$total_price = "{$lang_photoshop['shipping']} :: ".$shipping."{$lang_photoshop['USD']}&nbsp;<br>";
} else $total_price = "";
if ($discount > 0) {
$total_price .= "{$lang_photoshop['discount']} :: % {$discount}{$lang_photoshop['USD']}&nbsp;";
}
$total_price .= "<hr size=\"1\" width=\"200\" align=\"right\" />&nbsp;";
$total_price .= "{$lang_photoshop['total']}: {$tot_price}{$lang_photoshop['USD']}&nbsp;";
} 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']}&nbsp;<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", 'Incl. MWSt: '.$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];
}

Thank you in advance, I swear if i could have figured this out I would have done it myself!
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Stramm - Photo_shop Plug ??s -- Adding Taxes to the total
« Reply #1 on: January 15, 2009, 06:45:31 pm »

That needs some recoding... as you see I was lazy and did it the easy way with ... 'includes 19% VAT: x.yz USD'

the total is calculated here
Code: [Select]
$tot_price = number_format(($temp_price[1]+$temp_price[0]+$shipping_calc-$discount_calc),2);
just calc tax and add it... however that won't be enough... there's more you need to modify, eg. photo_shop_checkout.php function photoshop_add_data() ... check if all gets added correctly, IPN will need modifications and maybe a bunch of other files as well (admin, sales history etc.).

Jasondt2001

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Stramm - Photo_shop Plug ??s -- Adding Taxes to the total
« Reply #2 on: January 16, 2009, 04:14:47 pm »

Ick - Maybe I'll just up the price and do it your way  ;D

Thank you!!

- Jason
Logged
Pages: [1]   Go Up
 

Page created in 0.015 seconds with 20 queries.