$cd_price = item_price($cd_counter['cd']); if ($cd_price[3] == false) { // more CD items than max defined -> warn and show link to cart echo '<tr><td><br>' . $cd_price[2] . '<br>' . $lang_photoshop['goto_cart_cd'] . '</td></tr>'; } elseif ($_POST['order'] == "confirmed" && $cd_counter['cd'] + $cd_counter['photo'] > 0) { //add to mysql, show confirmation and send email (user+admin) photoshop_prep_data($shop_array_cd, $shop_array_photos); //order_id++ $results = cpg_db_query("SELECT oid FROM {$CONFIG['TABLE_SHOP']} ORDER BY oid DESC LIMIT 1"); $row = mysql_fetch_array($results); $order_id = ++$row['oid']; mysql_free_result($results); //merge photo und cd array $shop_array = array_merge($shop_array_photos, $shop_array_cd); //calculate the discount $discount_calc = calculate_discount($cd_price, $cd_counter); $shipping_price_calc = calculate_shipping(); $discount = number_format($discount_calc, 2); $shipping_price = number_format($shipping_price_calc, 2); $free_item = false; // if we have a free item in the cart, if yes, and download is enabled we create the down folder later, in case free_item gets set true in function photoshop_add_data if (photoshop_add_data($shop_array, $order_id, $free_item)) { // adding data succeeded //now email the user //first we prepare the invoice attachment $invoice = '<pre>'; //added to make the output more convenient when viewing the email not as text email but html $invoice .= $lang_photoshop_email_attach_header; //in the lang file we could define a header for the invoice $invoice .= photoshop_create_table($shop_array_photos, 'photo', 'text'); $invoice .= photoshop_create_table($shop_array_cd, 'cd', 'text');
<?php if ($paypal['showBonus']) { ?> <th>Bonus:</th> <?php } ?> <th>Action:</th> </tr> <?php foreach ($prices as $price => $points) { echo '<tr class="special">'; echo '<td>' . $price . '(' . $paypal['currency'] . ')</td>'; echo '<td>' . $points . '</td>'; if ($paypal['showBonus']) { echo '<td>' . calculate_discount($paypal['points_per_currency'] * $price, $points) . ' bonus</td>'; } ?> <td> <form action="https://www.paypal.com/cgi-bin/webscr" method="POST"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="<?php echo $paypal['email']; ?> "> <input type="hidden" name="item_name" value="<?php echo $points . ' shop points on ' . $config['site_title']; ?> "> <input type="hidden" name="item_number" value="1"> <input type="hidden" name="amount" value="<?php
function photoshop_format_price($temp_price, $cd_counter, $error = '', $template) { global $lang_photoshop, $SHOP_CONFIG, $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); $vat = number_format(($temp_price[1] + $temp_price[0] + $shipping_calc - $discount_calc) / 100 * $CONFIG['photo_shop_vat'], 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} {$CONFIG['photo_shop_currency']} <br />"; } else { $cd_price2 = ''; } if ($photo_price > 0) { $photo_price2 = "{$lang_photoshop['for_print']}: {$cd_counter['photo']} {$lang_photoshop['pics']} :: {$photo_price} {$CONFIG['photo_shop_currency']} <br />"; } else { $photo_price2 = ''; } if ($tot_price > 0) { if ($shipping > 0) { $total_price = "{$lang_photoshop['shipping']} :: {$shipping} {$CONFIG['photo_shop_currency']} <br>"; } else { $total_price = ""; } if ($discount > 0) { $total_price .= "{$lang_photoshop['discount']} :: % {$discount} {$CONFIG['photo_shop_currency']} "; } $total_price .= "<hr size=\"1\" width=\"200\" align=\"right\" /> "; $total_price .= "{$lang_photoshop['total']}: {$tot_price} {$CONFIG['photo_shop_currency']} <br><br>"; $total_price .= "<hr size=\"1\" width=\"220\" align=\"right\" /> "; $total_price .= sprintf($lang_photoshop['total_incl'], '19') . ": {$vat} {$CONFIG['photo_shop_currency']} "; } else { $tot_price = ''; } $out['html'] = <<<EOT \t\t<tr> \t\t\t<td colspan="6" align="center"> \t\t\t<hr size="1" /> \t\t\t</td> \t\t</tr> \t\t<tr> \t\t\t<td colspan="6" align="right"> \t\t\t\t{$photo_price2} \t\t\t\t{$cd_price2}{$error} \t\t\t\t{$total_price} \t\t\t</td> \t\t</tr> EOT; $vat_txt = sprintf($lang_photoshop['total_incl'], '19') . ": {$vat} {$CONFIG['photo_shop_currency']}"; $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 . ' ' . $CONFIG['photo_shop_currency']); } if ($cd_price > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['on_cd'] . ': ' . $cd_counter['cd'] . ' ' . $lang_photoshop['pics'] . ' :: ' . $cd_price . ' ' . $CONFIG['photo_shop_currency']); } if ($shipping > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['shipping'] . ' :: ' . $shipping . ' ' . $CONFIG['photo_shop_currency']); } if ($discount > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['discount'] . ' :: %' . $discount . ' ' . $CONFIG['photo_shop_currency']); } $out['text'] .= sprintf("%+63s\n", '--------------------------'); $out['text'] .= sprintf("%+63s\n", $lang_photoshop['total'] . ': ' . $tot_price . ' ' . $CONFIG['photo_shop_currency']); $out['text'] .= sprintf("%+63s\n", $vat_txt); return $out[$template]; }