read()) {
if (!is_dir( $module_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
$directory_array[] = $file;
}
}
}
sort($directory_array);
$dir->close();
}
// For each available payment module, check if enabled
for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
$file = $directory_array[$i];
include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/payment/' . $file);
include($module_directory . $file);
$class = substr($file, 0, strrpos($file, '.'));
if (tep_class_exists($class)) {
$module = new $class;
if ($module->check() > 0) {
// If module enabled create array of titles
$enabled_payment[] = array('id' => $module->title, 'text' => $module->title);
//if the payment method is the same as the payment module title then don't add it to dropdown menu
if ($module->title == $order->info['payment_method']) {
$paymentMatchExists='true';
}
}
}
}
//just in case the payment method found in db is not the same as the payment module title then make it part of the dropdown array or else it cannot be the selected default value
if ($paymentMatchExists !='true') {
$enabled_payment[] = array('id' => $order->info['payment_method'], 'text' => $order->info['payment_method']);
}
$enabled_payment[] = array('id' => 'Other', 'text' => 'Other');
//draw the dropdown menu for payment methods and default to the order value
echo tep_draw_pull_down_menu('update_info_payment_method', $enabled_payment, $order->info['payment_method'], 'id="update_info_payment_method" onChange="init()"');
}
else {
//draw the input field for payment methods and default to the order value
?>
currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}
echo tep_draw_pull_down_menu('update_info_payment_currency', $currencies_array, $order->info['currency'], 'id="update_info_payment_currency" onChange="currency()"');
?>
products); $i++) {
//calculate total weight
$products_weight = array($order->products[$i]['weight'] * $order->products[$i]['qty']);
foreach ($products_weight as $key => $value);
$total_weight += $value;
//end total weight
$orders_products_id = $order->products[$i]['orders_products_id'];
$RowStyle = "dataTableContent";
echo ' ' . "\n" .
' ' . "
\n" .
' ' . " products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-qty'>
\n" .
' ' . " ";
// Has Attributes?
if (sizeof($order->products[$i]['attributes']) > 0) {
for ($j=0; $jproducts[$i]['attributes']); $j++) {
$orders_products_attributes_id = $order->products[$i]['attributes'][$j]['orders_products_attributes_id'];
echo ' - ' . " " . ': ' . " " . ': ' . " products[$i]['tax_description'] . "', '" . $orders_products_attributes_id . "')\">" . ': ' . " products[$i]['tax_description'] . "', '" . $orders_products_attributes_id . "')\" id='p". $orders_products_id . "a" . $orders_products_attributes_id . "'>";
echo ' ';
} //end for ($j=0; $jproducts[$i]['attributes']); $j++) {
//Has downloads?
if (DOWNLOAD_ENABLED == 'true') {
$downloads_count = 1;
$d_index = 0;
$download_query_raw ="SELECT orders_products_download_id, orders_products_filename, download_maxdays, download_count
FROM " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . "
WHERE orders_products_id='" . $orders_products_id . "'
AND orders_id='" . (int)$oID . "'
ORDER BY orders_products_download_id";
$download_query = tep_db_query($download_query_raw);
//
if (isset($downloads->products)) unset($downloads->products);
//
if (tep_db_num_rows($download_query) > 0) {
while ($download = tep_db_fetch_array($download_query)) {
$downloads->products[$d_index] = array(
'id' => $download['orders_products_download_id'],
'filename' => $download['orders_products_filename'],
'maxdays' => $download['download_maxdays'],
'maxcount' => $download['download_count']);
$d_index++;
}
}
for ($mm=0; $mmproducts); $mm++) {
$id = $downloads->products[$mm]['id'];
echo '';
echo '' . ENTRY_DOWNLOAD_COUNT . $downloads_count . "";
echo ' ' . "\n";
echo ' - ' . ENTRY_DOWNLOAD_FILENAME . ": ";
echo ' ' . "\n";
echo ' - ' . ENTRY_DOWNLOAD_MAXDAYS . ": ";
echo ' ' . "\n";
echo ' - ' . ENTRY_DOWNLOAD_MAXCOUNT . ": ";
echo ' ' . "\n";
echo ' ';
$downloads_count++;
} //end for ($mm=0; $mmproducts[$i]['attributes']) > 0) {
echo ' ' . "\n" .
' ' . " " . ' ' . "\n" .
' ' . " products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-tax'>" .
" " .
" products[$i]['final_price'] / 100 * $order->products[$i]['qty']), 4, '.', '') . "'>" .
' ' . "\n" .
' ' . " products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-price'>" . ' ' . "\n" .
' ' . " products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-final_price'>" . ' ' . "\n" .
' ' . " products[$i]['tax']/100) + 1)), 4, '.', '') . "' onKeyUp=\"updatePrices('price_incl', 'p" . $orders_products_id . "', '" . $order->products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-price_incl'>" . ' ' . "\n" .
' ' . " products[$i]['qty'], 4, '.', '') . "' onKeyUp=\"updatePrices('total_excl', 'p" . $orders_products_id . "', '" . $order->products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-total_excl'>" . ' ' . "\n" .
' ' . " products[$i]['tax']/100) + 1))) * $order->products[$i]['qty'], 4, '.', '') . "' onKeyUp=\"updatePrices('total_incl', 'p" . $orders_products_id . "', '" . $order->products[$i]['tax_description'] . "')\" id='p" . $orders_products_id . "-total_incl'>" . ' ' . "\n" .
' ' .
" products[$i]['qty']), 2, '.', '') . "' id='p" . $orders_products_id . "-total_weight' readonly='readonly'>" . " " . ' ' . "\n" .
' ' .
" " . " " . ' ' . "\n" .
' ' . "\n" .
' ' . tep_draw_separator('pixel_trans.gif', '1', '1') . ' ' . "\n";
}
?>
' . tep_image_button('button_add_article.gif', ADDING_TITLE) . ''; ?>
'; ?>
totals); $i++) {
$TotalsLengthArray[] = array("Name" => $order->totals[$i]['title']);
}
reset($TotalsLengthArray);
foreach($TotalsLengthArray as $TotalIndex => $TotalDetails) {
if (strlen($TotalDetails["Name"]) > $max_length) {
$max_length = strlen($TotalDetails["Name"]);
}
}
// END OF MAKING ALL INPUT FIELDS THE SAME LENGTH
$TotalsArray = array();
for ($i=0; $itotals); $i++) {
$TotalsArray[] = array(
"Name" => $order->totals[$i]['title'],
"Price" => number_format($order->totals[$i]['value'], 2, '.', ''),
"Class" => $order->totals[$i]['class'],
"TotalID" => $order->totals[$i]['orders_total_id']);
$TotalsArray[] = array(
"Name" => "",
"Price" => "",
"Class" => "ot_custom",
"TotalID" => "0");
}
array_pop($TotalsArray);
foreach($TotalsArray as $TotalIndex => $TotalDetails)
{
$TotalStyle = "smallText";
// -> VDSTHT
// if ($TotalDetails["Class"] == "ot_total" || $TotalDetails["Class"] == "ot_subtotal") {
if ($TotalDetails["Class"] == "ot_total" || $TotalDetails["Class"] == "ot_subtotal" || $TotalDetails["Class"] == "ot_subtotal_wotax") {
// <- VDSTHT
$id = $TotalDetails["Class"];//subtotal and total should each only exist once
} elseif ($TotalDetails["Class"] == "ot_tax") {
$id = preg_replace("/:$/", "", $TotalDetails["Name"]) . '-total';
} elseif ($TotalDetails["Class"] == "ot_shipping") {
$id = $TotalDetails["Class"] . $TotalIndex;
} else {
$id = $TotalDetails["Class"] . $TotalIndex;
}
if(//tax, subtotal, and total are not editable, but have all the same format
$TotalDetails["Class"] == "ot_total" ||
// -> VDSTHT
$TotalDetails["Class"] == "ot_subtotal_wotax" ||
// <- VDSTHT
$TotalDetails["Class"] == "ot_subtotal" ||
$TotalDetails["Class"] == "ot_tax")
{
echo ' ' . "\n" .
' ' . $TotalDetails["Name"] . ' ' .
' ' .
" " .
" " .
" " .
" \n" .
" " . ' ' .
' ' . tep_draw_separator('pixel_trans.gif', '1', '17') . ' ' .
' ' . "\n";
} elseif (($TotalDetails["Class"] == "ot_shipping") && (ORDER_EDITOR_SHIPPING_DROPDOWN == 'true')) {
//shipping method dropdown?
// Get list of all payment modules available
$enabled_shipping = array();
$shipping_directory = DIR_FS_CATALOG_MODULES . 'shipping/';
$shipping_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
if ($dir = @dir($shipping_directory)) {
while ($file = $dir->read()) {
if (!is_dir( $shipping_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $shipping_extension) {
$shipping_array[] = $file;
}
}
}
sort($shipping_array);
$dir->close();
}
// For each available shipping module, check if enabled
for ($i=0, $n=sizeof($shipping_array); $i<$n; $i++) {
$file = $shipping_array[$i];
include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
include($shipping_directory . $file);
$class = substr($file, 0, strrpos($file, '.'));
if (tep_class_exists($class)) {
$module = new $class;
if ($module->check() > 0) {
// If module enabled create array of titles
$enabled_shipping[] = array('id' => $module->title, 'text' => $module->title . ':');
//if the shipping method is the same as the payment module title then don't add it to dropdown menu
if (($module->title == $TotalDetails["Name"]) ||($module->title . ':' == $TotalDetails["Name"])) {
$shippingMatchExists='true';
}
}
}
}
//in case the shipping method found in db is not the same as the shipping module title then make it part of the dropdown array or else it cannot be the selected default value
if ($shippingMatchExists !='true') {
$enabled_shipping[] = array('id' => $TotalDetails["Name"], 'text' => $TotalDetails["Name"]); }
$enabled_shipping[] = array('id' => 'Other', 'text' => 'Other:');
//draw the dropdown menu for shipment methods and default to the order value
echo ' ' . "\n";
echo ' ' . "\n";
echo tep_draw_pull_down_menu('update_totals[' . $TotalIndex . '][title]', $enabled_shipping, $TotalDetails["Name"], 'style="width:' . $max_length . '"');
echo ' ' . "\n";
echo ' ' . "\n";
echo ' ' . "\n";
echo ' ' . "\n";
echo ' ' . "\n";
echo ' ' . tep_draw_separator('pixel_trans.gif', '1', '17') . ' ' . "\n";
echo ' ' . "\n";
} else { //no shipping dropdown, the other total components are editable
echo ' ' . "\n" .
' ' . " " . ' ' . "\n" .
' ' . " " .
" " .
" " .
' ' . tep_draw_separator('pixel_trans.gif', '1', '17') . ' ' .
' ' . "\n" .
' ' . "\n";
}
}
?>
info['orders_status']); ?>
';
} /// end if action == edit
if ($action == "add_product"){
?>
)
' . tep_image_button('button_back.gif', IMAGE_BACK) . ''; ?>
' . "\n";
echo '' . tep_draw_form('quick_find', FILENAME_ORDERS_EDIT,'oID=' . $_GET['oID'] . '&action=' . $_GET['action']) . "\n";
echo '' . ADDPRODUCT_TEXT_STEP . ' 1: ' . "\n";
echo '';
if (isset($_GET['add_product_products_id'])) {
$form_product_name_query = tep_db_query("
SELECT products_name FROM " . TABLE_PRODUCTS_DESCRIPTION . "
WHERE products_id = '" . $_GET['add_product_products_id'] . "'
AND language_id = '" . (int)$languages_id . "'");
$form_product_name = tep_db_fetch_array($form_product_name_query);
echo ' ' . ' ';
}else{
echo ' ' . ' ';
}
echo ' ' . "\n";
echo ' ' . "\n";
echo '
' . "\n";
echo ' ' . "\n";
echo ' ' . "\n";
// Step 2: Choose Options
if( (($_GET['step'] > 1) && ($_GET['add_product_products_id'] > 0)) || (($_POST['step'] > 1) && ($_POST['add_product_products_id'] > 0)) )
{
// Get Options for Products
$products_attributes_query = tep_db_query("
SELECT count(*) AS total FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
WHERE patrib.products_id='" . $_GET['add_product_products_id'] . "'
AND patrib.options_id = popt.products_options_id
AND popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] == 0) {
echo '' . "\n";
echo '' . ADDPRODUCT_TEXT_STEP . ' 2: ' . "\n";
echo '' . ADDPRODUCT_TEXT_OPTIONS_NOTEXIST . ' ' . "\n";
echo ' ' . "\n";
$_POST['step'] = 3;
}
else //product options exist
{
echo '' . tep_draw_form('addProduct', FILENAME_ORDERS_EDIT,'oID=' . $_GET['oID'] . '&action=' . $_GET['action'] . '&add_product_products_id=' . $_GET['add_product_products_id']) . "\n";
echo '' . ADDPRODUCT_TEXT_STEP . ' 2: ';
$products_options_name_query = tep_db_query("
SELECT distinct popt.products_options_id, popt.products_options_name
FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
WHERE patrib.products_id='" . $_GET['add_product_products_id'] . "'
AND patrib.options_id = popt.products_options_id
AND popt.language_id = '" . (int)$languages_id . "'
ORDER BY popt.products_options_name");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("
SELECT pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix
FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
WHERE pa.products_id = '" . $_GET['add_product_products_id'] . "'
AND pa.options_id = '" . (int)$products_options_name['products_options_id'] . "'
AND pa.options_values_id = pov.products_options_values_id
AND pov.language_id = '" . (int)$languages_id . "'");
while ($products_options = tep_db_fetch_array($products_options_query)) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
if(isset($_POST['add_product_options'])) {
$selected_attribute = $_POST['add_product_options'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
echo $products_options_name['products_options_name'] . ':' . "\n";
echo tep_draw_pull_down_menu('add_product_options[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . ' ' . "\n";
}
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ' . "\n";
echo ' ' . "\n";
}
echo ' ' . "\n";
}
// Step 3: Confirm
if($_POST['step'] > 2)
{
echo '' . tep_draw_form('addProduct', FILENAME_ORDERS_EDIT,'oID=' . $_GET['oID'] . '&action=' . $_GET['action']) . "\n";
echo '' . ADDPRODUCT_TEXT_STEP . ' 3: ';
echo ' ';
echo ' ' . ADDPRODUCT_TEXT_CONFIRM_QUANTITY . ' ';
echo ' ';
if(is_array ($_POST['add_product_options']))
{
foreach($_POST['add_product_options'] as $option_id => $option_value_id)
{
echo ' ';
}
}
echo ' ';
echo ' ';
echo ' ' . "\n";
echo ' ' . "\n";
}
echo '
' . "\n";
}
?>