function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
         switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
             $tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $order->info['tax'] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $order->info['tax_groups']["{$tax_description}"] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
         }
     }
 }
Beispiel #2
0
 function calculate_price($products_price, $products_tax, $quantity = 1, $rate = "", $pid = "")
 {
     global $currency;
     if (is_numeric($pid)) {
         $dbres = tep_db_query("select categories_id from products_to_categories where products_id='" . $pid . "'");
         $row = tep_db_fetch_array($dbres);
         $cat_id = (int) $row['categories_id'];
         if ($cat_id == 23) {
             return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
         }
     }
     if ($rate == "") {
         $rate = get_price_rate($_SESSION['customer_id']);
     }
     if (get_price_group_name($_SESSION['customer_id']) == "Interior Designer") {
         $dbres = tep_db_query("select dn_price from products where products_id='{$pid}'");
         $row = tep_db_fetch_array($dbres);
         if ((double) $row['dn_price'] > 0) {
             $products_price = $row['dn_price'];
             $rate = "100";
         }
     }
     return ceil(tep_add_tax($products_price * $rate / 100, $products_tax)) * $quantity;
     //      return tep_round(tep_add_tax(($products_price*$rate)/100, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
 }
Beispiel #3
0
 function query($order_id)
 {
     global $shipping;
     $order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     $order = tep_db_fetch_array($order_query);
     $totals_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
         $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class'], 'value' => $totals['value'], 'sort_order' => $totals['sort_order'], 'orders_total_id' => $totals['orders_total_id']);
     }
     $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified'], 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'shipping_id' => $order['shipping_module'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array());
     $this->customer = array('id' => $order['customers_id'], 'name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'country_id' => oe_get_country_id($order['customers_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['customers_country']), $order['customers_state']), 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']);
     $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'country_id' => oe_get_country_id($order['delivery_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['delivery_country']), $order['delivery_state']), 'format_id' => $order['delivery_address_format_id']);
     $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'country_id' => oe_get_country_id($order['billing_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['billing_country']), $order['billing_state']), 'format_id' => $order['billing_address_format_id']);
     $index = 0;
     $orders_products_query = tep_db_query("select op.orders_products_id, op.products_id, op.products_name, op.products_model, op.products_code, op.products_price, op.products_tax, op.products_quantity, op.final_price, p.products_tax_class_id, p.products_weight, p.products_id from " . TABLE_ORDERS_PRODUCTS . " op INNER JOIN " . TABLE_PRODUCTS . " p on op.products_id = p.products_id where orders_id = '" . (int) $order_id . "' order by op.orders_products_id");
     while ($orders_products = tep_db_fetch_array($orders_products_query)) {
         $orders_products_tax_query = tep_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = " . $orders_products['products_id'] . "");
         $orders_products_tax = tep_db_fetch_array($orders_products_tax_query);
         $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'code' => $orders_products['products_code'], 'tax' => $orders_products['products_tax'], 'tax_description' => tep_get_tax_description($orders_products_tax['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]), 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price'], 'weight' => $orders_products['products_weight'], 'products_id' => $orders_products['products_id'], 'orders_products_id' => $orders_products['orders_products_id']);
         $subindex = 0;
         $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
         if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
                 $subindex++;
             }
         }
         $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Beispiel #4
0
 function process_button()
 {
     global $HTTP_POST_VARS, $customer_id, $currencies, $currency, $order, $languages_id, $cartID;
     $process_button_string = tep_draw_hidden_field('sid', MODULE_PAYMENT_2CHECKOUT_LOGIN) . tep_draw_hidden_field('total', $this->format_raw($order->info['total'], MODULE_PAYMENT_2CHECKOUT_CURRENCY)) . tep_draw_hidden_field('cart_order_id', date('YmdHis') . '-' . $customer_id . '-' . $cartID) . tep_draw_hidden_field('fixed', 'Y') . tep_draw_hidden_field('first_name', $order->billing['firstname']) . tep_draw_hidden_field('last_name', $order->billing['lastname']) . tep_draw_hidden_field('street_address', $order->billing['street_address']) . tep_draw_hidden_field('city', $order->billing['city']) . tep_draw_hidden_field('state', $order->billing['state']) . tep_draw_hidden_field('zip', $order->billing['postcode']) . tep_draw_hidden_field('country', $order->billing['country']['title']) . tep_draw_hidden_field('email', $order->customer['email_address']) . tep_draw_hidden_field('phone', $order->customer['telephone']) . tep_draw_hidden_field('ship_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']) . tep_draw_hidden_field('ship_street_address', $order->delivery['street_address']) . tep_draw_hidden_field('ship_city', $order->delivery['city']) . tep_draw_hidden_field('ship_state', $order->delivery['state']) . tep_draw_hidden_field('ship_zip', $order->delivery['postcode']) . tep_draw_hidden_field('ship_country', $order->delivery['country']['title']);
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         $process_button_string .= tep_draw_hidden_field('c_prod_' . ($i + 1), (int) $order->products[$i]['id'] . ',' . (int) $order->products[$i]['qty']) . tep_draw_hidden_field('c_name_' . ($i + 1), $order->products[$i]['name']) . tep_draw_hidden_field('c_description_' . ($i + 1), $order->products[$i]['name']) . tep_draw_hidden_field('c_price_' . ($i + 1), $this->format_raw(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), MODULE_PAYMENT_2CHECKOUT_CURRENCY));
     }
     $process_button_string .= tep_draw_hidden_field('id_type', '1') . tep_draw_hidden_field('skip_landing', '1');
     if (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') {
         $process_button_string .= tep_draw_hidden_field('demo', 'Y');
     }
     $process_button_string .= tep_draw_hidden_field('return_url', tep_href_link(FILENAME_SHOPPING_CART));
     $lang_query = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id = '" . (int) $languages_id . "'");
     $lang = tep_db_fetch_array($lang_query);
     switch (strtolower($lang['code'])) {
         case 'es':
             $process_button_string .= tep_draw_hidden_field('lang', 'sp');
             break;
     }
     $process_button_string .= tep_draw_hidden_field('cart_brand_name', 'oscommerce') . tep_draw_hidden_field('cart_version_name', PROJECT_VERSION);
     return $process_button_string;
 }
                  <tr class="dataTableHeadingRow">
                    <td class="dataTableHeadingContent" colspan="3"><?php 
        echo TABLE_HEADING_SHIPPING_QUOTES;
        ?>
</td>
                  </tr>
<?php 
        $r = 0;
        for ($i = 0, $n = sizeof($shipping_quotes); $i < $n; $i++) {
            for ($j = 0, $n2 = sizeof($shipping_quotes[$i]['methods']); $j < $n2; $j++) {
                $r++;
                if (!isset($shipping_quotes[$i]['tax'])) {
                    $shipping_quotes[$i]['tax'] = 0;
                }
                $rowClass = $r / 2 == floor($r / 2) ? 'dataTableRowOver' : 'dataTableRow';
                echo '                  <tr class="' . $rowClass . '" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this, \'' . $rowClass . '\')" onclick="selectRowEffect(this, ' . $r . '); setShipping(' . $r . ');">' . "\n" . '   <td class="dataTableContent" valign="top" align="left" width="15px">' . "\n" . '   <input type="radio" name="shipping" id="shipping_radio_' . $r . '" value="' . $shipping_quotes[$i]['id'] . '_' . $shipping_quotes[$i]['methods'][$j]['id'] . '">' . "\n" . '   <input type="hidden" id="update_shipping[' . $r . '][title]" name="update_shipping[' . $r . '][title]" value="' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):">' . "\n" . '   <input type="hidden" id="update_shipping[' . $r . '][value]" name="update_shipping[' . $r . '][value]" value="' . tep_add_tax($shipping_quotes[$i]['methods'][$j]['cost'], $shipping_quotes[$i]['tax']) . '">' . "\n" . '      <input type="hidden" id="update_shipping[' . $r . '][id]" name="update_shipping[' . $r . '][id]" value="' . $shipping_quotes[$i]['id'] . '_' . $shipping_quotes[$i]['methods'][$j]['id'] . '">' . "\n" . '<td class="dataTableContent" valign="top">' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):</td>' . "\n" . '<td class="dataTableContent" align="right">' . $currencies->format(tep_add_tax($shipping_quotes[$i]['methods'][$j]['cost'], $shipping_quotes[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '                  </tr>';
            }
        }
        ?>
                  <tr class="dataTableHeadingRow">
                    <td class="dataTableHeadingContent" colspan="3"><?php 
        echo sprintf(TEXT_PACKAGE_WEIGHT_COUNT, $shipping_num_boxes . ' x ' . $shipping_weight, $total_count);
        ?>
</td>
                  </tr>
                </table>
                <!-- shipping_quote_eof //-->
  
  <?php 
    } else {
        echo AJAX_NO_QUOTES;
                        echo '&nbsp;';
                    } else {
                        echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0));
                        ?>
&nbsp;&nbsp;<?php 
                        echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'required aria-required="true"');
                    }
                    ?>
        </td>

<?php 
                } else {
                    ?>

        <td align="right"><?php 
                    echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0)) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']);
                    ?>
</td>

<?php 
                }
                ?>

      </tr>

<?php 
            }
        }
    }
    ?>
</b></td>
                  </tr>
<?php 
}
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    echo '          <tr>' . "\n" . '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" . '            <td class="main" valign="top">' . $order->products[$i]['name'];
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
        for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
            echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
        }
    }
    echo '</td>' . "\n";
    if (sizeof($order->info['tax_groups']) > 1) {
        echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
    }
    echo '            <td class="main" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '          </tr>' . "\n";
}
?>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '10');
?>
</td>
      </tr>
      <tr>
Beispiel #8
0
</td>
	</tr>
	
<?php 
    for ($i = 0; $i < sizeof($order->products); $i++) {
        $orders_products_id = $order->products[$i]['orders_products_id'];
        $RowStyle = "dataTableContent";
        echo '	  <tr class="dataTableRow">' . "\n" . '	    <td class="' . $RowStyle . '" align="left" width="25">' . "<input name='update_products[{$orders_products_id}][qty]' size='2' value='" . $order->products[$i]['qty'] . "'></td>\n" . '	    <td class="' . $RowStyle . '" width="10">&nbsp;x&nbsp;</td>' . '	    <td class="' . $RowStyle . '" width="300">' . $order->products[$i]['name'] . "<input name='update_products[{$orders_products_id}][name]' type='hidden' value='" . $order->products[$i]['name'] . "'>";
        // # Has Attributes?
        if (sizeof($order->products[$i]['attributes']) > 0) {
            for ($j = 0; $j < sizeof($order->products[$i]['attributes']); $j++) {
                $orders_products_attributes_id = $order->products[$i]['attributes'][$j]['orders_products_attributes_id'];
                echo '<br><nobr><small>&nbsp;<i> - ' . htmlspecialchars($order->products[$i]['attributes'][$j]['option']) . ': ' . htmlspecialchars($order->products[$i]['attributes'][$j]['value']);
            }
        }
        echo '	    </td>' . "\n" . '	    <td class="' . $RowStyle . '">' . $order->products[$i]['model'] . "<input name='update_products[{$orders_products_id}][model]' size='12' type='hidden' value='" . $order->products[$i]['model'] . "'>" . '</td>' . "\n" . '	    <td class="' . $RowStyle . '">' . "<input name='update_products[{$orders_products_id}][tax]' size='4' value='" . tep_display_tax_value($order->products[$i]['tax']) . "'>" . '%</td>' . "\n" . '	    <td class="' . $RowStyle . '" align="right">' . $currencies->format($order->products[$i]['final_price']) . "<input name='update_products[{$orders_products_id}][final_price]' size='5' type='hidden' value='" . $order->products[$i]['final_price'] . "'>" . '</td>' . "\n" . '	    <td class="' . $RowStyle . '" align="right">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '	    <td class="' . $RowStyle . '" align="right">' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '	    <td class="' . $RowStyle . '" align="right"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '	  </tr>' . "\n";
    }
    ?>
</table>

        </td>
</tr>
      <tr>
	      <td>
				  <table width="100%" cellpadding="0" cellspacing="0">
					  <tr>
						  <td valign="top"><?php 
    echo "<span class='smalltext'>" . HINT_DELETE_POSITION . "</span>";
    ?>
</td>
			        <td align="right"><?php 
Beispiel #9
0
 function cart()
 {
     global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;
     $this->content_type = $cart->get_content_type();
     $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $customer_id . "' and ab.customers_id = '" . (int) $customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = tep_db_fetch_array($customer_address_query);
     $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $sendto . "'");
     $shipping_address = tep_db_fetch_array($shipping_address_query);
     $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $billto . "'");
     $billing_address = tep_db_fetch_array($billing_address_query);
     $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) ($this->content_type == 'virtual' ? $billto : $sendto) . "'");
     $tax_address = tep_db_fetch_array($tax_address_query);
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : '', 'cc_owner' => isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : '', 'cc_number' => isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : '', 'cc_expires' => isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : '', 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => isset($GLOBALS['comments']) ? $GLOBALS['comments'] : '');
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         $this->info['payment_method'] = $GLOBALS[$payment]->title;
         if (isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && $GLOBALS[$payment]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$payment]->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => tep_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => tep_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => tep_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $cart->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $languages_id . "' and poval.language_id = '" . (int) $languages_id . "'");
                 $attributes = tep_db_fetch_array($attributes_query);
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
$payment_modules = new payment($payment);
require DIR_WS_CLASSES . 'order.php';
$order = new order();
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($shipping);
if (sizeof($order->products) == 0) {
    tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
}
if ($customer_id == '58543') {
    $order->info['subtotal'] = 0;
    reset($order->products);
    while (list($i) = each($order->products)) {
        $order->products[$i]['price'] = round($order->products[$i]['price'] * 1.15);
        $order->products[$i]['final_price'] = round($order->products[$i]['final_price'] * 1.15);
        $order->info['subtotal'] += tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'];
        $order->info['total'] = $order->info['subtotal'];
    }
    $shipping = array('id' => 'slf_0', 'title' => 'Самовывоз', 'cost' => 0);
}
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_totals = $order_total_modules->process();
if ($customer_id == '58543') {
    reset($order_totals);
    while (list($i) = each($order_totals)) {
        if ($order_totals[$i]['code'] == 'ot_shipping') {
            $order_totals[$i]['title'] = 'Самовывоз';
            $order_totals[$i]['text'] = $currencies->format(0);
            $order_totals[$i]['value'] = '0';
        }
Beispiel #11
0
 function cart()
 {
     global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;
     $this->content_type = $cart->get_content_type();
     $shop_countries = tep_get_shops_countries();
     $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, ab.entry_country_id, ab.entry_telephone, ab.entry_state, c.customers_email_address, c.customers_telephone from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab where c.customers_id = '" . (int) $customer_id . "' and ab.customers_id = '" . (int) $customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = tep_db_fetch_array($customer_address_query);
     if (!is_array($customer_address)) {
         $customer_address = array();
     }
     $country_info_query = tep_db_query("select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $customer_address['entry_country_id'] . "' and language_id = '" . (int) $languages_id . "'");
     $country_info = tep_db_fetch_array($country_info_query);
     if (!is_array($country_info)) {
         $country_info = array();
         reset($shop_countries);
         while (list(, $shop_country) = each($shop_countries)) {
             if ($shop_country['country_id'] == $customer_address['entry_country_id']) {
                 $country_info = array('countries_id' => $shop_country['country_id'], 'countries_name' => $shop_country['country_name'], 'countries_iso_code_2' => $shop_country['country_code'], 'countries_iso_code_3' => $shop_country['country_code_3'], 'address_format_id' => $shop_country['address_format_id']);
                 break;
             }
         }
     }
     $zone_info_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_id = '" . (int) $customer_address['entry_zone_id'] . "'");
     $zone_info = tep_db_fetch_array($zone_info_query);
     if (!is_array($zone_info)) {
         $zone_info = array();
     }
     $customer_address = array_merge($customer_address, $country_info, $zone_info);
     $company = array();
     $company_info_query = tep_db_query("select * from " . TABLE_COMPANIES . " where customers_id = '" . (int) $customer_id . "'");
     $company_info = tep_db_fetch_array($company_info_query);
     if (!is_array($company_info)) {
         $company_info = array();
     }
     reset($company_info);
     while (list($k, $v) = each($company_info)) {
         $k = str_replace('companies_', 'company_', $k);
         $k = str_replace('company_full_name', 'company_full', $k);
         $k = str_replace('company_name', 'company', $k);
         $company[$k] = $v;
     }
     $shipping_address_query = tep_db_query("select entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_zone_id, entry_country_id, entry_telephone, entry_state from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $sendto . "'");
     $shipping_address = tep_db_fetch_array($shipping_address_query);
     if (!is_array($shipping_address)) {
         $shipping_address = array();
     }
     $country_info_query = tep_db_query("select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $shipping_address['entry_country_id'] . "' and language_id = '" . (int) $languages_id . "'");
     $country_info = tep_db_fetch_array($country_info_query);
     if (!is_array($country_info)) {
         $country_info = array();
         reset($shop_countries);
         while (list(, $shop_country) = each($shop_countries)) {
             if ($shop_country['country_id'] == $shipping_address['entry_country_id']) {
                 $country_info = array('countries_id' => $shop_country['country_id'], 'countries_name' => $shop_country['country_name'], 'countries_iso_code_2' => $shop_country['country_code'], 'countries_iso_code_3' => $shop_country['country_code_3'], 'address_format_id' => $shop_country['address_format_id']);
                 break;
             }
         }
     }
     $zone_info_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_id = '" . (int) $shipping_address['entry_zone_id'] . "'");
     $zone_info = tep_db_fetch_array($zone_info_query);
     if (!is_array($zone_info)) {
         $zone_info = array();
     }
     $shipping_address = array_merge($shipping_address, $country_info, $zone_info);
     $billing_address_query = tep_db_query("select entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_zone_id, entry_country_id, entry_telephone, entry_state from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $billto . "'");
     $billing_address = tep_db_fetch_array($billing_address_query);
     if (!is_array($billing_address)) {
         $billing_address = array();
     }
     $country_info_query = tep_db_query("select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $billing_address['entry_country_id'] . "' and language_id = '" . (int) $languages_id . "'");
     $country_info = tep_db_fetch_array($country_info_query);
     if (!is_array($country_info)) {
         $country_info = array();
         reset($shop_countries);
         while (list(, $shop_country) = each($shop_countries)) {
             if ($shop_country['country_id'] == $billing_address['entry_country_id']) {
                 $country_info = array('countries_id' => $shop_country['country_id'], 'countries_name' => $shop_country['country_name'], 'countries_iso_code_2' => $shop_country['country_code'], 'countries_iso_code_3' => $shop_country['country_code_3'], 'address_format_id' => $shop_country['address_format_id']);
                 break;
             }
         }
     }
     $zone_info_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_id = '" . (int) $billing_address['entry_zone_id'] . "'");
     $zone_info = tep_db_fetch_array($zone_info_query);
     if (!is_array($zone_info)) {
         $zone_info = array();
     }
     $billing_address = array_merge($billing_address, $country_info, $zone_info);
     $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) ($this->content_type == 'virtual' ? $billto : $sendto) . "'");
     $tax_address = tep_db_fetch_array($tax_address_query);
     $this->info = array('code' => '', 'order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'is_paid' => '0', 'payment_method' => $payment, 'cc_type' => isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : '', 'cc_owner' => isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : '', 'cc_number' => isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : '', 'cc_expires' => isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : '', 'check_account_type' => isset($GLOBALS['check_account_type']) ? $GLOBALS['check_account_type'] : '', 'check_bank_name' => isset($GLOBALS['check_bank_name']) ? $GLOBALS['check_bank_name'] : '', 'check_routing_number' => isset($GLOBALS['check_routing_number']) ? $GLOBALS['check_routing_number'] : '', 'check_account_number' => isset($GLOBALS['check_account_number']) ? $GLOBALS['check_account_number'] : '', 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => isset($GLOBALS['comments']) ? $GLOBALS['comments'] : '', 'delivery_transfer' => $cart->info['delivery_transfer'], 'shops_id' => SHOP_ID);
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         $this->info['payment_method'] = $GLOBALS[$payment]->title;
         if (isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && $GLOBALS[$payment]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$payment]->order_status;
         }
     }
     $this->customer = array('id' => $customer_id, 'firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => tep_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['entry_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->customer = array_merge($this->customer, $company);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => tep_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'telephone' => $shipping_address['entry_telephone'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => tep_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'telephone' => $billing_address['entry_telephone'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $cart->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'code' => $products[$i]['code'], 'manufacturer' => $products[$i]['manufacturer'], 'year' => $products[$i]['year'], 'type' => $products[$i]['type'], 'periodicity' => $products[$i]['periodicity'], 'periodicity_min' => $products[$i]['periodicity_min'], 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'weight' => $products[$i]['weight'], 'warranty' => $products[$i]['warranty'], 'id' => $products[$i]['id']);
         if (tep_not_null($products[$i]['filename'])) {
             $this->products[$index]['filename'] = $products[$i]['filename'];
             $this->products[$index]['download_maxdays'] = DOWNLOAD_MAX_DAYS;
             $this->products[$index]['download_count'] = DOWNLOAD_MAX_COUNT;
         }
         $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
 function fixTaxes()
 {
     global $cart, $order, $currencies, $onepage, $customer_id, $customer_country_id, $customer_zone_id;
     if ($cart->get_content_type() == 'virtual' && is_numeric($onepage['billing']['country_id'])) {
         $taxCountryID = $onepage['billing']['country_id'];
         $taxZoneID = $onepage['billing']['zone_id'];
     } elseif (is_numeric($onepage['delivery']['country_id'])) {
         $taxCountryID = $onepage['delivery']['country_id'];
         $taxZoneID = $onepage['delivery']['zone_id'];
     } elseif (!tep_session_is_registered('customer_id')) {
         if (DISPLAY_PRICE_WITH_TAX == 'false') {
             $taxCountryID = 0;
             $taxZoneID = 0;
         } else {
             $taxCountryID = STORE_COUNTRY;
             $taxZoneID = STORE_ZONE;
         }
     } else {
         $taxCountryID = $customer_country_id;
         $taxZoneID = $customer_zone_id;
     }
     $products = $cart->get_products();
     if (sizeof($products) > 0) {
         $order->info['subtotal'] = 0;
         $order->info['tax_groups'] = array();
         $order->info['tax'] = 0;
         //BOF KGT
         if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true') {
             $valid_products_count = 0;
             $order->coupon->applied_discount = array();
         }
         //EOF KGT
         //echo '<pre>';
         for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
             $taxClassID = $products[$i]['tax_class_id'];
             $order->products[$i]['tax'] = tep_get_tax_rate($taxClassID, $taxCountryID, $taxZoneID);
             $order->products[$i]['tax_description'] = tep_get_tax_description($taxClassID, $taxCountryID, $taxZoneID);
             //BOF KGT
             if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' && is_object($order->coupon) && !empty($order->coupon->coupon)) {
                 //kgt - discount coupons
                 $applied_discount = 0;
                 $discount = $order->coupon->calculate_discount($order->products[$i], $valid_products_count);
                 if ($discount['applied_discount'] > 0) {
                     $valid_products_count++;
                 }
                 $shown_price = $order->coupon->calculate_shown_price($discount, $order->products[$i]);
                 //var_dump($shown_price);
                 $shown_price = $shown_price['actual_shown_price'];
             } else {
                 $shown_price = tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'];
             }
             $order->info['subtotal'] += $shown_price;
             /**************
                  $shown_price = tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'];
                $order->info['subtotal'] += $shown_price;
                  **************/
             //end kgt - discount coupons
             //EOF KGT
             $products_tax = $order->products[$i]['tax'];
             $products_tax_description = $order->products[$i]['tax_description'];
             //echo "tax: $products_tax \n";
             //echo "tax desc: $products_tax_description \n";
             if (DISPLAY_PRICE_WITH_TAX == 'true') {
                 $order->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                 if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                     $order->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                 } else {
                     $order->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                 }
             } else {
                 $order->info['tax'] += $products_tax / 100 * $shown_price;
                 if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                     $order->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
                 } else {
                     $order->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
                 }
             }
             //echo $shown_price."\n";
         }
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $order->info['total'] = $order->info['subtotal'] + $order->info['shipping_cost'];
         } else {
             $order->info['total'] = $order->info['subtotal'] + $order->info['tax'] + $order->info['shipping_cost'];
         }
         //kgt - discount coupon
         if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' && is_object($order->coupon) && !empty($order->coupon->coupon)) {
             //$order->coupon->applied_discount = $applied_discount;
             $order->info['total'] = $order->coupon->finalize_discount($order->info);
             $onepage['coupon'] = $order->coupon;
         }
         //end kgt - discount coupon
     }
 }
 $pdf->SetX(30);
 $pdf->SetFont('Arial', '', 7);
 $pdf->MultiCell(25, 6, $order->products[$i]['model'], $border, 'C');
 $pdf->SetY($Y_Table_Position);
 $pdf->SetX(125);
 $pdf->SetFont('Arial', '', 7);
 $pdf->MultiCell(20, 6, $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']), $border, 'C');
 $pdf->SetY($Y_Table_Position);
 $pdf->SetX(145);
 $pdf->MultiCell(20, 6, $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']), $border, 'C');
 $pdf->SetY($Y_Table_Position);
 $pdf->SetX(165);
 $pdf->MultiCell(20, 6, $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), $border, 'C');
 $pdf->SetY($Y_Table_Position);
 $pdf->SetX(185);
 $pdf->MultiCell(18, 6, $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), $border, 'C');
 $Y_Table_Position += 6;
 $attributes = '';
 $pdf->SetFont('Arial', 'I', 5);
 for ($att = 0; $att < sizeof($order->products[$i]['attributes']); $att++) {
     $border = 'LR';
     if ($att == sizeof($order->products[$i]['attributes']) - 1) {
         $border .= 'B';
     }
     $pdf->SetY($Y_Table_Position);
     $pdf->SetX(20);
     //$temp = str_replace('&nbsp;', ' ');
     $pdf->MultiCell(10, 4, "", $border, 'C');
     $pdf->SetY($Y_Table_Position);
     $pdf->SetX(55);
     $attributes = $order->products[$i]['attributes'][$att]['option'] . " :" . $order->products[$i]['attributes'][$att]['value'];
                                    <?php 
        echo $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']);
        ?>
                                </strong>
                            </td>
                            <td class="dataTableContent" align="right" valign="top">
                                <strong>
                                    <?php 
        echo $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
        ?>
                                </strong>
                            </td>
                            <td class="dataTableContent" align="right" valign="top">
                                <strong>
                                    <?php 
        echo $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
        ?>
                                </strong>
                            </td>
                        </tr>
                        <?php 
    }
    ?>
                        <?php 
}
?>
                        <tr>
                            <td align="right" colspan="8">
                                <table border="0" cellspacing="0" cellpadding="2">
                                    <?php 
for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
function tep_get_price_with_tax($products_price, $products_tax, $default_currency, $calculate_currency_value = true)
{
    $price = tep_round(tep_add_tax($products_price, $products_tax, true), $default_currency['decimal_places']);
    if ($calculate_currency_value) {
        $format_string = number_format($price * $default_currency['value'], $default_currency['decimal_places'], $default_currency['decimal_point'], $default_currency['thousands_point']);
    } else {
        $format_string = number_format($price, $default_currency['decimal_places'], $default_currency['decimal_point'], $default_currency['thousands_point']);
    }
    return $format_string;
}
Beispiel #16
0
 function calculate()
 {
     global $currencies;
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents[$_REQUEST['project_id']])) {
         return 0;
     }
     reset($this->contents);
     //      while (list($products_id, ) = each($this->contents[$_REQUEST['project_id']])) {
     foreach ($this->contents[$_REQUEST['project_id']] as $products_id => $val) {
         $qty = $this->contents[$_REQUEST['project_id']][$products_id]['qty'];
         // products price
         $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
         if ($product = tep_db_fetch_array($product_query)) {
             $prid = $product['products_id'];
             $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int) $prid . "' and status = '1'");
             if (tep_db_num_rows($specials_query)) {
                 $specials = tep_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total += $currencies->calculate_price($products_price, $products_tax, $qty, "", $prid);
             $this->weight += $qty * $products_weight;
         }
         // attributes price
         if (isset($this->contents[$_REQUEST['project_id']][$products_id]['attributes'])) {
             reset($this->contents[$_REQUEST['project_id']][$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$_REQUEST['project_id']][$products_id]['attributes'])) {
                 $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $prid . "' and options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "'");
                 $attribute_price = tep_db_fetch_array($attribute_price_query);
                 // Actual Attribute Price
                 $price_prefix = $attribute_price['price_prefix'];
                 $option_price = $attribute_price['options_values_price'];
                 $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
                 $products_stuff = tep_db_fetch_array($products_query);
                 $products_price = $products_stuff['products_price'];
                 if ($price_prefix == '+') {
                     $this->total += $qty * tep_add_tax($option_price, $products_tax);
                 } elseif ($price_prefix == '-') {
                     $this->total -= $qty * tep_add_tax($option_price, $products_tax);
                 } else {
                     $this->total += $qty * tep_add_tax(tep_adjust_price($option_price, $products_price), $products_tax);
                 }
                 // Actual Attribute Price End
             }
         }
     }
 }
Beispiel #17
0
	 
   <?php 
}
//end if ($action == 'insert_shipping') {
//13. new order email
if ($action == 'new_order_email') {
    $order = new manualOrder($_GET['oID']);
    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
        //loop all the products in the order
        $products_ordered_attributes = '';
        if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
            for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                $products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value'];
            }
        }
        $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . $products_model . ' = ' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . $products_ordered_attributes . "\n";
    }
    //Build the email
    $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . (int) $_GET['oID'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . (int) $_GET['oID'], 'SSL') . "\n" . EMAIL_TEXT_DATE_MODIFIED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
    $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
    for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
        $email_order .= strip_tags($order->totals[$i]['title']) . ' ' . strip_tags($order->totals[$i]['text']) . "\n";
    }
    if ($order->content_type != 'virtual') {
        $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . $order->delivery['name'] . "\n";
        if ($order->delivery['company']) {
            $email_order .= $order->delivery['company'] . "\n";
        }
        $email_order .= $order->delivery['street_address'] . "\n";
        if ($order->delivery['suburb']) {
            $email_order .= $order->delivery['suburb'] . "\n";
Beispiel #18
0
 function display_price($products_price, $products_tax, $quantity = 1, $currency_type = DEFAULT_CURRENCY)
 {
     return $this->format(tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency_type]['decimal_places']) * $quantity);
 }
        ?>
</td>
      <td class="dataTableContent" valign="top" align="right"><?php 
        echo '<b>' . $osC_Currencies->format($products['final_price'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b>';
        ?>
</td>
      <td class="dataTableContent" valign="top" align="right"><?php 
        echo '<b>' . $osC_Currencies->format(tep_add_tax($products['final_price'], $products['tax']), $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b>';
        ?>
</td>
      <td class="dataTableContent" valign="top" align="right"><?php 
        echo '<b>' . $osC_Currencies->format($products['final_price'] * $products['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b>';
        ?>
</td>
      <td class="dataTableContent" valign="top" align="right"><?php 
        echo '<b>' . $osC_Currencies->format(tep_add_tax($products['final_price'], $products['tax']) * $products['quantity'], $osC_Order->getCurrency(), $osC_Order->getCurrencyValue()) . '</b>';
        ?>
</td>
    </tr>
<?php 
    }
    ?>
  </table>

  <table border="0" cellspacing="0" cellpadding="2" align="right">
<?php 
    foreach ($osC_Order->getTotals() as $totals) {
        ?>
    <tr>
      <td class="smallText" align="right"><?php 
        echo $totals['title'];
Beispiel #20
0
 function calculate_price($products_price, $products_tax, $quantity = 1)
 {
     return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$_SESSION['currency']]['decimal_places']) * $quantity;
 }
    }
    ?>
	</table>
	</fieldset>
<?php 
}
?>
	<fieldset>
	<legend><?php 
echo HEADING_PRODUCTS;
?>
</legend>
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
<?php 
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    echo '	  <tr valign="top">' . "\n" . '		<td width="1%" align="right">' . $order->products[$i]['qty'] . '</td>' . "\n" . '		<td width="1%">x</td>' . "\n" . '		<td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $order->products[$i]['id']) . '">' . $order->products[$i]['name'] . '</a>' . (tep_not_null($order->products[$i]['tracking_number']) && $tracking_numbers_count > 1 ? '<br />' . "\n" . HEADING_TRACKING_NUMBER . ' ' . $order->products[$i]['tracking_number'] : '') . '</td>' . "\n" . '		<td align="right" nowrap="nowrap">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '	  </tr>' . "\n";
}
?>
	</table>
	</fieldset>
	<fieldset>
	<legend><?php 
echo HEADING_ORDER_HISTORY;
?>
</legend>
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
<?php 
$statuses_query = tep_db_query("select os.orders_status_name, os.orders_status_description, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int) $HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int) DEFAULT_LANGUAGE_ID . "' order by osh.date_added");
while ($statuses = tep_db_fetch_array($statuses_query)) {
    echo '	  <tr valign="top">' . "\n" . '		<td width="50%">' . tep_date_long($statuses['date_added']) . '</td>' . "\n" . '		<td width="50%">' . $statuses['orders_status_name'] . (tep_not_null($statuses['comments']) ? ' (' . nl2br(tep_output_string_protected($statuses['comments'])) . ')' : (tep_not_null($statuses['orders_status_description']) ? ' (' . tep_output_string_protected($statuses['orders_status_description']) . ')' : '')) . '</td>' . "\n" . '	  </tr>' . "\n";
}
Beispiel #22
0
                 for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j++) {
                     $thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'];
                     $ShipTxt .= '<tr class="' . $extra . '">';
                     $ShipTxt .= '<td class="main">' . $quotes[$i]['icon'] . '&nbsp;&nbsp;&nbsp;</td>';
                     if ($quotes[$i]['error']) {
                         $ShipTxt .= '<td colspan="2" class="main">' . $quotes[$i]['module'] . '&nbsp;';
                         $ShipTxt .= '(' . $quotes[$i]['error'] . ')</td></tr>';
                     } else {
                         if ($selected_shipping['id'] == $thisquoteid) {
                             // commented for v2.10 :  $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].'&nbsp;';
                             $ShipTxt .= '<td class="main"><a title="' . CART_SELECT_THIS_METHOD . '" href="_" onclick="return shipincart_submit(\'' . $thisquoteid . '\');"><b>' . $quotes[$i]['module'] . '&nbsp;';
                             $ShipTxt .= '(' . $quotes[$i]['methods'][$j]['title'] . ')</b></a>&nbsp;&nbsp;&nbsp;</td><td align="right" class="main"><b>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . '</b></td><td class="main">' . tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected') . '</td></tr>';
                         } else {
                             // commented for v2.10 :   $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].'&nbsp;';
                             $ShipTxt .= '<td class="main"><a title="' . CART_SELECT_THIS_METHOD . '" href="_" onclick="return shipincart_submit(\'' . $thisquoteid . '\');">' . $quotes[$i]['module'] . '&nbsp;';
                             $ShipTxt .= '(' . $quotes[$i]['methods'][$j]['title'] . ')</a>&nbsp;&nbsp;&nbsp;</td><td align="right" class="main">' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . '</td><td class="main">&nbsp;</td></tr>';
                         }
                     }
                 }
             }
         }
     }
 }
 $ShipTxt .= '</table></form>';
 $info_box_contents = array();
 $info_box_contents[] = array('text' => $ShipTxt);
 new infoBox($info_box_contents);
 if (CARTSHIP_SHOWOT == 'true') {
     // BOF get taxes if not logged in
     if (!tep_session_is_registered('customer_id')) {
         $products = $cart->get_products();
Beispiel #23
0
 function calculate()
 {
     // ############ Added CCGV Contribution ##########
     $this->total_virtual = 0;
     // CCGV Contribution
     // ############ End Added CCGV Contribution ##########
     $mydb =& XoopsDatabaseFactory::getDatabaseConnection();
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // products price
         $product_query = $mydb->query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
         if ($product = $mydb->fetchArray($product_query)) {
             // ############ Added CCGV Contribution ##########
             $no_count = 1;
             $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
             $gv_result = tep_db_fetch_array($gv_query);
             if (ereg('^GIFT', $gv_result['products_model'])) {
                 $no_count = 0;
             }
             // ############ End Added CCGV Contribution ##########
             $prid = $product['products_id'];
             $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = $mydb->query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int) $prid . "' and status = '1'");
             if ($mydb->getRowsNum($specials_query)) {
                 $specials = $mydb->fetchArray($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             // ############ Added CCGV Contribution ##########
             $this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty * $no_count;
             // ICW CREDIT CLASS;
             $this->weight_virtual += $qty * $products_weight * $no_count;
             // ICW CREDIT CLASS;
             // ############ End Added CCGV Contribution ##########
             $this->total += tep_add_tax($products_price, $products_tax) * $qty;
             $this->weight += $qty * $products_weight;
         }
         // attributes price
         if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $attribute_price_query = $mydb->query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $prid . "' and options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "'");
                 $attribute_price = $mydb->fetchArray($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
Beispiel #24
0
            <td class="dataTableHeadingContent"><?php 
    echo TABLE_HEADING_TAX;
    ?>
</td>
            <td class="dataTableHeadingContent"><?php 
    echo TABLE_HEADING_TOTAL;
    ?>
</td>
          </tr>
<?php 
    for ($i = 0, $total_weight = 0, $n = sizeof($order->products); $i < $n; $i++) {
        $manufacturer_string = $order->products[$i]['manufacturer'];
        if ($order->products[$i]['year'] > 0) {
            $manufacturer_string .= (tep_not_null($manufacturer_string) ? ', ' : '') . $order->products[$i]['year'];
        }
        echo '          <tr class="dataTableRow" align="center">' . "\n" . '            <td class="dataTableContent" align="left">' . ($i + 1) . '.&nbsp;<a href="' . tep_catalog_href_link(FILENAME_CATALOG_PRODUCT_INFO, 'products_id=' . $order->products[$i]['id']) . '" target="_blank"><u>' . $order->products[$i]['name'] . '</u></a></td>' . "\n" . '            <td class="dataTableContent">' . $manufacturer_string . '</td>' . "\n" . '            <td class="dataTableContent"><nobr>' . $order->products[$i]['model'] . '</nobr></td>' . "\n" . '            <td class="dataTableContent">' . $order->products[$i]['code'] . '</td>' . "\n" . '            <td class="dataTableContent">' . $order->products[$i]['weight'] . '</td>' . "\n" . '            <td class="dataTableContent">' . $order->products[$i]['qty'] . '</td>' . "\n" . '            <td class="dataTableContent" align="right"><nobr>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</nobr></td>' . "\n" . '            <td class="dataTableContent">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . '            <td class="dataTableContent" align="right"><nobr><strong>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></nobr></td>' . "\n" . '          </tr>' . "\n";
        $total_weight += $order->products[$i]['weight'] * $order->products[$i]['qty'];
    }
    ?>
          <tr>
            <td align="right" colspan="9"><table border="0" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText" align="right"><?php 
    echo ENTRY_TOTAL_WEIGHT;
    ?>
</td>
				<td class="smallText" align="center"><?php 
    echo $total_weight . ENTRY_TOTAL_WEIGHT_UNITS;
    ?>
</td>
			  </tr>
Beispiel #25
0
 $pdf->addText($x += PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, TABLE_HEADING_PRODUCTS_MODEL);
 $pdf->addText($x += MODEL_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, TABLE_HEADING_PRICE_INCLUDING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, TABLE_HEADING_TOTAL_INCLUDING_TAX);
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 // Sort through the products
 for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
     $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
     change_color(PRODUCT_LISTING_BKGD_COLOR);
     $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
     $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
     $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
     change_color(GENERAL_FONT_COLOR);
     $truncated_str = $pdf->addTextWrap($x, $pos, PRODUCTS_COLUMN_SIZE, TABLE_HEADER_FONT_SIZE, $prod_str);
     $pdf->addText($x += PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, $order->products[$i]['model']);
     $pdf->addText($x += MODEL_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, html_entity_decode($currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value'])));
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, html_entity_decode($currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])));
     $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
     if ($truncated_str) {
         change_color(PRODUCT_LISTING_BKGD_COLOR);
         $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
         $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
         change_color(GENERAL_FONT_COLOR);
         $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
         $pdf->addText($reset_x, $pos, TABLE_HEADER_FONT_SIZE, $truncated_str);
         $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
     }
     if (($k = sizeof($order->products[$i]['attributes'])) > 0) {
         for ($j = 0; $j < $k; $j++) {
             $attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
             if ($order->products[$i]['attributes'][$j]['price'] != '0') {
                 $attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
Beispiel #26
0
 function calculate_price($products_price, $products_tax, $quantity = 1)
 {
     global $currency;
     return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
 }
Beispiel #27
0
</td>
      </tr>
<?php 
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    echo '      <tr class="dataTableRow">' . "\n" . '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" . '        <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
    if (isset($order->products[$i]['attributes']) && ($k = sizeof($order->products[$i]['attributes'])) > 0) {
        for ($j = 0; $j < $k; $j++) {
            echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
            if ($order->products[$i]['attributes'][$j]['price'] != '0') {
                echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
            }
            echo '</i></small></nobr>';
        }
    }
    echo '        </td>' . "\n" . '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
    echo '        <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
    echo '      </tr>' . "\n";
}
?>
      <tr>
        <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
<?php 
for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
    echo '          <tr>' . "\n" . '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" . '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" . '          </tr>' . "\n";
}
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
Beispiel #28
0
 function calculate()
 {
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     foreach ($this->contents as $line) {
         $products_id = intval($line['id']);
         $qty = $line['qty'];
         // products price
         $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $products_id . "'") or die(mysql_error());
         if ($product = tep_db_fetch_array($product_query)) {
             $prid = $product['products_id'];
             $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1'") or die(mysql_error());
             if (tep_db_num_rows($specials_query)) {
                 $specials = tep_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total += tep_add_tax($products_price, $products_tax) * $qty;
             $this->weight += $qty * $products_weight;
         }
         // attributes price
         if (isset($line['attributes'])) {
             foreach ($line['attributes'] as $option => $value) {
                 $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "'") or die(mysql_error());
                 $attribute_price = tep_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
Beispiel #29
0
 public function display_price($products_price, $products_tax, $quantity = 1)
 {
     return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
 }
Beispiel #30
0
 function display_price($products_price, $products_tax, $quantity = 1)
 {
     //	 echo "PRICE".$products_price.":".$products_tax.":".$quantity."<br>";
     return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
 }